Skip to content

Instantly share code, notes, and snippets.

@jimmo
Created April 27, 2016 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmo/b4aa8e6c4fadd2c6dcfe14959d9a93e3 to your computer and use it in GitHub Desktop.
Save jimmo/b4aa8e6c4fadd2c6dcfe14959d9a93e3 to your computer and use it in GitHub Desktop.
Simple program to count to 0xff and fill memory.
mov %a, 0
mov %b, %a
mov %c, %a
mov %d, %a
mov %e, %a
mov %f, %a
loop:
; Write output
mov %c, %e
mov %d, %f
mov %mem, %a
mov %out, %a
; Increment %e:f
mov %c, %a ; stash a
mov %a, %f
inc
mov %f, %a
mov %a, %e
mov %b, 0
addc
mov %e, %b
mov %a, %c ; restore a
; Increment counter
inc
; Terminate at overflow
mov %b, 0x00
cmp
mov %c:d, $end
je
; Otherwise keep counting
mov %c:d, $loop
jmp
; Halt
end:
jmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment