summaryrefslogtreecommitdiff
path: root/arm9/asm/OS_system.s
blob: 3801b8e753ae77e9f51aaa52fcee81dab4f62595 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    .include "asm/macros.inc"
    .include "global.inc"

    .text

	arm_func_start OS_EnableInterrupts
OS_EnableInterrupts: ; 0x020CD2FC
	mrs r0, cpsr
	bic r1, r0, #0x80
	msr cpsr_c, r1
	and r0, r0, #0x80
	bx lr

	arm_func_start OS_DisableInterrupts
OS_DisableInterrupts:
	mrs r0, cpsr
	orr r1, r0, #0x80
	msr cpsr_c, r1
	and r0, r0, #0x80
	bx lr

	arm_func_start OS_RestoreInterrupts
OS_RestoreInterrupts:
	mrs r1, cpsr
	bic r2, r1, #0x80
	orr r2, r2, r0
	msr cpsr_c, r2
	and r0, r1, #0x80
	bx lr

	arm_func_start OS_DisableInterrupts_IrqAndFiq
OS_DisableInterrupts_IrqAndFiq: ; 0x020CD33C
	mrs r0, cpsr
	orr r1, r0, #0xc0
	msr cpsr_c, r1
	and r0, r0, #0xc0
	bx lr

	arm_func_start OS_RestoreInterrupts_IrqAndFiq
OS_RestoreInterrupts_IrqAndFiq: ; 0x020CD350
	mrs r1, cpsr
	bic r2, r1, #0xc0
	orr r2, r2, r0
	msr cpsr_c, r2
	and r0, r1, #0xc0
	bx lr

	arm_func_start OS_GetCpsrIrq
OS_GetCpsrIrq: ; 0x020CD368
	mrs r0, cpsr
	and r0, r0, #0x80
	bx lr

	arm_func_start OS_GetProcMode
OS_GetProcMode: ; 0x020CD374
	mrs r0, cpsr
	and r0, r0, #0x1f
	bx lr

	arm_func_start OS_SpinWait
OS_SpinWait:
	subs r0, r0, #0x4
	bhs OS_SpinWait
	bx lr

	arm_func_start OS_WaitVBlankIntr
OS_WaitVBlankIntr: ; 0x020CD38C
	stmdb sp!, {lr}
	sub sp, sp, #0x4
	mov r0, #0x1
	blx SVC_WaitByLoop
	mov r0, #0x1
	mov r1, r0
	bl OS_WaitIrq
	add sp, sp, #0x4
	ldmia sp!, {lr}
	bx lr