Skip to content

Instantly share code, notes, and snippets.

@antonijn
Last active August 29, 2015 13:56
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 antonijn/9117573 to your computer and use it in GitHub Desktop.
Save antonijn/9117573 to your computer and use it in GitHub Desktop.
getch:
peek64 0
peek64 8
peek64 16
peek64 24
dup abs(1)
deref64
dup abs(2)
ult
cjmp .0
fail:
load -1
ret
.0:
dup abs(1)
dup
deref64
inc
store64
load 2
umul
dup abs(0)
add
deref64
dup
load fc00h
and
load d800h
eq
cjmp .1
swap 1, 2
store64
load 0
ret
.1:
dup abs(1)
deref64
dup abs(2)
ulte
cjmp fail
dup abs(1)
dup
deref64
inc
store64
load 2
umul
dup abs(0)
add
deref64
dup
load fc00h
and
load dc00h
neq
cjmp fail
dup abs(3)
dup abs(4)
load 03ffh
and
load 10
shl
dup abs(5)
load 03ffh
and
or
store64
load 0
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment