Skip to content

Instantly share code, notes, and snippets.

@ddevault
Created November 15, 2012 21:38
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 ddevault/826a15520391e338291c to your computer and use it in GitHub Desktop.
Save ddevault/826a15520391e338291c to your computer and use it in GitHub Desktop.
.nolist
#include "kernel.inc" ; Kernel routines like loadLibrary
#include "macros.inc"
#include "keys.inc" ; Key codes
#include "libtext.inc" ; For drawing text
#include "applib.inc" ; For drawing UI
.list
; Header
.db %00000010
.db 50 ; Stack size
; Program
.org 0
; Get hardware locks
call getLcdLock
call getKeypadLock
; Load dependencies
kld de, libtextPath
call loadLibrary
kld de, applibPath
call loadLibrary
; Draw window
xor a ; Window flags (defaults)
kld hl, windowTitle
applib(drawWindow)
; Draw text
ld de, $0208 ; D = X, E = Y
kld hl, helloWorld
libtext(drawString)
; Loop until Clear is pressed
loop:
applib(appGetKey) ; Same as getKey, but watches for UI hotkeys
cp kClear
ret z
jr loop
helloWorld:
.db "Hello, world!", 0
windowTitle:
.db "Hello World", 0
libtextPath:
.db "/lib/libtext", 0
applibPath:
.db "/lib/applib", 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment