fork download
  1. ; Assembler test for DCPU
  2. ; by Markus Persson
  3.  
  4. set a, 0xbeef ; Assign 0xbeef to register a
  5. set (0x1000), a ; Assign memory at 0x1000 to value of register a
  6. ifn a, (0x1000) ; Compare value of register a to memory at 0x1000 ..
  7. set PC, end ; .. and jump to end if they don't match
  8.  
  9. set i, 0 ; Init loop counter, for clarity
  10. :nextchar ife (data+i), 0 ; If the character is 0 ..
  11. set PC, end ; .. jump to the end
  12. set (0x8000+i), (data+i) ; Video ram starts at 0x8000, copy char there
  13. add i, 1 ; Increase loop counter
  14. set PC, nextchar ; Loop
  15.  
  16. :data dat "Hello_world!", 0 ; Zero terminated string
  17.  
  18. :end sub PC, 1 ; Freeze the CPU forever
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.asm:4: error: parser: instruction expected
prog.asm:5: error: symbol `set' redefined
prog.asm:5: error: parser: instruction expected
prog.asm:6: error: parser: instruction expected
prog.asm:7: error: symbol `set' redefined
prog.asm:7: error: parser: instruction expected
prog.asm:9: error: symbol `set' redefined
prog.asm:9: error: parser: instruction expected
prog.asm:10: error: label or instruction expected at start of line
prog.asm:11: error: symbol `set' redefined
prog.asm:11: error: parser: instruction expected
prog.asm:12: error: symbol `set' redefined
prog.asm:12: error: parser: instruction expected
prog.asm:14: error: symbol `set' redefined
prog.asm:14: error: parser: instruction expected
prog.asm:16: error: label or instruction expected at start of line
prog.asm:18: error: label or instruction expected at start of line
stdout
Standard output is empty