Skip to content

Instantly share code, notes, and snippets.

@tonyg
Last active July 10, 2023 19:14
Show Gist options
  • Save tonyg/4708ccbd5f5e02b4e16bfad7c3b52da3 to your computer and use it in GitHub Desktop.
Save tonyg/4708ccbd5f5e02b4e16bfad7c3b52da3 to your computer and use it in GitHub Desktop.
Exploring uxn
%.run: %.rom
uxncli $<
%.debug: %.rom
uxnemu ~/build/uxn11/beetbug/bin/beetbug.rom $<
%.rom: %.tal
uxnasm $< $@
|00 @System &vector $2 &expansion $2 &friend $2 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &halt $1
|10 @Console &vector $2 &read $1 $4 &type $1 &write $1 &error $1
|80 @Controller &vector $2 &button $1 &key $1
|0100
@reset ( -> )
#ffff #0022 DIV2 dumphex nl
#ffff #0002 DIV2 dumphex nl
(
#1234 dumphex nl
#fedc dumphex nl
#3f .Console/write DEO
#00 getch dumphex nl
#00 getch dumphex nl
#00 getch dumphex nl
)
halt
@getch ( -- ch )
;&k .Console/vector DEO2 BRK &k #0000 .Console/vector DEO2
.Console/type DEI #01 NEQ ?getch
.Console/read DEI
JMP2r
@halt ( -- ! )
#80 .System/halt DEO BRK
@dumphex ( w* -- )
SWP ,&b JSR &b
DUP #04 SFT ,&n JSR &n
#0f AND DUP #0a LTH ?&lo #27 ADD &lo
#30 ADD .Console/write DEO
JMP2r
@nl ( -- )
#0a .Console/write DEO
JMP2r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment