convert comments (; -> @)
This commit is contained in:
+68
-68
@@ -1,12 +1,12 @@
|
||||
; This library can be used to download and execute a multi-boot image from
|
||||
; a GameCube using the JOY Bus protocol over the link cable.
|
||||
@ This library can be used to download and execute a multi-boot image from
|
||||
@ a GameCube using the JOY Bus protocol over the link cable.
|
||||
|
||||
.set GCMB_STRUCT_BASE_DEST_PTR, 0x20
|
||||
.set GCMB_STRUCT_CUR_DEST_PTR, 0x24
|
||||
.set GCMB_STRUCT_SERIAL_INTR_HANDLER, 0x28
|
||||
|
||||
thumb_func_start GameCubeMultiBoot_Hash
|
||||
GameCubeMultiBoot_Hash: ; 82DED70
|
||||
GameCubeMultiBoot_Hash: @ 82DED70
|
||||
push {r4,lr}
|
||||
ldr r4, pool_HashVal
|
||||
eors r3, r1
|
||||
@@ -26,8 +26,8 @@ $skipEor:
|
||||
thumb_func_end GameCubeMultiBoot_Hash
|
||||
|
||||
thumb_func_start GameCubeMultiBoot_Main
|
||||
; void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_Main: ; 82DED84
|
||||
@ void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_Main: @ 82DED84
|
||||
ldr r1, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
|
||||
cmp r1, 0
|
||||
beq _082DEDAA
|
||||
@@ -166,13 +166,13 @@ _082DEE76:
|
||||
|
||||
pool_HashVal: .4byte 0xa1c1
|
||||
|
||||
pool_Kawa: .ascii "Kawa" ; name of BIOS developer
|
||||
pool_Kawa: .ascii "Kawa" @ name of BIOS developer
|
||||
|
||||
pool_NintendoLogo: .4byte RomHeaderNintendoLogo
|
||||
|
||||
thumb_func_start GameCubeMultiBoot_ExecuteProgram
|
||||
; void GameCubeMultiBoot_ExecuteProgram(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_ExecuteProgram: ; 82DEE84
|
||||
@ void GameCubeMultiBoot_ExecuteProgram(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_ExecuteProgram: @ 82DEE84
|
||||
ldrb r1, [r0, 0x2]
|
||||
cmp r1, 0x2
|
||||
bne $unableToExecute
|
||||
@@ -187,20 +187,20 @@ $unableToExecute:
|
||||
thumb_func_end GameCubeMultiBoot_ExecuteProgram
|
||||
|
||||
thumb_func_start GameCubeMultiBoot_Init
|
||||
; void GameCubeMultiBoot_Init(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_Init: ; 82DEE98
|
||||
@ void GameCubeMultiBoot_Init(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_Init: @ 82DEE98
|
||||
ldr r3, pool_InterruptRegs
|
||||
|
||||
; Save IME register.
|
||||
@ Save IME register.
|
||||
ldrh r2, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
; Disable interrupts.
|
||||
@ Disable interrupts.
|
||||
movs r1, 0
|
||||
strh r1, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
; Set the handler to the "Stop" routine.
|
||||
; Unless the first command that is received is a device reset command, the
|
||||
; "Stop" routine will be executed and no further commands will be processed.
|
||||
@ Set the handler to the "Stop" routine.
|
||||
@ Unless the first command that is received is a device reset command, the
|
||||
@ "Stop" routine will be executed and no further commands will be processed.
|
||||
adr r3, GcMbIntrHandler_Stop
|
||||
str r3, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER]
|
||||
|
||||
@@ -212,7 +212,7 @@ GameCubeMultiBoot_Init: ; 82DEE98
|
||||
adds r3, r0, 0
|
||||
adds r3, GCMB_STRUCT_BASE_DEST_PTR
|
||||
|
||||
; clear all but the last 3 fields of the struct
|
||||
@ clear all but the last 3 fields of the struct
|
||||
$clearStructLoop:
|
||||
stm r0!, {r1}
|
||||
cmp r0, r3
|
||||
@@ -226,43 +226,43 @@ $clearStructLoop:
|
||||
|
||||
ldr r3, pool_SerialRegs
|
||||
|
||||
; Turn off JOY Bus mode.
|
||||
@ Turn off JOY Bus mode.
|
||||
lsls r0, r3, 10
|
||||
strh r0, [r3, OFFSET_REG_RCNT - 0x120]
|
||||
|
||||
; Turn on JOY Bus mode.
|
||||
@ Turn on JOY Bus mode.
|
||||
movs r0, 0xC0
|
||||
lsls r0, 8
|
||||
strh r0, [r3, OFFSET_REG_RCNT - 0x120]
|
||||
|
||||
; Init JOY Bus registers.
|
||||
@ Init JOY Bus registers.
|
||||
movs r0, 0x47
|
||||
strh r0, [r3, OFFSET_REG_JOYCNT - 0x120]
|
||||
strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120]
|
||||
|
||||
ldr r3, pool_InterruptRegs
|
||||
|
||||
; Acknowledge serial interrupt.
|
||||
@ Acknowledge serial interrupt.
|
||||
movs r0, INTR_FLAG_SERIAL
|
||||
strh r0, [r3, OFFSET_REG_IF - 0x200]
|
||||
|
||||
; Enable serial interrupt.
|
||||
@ Enable serial interrupt.
|
||||
ldrh r1, [r3, OFFSET_REG_IE - 0x200]
|
||||
orrs r1, r0
|
||||
strh r1, [r3, OFFSET_REG_IE - 0x200]
|
||||
|
||||
; Restore IME register.
|
||||
@ Restore IME register.
|
||||
strh r2, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
bx lr
|
||||
thumb_func_end GameCubeMultiBoot_Init
|
||||
|
||||
non_word_aligned_thumb_func_start GameCubeMultiBoot_HandleSerialInterrupt
|
||||
; void GameCubeMultiBoot_HandleSerialInterrupt(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_HandleSerialInterrupt: ; 82DEEE2
|
||||
@ void GameCubeMultiBoot_HandleSerialInterrupt(struct GameCubeMultiBoot *mb);
|
||||
GameCubeMultiBoot_HandleSerialInterrupt: @ 82DEEE2
|
||||
ldr r3, pool_SerialRegs
|
||||
|
||||
; Acknowledge reset/receive/send flags.
|
||||
@ Acknowledge reset/receive/send flags.
|
||||
ldrh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
|
||||
strh r1, [r3, OFFSET_REG_JOYCNT - 0x120]
|
||||
|
||||
@@ -273,16 +273,16 @@ GameCubeMultiBoot_HandleSerialInterrupt: ; 82DEEE2
|
||||
cmp r2, 0
|
||||
beq GameCubeMultiBoot_HandleSerialInterruptDone
|
||||
|
||||
lsrs r1, 1 ; was a device reset command received?
|
||||
bcs GameCubeMultiBoot_BeginHandshake ; branch if so
|
||||
lsrs r1, 1 @ was a device reset command received?
|
||||
bcs GameCubeMultiBoot_BeginHandshake @ branch if so
|
||||
|
||||
mov pc, r2
|
||||
|
||||
.align 2, 0
|
||||
|
||||
; Zero the status and the interrupt handler pointer.
|
||||
; Commands from the GameCube will not be processed after this is executed
|
||||
; unless GameCubeMultiBoot_Init() is called again.
|
||||
@ Zero the status and the interrupt handler pointer.
|
||||
@ Commands from the GameCube will not be processed after this is executed
|
||||
@ unless GameCubeMultiBoot_Init() is called again.
|
||||
GcMbIntrHandler_Stop:
|
||||
movs r2, 0
|
||||
strh r2, [r3, OFFSET_REG_JOYSTAT - 0x120]
|
||||
@@ -317,27 +317,27 @@ GameCubeMultiBoot_BeginHandshake:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_CheckGameCodeSent: ; 82DEF24
|
||||
GcMbIntrHandler_CheckGameCodeSent: @ 82DEF24
|
||||
lsls r1, 31
|
||||
bcc GcMbIntrHandler_Stop ; stop if send failed
|
||||
bmi GameCubeMultiBoot_CheckHandshakeResponse ; branch if receive is complete
|
||||
bcc GcMbIntrHandler_Stop @ stop if send failed
|
||||
bmi GameCubeMultiBoot_CheckHandshakeResponse @ branch if receive is complete
|
||||
|
||||
; If the response hasn't been fully received yet,
|
||||
; check again upon the next interrupt.
|
||||
@ If the response hasn't been fully received yet,
|
||||
@ check again upon the next interrupt.
|
||||
adr r2, GcMbIntrHandler_CheckHandshakeResponse
|
||||
b GameCubeMultiBoot_SetInterruptHandler
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_CheckHandshakeResponse: ; 82DEF30
|
||||
lsrs r1, 1 ; is receive complete?
|
||||
bcc GcMbIntrHandler_Stop ; stop if not
|
||||
GcMbIntrHandler_CheckHandshakeResponse: @ 82DEF30
|
||||
lsrs r1, 1 @ is receive complete?
|
||||
bcc GcMbIntrHandler_Stop @ stop if not
|
||||
|
||||
GameCubeMultiBoot_CheckHandshakeResponse:
|
||||
ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
|
||||
ldr r2, pool_RubyUSAGameCode
|
||||
cmp r1, r2
|
||||
bne GcMbIntrHandler_Stop ; stop if the GameCube didn't reply with the same game code
|
||||
bne GcMbIntrHandler_Stop @ stop if the GameCube didn't reply with the same game code
|
||||
ldrb r1, [r0, 0x3]
|
||||
strb r1, [r0, 0xB]
|
||||
adr r2, GcMbIntrHandler_82DEF44
|
||||
@@ -345,9 +345,9 @@ GameCubeMultiBoot_CheckHandshakeResponse:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEF44: ; 82DEF44
|
||||
lsrs r1, 1 ; is receive complete?
|
||||
bcc GcMbIntrHandler_Stop ; branch if not
|
||||
GcMbIntrHandler_82DEF44: @ 82DEF44
|
||||
lsrs r1, 1 @ is receive complete?
|
||||
bcc GcMbIntrHandler_Stop @ branch if not
|
||||
ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
|
||||
lsrs r2, r1, 24
|
||||
cmp r2, 0xDD
|
||||
@@ -383,18 +383,18 @@ _082DEF72:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEF84: ; 82DEF84
|
||||
GcMbIntrHandler_82DEF84: @ 82DEF84
|
||||
lsls r1, 31
|
||||
bcc GcMbIntrHandler_Stop ; stop if send failed
|
||||
bmi _082DEF94 ; branch if receive is complete
|
||||
bcc GcMbIntrHandler_Stop @ stop if send failed
|
||||
bmi _082DEF94 @ branch if receive is complete
|
||||
adr r2, GcMbIntrHandler_82DEF90
|
||||
b GameCubeMultiBoot_SetInterruptHandler
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEF90: ; 82DEF90
|
||||
lsrs r1, 1 ; is receive complete?
|
||||
bcc GcMbIntrHandler_Stop ; branch if not
|
||||
GcMbIntrHandler_82DEF90: @ 82DEF90
|
||||
lsrs r1, 1 @ is receive complete?
|
||||
bcc GcMbIntrHandler_Stop @ branch if not
|
||||
_082DEF94:
|
||||
ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
|
||||
ldr r2, _082DF034
|
||||
@@ -415,9 +415,9 @@ _082DEFA6:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEFB4: ; 82DEFB4
|
||||
lsrs r1, 1 ; is receive complete?
|
||||
bcc GcMbIntrHandler_Stop ; branch if not
|
||||
GcMbIntrHandler_82DEFB4: @ 82DEFB4
|
||||
lsrs r1, 1 @ is receive complete?
|
||||
bcc GcMbIntrHandler_Stop @ branch if not
|
||||
ldr r2, [r0, GCMB_STRUCT_CUR_DEST_PTR]
|
||||
movs r1, 0x4
|
||||
ands r1, r2
|
||||
@@ -456,18 +456,18 @@ _082DEFE2:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEFF0: ; 82DEFF0
|
||||
GcMbIntrHandler_82DEFF0: @ 82DEFF0
|
||||
lsls r1, 31
|
||||
bcc _082DEFE2 ; branch if send failed
|
||||
bmi _082DF000 ; branch if receive is complete
|
||||
bcc _082DEFE2 @ branch if send failed
|
||||
bmi _082DF000 @ branch if receive is complete
|
||||
adr r2, GcMbIntrHandler_82DEFFC
|
||||
b GameCubeMultiBoot_SetInterruptHandler
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DEFFC: ; 82DEFFC
|
||||
lsrs r1, 1 ; is receive complete?
|
||||
bcc _082DEFE2 ; branch if not
|
||||
GcMbIntrHandler_82DEFFC: @ 82DEFFC
|
||||
lsrs r1, 1 @ is receive complete?
|
||||
bcc _082DEFE2 @ branch if not
|
||||
|
||||
_082DF000:
|
||||
ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120]
|
||||
@@ -480,45 +480,45 @@ _082DF000:
|
||||
|
||||
.align 2, 0
|
||||
|
||||
GcMbIntrHandler_82DF010: ; 82DF010
|
||||
GcMbIntrHandler_82DF010: @ 82DF010
|
||||
b GcMbIntrHandler_Stop
|
||||
|
||||
thumb_func_end GameCubeMultiBoot_HandleSerialInterrupt
|
||||
|
||||
non_word_aligned_thumb_func_start GameCubeMultiBoot_Quit
|
||||
; void GameCubeMultiBoot_Quit();
|
||||
GameCubeMultiBoot_Quit: ; 82DF012
|
||||
@ void GameCubeMultiBoot_Quit();
|
||||
GameCubeMultiBoot_Quit: @ 82DF012
|
||||
ldr r3, pool_InterruptRegs
|
||||
|
||||
; Save IME register.
|
||||
@ Save IME register.
|
||||
ldrh r2, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
; Disable interrupts.
|
||||
@ Disable interrupts.
|
||||
movs r1, 0
|
||||
strh r1, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
ldr r3, pool_SerialRegs
|
||||
|
||||
; Acknowledge all JOYCNT flags.
|
||||
@ Acknowledge all JOYCNT flags.
|
||||
movs r0, 0x7
|
||||
strh r0, [r3, OFFSET_REG_JOYCNT - 0x120]
|
||||
|
||||
; Turn off JOY Bus mode.
|
||||
@ Turn off JOY Bus mode.
|
||||
lsls r0, r3, 10
|
||||
strh r0, [r3, OFFSET_REG_RCNT - 0x120] ; store 0x8000
|
||||
strh r0, [r3, OFFSET_REG_RCNT - 0x120] @ store 0x8000
|
||||
|
||||
ldr r3, pool_InterruptRegs
|
||||
|
||||
; Acknowledge serial interrupt.
|
||||
@ Acknowledge serial interrupt.
|
||||
movs r0, INTR_FLAG_SERIAL
|
||||
strh r0, [r3, OFFSET_REG_IF - 0x200]
|
||||
|
||||
; Disable serial interrupt.
|
||||
@ Disable serial interrupt.
|
||||
ldrh r1, [r3, OFFSET_REG_IE - 0x200]
|
||||
bics r1, r0
|
||||
strh r1, [r3, OFFSET_REG_IE - 0x200]
|
||||
|
||||
; Restore IME register.
|
||||
@ Restore IME register.
|
||||
strh r2, [r3, OFFSET_REG_IME - 0x200]
|
||||
|
||||
bx lr
|
||||
|
||||
Reference in New Issue
Block a user