summaryrefslogtreecommitdiff
path: root/src/osnes9xgp_asmfunc.S
blob: 7cdc3ec6982e1eb00d47fa192c87655ae5f11562 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        .global asmClearScreenFast8        
        .global asmClearScreenFast16
        
asmClearScreenFast16:
;@R0 = scr
;@R1 = starty
;@R2 = endy
;@R3 = col
		stmfd	R13!,{R4-R11}
		
		sub		R12,R2,R1
		add		R12,R12,#1
		;@R12 = endy-starty+1
		
		mov r2,#320
		mul r1,r2,r1
		;@R1 = 320*starty
		
		add		R0,R0,R1,lsl #1
		;@R0 = screen + ((320*starty)<<1)
		
		mov		R2,R3
		mov 		R4,R3
		mov		R5,R3
		mov		R6,R3
		mov		R7,R3
		mov		R8,R3
		mov		R9,R3
2:
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		
		add r0,r0,#32*4
	
	    subs 		R12,R12,#1
		bne 		2b
		
		ldmfd 	R13!,{R4-R11}
        mov	  	PC,LR        
         
		
asmClearScreenFast8:
;R0 = scr
;R1 = starty
;R2 = endy
;R3 = col
		stmfd	R13!,{R4-R11}
		
		sub		R12,R2,R1
		add		R12,R12,#1
		;@R12 = endy-starty+1
		
		mov r2,#320
		mul r1,r2,r1
		;@R1 = 320*starty
		
		add		R0,R0,R1
		;@R0 = screen + ((320*starty))

		mov		R2,R3
		mov 		R4,R3
		mov		R5,R3
		mov		R6,R3
		mov		R7,R3
		mov		R8,R3
		mov		R9,R3
	
2:		
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}
		stmia  	R0!,{R2,R3,R4,R5,R6,R7,R8,R9}

		subs 		R12,R12,#1
		bne 2b
	
		ldmfd 	R13!,{R4-R11}
        mov	  	PC,LR