Skip to content

Instantly share code, notes, and snippets.

@migerh
Created April 15, 2012 05:55
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 migerh/2390325 to your computer and use it in GitHub Desktop.
Save migerh/2390325 to your computer and use it in GitHub Desktop.
dcpu asm reference example
set A, 0x30 ; 7c01 0030
SET [0x1000], 0x20 ; 7de1 1000 0020
SUB a, [0x1000] ; 7803 1000
IfN A, 0x10 ; c00d
SET Pc, crash ; 7dc1 001a [*]
; Do a loopy thing
SET I, 10 ; a861
SET A, 0x2000 ; 7c01 2000
:loop
SET [0x2000+I], [A] ; 2161 2000
SUB I, 1 ; 8463
IFN I, 0 ; 806d
SET PC, loop ; 7dc1 000d [*]
; Call a subroutine
SET X, 0x4 ; 9031
JSR testsub ; 7c10 0018 [*]
SET PC, crash ; 7dc1 001a [*]
:testsub SHL X, 4 ; 9037
SET PC, POP ; 61c1
; Hang forever. X should now be 0x40 if everything went right.
:crash SET PC, crash ; 7dc1 001a [*]
:data
dat 0x170, "Hello, World!", 0x65, 73, "w0,,0t!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment