Skip to content

Instantly share code, notes, and snippets.

@castleberrysam
Created January 12, 2017 02:29
Show Gist options
  • Save castleberrysam/af97f7875131ae781b530caab29a8e6b to your computer and use it in GitHub Desktop.
Save castleberrysam/af97f7875131ae781b530caab29a8e6b to your computer and use it in GitHub Desktop.
(.macro movx)
(movl $1 (logand $2 #xff))
(movh $1 (ash $2 -8))
(.endmacro)
(.print "Testing the .print macro!\n")
(movx :sp #xffff)
(.macro push-reg)
(mov (@+ :sp 0) $1)
(add :sp -1)
(.endmacro)
; this is a comment
(.set foo 5)
(.set bar 10) ; this is also a comment
(.label foo-bar-test)
(.if (> foo bar))
(movx :ax foo)
(.print "This directive should not execute.\n")
(.else)
(movx :bx (+ foo-bar-test bar))
(.print "This directive SHOULD execute.\n")
(.endif)
(push-reg :bx)
(.word #xabcd 10)
(.align 3)
(.ascii "This string should be inserted into the binary as null terminated data.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment