summaryrefslogtreecommitdiff
path: root/test.s
blob: 098647e3db19cfebc959022da83bcd82755b8e30 (plain) (blame)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.syntax unified

.cpu arm7tdmi

.arm
b _start

.byte 0x24,0xFF,0xAE,0x51
.byte 0x69,0x9A,0xA2,0x21
.byte 0x3D,0x84,0x82,0x0A
.byte 0x84,0xE4,0x09,0xAD
.byte 0x11,0x24,0x8B,0x98
.byte 0xC0,0x81,0x7F,0x21
.byte 0xA3,0x52,0xBE,0x19
.byte 0x93,0x09,0xCE,0x20
.byte 0x10,0x46,0x4A,0x4A
.byte 0xF8,0x27,0x31,0xEC
.byte 0x58,0xC7,0xE8,0x33
.byte 0x82,0xE3,0xCE,0xBF
.byte 0x85,0xF4,0xDF,0x94
.byte 0xCE,0x4B,0x09,0xC1
.byte 0x94,0x56,0x8A,0xC0
.byte 0x13,0x72,0xA7,0xFC
.byte 0x9F,0x84,0x4D,0x73
.byte 0xA3,0xCA,0x9A,0x61
.byte 0x58,0x97,0xA3,0x27
.byte 0xFC,0x03,0x98,0x76
.byte 0x23,0x1D,0xC7,0x61
.byte 0x03,0x04,0xAE,0x56
.byte 0xBF,0x38,0x84,0x00
.byte 0x40,0xA7,0x0E,0xFD
.byte 0xFF,0x52,0xFE,0x03
.byte 0x6F,0x95,0x30,0xF1
.byte 0x97,0xFB,0xC0,0x85
.byte 0x60,0xD6,0x80,0x25
.byte 0xA9,0x63,0xBE,0x03
.byte 0x01,0x4E,0x38,0xE2
.byte 0xF9,0xA2,0x34,0xFF
.byte 0xBB,0x3E,0x03,0x44
.byte 0x78,0x00,0x90,0xCB
.byte 0x88,0x11,0x3A,0x94
.byte 0x65,0xC0,0x7C,0x63
.byte 0x87,0xF0,0x3C,0xAF
.byte 0xD6,0x25,0xE4,0x8B
.byte 0x38,0x0A,0xAC,0x72
.byte 0x21,0xD4,0xF8,0x07

.ascii "LUMA\x0\x0\x0\x0\x0\x0\x0\x0"

.ascii "AMUL"

.ascii "00"

.byte 0x96

.byte 0x0

.byte 0x0

.fill 0x7,0x1,0x0

.byte 0x45

.byte 0x0

.fill 0x2,0x1,0x0

.arm
nop

.byte 0x0

.byte 0x0

.fill 0x1A,0x1,0x0

.arm
nop

.arm
.func
_start:
	ldr lr, =start
	bx  lr
.endfunc

.thumb
.func
.thumb_func
start:
	@ Set up video mode:
	ldr  r0, .ioAddr
	@ Already at DISPCNT.
	ldr  r1, .displayControl
	strh r1, [r0]

	@ Set up palette:
	ldr  r0, .paletteAddr
	ldr  r1, .backgroundColour
	strh r1, [r0]
	ldr  r1, .paletteIndex
	lsls r1, 0x1 @ Multiply by two.
	adds r0, r1 @ Apply index.
	ldr  r1, .foregroundColour
	strh r1, [r0]

	@ Set up loop:
	@ - r0 is the current pixel address.
	@ - r1 is the palette value/index.
	@ - r2 is the addend.
	@ - r3 is the last pixel address.
	ldr  r0, .videoAddr
	ldr  r1, .paletteIndex
	movs r2, 0x0
	movs r3, 0x4B
	lsls r3, 0x9
	adds r3, r0

	@ Plot pixels:
.loop:
	strb r1, [r0]
	adds r0, r2
	adds r2, 0x1
	cmp  r0, r3
	bge  .stop @ Stop if we've reached the end.
	b    .loop @ Repeat loop.

	@ Stop:
.stop:
	b .stop
.endfunc

.align
.ioAddr:
	.word 0x04000000

.align
.displayControl:
	.word 0x0404

.align
.paletteAddr:
	.word 0x05000000

.align
.paletteIndex:
	.word 0xFF

.align
.backgroundColour:
	.word 0b0000100001000010

.align
.foregroundColour:
	.word 0b0001001010011110

.align
.videoAddr:
	.word 0x06000000