You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 16.5
This commit is contained in:
8
CHANGES
8
CHANGES
@@ -1,3 +1,11 @@
|
|||||||
|
Refresh 16.5 (Another two years later...)
|
||||||
|
|
||||||
|
1.) Fix build with make-4.4. (#1218)
|
||||||
|
2.) Split src/audio/ into separate directories per version (#1219)
|
||||||
|
3.) Remove unused string defines for PAL (#1216)
|
||||||
|
4.) Update armips.cpp (#1217)
|
||||||
|
5.) Libultra and OS related assembly cleanup, compiler improvements and more (#1210)
|
||||||
|
|
||||||
Refresh 16 (Two years later...)
|
Refresh 16 (Two years later...)
|
||||||
1.) remove capstone from readme, slight update (#1212)
|
1.) remove capstone from readme, slight update (#1212)
|
||||||
2.) Update ido static recomp (#1211)
|
2.) Update ido static recomp (#1211)
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ ACTOR_GROUPS := \
|
|||||||
|
|
||||||
LEVEL_FILES := $(addsuffix leveldata,$(LEVEL_DIRS))
|
LEVEL_FILES := $(addsuffix leveldata,$(LEVEL_DIRS))
|
||||||
|
|
||||||
|
LEVEL_ELF_FILES := $(foreach level_dir,$(LEVEL_DIRS),$(BUILD_DIR)/levels/$(level_dir)leveldata.elf)
|
||||||
|
|
||||||
SEG_FILES := \
|
SEG_FILES := \
|
||||||
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.elf) \
|
$(SEGMENTS:%=$(BUILD_DIR)/bin/%.elf) \
|
||||||
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.elf) \
|
$(ACTOR_GROUPS:%=$(BUILD_DIR)/actors/%.elf) \
|
||||||
|
|||||||
254
asm/boot.s
254
asm/boot.s
@@ -3,12 +3,21 @@
|
|||||||
.set noreorder // don't insert nops after branches
|
.set noreorder // don't insert nops after branches
|
||||||
|
|
||||||
#include "macros.inc"
|
#include "macros.inc"
|
||||||
|
#include <PR/rcp.h>
|
||||||
|
|
||||||
.equ EXCEPTION_TLB_MISS, 0x80000000
|
#define PHYS_TO_CART(addr) ((addr) | 0xB0000000)
|
||||||
.equ SP_DMEM, 0xA4000000
|
.equ CART_ENTRYPOINT, 0x00000008
|
||||||
.equ SP_IMEM, 0xA4001000
|
.equ CART_CHECKSUM0, 0x00000010
|
||||||
.equ MI_MODE_REG, 0xA4300000
|
.equ CART_CHECKSUM1, 0x00000014
|
||||||
.equ RI_MODE_REG, 0xA4700000
|
|
||||||
|
// initial DMEM state
|
||||||
|
.equ SP_DMEM_UNK0, 0x040004C0
|
||||||
|
.equ SP_DMEM_UNK1, 0x04000774
|
||||||
|
|
||||||
|
// This value must fit in one instruction
|
||||||
|
// - Either use the top 16 bits or the low 16 bits, but not both
|
||||||
|
.equ INITIAL_DMA_LEN, (0x00100000 - 1)
|
||||||
|
.equ INITIAL_DMA_ROMPOS, 0x1000
|
||||||
|
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
.macro cn_li a b
|
.macro cn_li a b
|
||||||
@@ -24,43 +33,42 @@
|
|||||||
// 0xA0000000-0xBFFFFFFF: KSEG1 direct map non-cache mirror of 0x00000000
|
// 0xA0000000-0xBFFFFFFF: KSEG1 direct map non-cache mirror of 0x00000000
|
||||||
// 0xA4000000-0xA4000FFF: RSP DMEM
|
// 0xA4000000-0xA4000FFF: RSP DMEM
|
||||||
|
|
||||||
// 0xA4000000-0xA400003F: ROM header
|
|
||||||
|
|
||||||
.section .text, "ax"
|
.section .text, "ax"
|
||||||
|
|
||||||
// 0xA4000040-0xA4000B6F: IPL3
|
// 0xA4000040-0xA4000B6F: IPL3
|
||||||
|
|
||||||
// IPL3 entry point jumped to from IPL2
|
// IPL3 entry point jumped to from IPL2
|
||||||
glabel ipl3_entry // 0xA4000040
|
glabel ipl3_entry // 0xA4000040
|
||||||
mtc0 $zero, $13
|
.ent ipl3_entry
|
||||||
mtc0 $zero, $9
|
mtc0 $zero, C0_CAUSE
|
||||||
mtc0 $zero, $11
|
mtc0 $zero, C0_COUNT
|
||||||
cn_li $t0, RI_MODE_REG
|
mtc0 $zero, C0_COMPARE
|
||||||
lw $t1, 0xc($t0)
|
cn_li $t0, PHYS_TO_K1(RI_BASE_REG)
|
||||||
|
lw $t1, %lo(RI_SELECT_REG)($t0)
|
||||||
bnez $t1, .LA4000410
|
bnez $t1, .LA4000410
|
||||||
nop
|
nop
|
||||||
addiu $sp, $sp, -0x18
|
addiu $sp, $sp, -0x18
|
||||||
sw $s3, ($sp)
|
sw $s3, ($sp)
|
||||||
sw $s4, 4($sp)
|
sw $s4, 4($sp)
|
||||||
sw $s5, 8($sp)
|
sw $s5, 8($sp)
|
||||||
sw $s6, 0xc($sp)
|
sw $s6, 0xc($sp)
|
||||||
sw $s7, 0x10($sp)
|
sw $s7, 0x10($sp)
|
||||||
cn_li $t0, RI_MODE_REG
|
cn_li $t0, PHYS_TO_K1(RI_BASE_REG)
|
||||||
lui $t2, (0xa3f80000 >> 16)
|
lui $t2, %hi(PHYS_TO_K1(RDRAM_BASE_REG + 0x80000))
|
||||||
lui $t3, (0xa3f00000 >> 16)
|
lui $t3, %hi(PHYS_TO_K1(RDRAM_BASE_REG))
|
||||||
cn_li $t4, MI_MODE_REG
|
cn_li $t4, PHYS_TO_K1(MI_BASE_REG)
|
||||||
ori $t1, $zero, 64
|
ori $t1, $zero, 64
|
||||||
sw $t1, 4($t0)
|
sw $t1, %lo(MI_VERSION_REG)($t0)
|
||||||
li $s1, 8000
|
li $s1, 8000
|
||||||
.LA400009C:
|
.LA400009C:
|
||||||
nop
|
nop
|
||||||
addi $s1, $s1, -1
|
addi $s1, $s1, -1
|
||||||
bnez $s1, .LA400009C
|
bnez $s1, .LA400009C
|
||||||
nop
|
nop
|
||||||
sw $zero, 8($t0)
|
sw $zero, %lo(RI_CURRENT_LOAD_REG)($t0)
|
||||||
ori $t1, $zero, 20
|
ori $t1, $zero, 0x14
|
||||||
sw $t1, 0xc($t0)
|
sw $t1, %lo(RI_SELECT_REG)($t0)
|
||||||
sw $zero, ($t0)
|
sw $zero, %lo(RI_MODE_REG)($t0)
|
||||||
li $s1, 4
|
li $s1, 4
|
||||||
.LA40000C0:
|
.LA40000C0:
|
||||||
nop
|
nop
|
||||||
@@ -68,34 +76,34 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
bnez $s1, .LA40000C0
|
bnez $s1, .LA40000C0
|
||||||
nop
|
nop
|
||||||
ori $t1, $zero, 14
|
ori $t1, $zero, 14
|
||||||
sw $t1, ($t0)
|
sw $t1, %lo(RI_MODE_REG)($t0)
|
||||||
li $s1, 32
|
li $s1, 32
|
||||||
.LA40000DC:
|
.LA40000DC:
|
||||||
addi $s1, $s1, -1
|
addi $s1, $s1, -1
|
||||||
bnez $s1, .LA40000DC
|
bnez $s1, .LA40000DC
|
||||||
ori $t1, $zero, 271
|
ori $t1, $zero, (MI_SET_INIT | 0xF)
|
||||||
sw $t1, ($t4)
|
sw $t1, %lo(MI_MODE_REG)($t4)
|
||||||
lui $t1, (0x18082838 >> 16)
|
lui $t1, (0x18082838 >> 16)
|
||||||
ori $t1, (0x18082838 & 0xFFFF)
|
ori $t1, (0x18082838 & 0xFFFF)
|
||||||
sw $t1, 0x8($t2)
|
sw $t1, %lo(RDRAM_DELAY_REG)($t2)
|
||||||
sw $zero, 0x14($t2)
|
sw $zero, %lo(RDRAM_REF_ROW_REG)($t2)
|
||||||
lui $t1, 0x8000
|
lui $t1, 0x8000
|
||||||
sw $t1, 0x4($t2)
|
sw $t1, %lo(RDRAM_DEVICE_ID_REG)($t2)
|
||||||
move $t5, $zero
|
move $t5, $zero
|
||||||
move $t6, $zero
|
move $t6, $zero
|
||||||
lui $t7, (0xA3F00000 >> 16)
|
lui $t7, %hi(PHYS_TO_K1(RDRAM_BASE_REG))
|
||||||
move $t8, $zero
|
move $t8, $zero
|
||||||
lui $t9, (0xA3F00000 >> 16)
|
lui $t9, %hi(PHYS_TO_K1(RDRAM_BASE_REG))
|
||||||
lui $s6, (0xA0000000 >> 16)
|
lui $s6, (0xA0000000 >> 16)
|
||||||
move $s7, $zero
|
move $s7, $zero
|
||||||
lui $a2, (0xA3F00000 >> 16)
|
lui $a2, %hi(PHYS_TO_K1(RDRAM_BASE_REG))
|
||||||
lui $a3, (0xA0000000 >> 16)
|
lui $a3, (0xA0000000 >> 16)
|
||||||
move $s2, $zero
|
move $s2, $zero
|
||||||
lui $s4, (0xA0000000 >> 16)
|
lui $s4, (0xA0000000 >> 16)
|
||||||
addiu $sp, $sp, -0x48
|
addiu $sp, $sp, -0x48
|
||||||
move $fp, $sp
|
move $fp, $sp
|
||||||
lui $s0, %hi(MI_VERSION_REG)
|
lui $s0, %hi(PHYS_TO_K1(MI_VERSION_REG))
|
||||||
lw $s0, %lo(MI_VERSION_REG)($s0)
|
lw $s0, %lo(PHYS_TO_K1(MI_VERSION_REG))($s0)
|
||||||
cn_li $s1, 0x01010101
|
cn_li $s1, 0x01010101
|
||||||
bne $s0, $s1, .LA4000160
|
bne $s0, $s1, .LA4000160
|
||||||
nop
|
nop
|
||||||
@@ -115,14 +123,14 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
nop
|
nop
|
||||||
sw $v0, ($sp)
|
sw $v0, ($sp)
|
||||||
li $t1, 8192
|
li $t1, 8192
|
||||||
sw $t1, ($t4)
|
sw $t1, %lo(MI_MODE_REG)($t4)
|
||||||
lw $t3, ($t7)
|
lw $t3, %lo(RDRAM_CONFIG_REG)($t7)
|
||||||
lui $t0, 0xf0ff
|
lui $t0, 0xf0ff
|
||||||
and $t3, $t3, $t0
|
and $t3, $t3, $t0
|
||||||
sw $t3, 4($sp)
|
sw $t3, 4($sp)
|
||||||
addi $sp, $sp, 8
|
addi $sp, $sp, 8
|
||||||
li $t1, 4096
|
li $t1, 4096
|
||||||
sw $t1, ($t4)
|
sw $t1, %lo(MI_MODE_REG)($t4)
|
||||||
lui $t0, 0xb019
|
lui $t0, 0xb019
|
||||||
bne $t3, $t0, .LA40001E0
|
bne $t3, $t0, .LA40001E0
|
||||||
nop
|
nop
|
||||||
@@ -142,11 +150,11 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
add $s4, $s4, $t0
|
add $s4, $s4, $t0
|
||||||
.LA40001E8:
|
.LA40001E8:
|
||||||
li $t0, 8192
|
li $t0, 8192
|
||||||
sw $t0, ($t4)
|
sw $t0, %lo(MI_MODE_REG)($t4)
|
||||||
lw $t1, 0x24($t7)
|
lw $t1, %lo(RDRAM_DEVICE_MANUF_REG)($t7)
|
||||||
lw $k0, ($t7)
|
lw $k0, %lo(RDRAM_CONFIG_REG)($t7)
|
||||||
li $t0, 4096
|
li $t0, 4096
|
||||||
sw $t0, ($t4)
|
sw $t0, %lo(MI_MODE_REG)($t4)
|
||||||
andi $t1, $t1, 0xffff
|
andi $t1, $t1, 0xffff
|
||||||
li $t0, 1280
|
li $t0, 1280
|
||||||
bne $t1, $t0, .LA4000230
|
bne $t1, $t0, .LA4000230
|
||||||
@@ -178,9 +186,9 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
#else
|
#else
|
||||||
li $t0, 0xc4000000
|
li $t0, 0xc4000000
|
||||||
#endif
|
#endif
|
||||||
sw $t0, 0xc($t2)
|
sw $t0, %lo(RDRAM_MODE_REG)($t2)
|
||||||
li $t0, 0x80000000
|
li $t0, 0x80000000
|
||||||
sw $t0, 0x4($t2)
|
sw $t0, %lo(RDRAM_DEVICE_ID_REG)($t2)
|
||||||
move $sp, $fp
|
move $sp, $fp
|
||||||
move $v1, $zero
|
move $v1, $zero
|
||||||
.LA4000274:
|
.LA4000274:
|
||||||
@@ -248,7 +256,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
slt $t0, $v1, $t5
|
slt $t0, $v1, $t5
|
||||||
bnez $t0, .LA4000274
|
bnez $t0, .LA4000274
|
||||||
nop
|
nop
|
||||||
lui $t2, %hi(RI_REFRESH_REG)
|
lui $t2, %hi(PHYS_TO_K1(RI_BASE_REG))
|
||||||
sll $s2, $s2, 0x13
|
sll $s2, $s2, 0x13
|
||||||
lui $t1, (0x00063634 >> 16)
|
lui $t1, (0x00063634 >> 16)
|
||||||
ori $t1, (0x00063634 & 0xFFFF)
|
ori $t1, (0x00063634 & 0xFFFF)
|
||||||
@@ -269,7 +277,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
lw $s6, 0xc($sp)
|
lw $s6, 0xc($sp)
|
||||||
lw $s7, 0x10($sp)
|
lw $s7, 0x10($sp)
|
||||||
addiu $sp, $sp, 0x18
|
addiu $sp, $sp, 0x18
|
||||||
cn_li $t0, EXCEPTION_TLB_MISS
|
cn_li $t0, UT_VEC
|
||||||
addiu $t1, $t0, 0x4000
|
addiu $t1, $t0, 0x4000
|
||||||
addiu $t1, $t1, -0x20
|
addiu $t1, $t1, -0x20
|
||||||
mtc0 $zero, $28
|
mtc0 $zero, $28
|
||||||
@@ -279,7 +287,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
sltu $at, $t0, $t1
|
sltu $at, $t0, $t1
|
||||||
bnez $at, .LA40003D8
|
bnez $at, .LA40003D8
|
||||||
addiu $t0, $t0, 0x20
|
addiu $t0, $t0, 0x20
|
||||||
cn_li $t0, EXCEPTION_TLB_MISS
|
cn_li $t0, UT_VEC
|
||||||
addiu $t1, $t0, 0x2000
|
addiu $t1, $t0, 0x2000
|
||||||
addiu $t1, $t1, -0x10
|
addiu $t1, $t1, -0x10
|
||||||
.LA40003F8:
|
.LA40003F8:
|
||||||
@@ -290,7 +298,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
b .LA4000458
|
b .LA4000458
|
||||||
nop
|
nop
|
||||||
.LA4000410:
|
.LA4000410:
|
||||||
cn_li $t0, EXCEPTION_TLB_MISS
|
cn_li $t0, UT_VEC
|
||||||
addiu $t1, $t0, 0x4000
|
addiu $t1, $t0, 0x4000
|
||||||
addiu $t1, $t1, -0x20
|
addiu $t1, $t1, -0x20
|
||||||
mtc0 $zero, $28
|
mtc0 $zero, $28
|
||||||
@@ -300,7 +308,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
sltu $at, $t0, $t1
|
sltu $at, $t0, $t1
|
||||||
bnez $at, .LA4000428
|
bnez $at, .LA4000428
|
||||||
addiu $t0, $t0, 0x20
|
addiu $t0, $t0, 0x20
|
||||||
cn_li $t0, EXCEPTION_TLB_MISS
|
cn_li $t0, UT_VEC
|
||||||
addiu $t1, $t0, 0x2000
|
addiu $t1, $t0, 0x2000
|
||||||
addiu $t1, $t1, -0x10
|
addiu $t1, $t1, -0x10
|
||||||
.LA4000448:
|
.LA4000448:
|
||||||
@@ -310,7 +318,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
addiu $t0, $t0, 0x10
|
addiu $t0, $t0, 0x10
|
||||||
.LA4000458:
|
.LA4000458:
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
la $t0, D_CN_0400049C
|
la $t0, SP_DMEM_CN_UNK0
|
||||||
lui $t1, 0xf
|
lui $t1, 0xf
|
||||||
ori $t1, $t1, 0xffff
|
ori $t1, $t1, 0xffff
|
||||||
and $t0, $t0, $t1
|
and $t0, $t0, $t1
|
||||||
@@ -318,7 +326,7 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
lui $t3, 0xfff0
|
lui $t3, 0xfff0
|
||||||
and $t2, $t2, $t3
|
and $t2, $t2, $t3
|
||||||
or $t0, $t0, $t2
|
or $t0, $t0, $t2
|
||||||
la $t3, D_CN_0400074C
|
la $t3, SP_DMEM_CN_UNK1
|
||||||
and $t3, $t3, $t1
|
and $t3, $t3, $t1
|
||||||
or $t3, $t3, $t2
|
or $t3, $t3, $t2
|
||||||
lui $t1, 0xa000
|
lui $t1, 0xa000
|
||||||
@@ -347,15 +355,15 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
bnez $t0, .LA40004B8
|
bnez $t0, .LA40004B8
|
||||||
nop
|
nop
|
||||||
#else
|
#else
|
||||||
cn_li $t2, SP_DMEM
|
cn_li $t2, PHYS_TO_K1(SP_DMEM_START)
|
||||||
lui $t3, 0xfff0
|
lui $t3, 0xfff0
|
||||||
lui $t1, 0x0010
|
lui $t1, 0x0010
|
||||||
and $t2, $t2, $t3
|
and $t2, $t2, $t3
|
||||||
lui $t0, %hi(SP_DMEM_UNK0)
|
lui $t0, %hi(PHYS_TO_K1(SP_DMEM_UNK0))
|
||||||
addiu $t1, -1
|
addiu $t1, -1
|
||||||
lui $t3, %hi(SP_DMEM_UNK1)
|
lui $t3, %hi(PHYS_TO_K1(SP_DMEM_UNK1))
|
||||||
addiu $t0, %lo(SP_DMEM_UNK0)
|
addiu $t0, %lo(PHYS_TO_K1(SP_DMEM_UNK0))
|
||||||
addiu $t3, %lo(SP_DMEM_UNK1)
|
addiu $t3, %lo(PHYS_TO_K1(SP_DMEM_UNK1))
|
||||||
and $t0, $t0, $t1
|
and $t0, $t0, $t1
|
||||||
and $t3, $t3, $t1
|
and $t3, $t3, $t1
|
||||||
lui $t1, 0xa000
|
lui $t1, 0xa000
|
||||||
@@ -369,31 +377,31 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
addiu $t1, $t1, 4
|
addiu $t1, $t1, 4
|
||||||
bnez $at, .LA4000498
|
bnez $at, .LA4000498
|
||||||
sw $t5, -4($t1)
|
sw $t5, -4($t1)
|
||||||
cn_li $t4, EXCEPTION_TLB_MISS
|
cn_li $t4, UT_VEC
|
||||||
jr $t4
|
jr $t4
|
||||||
nop
|
nop
|
||||||
lui $t3, %hi(D_B0000008)
|
lui $t3, %hi(PHYS_TO_CART(CART_ENTRYPOINT))
|
||||||
lw $t1, %lo(D_B0000008)($t3)
|
lw $t1, %lo(PHYS_TO_CART(CART_ENTRYPOINT))($t3)
|
||||||
lui $t2, (0x1FFFFFFF >> 16)
|
lui $t2, (0x1FFFFFFF >> 16)
|
||||||
ori $t2, (0x1FFFFFFF & 0xFFFF)
|
ori $t2, (0x1FFFFFFF & 0xFFFF)
|
||||||
lui $at, %hi(PI_DRAM_ADDR_REG)
|
lui $at, %hi(PHYS_TO_K1(PI_DRAM_ADDR_REG))
|
||||||
and $t1, $t1, $t2
|
and $t1, $t1, $t2
|
||||||
sw $t1, %lo(PI_DRAM_ADDR_REG)($at)
|
sw $t1, %lo(PHYS_TO_K1(PI_DRAM_ADDR_REG))($at)
|
||||||
lui $t0, %hi(PI_STATUS_REG)
|
lui $t0, %hi(PHYS_TO_K1(PI_STATUS_REG))
|
||||||
.LA40004D0:
|
.LA40004D0:
|
||||||
lw $t0, %lo(PI_STATUS_REG)($t0)
|
lw $t0, %lo(PHYS_TO_K1(PI_STATUS_REG))($t0)
|
||||||
andi $t0, $t0, 2
|
andi $t0, $t0, PI_STATUS_IO_BUSY
|
||||||
bnezl $t0, .LA40004D0
|
bnezl $t0, .LA40004D0
|
||||||
lui $t0, %hi(PI_STATUS_REG)
|
lui $t0, %hi(PHYS_TO_K1(PI_STATUS_REG))
|
||||||
#endif
|
#endif
|
||||||
li $t0, 0x1000
|
li $t0, INITIAL_DMA_ROMPOS
|
||||||
add $t0, $t0, $t3
|
add $t0, $t0, $t3
|
||||||
and $t0, $t0, $t2
|
and $t0, $t0, $t2
|
||||||
lui $at, %hi(PI_CART_ADDR_REG)
|
lui $at, %hi(PHYS_TO_K1(PI_CART_ADDR_REG))
|
||||||
sw $t0, %lo(PI_CART_ADDR_REG)($at)
|
sw $t0, %lo(PHYS_TO_K1(PI_CART_ADDR_REG))($at)
|
||||||
cn_li $t2, 0x000FFFFF
|
cn_li $t2, INITIAL_DMA_LEN
|
||||||
lui $at, %hi(PI_WR_LEN_REG)
|
lui $at, %hi(PHYS_TO_K1(PI_WR_LEN_REG))
|
||||||
sw $t2, %lo(PI_WR_LEN_REG)($at)
|
sw $t2, %lo(PHYS_TO_K1(PI_WR_LEN_REG))($at)
|
||||||
|
|
||||||
.LA4000514:
|
.LA4000514:
|
||||||
nop
|
nop
|
||||||
@@ -424,8 +432,8 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
lui $t3, %hi(PI_STATUS_REG)
|
lui $t3, %hi(PHYS_TO_K1(PI_STATUS_REG))
|
||||||
lw $t3, %lo(PI_STATUS_REG)($t3)
|
lw $t3, %lo(PHYS_TO_K1(PI_STATUS_REG))($t3)
|
||||||
andi $t3, $t3, 0x1
|
andi $t3, $t3, 0x1
|
||||||
bnez $t3, .LA4000514
|
bnez $t3, .LA4000514
|
||||||
nop
|
nop
|
||||||
@@ -496,39 +504,39 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
nop
|
nop
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
lui $t1, %hi(SP_PC)
|
lui $t1, %hi(PHYS_TO_K1(SP_PC_REG))
|
||||||
lw $t1, %lo(SP_PC)($t1)
|
lw $t1, %lo(PHYS_TO_K1(SP_PC_REG))($t1)
|
||||||
beqz $t1, .LA4000698
|
beqz $t1, .LA4000698
|
||||||
nop
|
nop
|
||||||
addiu $t2, $zero, 0x41
|
addiu $t2, $zero, 0x41
|
||||||
lui $at, %hi(SP_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG))
|
||||||
sw $t2, %lo(SP_STATUS_REG)($at)
|
sw $t2, %lo(PHYS_TO_K1(SP_STATUS_REG))($at)
|
||||||
lui $at, %hi(SP_PC)
|
lui $at, %hi(PHYS_TO_K1(SP_PC_REG))
|
||||||
sw $zero, %lo(SP_PC)($at)
|
sw $zero, %lo(PHYS_TO_K1(SP_PC_REG))($at)
|
||||||
.LA4000698:
|
.LA4000698:
|
||||||
li $t3, 0x00AAAAAE
|
li $t3, 0x00AAAAAE
|
||||||
lui $at, %hi(SP_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG))
|
||||||
sw $t3, %lo(SP_STATUS_REG)($at)
|
sw $t3, %lo(PHYS_TO_K1(SP_STATUS_REG))($at)
|
||||||
li $t0, 1365
|
li $t0, 1365
|
||||||
lui $at, %hi(MI_INTR_MASK_REG)
|
lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG))
|
||||||
sw $t0, %lo(MI_INTR_MASK_REG)($at)
|
sw $t0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at)
|
||||||
lui $at, %hi(SI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG))
|
||||||
sw $zero, %lo(SI_STATUS_REG)($at)
|
sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at)
|
||||||
lui $at, %hi(AI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG))
|
||||||
sw $zero, %lo(AI_STATUS_REG)($at)
|
sw $zero, %lo(PHYS_TO_K1(AI_STATUS_REG))($at)
|
||||||
li $t1, 2048
|
li $t1, 2048
|
||||||
lui $at, %hi(MI_MODE_REG)
|
lui $at, %hi(PHYS_TO_K1(MI_MODE_REG))
|
||||||
sw $t1, %lo(MI_MODE_REG)($at)
|
sw $t1, %lo(PHYS_TO_K1(MI_MODE_REG))($at)
|
||||||
li $t1, 2
|
li $t1, 2
|
||||||
lui $at, %hi(PI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG))
|
||||||
sw $t1, %lo(PI_STATUS_REG)($at)
|
sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at)
|
||||||
lui $t0, (0xA0000300 >> 16)
|
lui $t0, (0xA0000300 >> 16)
|
||||||
ori $t0, (0xA0000300 & 0xFFFF)
|
ori $t0, (0xA0000300 & 0xFFFF)
|
||||||
sw $s4, ($t0)
|
sw $s4, ($t0)
|
||||||
sw $s3, 4($t0)
|
sw $s3, 4($t0)
|
||||||
#else
|
#else
|
||||||
lui $t3, %hi(D_B0000008)
|
lui $t3, %hi(PHYS_TO_CART(CART_ENTRYPOINT))
|
||||||
lw $a0, %lo(D_B0000008)($t3)
|
lw $a0, %lo(PHYS_TO_CART(CART_ENTRYPOINT))($t3)
|
||||||
move $a1, $s6
|
move $a1, $s6
|
||||||
lui $at, (0x5D588B65 >> 16)
|
lui $at, (0x5D588B65 >> 16)
|
||||||
ori $at, (0x5D588B65 & 0xFFFF)
|
ori $at, (0x5D588B65 & 0xFFFF)
|
||||||
@@ -582,11 +590,11 @@ glabel ipl3_entry // 0xA4000040
|
|||||||
xor $a3, $t6, $t3
|
xor $a3, $t6, $t3
|
||||||
xor $t8, $s0, $a2
|
xor $t8, $s0, $a2
|
||||||
xor $s0, $t8, $t4
|
xor $s0, $t8, $t4
|
||||||
lui $t3, %hi(D_B0000010)
|
lui $t3, %hi(PHYS_TO_CART(CART_CHECKSUM0))
|
||||||
lw $t0, %lo(D_B0000010)($t3)
|
lw $t0, %lo(PHYS_TO_CART(CART_CHECKSUM0))($t3)
|
||||||
bne $a3, $t0, halt
|
bne $a3, $t0, halt
|
||||||
nop
|
nop
|
||||||
lw $t0, %lo(D_B0000014)($t3)
|
lw $t0, %lo(PHYS_TO_CART(CART_CHECKSUM1))($t3)
|
||||||
bne $s0, $t0, halt
|
bne $s0, $t0, halt
|
||||||
nop
|
nop
|
||||||
bal func_A4000690
|
bal func_A4000690
|
||||||
@@ -597,36 +605,36 @@ halt:
|
|||||||
nop
|
nop
|
||||||
|
|
||||||
func_A4000690:
|
func_A4000690:
|
||||||
lui $t1, %hi(SP_PC)
|
lui $t1, %hi(PHYS_TO_K1(SP_PC_REG))
|
||||||
lw $t1, %lo(SP_PC)($t1)
|
lw $t1, %lo(PHYS_TO_K1(SP_PC_REG))($t1)
|
||||||
lw $s0, 0x14($sp)
|
lw $s0, 0x14($sp)
|
||||||
lw $ra, 0x1c($sp)
|
lw $ra, 0x1c($sp)
|
||||||
beqz $t1, .LA40006BC
|
beqz $t1, .LA40006BC
|
||||||
addiu $sp, $sp, 0x20
|
addiu $sp, $sp, 0x20
|
||||||
li $t2, 65
|
li $t2, 65
|
||||||
lui $at, %hi(SP_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG))
|
||||||
sw $t2, %lo(SP_STATUS_REG)($at)
|
sw $t2, %lo(PHYS_TO_K1(SP_STATUS_REG))($at)
|
||||||
lui $at, %hi(SP_PC)
|
lui $at, %hi(PHYS_TO_K1(SP_PC_REG))
|
||||||
sw $zero, %lo(SP_PC)($at)
|
sw $zero, %lo(PHYS_TO_K1(SP_PC_REG))($at)
|
||||||
.LA40006BC:
|
.LA40006BC:
|
||||||
li $t3, 0x00AAAAAE
|
li $t3, 0x00AAAAAE
|
||||||
lui $at, %hi(SP_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SP_STATUS_REG))
|
||||||
sw $t3, %lo(SP_STATUS_REG)($at)
|
sw $t3, %lo(PHYS_TO_K1(SP_STATUS_REG))($at)
|
||||||
lui $at, %hi(MI_INTR_MASK_REG)
|
lui $at, %hi(PHYS_TO_K1(MI_INTR_MASK_REG))
|
||||||
li $t0, 1365
|
li $t0, 1365
|
||||||
sw $t0, %lo(MI_INTR_MASK_REG)($at)
|
sw $t0, %lo(PHYS_TO_K1(MI_INTR_MASK_REG))($at)
|
||||||
lui $at, %hi(SI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(SI_STATUS_REG))
|
||||||
sw $zero, %lo(SI_STATUS_REG)($at)
|
sw $zero, %lo(PHYS_TO_K1(SI_STATUS_REG))($at)
|
||||||
lui $at, %hi(AI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(AI_STATUS_REG))
|
||||||
sw $zero, %lo(AI_STATUS_REG)($at)
|
sw $zero, %lo(PHYS_TO_K1(AI_STATUS_REG))($at)
|
||||||
lui $at, %hi(MI_MODE_REG)
|
lui $at, %hi(PHYS_TO_K1(MI_BASE_REG))
|
||||||
li $t1, 2048
|
li $t1, 2048
|
||||||
sw $t1, %lo(MI_MODE_REG)($at)
|
sw $t1, %lo(PHYS_TO_K1(MI_BASE_REG))($at)
|
||||||
li $t1, 2
|
li $t1, 2
|
||||||
lui $at, %hi(PI_STATUS_REG)
|
lui $at, %hi(PHYS_TO_K1(PI_STATUS_REG))
|
||||||
lui $t0, (0xA0000300 >> 16)
|
lui $t0, (0xA0000300 >> 16)
|
||||||
ori $t0, (0xA0000300 & 0xFFFF)
|
ori $t0, (0xA0000300 & 0xFFFF)
|
||||||
sw $t1, %lo(PI_STATUS_REG)($at)
|
sw $t1, %lo(PHYS_TO_K1(PI_STATUS_REG))($at)
|
||||||
sw $s7, 0x14($t0)
|
sw $s7, 0x14($t0)
|
||||||
#endif
|
#endif
|
||||||
sw $s5, 0xc($t0)
|
sw $s5, 0xc($t0)
|
||||||
@@ -647,7 +655,7 @@ func_A4000690:
|
|||||||
cn_li $t1, 0xb0000000
|
cn_li $t1, 0xb0000000
|
||||||
.LA4000730:
|
.LA4000730:
|
||||||
sw $t1, 0x8($t0)
|
sw $t1, 0x8($t0)
|
||||||
cn_li $t0, SP_DMEM
|
cn_li $t0, PHYS_TO_K1(SP_DMEM_START)
|
||||||
addi $t1, $t0, 0x1000
|
addi $t1, $t0, 0x1000
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
.LA4000710:
|
.LA4000710:
|
||||||
@@ -661,7 +669,7 @@ func_A4000690:
|
|||||||
bne $t0, $t1, .LA4000740
|
bne $t0, $t1, .LA4000740
|
||||||
sw $zero, -4($t0)
|
sw $zero, -4($t0)
|
||||||
#endif
|
#endif
|
||||||
cn_li $t0, SP_IMEM
|
cn_li $t0, PHYS_TO_K1(SP_IMEM_START)
|
||||||
addi $t1, $t0, 0x1000
|
addi $t1, $t0, 0x1000
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
.LA400072C:
|
.LA400072C:
|
||||||
@@ -675,8 +683,8 @@ func_A4000690:
|
|||||||
bne $t0, $t1, .LA4000758
|
bne $t0, $t1, .LA4000758
|
||||||
sw $zero, -4($t0)
|
sw $zero, -4($t0)
|
||||||
#endif
|
#endif
|
||||||
lui $t3, %hi(D_B0000008)
|
lui $t3, %hi(PHYS_TO_CART(CART_ENTRYPOINT))
|
||||||
lw $t1, %lo(D_B0000008)($t3)
|
lw $t1, %lo(PHYS_TO_CART(CART_ENTRYPOINT))($t3)
|
||||||
jr $t1
|
jr $t1
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
@@ -1074,8 +1082,8 @@ func_A4000A40:
|
|||||||
bne $a1, $k1, .LA4000AC0
|
bne $a1, $k1, .LA4000AC0
|
||||||
sw $t7, ($s5)
|
sw $t7, ($s5)
|
||||||
#endif
|
#endif
|
||||||
lui $k0, %hi(MI_MODE_REG)
|
lui $k0, %hi(PHYS_TO_K1(MI_BASE_REG))
|
||||||
sw $zero, %lo(MI_MODE_REG)($k0)
|
sw $zero, %lo(PHYS_TO_K1(MI_BASE_REG))($k0)
|
||||||
.LA4000AC0:
|
.LA4000AC0:
|
||||||
lw $ra, 0x1c($sp)
|
lw $ra, 0x1c($sp)
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
@@ -1094,14 +1102,14 @@ func_A4000AD0:
|
|||||||
move $fp, $zero
|
move $fp, $zero
|
||||||
#endif
|
#endif
|
||||||
li $k0, 0x2000
|
li $k0, 0x2000
|
||||||
lui $k1, %hi(MI_MODE_REG)
|
lui $k1, %hi(PHYS_TO_K1(MI_BASE_REG))
|
||||||
sw $k0, %lo(MI_MODE_REG)($k1)
|
sw $k0, %lo(PHYS_TO_K1(MI_BASE_REG))($k1)
|
||||||
#ifndef VERSION_CN
|
#ifndef VERSION_CN
|
||||||
move $fp, $zero
|
move $fp, $zero
|
||||||
#endif
|
#endif
|
||||||
lw $fp, ($s5)
|
lw $fp, ($s5)
|
||||||
li $k0, 0x1000
|
li $k0, 0x1000
|
||||||
sw $k0, %lo(MI_MODE_REG)($k1)
|
sw $k0, %lo(PHYS_TO_K1(MI_BASE_REG))($k1)
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
move $k0, $zero
|
move $k0, $zero
|
||||||
#endif
|
#endif
|
||||||
@@ -1144,3 +1152,5 @@ func_A4000AD0:
|
|||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.end ipl3_entry
|
||||||
|
|||||||
61
asm/entry.s
61
asm/entry.s
@@ -4,45 +4,50 @@
|
|||||||
|
|
||||||
#include "macros.inc"
|
#include "macros.inc"
|
||||||
|
|
||||||
|
|
||||||
.section .text, "ax"
|
.section .text, "ax"
|
||||||
|
|
||||||
glabel entry_point
|
glabel entry_point
|
||||||
.if VERSION_CN == 1
|
#ifdef VERSION_CN
|
||||||
|
// Get main segment bss address and size
|
||||||
lui $t0, %lo(_mainSegmentNoloadStartHi)
|
lui $t0, %lo(_mainSegmentNoloadStartHi)
|
||||||
ori $t0, %lo(_mainSegmentNoloadStartLo)
|
ori $t0, %lo(_mainSegmentNoloadStartLo)
|
||||||
lui $t1, %lo(_mainSegmentNoloadSizeHi)
|
lui $t1, %lo(_mainSegmentNoloadSizeHi)
|
||||||
ori $t1, %lo(_mainSegmentNoloadSizeLo)
|
ori $t1, %lo(_mainSegmentNoloadSizeLo)
|
||||||
.L80249010:
|
.clear_bytes:
|
||||||
sw $zero, ($t0)
|
// Clear bss section until they are zeroed out
|
||||||
sw $zero, 4($t0)
|
sw $zero, ($t0) // Clear 4 bytes
|
||||||
addi $t0, $t0, 8
|
sw $zero, 4($t0) // Clear the next 4 bytes
|
||||||
addi $t1, $t1, -8
|
addi $t0, $t0, 8 // Increment the address of bytes to clear
|
||||||
bnez $t1, .L80249010
|
addi $t1, $t1, -8 // Subtract 8 bytes from the amount remaining
|
||||||
nop
|
bnez $t1, .clear_bytes // Continue clearing until clear_bytes is 0
|
||||||
|
nop
|
||||||
|
// Get init function and idle thread stack
|
||||||
lui $sp, %lo(gIdleThreadStackHi)
|
lui $sp, %lo(gIdleThreadStackHi)
|
||||||
ori $sp, %lo(gIdleThreadStackLo)
|
ori $sp, %lo(gIdleThreadStackLo)
|
||||||
lui $t2, %lo(main_funcHi)
|
lui $t2, %lo(main_funcHi)
|
||||||
ori $t2, %lo(main_funcLo)
|
ori $t2, %lo(main_funcLo)
|
||||||
jr $t2
|
jr $t2 // Jump to the init function
|
||||||
nop
|
nop
|
||||||
.else
|
#else
|
||||||
lui $t0, %hi(_mainSegmentNoloadStart) // $t0, 0x8034
|
// Get main segment bss address and size
|
||||||
lui $t1, %lo(_mainSegmentNoloadSizeHi) // lui $t1, 2
|
lui $t0, %hi(_mainSegmentNoloadStart)
|
||||||
addiu $t0, %lo(_mainSegmentNoloadStart) // addiu $t0, $t0, -0x6df0
|
lui $t1, %lo(_mainSegmentNoloadSizeHi)
|
||||||
ori $t1, %lo(_mainSegmentNoloadSizeLo) // ori $t1, $t1, 0xcee0
|
addiu $t0, %lo(_mainSegmentNoloadStart)
|
||||||
.L80246010:
|
ori $t1, %lo(_mainSegmentNoloadSizeLo)
|
||||||
addi $t1, $t1, -8
|
.clear_bytes:
|
||||||
sw $zero, ($t0)
|
// Clear bss section until they are zeroed out
|
||||||
sw $zero, 4($t0)
|
addi $t1, $t1, -8 // Subtract 8 bytes from the amount remaining
|
||||||
bnez $t1, .L80246010
|
sw $zero, ($t0) // Clear 4 bytes
|
||||||
addi $t0, $t0, 8
|
sw $zero, 4($t0) // Clear the next 4 bytes
|
||||||
lui $t2, %hi(main_func) // $t2, 0x8024
|
bnez $t1, .clear_bytes // Continue clearing until clear_bytes is 0
|
||||||
lui $sp, %hi(gIdleThreadStack) // $sp, 0x8020
|
addi $t0, $t0, 8 // Increment the address of bytes to clear
|
||||||
addiu $t2, %lo(main_func) // addiu $t2, $t2, 0x6dc4
|
// Get init function and idle thread stack
|
||||||
jr $t2
|
lui $t2, %hi(main_func)
|
||||||
addiu $sp, %lo(gIdleThreadStack) // addiu $sp, $sp, 0xa00
|
lui $sp, %hi(gIdleThreadStack)
|
||||||
.endif
|
addiu $t2, %lo(main_func)
|
||||||
|
jr $t2 // Jump to the init function
|
||||||
|
addiu $sp, %lo(gIdleThreadStack)
|
||||||
|
#endif
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
nop
|
nop
|
||||||
|
|||||||
@@ -8,15 +8,9 @@
|
|||||||
.word entry_point /* Entrypoint */
|
.word entry_point /* Entrypoint */
|
||||||
|
|
||||||
/* Revision */
|
/* Revision */
|
||||||
#ifdef VERSION_SH
|
.half 0x0000
|
||||||
.word 0x00001448
|
.byte 20 /* Major version 2.0 */
|
||||||
#elif defined(VERSION_CN)
|
.ascii LIBULTRA_STR_VER /* Minor Version */
|
||||||
.word 0x0000144C
|
|
||||||
#elif defined(VERSION_EU)
|
|
||||||
.word 0x00001446
|
|
||||||
#else /* NTSC-U and NTSC-J 1.0 */
|
|
||||||
.word 0x00001444
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VERSION_CN
|
#ifdef VERSION_CN
|
||||||
.fill 0x30
|
.fill 0x30
|
||||||
|
|||||||
97
include/PR/bcp.h
Normal file
97
include/PR/bcp.h
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
#ifndef _BCP_H_
|
||||||
|
#define _BCP_H_
|
||||||
|
|
||||||
|
#ifdef BBPLAYER
|
||||||
|
#include "rcp.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MIPS Interface (MI) Additional Registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! MI_SK_EXCEPTION_REG ?
|
||||||
|
#define MI_14_REG (MI_BASE_REG + 0x14)
|
||||||
|
|
||||||
|
//! MI_SK_WATCHDOG_TIMER ?
|
||||||
|
#define MI_18_REG (MI_BASE_REG + 0x18)
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define MI_30_REG (MI_BASE_REG + 0x30)
|
||||||
|
|
||||||
|
//! MI_HW_INTR_REG ?
|
||||||
|
#define MI_38_REG (MI_BASE_REG + 0x38)
|
||||||
|
|
||||||
|
//! MI_HW_INTR_MASK_REG ?
|
||||||
|
#define MI_3C_REG (MI_BASE_REG + 0x3C)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peripheral Interface (PI) Additional Registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! PI_ATB_UPPER_REG ?
|
||||||
|
#define PI_40_REG (PI_BASE_REG + 0x40)
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define PI_44_REG (PI_BASE_REG + 0x44)
|
||||||
|
|
||||||
|
//! PI_CARD_CNT_REG ?
|
||||||
|
#define PI_48_REG (PI_BASE_REG + 0x48)
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define PI_4C_REG (PI_BASE_REG + 0x4C)
|
||||||
|
|
||||||
|
//! PI_AES_CNT_REG ?
|
||||||
|
#define PI_50_REG (PI_BASE_REG + 0x50)
|
||||||
|
|
||||||
|
//! PI_ALLOWED_IO_REG ?
|
||||||
|
#define PI_54_REG (PI_BASE_REG + 0x54)
|
||||||
|
|
||||||
|
//! PI_EX_RD_LEN_REG ?
|
||||||
|
#define PI_58_REG (PI_BASE_REG + 0x58)
|
||||||
|
|
||||||
|
//! PI_EX_WR_LEN_REG ?
|
||||||
|
#define PI_5C_REG (PI_BASE_REG + 0x5C)
|
||||||
|
|
||||||
|
//! PI_MISC_REG ?
|
||||||
|
#define PI_60_REG (PI_BASE_REG + 0x60)
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define PI_64_REG (PI_BASE_REG + 0x64)
|
||||||
|
|
||||||
|
//! PI_CARD_BLK_OFFSET_REG ?
|
||||||
|
#define PI_70_REG (PI_BASE_REG + 0x70)
|
||||||
|
|
||||||
|
//! PI_EX_DMA_BUF ?
|
||||||
|
#define PI_10000_REG(i) (PI_BASE_REG + 0x10000 + (i))
|
||||||
|
|
||||||
|
//! PI_ATB_LOWER_REG ?
|
||||||
|
#define PI_10500_REG(i) (PI_BASE_REG + 0x10500 + (i) * 4)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serial Interface (SI) Additional Registers
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define SI_0C_REG (SI_BASE_REG + 0x0C)
|
||||||
|
|
||||||
|
//! ?
|
||||||
|
#define SI_1C_REG (SI_BASE_REG + 0x1C)
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
extern u8 *__osBbEepromAddress;
|
||||||
|
extern u32 __osBbEepromSize;
|
||||||
|
extern u32 __osBbFlashAddress;
|
||||||
|
extern u32 __osBbFlashSize;
|
||||||
|
extern u32 __osBbSramAddress;
|
||||||
|
extern u32 __osBbSramSize;
|
||||||
|
extern u32 *__osBbPakAddress[];
|
||||||
|
extern u32 __osBbPakSize;
|
||||||
|
extern u32 __osBbIsBb;
|
||||||
|
extern u32 __osBbHackFlags;
|
||||||
|
|
||||||
|
void skKeepAlive(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
114
include/PR/gu.h
114
include/PR/gu.h
@@ -1,29 +1,99 @@
|
|||||||
#ifndef _ULTRA64_GU_H_
|
#ifndef _GU_H_
|
||||||
#define _ULTRA64_GU_H_
|
#define _GU_H_
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* *
|
||||||
|
* Copyright (C) 1994, Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
* These coded instructions, statements, and computer programs contain *
|
||||||
|
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||||
|
* are protected by Federal copyright law. They may not be disclosed *
|
||||||
|
* to third parties or copied or duplicated in any form, in whole or *
|
||||||
|
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* $Revision: 1.48 $
|
||||||
|
* $Date: 1999/07/13 08:00:20 $
|
||||||
|
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/gu.h,v $
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
#include <PR/mbi.h>
|
#include <PR/mbi.h>
|
||||||
#include <PR/ultratypes.h>
|
#include <PR/ultratypes.h>
|
||||||
|
#include <PR/sptask.h>
|
||||||
|
|
||||||
#define GU_PI 3.1415926
|
#ifndef MAX
|
||||||
/* Functions */
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
|
#endif
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||||
|
#endif
|
||||||
|
|
||||||
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect,
|
#define M_PI 3.14159265358979323846
|
||||||
float near, float far, float scale);
|
|
||||||
void guPerspective(Mtx *m, u16 *perspNorm, float fovy, float aspect, float near,
|
#define GU_PI 3.1415926
|
||||||
float far, float scale);
|
|
||||||
void guOrtho(Mtx *m, float left, float right, float bottom, float top,
|
#define FTOFIX32(x) (long)((x) * (float)0x00010000)
|
||||||
float near, float far, float scale);
|
#ifdef AVOID_UB
|
||||||
void guTranslate(Mtx *m, float x, float y, float z);
|
#define FIX32TOF(x) ((float)(x) * (1.0f / (float)0x00010000))
|
||||||
void guRotate(Mtx *m, float a, float x, float y, float z);
|
#else
|
||||||
void guScale(Mtx *m, float x, float y, float z);
|
#define FIX32TOF(x) (x / (float)0x00010000)
|
||||||
void guMtxF2L(float mf[4][4], Mtx *m);
|
#endif
|
||||||
void guMtxIdent(Mtx *m);
|
#define FTOFRAC8(x) ((int) MIN(((x) * (128.0f)), 127.0f) & 0xff)
|
||||||
void guMtxIdentF(float mf[4][4]);
|
|
||||||
void guMtxL2F(float mf[4][4], Mtx *m);
|
#define FILTER_WRAP 0
|
||||||
void guNormalize(float *, float *, float *);
|
#define FILTER_CLAMP 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* matrix operations:
|
||||||
|
*
|
||||||
|
* The 'F' version is floating point, in case the application wants
|
||||||
|
* to do matrix manipulations and convert to fixed-point at the last
|
||||||
|
* minute.
|
||||||
|
*/
|
||||||
|
extern void guMtxIdent(Mtx *m);
|
||||||
|
extern void guMtxIdentF(float mf[4][4]);
|
||||||
|
extern void guOrtho(Mtx *m, float l, float r, float b, float t,
|
||||||
|
float n, float f, float scale);
|
||||||
|
extern void guOrthoF(float mf[4][4], float l, float r, float b, float t,
|
||||||
|
float n, float f, float scale);
|
||||||
|
extern void guPerspective(Mtx *m, u16 *perspNorm, float fovy,
|
||||||
|
float aspect, float near, float far, float scale);
|
||||||
|
extern void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy,
|
||||||
|
float aspect, float near, float far, float scale);
|
||||||
|
extern void guRotate(Mtx *m, float a, float x, float y, float z);
|
||||||
|
extern void guRotateF(float mf[4][4], float a, float x, float y, float z);
|
||||||
|
extern void guScale(Mtx *m, float x, float y, float z);
|
||||||
|
extern void guScaleF(float mf[4][4], float x, float y, float z);
|
||||||
|
extern void guTranslate(Mtx *m, float x, float y, float z);
|
||||||
|
extern void guTranslateF(float mf[4][4], float x, float y, float z);
|
||||||
|
extern void guMtxF2L(float mf[4][4], Mtx *m);
|
||||||
|
extern void guMtxL2F(float mf[4][4], Mtx *m);
|
||||||
|
|
||||||
|
/* vector utility: */
|
||||||
|
extern void guNormalize(float *x, float *y, float *z);
|
||||||
|
|
||||||
/* Used only in Fast3DEX2 */
|
/* Used only in Fast3DEX2 */
|
||||||
void guLookAtReflect (Mtx *m, LookAt *l, float xEye, float yEye, float zEye,
|
extern void guLookAtReflect(Mtx *m, LookAt *l,
|
||||||
float xAt, float yAt, float zAt,
|
float xEye, float yEye, float zEye,
|
||||||
float xUp, float yUp, float zUp);
|
float xAt, float yAt, float zAt,
|
||||||
#endif
|
float xUp, float yUp, float zUp);
|
||||||
|
extern void guLookAtReflectF(float mf[4][4], LookAt *l,
|
||||||
|
float xEye, float yEye, float zEye,
|
||||||
|
float xAt, float yAt, float zAt,
|
||||||
|
float xUp, float yUp, float zUp);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Math functions
|
||||||
|
*/
|
||||||
|
extern float sinf(float);
|
||||||
|
extern double sin(double);
|
||||||
|
extern float cosf(float);
|
||||||
|
extern double cos(double);
|
||||||
|
|
||||||
|
extern float sqrtf(float);
|
||||||
|
|
||||||
|
#endif /* !_GU_H_ */
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
#ifndef IQUE_H
|
|
||||||
#define IQUE_H
|
|
||||||
|
|
||||||
#include "rcp.h"
|
|
||||||
|
|
||||||
#define MI_SK_EXCEPTION_REG (MI_BASE_REG+0x14)
|
|
||||||
#define MI_SK_WATCHDOG_TIMER (MI_BASE_REG+0x18)
|
|
||||||
|
|
||||||
// Hardware interrupts
|
|
||||||
// 0x40 = NAND DMA, 0x80 = MD, 0x100 = RDB, 0x200 = AES,
|
|
||||||
// 0x400 = PI_ERR, 0x800 = USB0, 0x1000 = USB1, 0x2000 = NAND
|
|
||||||
#define MI_HW_INTR_REG (MI_BASE_REG+0x38)
|
|
||||||
#define MI_HW_INTR_MASK_REG (MI_BASE_REG+0x3C)
|
|
||||||
|
|
||||||
#define PI_CARD_ADDR_REG (PI_BASE_REG+0x48)
|
|
||||||
#define PI_EX_RD_LEN_REG (PI_BASE_REG+0x58)
|
|
||||||
#define PI_EX_WR_LEN_REG (PI_BASE_REG+0x5C)
|
|
||||||
#define PI_MISC_REG (PI_BASE_REG+0x60)
|
|
||||||
|
|
||||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
|
||||||
|
|
||||||
extern u8 *__osBbEepromAddress;
|
|
||||||
extern u32 __osBbEepromSize;
|
|
||||||
extern u32 __osBbFlashAddress;
|
|
||||||
extern u32 __osBbFlashSize;
|
|
||||||
extern u32 __osBbSramAddress;
|
|
||||||
extern u32 __osBbSramSize;
|
|
||||||
extern u32 *__osBbPakAddress[];
|
|
||||||
extern u32 __osBbPakSize;
|
|
||||||
extern u32 __osBbIsBb;
|
|
||||||
extern u32 __osBbHackFlags;
|
|
||||||
|
|
||||||
void skKeepAlive(void);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,7 +1,195 @@
|
|||||||
#ifndef _ULTRA64_LIBAUDIO_H_
|
/*====================================================================
|
||||||
#define _ULTRA64_LIBAUDIO_H_
|
* libaudio.h
|
||||||
|
*
|
||||||
|
* Copyright 1993, Silicon Graphics, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||||
|
* Inc.; the contents of this file may not be disclosed to third
|
||||||
|
* parties, copied or duplicated in any form, in whole or in part,
|
||||||
|
* without the prior written permission of Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* RESTRICTED RIGHTS LEGEND:
|
||||||
|
* Use, duplication or disclosure by the Government is subject to
|
||||||
|
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||||
|
* in Technical Data and Computer Software clause at DFARS
|
||||||
|
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||||
|
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||||
|
* Copyright Laws of the United States.
|
||||||
|
*====================================================================*/
|
||||||
|
|
||||||
#include "abi.h"
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* $Revision: 1.173 $
|
||||||
|
* $Date: 1997/12/01 12:42:21 $
|
||||||
|
* $Source: /exdisk2/cvs/N64OS/Master/cvsmdev2/PR/include/libaudio.h,v $
|
||||||
|
*
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __LIB_AUDIO__
|
||||||
|
#define __LIB_AUDIO__
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
#include <PR/mbi.h>
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* misc defines
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
typedef s32 ALMicroTime;
|
||||||
|
typedef u8 ALPan;
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Error handling
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define ALFailIf(condition, error) \
|
||||||
|
if (condition) { \
|
||||||
|
__osError(error, 0); \
|
||||||
|
return; }
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define ALFailIf(condition, error) \
|
||||||
|
if (condition) { \
|
||||||
|
return; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define ALFlagFailIf(condition, flag, error) \
|
||||||
|
if (condition) { \
|
||||||
|
if(flag) __osError(error, 0); \
|
||||||
|
return; }
|
||||||
|
|
||||||
|
#else
|
||||||
|
#define ALFlagFailIf(condition, flag, error) \
|
||||||
|
if (condition) { \
|
||||||
|
return; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Macros
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#define ALBnkfPatch(src, base, type) (type)((uintptr_t) src + (uintptr_t) base)
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* data structures for sound banks
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
#define AL_BANK_VERSION 0x4231 /* 'B1' */
|
||||||
|
|
||||||
|
/* Possible wavetable types */
|
||||||
|
enum {AL_ADPCM_WAVE = 0,
|
||||||
|
AL_RAW16_WAVE};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
s32 order;
|
||||||
|
s32 npredictors;
|
||||||
|
s16 book[1]; /* Actually variable size. Must be 8-byte aligned */
|
||||||
|
} ALADPCMBook;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u32 start;
|
||||||
|
u32 end;
|
||||||
|
u32 count;
|
||||||
|
ADPCM_STATE state;
|
||||||
|
} ALADPCMloop;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u32 start;
|
||||||
|
u32 end;
|
||||||
|
u32 count;
|
||||||
|
} ALRawLoop;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ALMicroTime attackTime;
|
||||||
|
ALMicroTime decayTime;
|
||||||
|
ALMicroTime releaseTime;
|
||||||
|
u8 attackVolume;
|
||||||
|
u8 decayVolume;
|
||||||
|
} ALEnvelope;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u8 velocityMin;
|
||||||
|
u8 velocityMax;
|
||||||
|
u8 keyMin;
|
||||||
|
u8 keyMax;
|
||||||
|
u8 keyBase;
|
||||||
|
s8 detune;
|
||||||
|
} ALKeyMap;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ALADPCMloop *loop;
|
||||||
|
ALADPCMBook *book;
|
||||||
|
} ALADPCMWaveInfo;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ALRawLoop *loop;
|
||||||
|
} ALRAWWaveInfo;
|
||||||
|
|
||||||
|
typedef struct ALWaveTable_s {
|
||||||
|
u8 *base; /* ptr to start of wave data */
|
||||||
|
s32 len; /* length of data in bytes */
|
||||||
|
u8 type; /* compression type */
|
||||||
|
u8 flags; /* offset/address flags */
|
||||||
|
union {
|
||||||
|
ALADPCMWaveInfo adpcmWave;
|
||||||
|
ALRAWWaveInfo rawWave;
|
||||||
|
} waveInfo;
|
||||||
|
} ALWaveTable;
|
||||||
|
|
||||||
|
typedef struct ALSound_s {
|
||||||
|
ALEnvelope *envelope;
|
||||||
|
ALKeyMap *keyMap;
|
||||||
|
ALWaveTable *wavetable; /* offset to wavetable struct */
|
||||||
|
ALPan samplePan;
|
||||||
|
u8 sampleVolume;
|
||||||
|
u8 flags;
|
||||||
|
} ALSound;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
u8 volume; /* overall volume for this instrument */
|
||||||
|
ALPan pan; /* 0 = hard left, 127 = hard right */
|
||||||
|
u8 priority; /* voice priority for this instrument */
|
||||||
|
u8 flags;
|
||||||
|
u8 tremType; /* the type of tremelo osc. to use */
|
||||||
|
u8 tremRate; /* the rate of the tremelo osc. */
|
||||||
|
u8 tremDepth; /* the depth of the tremelo osc */
|
||||||
|
u8 tremDelay; /* the delay for the tremelo osc */
|
||||||
|
u8 vibType; /* the type of tremelo osc. to use */
|
||||||
|
u8 vibRate; /* the rate of the tremelo osc. */
|
||||||
|
u8 vibDepth; /* the depth of the tremelo osc */
|
||||||
|
u8 vibDelay; /* the delay for the tremelo osc */
|
||||||
|
s16 bendRange; /* pitch bend range in cents */
|
||||||
|
s16 soundCount; /* number of sounds in this array */
|
||||||
|
ALSound *soundArray[1];
|
||||||
|
} ALInstrument;
|
||||||
|
|
||||||
|
typedef struct ALBank_s {
|
||||||
|
s16 instCount; /* number of programs in this bank */
|
||||||
|
u8 flags;
|
||||||
|
u8 pad;
|
||||||
|
s32 sampleRate; /* e.g. 44100, 22050, etc... */
|
||||||
|
ALInstrument *percussion; /* default percussion for GM */
|
||||||
|
ALInstrument *instArray[1]; /* ARRAY of instruments */
|
||||||
|
} ALBank;
|
||||||
|
|
||||||
|
typedef struct { /* Note: sizeof won't be correct */
|
||||||
|
s16 revision; /* format revision of this file */
|
||||||
|
s16 bankCount; /* number of banks */
|
||||||
|
ALBank *bankArray[1]; /* ARRAY of bank offsets */
|
||||||
|
} ALBankFile;
|
||||||
|
|
||||||
|
void alBnkfNew(ALBankFile *f, u8 *table);
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Sequence Files
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -48,4 +236,8 @@ typedef struct
|
|||||||
|
|
||||||
void alSeqFileNew(ALSeqFile *f, u8 *base);
|
void alSeqFileNew(ALSeqFile *f, u8 *base);
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
#ifndef _LIBULTRA_H
|
|
||||||
#define _LIBULTRA_H
|
|
||||||
|
|
||||||
#define TV_TYPE_NTSC 1
|
|
||||||
#define TV_TYPE_PAL 0
|
|
||||||
#define TV_TYPE_MPAL 2
|
|
||||||
|
|
||||||
#define RESET_TYPE_COLD_RESET 0
|
|
||||||
#define RESET_TYPE_NMI 1
|
|
||||||
#define RESET_TYPE_BOOT_DISK 2
|
|
||||||
|
|
||||||
extern u32 osTvType;
|
|
||||||
extern u32 osRomBase;
|
|
||||||
extern u32 osResetType;
|
|
||||||
extern u32 osMemSize;
|
|
||||||
extern u8 osAppNmiBuffer[64];
|
|
||||||
|
|
||||||
#endif /* _LIBULTRA_H */
|
|
||||||
683
include/PR/os.h
683
include/PR/os.h
File diff suppressed because it is too large
Load Diff
@@ -93,6 +93,7 @@ typedef struct {
|
|||||||
/* controller errors */
|
/* controller errors */
|
||||||
#define CONT_NO_RESPONSE_ERROR 0x8
|
#define CONT_NO_RESPONSE_ERROR 0x8
|
||||||
#define CONT_OVERRUN_ERROR 0x4
|
#define CONT_OVERRUN_ERROR 0x4
|
||||||
|
#define CONT_RANGE_ERROR -1
|
||||||
#ifdef _HW_VERSION_1
|
#ifdef _HW_VERSION_1
|
||||||
#define CONT_FRAME_ERROR 0x2
|
#define CONT_FRAME_ERROR 0x2
|
||||||
#define CONT_COLLISION_ERROR 0x1
|
#define CONT_COLLISION_ERROR 0x1
|
||||||
|
|||||||
119
include/PR/os_convert.h
Normal file
119
include/PR/os_convert.h
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
|
||||||
|
/*====================================================================
|
||||||
|
* os_convert.h
|
||||||
|
*
|
||||||
|
* Copyright 1995, Silicon Graphics, Inc.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics,
|
||||||
|
* Inc.; the contents of this file may not be disclosed to third
|
||||||
|
* parties, copied or duplicated in any form, in whole or in part,
|
||||||
|
* without the prior written permission of Silicon Graphics, Inc.
|
||||||
|
*
|
||||||
|
* RESTRICTED RIGHTS LEGEND:
|
||||||
|
* Use, duplication or disclosure by the Government is subject to
|
||||||
|
* restrictions as set forth in subdivision (c)(1)(ii) of the Rights
|
||||||
|
* in Technical Data and Computer Software clause at DFARS
|
||||||
|
* 252.227-7013, and/or in similar or successor clauses in the FAR,
|
||||||
|
* DOD or NASA FAR Supplement. Unpublished - rights reserved under the
|
||||||
|
* Copyright Laws of the United States.
|
||||||
|
*====================================================================*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------*
|
||||||
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||||
|
|
||||||
|
$RCSfile: os_convert.h,v $
|
||||||
|
$Revision: 1.2 $
|
||||||
|
$Date: 1999/04/21 02:53:11 $
|
||||||
|
*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _OS_CONVERT_H_
|
||||||
|
#define _OS_CONVERT_H_
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <PR/ultratypes.h>
|
||||||
|
#include <PR/os_version.h>
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Type definitions
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Global definitions
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define OS_CLOCK_RATE 62500000LL
|
||||||
|
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Macro definitions
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if LIBULTRA_VERSION > OS_VER_H
|
||||||
|
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625000LL))/(1000000000LL/15625000LL))
|
||||||
|
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
|
||||||
|
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL/15625000LL))/(OS_CPU_COUNTER/15625000LL))
|
||||||
|
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL/15625LL))/(OS_CPU_COUNTER/15625LL))
|
||||||
|
#else
|
||||||
|
#define OS_NSEC_TO_CYCLES(n) (((u64)(n)*(osClockRate))/(1000000000LL))
|
||||||
|
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(osClockRate))/(1000000LL))
|
||||||
|
#define OS_CYCLES_TO_NSEC(c) (((u64)(c)*(1000000000LL))/(osClockRate))
|
||||||
|
#define OS_CYCLES_TO_USEC(c) (((u64)(c)*(1000000LL))/(osClockRate))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* OS_K?_TO_PHYSICAL macro bug fix for CodeWarrior */
|
||||||
|
#ifndef __MWERKS__
|
||||||
|
#define OS_K0_TO_PHYSICAL(x) (u32)(((char *)(x)-0x80000000))
|
||||||
|
#define OS_K1_TO_PHYSICAL(x) (u32)(((char *)(x)-0xa0000000))
|
||||||
|
#else
|
||||||
|
#define OS_K0_TO_PHYSICAL(x) ((char *)(x)-0x80000000)
|
||||||
|
#define OS_K1_TO_PHYSICAL(x) ((char *)(x)-0xa0000000)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OS_PHYSICAL_TO_K0(x) (void *)(((u32)(x)+0x80000000))
|
||||||
|
#define OS_PHYSICAL_TO_K1(x) (void *)(((u32)(x)+0xa0000000))
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Extern variables
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* Function prototypes
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Address translation routines and macros */
|
||||||
|
|
||||||
|
extern uintptr_t osVirtualToPhysical(void *);
|
||||||
|
extern void * osPhysicalToVirtual(u32);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_OS_CONVERT_H_ */
|
||||||
@@ -66,6 +66,10 @@ extern "C" {
|
|||||||
#define EEP16K_MAXBLOCKS 256
|
#define EEP16K_MAXBLOCKS 256
|
||||||
#define EEPROM_BLOCK_SIZE 8
|
#define EEPROM_BLOCK_SIZE 8
|
||||||
|
|
||||||
|
/* EEPROM SIZE */
|
||||||
|
|
||||||
|
#define EEPROM_SIZE EEPROM_BLOCK_SIZE * EEPROM_MAXBLOCKS
|
||||||
|
#define EEP16K_SIZE EEPROM_BLOCK_SIZE * EEP16K_MAXBLOCKS
|
||||||
|
|
||||||
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ typedef u32 OSHWIntr;
|
|||||||
/* Interrupt masks */
|
/* Interrupt masks */
|
||||||
|
|
||||||
#define OS_IM_NONE 0x00000001
|
#define OS_IM_NONE 0x00000001
|
||||||
|
#define OS_IM_RCP 0x00000401
|
||||||
#define OS_IM_SW1 0x00000501
|
#define OS_IM_SW1 0x00000501
|
||||||
#define OS_IM_SW2 0x00000601
|
#define OS_IM_SW2 0x00000601
|
||||||
#define OS_IM_CART 0x00000c01
|
#define OS_IM_CART 0x00000c01
|
||||||
|
|||||||
@@ -1,19 +1,41 @@
|
|||||||
#ifndef _ULTRA64_OS_INTERNAL_H_
|
/**************************************************************************
|
||||||
#define _ULTRA64_OS_INTERNAL_H_
|
* *
|
||||||
#include "PR/os_message.h"
|
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
* These coded instructions, statements, and computer programs contain *
|
||||||
|
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||||
|
* are protected by Federal copyright law. They may not be disclosed *
|
||||||
|
* to third parties or copied or duplicated in any form, in whole or *
|
||||||
|
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
/* Internal functions used by the operating system */
|
/*---------------------------------------------------------------------*
|
||||||
/* Do not include this header in application code */
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||||
|
|
||||||
|
$RCSfile: os_internal.h,v $
|
||||||
|
$Revision: 1.20 $
|
||||||
|
$Date: 1998/10/09 08:01:09 $
|
||||||
|
*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Variables */
|
#ifndef _OS_INTERNAL_H_
|
||||||
|
#define _OS_INTERNAL_H_
|
||||||
|
|
||||||
//extern u64 osClockRate;
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Functions */
|
#include <PR/os.h>
|
||||||
|
|
||||||
/*u32 __osProbeTLB(void *);
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
u32 __osDisableInt(void);
|
|
||||||
void __osRestoreInt(u32);*/
|
#include "os_internal_reg.h"
|
||||||
OSThread *__osGetCurrFaultedThread(void);
|
#include "os_internal_si.h"
|
||||||
|
#include "os_internal_vi.h"
|
||||||
|
#include "os_internal_rsp.h"
|
||||||
|
#include "os_internal_error.h"
|
||||||
|
#include "os_internal_debug.h"
|
||||||
|
#include "os_internal_exception.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
42
include/PR/os_internal_debug.h
Normal file
42
include/PR/os_internal_debug.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
* *
|
||||||
|
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
* These coded instructions, statements, and computer programs contain *
|
||||||
|
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||||
|
* are protected by Federal copyright law. They may not be disclosed *
|
||||||
|
* to third parties or copied or duplicated in any form, in whole or *
|
||||||
|
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------*
|
||||||
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||||
|
|
||||||
|
$RCSfile: os_internal_debug.h,v $
|
||||||
|
$Revision: 1.1 $
|
||||||
|
$Date: 1998/10/09 08:01:09 $
|
||||||
|
*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _OS_INTERNAL_DEBUG_H_
|
||||||
|
#define _OS_INTERNAL_DEBUG_H_
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <PR/os.h>
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
/* Debug port */
|
||||||
|
extern int __osAtomicDec(unsigned int *p);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _LANGUAGE_C */
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_OS_INTERNAL_DEBUG_H */
|
||||||
43
include/PR/os_internal_error.h
Normal file
43
include/PR/os_internal_error.h
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
* *
|
||||||
|
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
* These coded instructions, statements, and computer programs contain *
|
||||||
|
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||||
|
* are protected by Federal copyright law. They may not be disclosed *
|
||||||
|
* to third parties or copied or duplicated in any form, in whole or *
|
||||||
|
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------*
|
||||||
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||||
|
|
||||||
|
$RCSfile: os_internal_error.h,v $
|
||||||
|
$Revision: 1.1 $
|
||||||
|
$Date: 1998/10/09 08:01:10 $
|
||||||
|
*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _OS_INTERNAL_ERROR_H_
|
||||||
|
#define _OS_INTERNAL_ERROR_H_
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <PR/os.h>
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
/* Error handling */
|
||||||
|
|
||||||
|
extern OSThread * __osGetCurrFaultedThread(void);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _LANGUAGE_C */
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_OS_INTERNAL_ERROR_H */
|
||||||
50
include/PR/os_internal_exception.h
Normal file
50
include/PR/os_internal_exception.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
* *
|
||||||
|
* Copyright (C) 1995, Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
* These coded instructions, statements, and computer programs contain *
|
||||||
|
* unpublished proprietary information of Silicon Graphics, Inc., and *
|
||||||
|
* are protected by Federal copyright law. They may not be disclosed *
|
||||||
|
* to third parties or copied or duplicated in any form, in whole or *
|
||||||
|
* in part, without the prior written consent of Silicon Graphics, Inc. *
|
||||||
|
* *
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------*
|
||||||
|
Copyright (C) 1998 Nintendo. (Originated by SGI)
|
||||||
|
|
||||||
|
$RCSfile: os_internal_exception.h,v $
|
||||||
|
$Revision: 1.1 $
|
||||||
|
$Date: 1998/10/09 08:01:10 $
|
||||||
|
*---------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _OS_INTERNAL_EXCEPTION_H_
|
||||||
|
#define _OS_INTERNAL_EXCEPTION_H_
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "os.h"
|
||||||
|
|
||||||
|
#if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
|
||||||
|
|
||||||
|
/* Routine for HW interrupt "handler" */
|
||||||
|
#if LIBULTRA_VERSION >= OS_VER_J
|
||||||
|
extern void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void), void *stackEnd);
|
||||||
|
#else
|
||||||
|
extern void __osSetHWIntrRoutine(OSHWIntr interrupt, s32 (*handler)(void));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Routine for global interrupt mask */
|
||||||
|
extern void __osSetGlobalIntMask(OSHWIntr);
|
||||||
|
extern void __osResetGlobalIntMask(OSHWIntr);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _LANGUAGE_C */
|
||||||
|
|
||||||
|
#ifdef _LANGUAGE_C_PLUS_PLUS
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !_OS_INTERNAL_EXCEPTION_H */
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user