Created
March 15, 2016 11:05
-
-
Save dekuNukem/e8126070469b6b56f94b to your computer and use it in GitHub Desktop.
FAP's first hello world program
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
org 0x0 | |
xor d | |
xor e | |
xor b | |
ld sp, 0x7fff | |
ld hl, 0x92bf ; fill attribute RAM with 0x3c, yellow | |
ld de, 2400 | |
ld b, 0x3c | |
clear_attri: | |
call check | |
ld (hl), b | |
dec hl | |
dec de | |
ld a,d | |
or e | |
jp nz,clear_attri | |
ld hl, 0x895f ; fill char RAM with 0, effectively clearing screen | |
ld de, 2400 | |
ld b, 0 | |
clear_char: | |
call check | |
ld (hl), b | |
dec hl | |
dec de | |
ld a,d | |
or e | |
jp nz,clear_char | |
ld hl, 0x8001 ; then print "hello world" | |
call check | |
ld (hl), 'h' | |
ld hl, 0x8002 | |
call check | |
ld (hl), 'e' | |
ld hl, 0x8003 | |
call check | |
ld (hl), 'l' | |
ld hl, 0x8004 | |
call check | |
ld (hl), 'l' | |
ld hl, 0x8005 | |
call check | |
ld (hl), 'o' | |
ld hl, 0x8007 | |
call check | |
ld (hl), 'w' | |
ld hl, 0x8008 | |
call check | |
ld (hl), 'o' | |
ld hl, 0x8009 | |
call check | |
ld (hl), 'r' | |
ld hl, 0x800a | |
call check | |
ld (hl), 'l' | |
ld hl, 0x800b | |
call check | |
ld (hl), 'd' | |
end: jp end | |
; check if GPU copy is underway, wait if it does | |
check: ld a, (0x92c0) | |
or a | |
jp nz,check | |
ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment