Skip to content

Instantly share code, notes, and snippets.

@mntmn
Last active December 26, 2015 00:09
Show Gist options
  • Save mntmn/7061657 to your computer and use it in GitHub Desktop.
Save mntmn/7061657 to your computer and use it in GitHub Desktop.
ds test
mov r8,r14 ; back up link-address in r8
mov r2,#0 ; r2 = 0
loopa:
mov r1,#99
lsl r1,r1,#4 ; r1 = 100<<4 = 1600 (40x40 zeichen display)
loopb:
lsl r0,r2,#0 ; r0 = r2
sym display ; r7 = display address
add r7,r7,r1 ; add offset in r1 to display address
strb r0,[r7,#0] ; output r0 to display
add r2,r2,#1 ; r2++
sub r1,r1,#1 ; r1--
cmp r1,#0 ; if r1 != 0
bne loopb ; goto loopb
mov r11,r2 ; backup r2 in r11 (gets clobbered)
sym readKey ; load readKey function pointer in r7
call ; macro to call r7 and return
cmp r0,#32 ; key is in r0, is it space (32)?
mov r2,r11 ; [restore r2]
bne loopa ; no, go to loopa
bx r8 ; return from program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment