Created
April 27, 2016 12:40
-
-
Save jimmo/b4aa8e6c4fadd2c6dcfe14959d9a93e3 to your computer and use it in GitHub Desktop.
Simple program to count to 0xff and fill memory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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