Advertisement
TheFastFish

[DCPU-16]Hello World

Jul 8th, 2014
3,651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;A Hello World in DCPU-16 1.7
  2.  
  3. :string
  4. dat "Hello, world!", 0
  5.  
  6. :readString
  7. set j, [string+i]
  8. ife j, 0
  9. set pc, disp
  10. jsr setChar
  11. add i, 1
  12. set pc, readString
  13.  
  14. :setChar
  15. bor j, 0xf000
  16. bor j, 0x0000
  17. set [0x3000+i], j
  18. set pc, pop
  19.  
  20. :disp
  21. set a, 0
  22. set b, 0x3000
  23. hwi 0
  24.  
  25. ;NOTES
  26. ;-The hardware id of the display may not be 0 in some cases. Set it appropriately for the hwi call
  27. ;-The string given can be anything you want, as long as you leave the 0
  28. ;-The 2 bor calls set the string's color and highlight respectively. You can change these if you want
  29. ;-Screen data is allocated in memory within the range of 0x3000 to 0x3181 (approx.)
  30. ;-The 0 data after the string is used to signify the end, as to tell the CPU when to call the disp subroutine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement