Skip to content

Instantly share code, notes, and snippets.

@FireyFly
Created April 21, 2012 20:54
Show Gist options
  • Save FireyFly/2439542 to your computer and use it in GitHub Desktop.
Save FireyFly/2439542 to your computer and use it in GitHub Desktop.
:begin
set A, foo
set B, foo
add B, 2
set C, 0x8000
jsr upack
jsr makevisible
:end sub PC, 1
:foo dat 0x4141, 0x4243, 0x4445
:makevisible
bor [0x8000], 0xf000
bor [0x8001], 0xf000
bor [0x8002], 0xf000
bor [0x8003], 0xf000
bor [0x8004], 0xf000
bor [0x8005], 0xf000
bor [0x8006], 0xf000
bor [0x8007], 0xf000
bor [0x8008], 0xf000
bor [0x8009], 0xf000
bor [0x800a], 0xf000
set PC, POP
; 0045 0009 0041 0041 0042 0043 0044 0045
;Unpacks text. High byte goes first
;Register a is the start of the packed
;data. Register b is the end of the
;packed data. Register c is the start
;of where you want to unpack to
:upack
set PUSH, [a]
shr PEEK, 8
set [c], POP
add c, 1
set PUSH, [a]
and PEEK, 0x00FF
set [c], POP
ife a, b
set PC, POP
add c, 1
add a, 1
set PC, upack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment