Initial commit

This commit is contained in:
Gericom
2025-11-22 11:08:28 +01:00
commit 9cf3ffbfcf
358 changed files with 58350 additions and 0 deletions

32
arm9/source/arm9Clock.s Normal file
View File

@@ -0,0 +1,32 @@
.section ".itcm", "ax"
.arm
#define REG_SCFG_CLK 0x04004004
#define SCFG_CLK_CPU_SPEED 1
.global scfg_setArm9Clock
.type scfg_setArm9Clock, %function
scfg_setArm9Clock:
ldr r3,= REG_SCFG_CLK
ldrh r2, [r3]
and r1, r2, #SCFG_CLK_CPU_SPEED
cmp r1, r0
bxeq lr // requested speed already set
mrs r12, cpsr
orr r1, r12, #0xC0 // disable irq and fiq
msr cpsr, r1
bic r2, r2, #SCFG_CLK_CPU_SPEED
orr r2, r2, r0
strh r2, [r3]
// allow the clock switch to stabilize
mov r0, #8
1:
subs r0, r0, #1
bne 1b
msr cpsr, r12
bx lr