#18874 - anoneem - Wed Apr 07, 2004 5:48 pm
Hi! I'm learning asm from gbaguy's tutorial and finished Day 2. I tried to write a program wich is drawing a line (i don't know is that way of drawing okay, becaouse i had never read how to do it). Here's code:
;start
@include screen.h
@textarea
program ;label
ldr r4,=2410 ;x
ldr r5,=100 ;line 100px
ldr r3,=0 ;counter
ldr r1,=REG_DISPCNT ;r1=0x04000000
ldr r2,=(BG2_ENABLE|MODE_3) ;r2=0x403
str r2,[r1] ;Mode3 on
ldr r1,=0x0FF ;colour in r1
ldr r2,=vram+r4 ;pixel position
str r1,[r2] ;draw point
ADD r3,r3,1 ;add 1 to r3
CMP r3, r5 ;cmp r3 with r5
BLT rysuj ;go to rysuj
BEQ koniec ;go to koniec
rysuj ;label draw
ADD r4,r4,1 ;add 1 to r4
str r1,[r2] ;draw point
B program ;go to program
koniec ;label koniec
@pool ;asm shits
@endarea ;koniec
Compiler pointed only one error, but I'm sure there are more of them :).
;start
@include screen.h
@textarea
program ;label
ldr r4,=2410 ;x
ldr r5,=100 ;line 100px
ldr r3,=0 ;counter
ldr r1,=REG_DISPCNT ;r1=0x04000000
ldr r2,=(BG2_ENABLE|MODE_3) ;r2=0x403
str r2,[r1] ;Mode3 on
ldr r1,=0x0FF ;colour in r1
ldr r2,=vram+r4 ;pixel position
str r1,[r2] ;draw point
ADD r3,r3,1 ;add 1 to r3
CMP r3, r5 ;cmp r3 with r5
BLT rysuj ;go to rysuj
BEQ koniec ;go to koniec
rysuj ;label draw
ADD r4,r4,1 ;add 1 to r4
str r1,[r2] ;draw point
B program ;go to program
koniec ;label koniec
@pool ;asm shits
@endarea ;koniec
Compiler pointed only one error, but I'm sure there are more of them :).