aboutsummaryrefslogtreecommitdiff
path: root/00-disptest/start.S
blob: aee4759191a4c99842d6844dd3ff050690c4663f (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
#define VRAMADDR 0x14800000
#define DISPH 480
#define DISPW 800

.globl start
.arm
start:
// r0: y, r1: x
  mov r0, #0
  mov r1, #0

.Lloopy:
  cmp r0, #(DISPH)
  beq .Lstop
.Lloopx:
  cmp r1, #(DISPW)
  bne .Lcontx
  mov r1, #0
  add r0, #1
  b .Lloopy
.Lcontx:
// r2: ((y&0)^(x&0)) ? 0xffffffff : 0
  eor r2, r0, r1
  and r2, #1
  sub r2, #1
// addr: VRAMADDR + (y*DISPW + x)*2
  mov r3, #(DISPW)
  mul r3, r0
  add r3, r1
  add r3, r3
  add r3, #(VRAMADDR)
// store the pixel
  strh r2, [r3]

  add r1, #1
  b .Lloopx
.Lstop:
  b .Lstop