diff options
author | GriffinR <griffin.g.richards@gmail.com> | 2020-07-17 18:19:06 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-17 18:19:06 -0400 |
commit | 1cf2470aac038fce48a5777e36b00554af90d910 (patch) | |
tree | 31a0afce3cc927221ef5229a8d2fb0f5754e1a54 /src | |
parent | 96fd719a1906346db062daf13e1107b3c4b220ed (diff) | |
parent | 98441b119996ff1dc9575d925479213864d293f7 (diff) |
Merge pull request #1097 from PokeCodec/asm
Allow assembly on Clang
Diffstat (limited to 'src')
-rw-r--r-- | src/crt0.s | 80 | ||||
-rw-r--r-- | src/libgcnmultiboot.s | 86 |
2 files changed, 83 insertions, 83 deletions
diff --git a/src/crt0.s b/src/crt0.s index 3ab711713..cb7c93a6b 100644 --- a/src/crt0.s +++ b/src/crt0.s @@ -82,10 +82,10 @@ GPIOPortReadEnable: @ 80000C8 .align 2, 0 .global Init Init: @ 8000204 - mov r0, PSR_IRQ_MODE + mov r0, #PSR_IRQ_MODE msr cpsr_cf, r0 ldr sp, sp_irq - mov r0, PSR_SYS_MODE + mov r0, #PSR_SYS_MODE msr cpsr_cf, r0 ldr sp, sp_sys ldr r1, =INTR_VECTOR @@ -106,91 +106,91 @@ sp_irq: .word IWRAM_END - 0x60 .align 2, 0 .global IntrMain IntrMain: @ 8000248 - mov r3, REG_BASE - add r3, r3, 0x200 - ldr r2, [r3, OFFSET_REG_IE - 0x200] - ldrh r1, [r3, OFFSET_REG_IME - 0x200] + mov r3, #REG_BASE + add r3, r3, #OFFSET_REG_IE + ldr r2, [r3] + ldrh r1, [r3, #OFFSET_REG_IME - 0x200] mrs r0, spsr - stmdb sp!, {r0-r3,lr} - mov r0, 0 - strh r0, [r3, OFFSET_REG_IME - 0x200] - and r1, r2, r2, lsr 16 - mov r12, 0 - ands r0, r1, INTR_FLAG_VCOUNT + stmfd sp!, {r0-r3,lr} + mov r0, #0 + strh r0, [r3, #OFFSET_REG_IME - 0x200] + and r1, r2, r2, lsr #16 + mov r12, #0 + ands r0, r1, #INTR_FLAG_VCOUNT bne IntrMain_FoundIntr add r12, r12, 0x4 mov r0, 0x1 - strh r0, [r3, OFFSET_REG_IME - 0x200] - ands r0, r1, INTR_FLAG_SERIAL + strh r0, [r3, #OFFSET_REG_IME - 0x200] + ands r0, r1, #INTR_FLAG_SERIAL bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_TIMER3 + ands r0, r1, #INTR_FLAG_TIMER3 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_HBLANK + ands r0, r1, #INTR_FLAG_HBLANK bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_VBLANK + ands r0, r1, #INTR_FLAG_VBLANK bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_TIMER0 + ands r0, r1, #INTR_FLAG_TIMER0 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_TIMER1 + ands r0, r1, #INTR_FLAG_TIMER1 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_TIMER2 + ands r0, r1, #INTR_FLAG_TIMER2 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_DMA0 + ands r0, r1, #INTR_FLAG_DMA0 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_DMA1 + ands r0, r1, #INTR_FLAG_DMA1 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_DMA2 + ands r0, r1, #INTR_FLAG_DMA2 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_DMA3 + ands r0, r1, #INTR_FLAG_DMA3 bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_KEYPAD + ands r0, r1, #INTR_FLAG_KEYPAD bne IntrMain_FoundIntr add r12, r12, 0x4 - ands r0, r1, INTR_FLAG_GAMEPAK - strbne r0, [r3, OFFSET_REG_SOUNDCNT_X - 0x200] + ands r0, r1, #INTR_FLAG_GAMEPAK + strbne r0, [r3, #REG_SOUNDCNT_X - REG_IE] bne . @ spin IntrMain_FoundIntr: - strh r0, [r3, OFFSET_REG_IF - 0x200] + strh r0, [r3, #OFFSET_REG_IF - 0x200] bic r2, r2, r0 ldr r0, =gSTWIStatus ldr r0, [r0] ldrb r0, [r0, 0xA] mov r1, 0x8 - mov r0, r1, lsl r0 - orr r0, r0, INTR_FLAG_GAMEPAK - orr r1, r0, INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK + lsl r0, r1, r0 + orr r0, r0, #INTR_FLAG_GAMEPAK + orr r1, r0, #INTR_FLAG_SERIAL | INTR_FLAG_TIMER3 | INTR_FLAG_VCOUNT | INTR_FLAG_HBLANK and r1, r1, r2 - strh r1, [r3, OFFSET_REG_IE - 0x200] + strh r1, [r3, #OFFSET_REG_IE - 0x200] mrs r3, cpsr - bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK - orr r3, r3, PSR_SYS_MODE + bic r3, r3, #PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK + orr r3, r3, #PSR_SYS_MODE msr cpsr_cf, r3 ldr r1, =gIntrTable add r1, r1, r12 ldr r0, [r1] - stmdb sp!, {lr} + stmfd sp!, {lr} adr lr, IntrMain_RetAddr bx r0 IntrMain_RetAddr: - ldmia sp!, {lr} + ldmfd sp!, {lr} mrs r3, cpsr - bic r3, r3, PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK - orr r3, r3, PSR_I_BIT | PSR_IRQ_MODE + bic r3, r3, #PSR_I_BIT | PSR_F_BIT | PSR_MODE_MASK + orr r3, r3, #PSR_I_BIT | PSR_IRQ_MODE msr cpsr_cf, r3 ldmia sp!, {r0-r3,lr} - strh r2, [r3, OFFSET_REG_IE - 0x200] - strh r1, [r3, OFFSET_REG_IME - 0x200] + strh r2, [r3, #OFFSET_REG_IE - 0x200] + strh r1, [r3, #OFFSET_REG_IME - 0x200] msr spsr_cf, r0 bx lr diff --git a/src/libgcnmultiboot.s b/src/libgcnmultiboot.s index 0e418e51f..dbf70ccf8 100644 --- a/src/libgcnmultiboot.s +++ b/src/libgcnmultiboot.s @@ -22,7 +22,7 @@ GameCubeMultiBoot_Hash: @ 82DED70 movs r2, 0x20 GameCubeMultiBoot_Hash_Loop: - lsrs r3, 1 + lsrs r3, #1 bcc GameCubeMultiBoot_Hash_SkipEor eors r3, r4 @@ -37,8 +37,8 @@ GameCubeMultiBoot_Hash_SkipEor: thumb_func_start GameCubeMultiBoot_Main @ void GameCubeMultiBoot_Main(struct GameCubeMultiBoot *mb); GameCubeMultiBoot_Main: @ 82DED84 - ldr r1, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER] - cmp r1, 0 + ldr r1, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER] + cmp r1, #0 beq _082DEDAA ldrb r1, [r0, 0x1] adds r1, 0x1 @@ -47,30 +47,30 @@ GameCubeMultiBoot_Main: @ 82DED84 cmp r1, 0x2 beq _082DEDF4 ldr r3, pool_InterruptRegs - ldrh r2, [r3, OFFSET_REG_IME - 0x200] + ldrh r2, [r3, #OFFSET_REG_IME - 0x200] movs r1, 0 - strh r1, [r3, OFFSET_REG_IME - 0x200] + strh r1, [r3, #OFFSET_REG_IME - 0x200] ldrb r1, [r0] cmp r1, 0xA bgt _082DEDA8 adds r1, 0x1 strb r1, [r0] _082DEDA8: - strh r2, [r3, OFFSET_REG_IME - 0x200] + strh r2, [r3, #OFFSET_REG_IME - 0x200] _082DEDAA: bcs GameCubeMultiBoot_Init ldrb r1, [r0, 0x2] cmp r1, 0 bne _082DEDF6 - ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR] - ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR] + ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR] + ldr r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR] subs r1, r2 beq _082DEE76 cmp r1, 0xA0 bcc _082DEE76 push {r4-r6} movs r1, 0x98 - adds r2, ROM_HEADER_NINTENDO_LOGO_OFFSET + adds r2, #ROM_HEADER_NINTENDO_LOGO_OFFSET ldr r4, pool_NintendoLogo _082DEDC6: ldm r2!, {r5} @@ -82,8 +82,8 @@ _082DEDC6: ldm r2!, {r5} ldm r4!, {r6} eors r5, r6 - lsrs r5, 8 - str r2, [r0, GCMB_STRUCT_BASE_DEST_PTR] + lsrs r5, #8 + str r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR] _082DEDDC: pop {r4-r6} bne GameCubeMultiBoot_Init @@ -100,11 +100,11 @@ _082DEDDC: _082DEDF4: bx lr _082DEDF6: - ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR] + ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR] mov r12, r1 ldr r3, [r0, 0x18] push {r4-r7} - ldr r4, [r0, GCMB_STRUCT_BASE_DEST_PTR] + ldr r4, [r0, #GCMB_STRUCT_BASE_DEST_PTR] ldr r5, pool_Kawa ldr r6, [r0, 0x14] ldr r7, pool_HashVal @@ -118,7 +118,7 @@ _082DEE06: eors r3, r1 movs r2, 0x20 _082DEE16: - lsrs r3, 1 + lsrs r3, #1 bcc _082DEE1C eors r3, r7 _082DEE1C: @@ -128,22 +128,22 @@ _082DEE1C: adds r6, 0x1 b _082DEE06 _082DEE26: - str r4, [r0, GCMB_STRUCT_BASE_DEST_PTR] + str r4, [r0, #GCMB_STRUCT_BASE_DEST_PTR] str r6, [r0, 0x14] pop {r4-r7} str r3, [r0, 0x18] ldrh r1, [r0, 0x12] - cmp r1, 0 + cmp r1, #0 bne _082DEE76 - ldr r1, [r0, GCMB_STRUCT_CUR_DEST_PTR] - ldr r2, [r0, GCMB_STRUCT_BASE_DEST_PTR] + ldr r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR] + ldr r2, [r0, #GCMB_STRUCT_BASE_DEST_PTR] cmp r1, r2 bne _082DEE76 ldr r1, [r0, 0xC] - cmp r1, 0 + cmp r1, #0 beq _082DEE60 ldrh r1, [r0, 0x10] - cmp r1, 0 + cmp r1, #0 beq _082DEDF4 mov r12, lr movs r1, 0xBB @@ -159,11 +159,11 @@ _082DEE26: _082DEE60: mov r12, lr ldrb r1, [r0, 0x3] - lsls r1, 24 + lsls r1, #24 subs r1, 0x1 str r1, [r0, 0xC] bl GameCubeMultiBoot_Hash - lsls r3, 8 + lsls r3, #8 adds r3, 0xFF str r3, [r0, 0x1C] bx r12 @@ -186,8 +186,8 @@ GameCubeMultiBoot_ExecuteProgram: @ 82DEE84 cmp r1, 0x2 bne GameCubeMultiBoot_ExecuteProgram_Fail ldr r3, pool_InterruptRegs - movs r1, 0 - strh r1, [r3, OFFSET_REG_IME - 0x200] + movs r1, #0 + strh r1, [r3, #OFFSET_REG_IME - 0x200] ldr r1, pool_MultiBootLoadAddr adds r1, 0xC0 bx r1 @@ -201,25 +201,25 @@ GameCubeMultiBoot_Init: @ 82DEE98 ldr r3, pool_InterruptRegs @ Save IME register. - ldrh r2, [r3, OFFSET_REG_IME - 0x200] + ldrh r2, [r3, #OFFSET_REG_IME - 0x200] @ Disable interrupts. movs r1, 0 - strh r1, [r3, OFFSET_REG_IME - 0x200] + 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. adr r3, GcMbIntrHandler_Stop - str r3, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER] + str r3, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER] ldrb r3, [r0, 0x3] push {r3} ldrb r3, [r0, 0x1] push {r0,r3} - adds r3, r0, 0 - adds r3, GCMB_STRUCT_BASE_DEST_PTR + adds r3, r0, #0 + adds r3, #GCMB_STRUCT_BASE_DEST_PTR @ clear all but the last 3 fields of the struct GameCubeMultiBoot_Init_ClearStructLoop: @@ -261,7 +261,7 @@ GameCubeMultiBoot_Init_ClearStructLoop: strh r1, [r3, OFFSET_REG_IE - 0x200] @ Restore IME register. - strh r2, [r3, OFFSET_REG_IME - 0x200] + strh r2, [r3, #OFFSET_REG_IME - 0x200] bx lr thumb_func_end GameCubeMultiBoot_Init @@ -275,11 +275,11 @@ GameCubeMultiBoot_HandleSerialInterrupt: @ 82DEEE2 ldrh r1, [r3, OFFSET_REG_JOYCNT - 0x120] strh r1, [r3, OFFSET_REG_JOYCNT - 0x120] - movs r2, 0 + movs r2, #0 strb r2, [r0] - ldr r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER] - cmp r2, 0 + ldr r2, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER] + cmp r2, #0 beq GameCubeMultiBoot_HandleSerialInterruptDone lsrs r1, 1 @ was a device reset command received? @@ -297,7 +297,7 @@ GcMbIntrHandler_Stop: strh r2, [r3, OFFSET_REG_JOYSTAT - 0x120] GameCubeMultiBoot_SetInterruptHandler: - str r2, [r0, GCMB_STRUCT_SERIAL_INTR_HANDLER] + str r2, [r0, #GCMB_STRUCT_SERIAL_INTR_HANDLER] GameCubeMultiBoot_ReadVCount: ldr r3, pool_RegDispstat @@ -319,8 +319,8 @@ GameCubeMultiBoot_BeginHandshake: cmp r1, 0 bne GcMbIntrHandler_Stop ldr r1, pool_MultiBootLoadAddr - str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR] - str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR] + str r1, [r0, #GCMB_STRUCT_BASE_DEST_PTR] + str r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR] adr r2, GcMbIntrHandler_CheckGameCodeSent b GameCubeMultiBoot_SetInterruptHandler @@ -417,8 +417,8 @@ _082DEF94: _082DEFA6: bne GcMbIntrHandler_Stop ldr r1, pool_MultiBootLoadAddr - str r1, [r0, GCMB_STRUCT_BASE_DEST_PTR] - str r1, [r0, GCMB_STRUCT_CUR_DEST_PTR] + str r1, [r0, #GCMB_STRUCT_BASE_DEST_PTR] + str r1, [r0, #GCMB_STRUCT_CUR_DEST_PTR] adr r2, GcMbIntrHandler_82DEFB4 b GameCubeMultiBoot_SetInterruptHandler @@ -427,7 +427,7 @@ _082DEFA6: GcMbIntrHandler_82DEFB4: @ 82DEFB4 lsrs r1, 1 @ is receive complete? bcc GcMbIntrHandler_Stop @ branch if not - ldr r2, [r0, GCMB_STRUCT_CUR_DEST_PTR] + ldr r2, [r0, #GCMB_STRUCT_CUR_DEST_PTR] movs r1, 0x4 ands r1, r2 adds r1, 0x8 @@ -435,7 +435,7 @@ GcMbIntrHandler_82DEFB4: @ 82DEFB4 strh r1, [r3, OFFSET_REG_JOYSTAT - 0x120] ldr r1, [r3, OFFSET_REG_JOY_RECV - 0x120] stm r2!, {r1} - str r2, [r0, GCMB_STRUCT_CUR_DEST_PTR] + str r2, [r0, #GCMB_STRUCT_CUR_DEST_PTR] ldrh r1, [r0, 0x12] subs r1, 0x1 strh r1, [r0, 0x12] @@ -500,11 +500,11 @@ GameCubeMultiBoot_Quit: @ 82DF012 ldr r3, pool_InterruptRegs @ Save IME register. - ldrh r2, [r3, OFFSET_REG_IME - 0x200] + ldrh r2, [r3, #OFFSET_REG_IME - 0x200] @ Disable interrupts. movs r1, 0 - strh r1, [r3, OFFSET_REG_IME - 0x200] + strh r1, [r3, #OFFSET_REG_IME - 0x200] ldr r3, pool_SerialRegs @@ -528,7 +528,7 @@ GameCubeMultiBoot_Quit: @ 82DF012 strh r1, [r3, OFFSET_REG_IE - 0x200] @ Restore IME register. - strh r2, [r3, OFFSET_REG_IME - 0x200] + strh r2, [r3, #OFFSET_REG_IME - 0x200] bx lr thumb_func_end GameCubeMultiBoot_Quit |