#5674 - bakery2k - Mon May 05, 2003 8:34 pm
I am currently taking my first steps into GBA assembly, using gbaguy's tutorials. I have performed a small modification to tutorial 1, in order to get it to display a line of pixels, rather than just a single one.
However, I do not get 32 consecutive pixels lit, rather 17 with a gap between each. On changing the address increment value to 4, I get the 32 pixels, with a gap between each. What have I done wrong?
Here is my code:
@include screen.h
@textarea
;Set mode 3, enabling BG2
ldr r1,=REG_DISPCNT
ldr r2,=(BG2_ENABLE|MODE_3)
str r2,[r1]
;Load color (green) into r1
ldr r1,=(0x1F << 5)
;Load address into r2
ldr r2,=vram+2410
;Load number of pixels to fill into r3
ldr r3,=0x20
startloop:
;Paint pixel
str r1,[r2]
;update position
add r2, r2, 2
;Update loop
subs r3, r3, 1
;branch if non-zero
bne startloop
;Infinite loop
label1
B label1
@pool
@endarea
Thanks for your help.
However, I do not get 32 consecutive pixels lit, rather 17 with a gap between each. On changing the address increment value to 4, I get the 32 pixels, with a gap between each. What have I done wrong?
Here is my code:
@include screen.h
@textarea
;Set mode 3, enabling BG2
ldr r1,=REG_DISPCNT
ldr r2,=(BG2_ENABLE|MODE_3)
str r2,[r1]
;Load color (green) into r1
ldr r1,=(0x1F << 5)
;Load address into r2
ldr r2,=vram+2410
;Load number of pixels to fill into r3
ldr r3,=0x20
startloop:
;Paint pixel
str r1,[r2]
;update position
add r2, r2, 2
;Update loop
subs r3, r3, 1
;branch if non-zero
bne startloop
;Infinite loop
label1
B label1
@pool
@endarea
Thanks for your help.