Advertisement
NovaYoshi

joshcraft dcpu

Jan 24th, 2013
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. hwn i
  2. :FindDevices
  3. sub i, 1
  4. hwq i
  5. ife b, 0x7349
  6. ife a, 0xf615
  7. set [DISPLAY], i
  8. ife b, 0x12d0
  9. ife a, 0xb402
  10. set [CLOCK], i
  11. ife b, 0x30cf
  12. ife a, 0x7406
  13. set [KEYBOARD], i
  14. ifn i, 0
  15. set pc, FindDevices
  16.  
  17. set i, 0
  18. :FillMap
  19. set [i+0xa000],0
  20. add i, 1
  21. ifn i, 2048
  22. set pc, FillMap
  23. :init_display ; Initialize the LEM1802
  24. set i, [DISPLAY]
  25. set a, 0 ; map the screen to 0x8000
  26. set b, 0x8000
  27. hwi i
  28. set a, 4 ; dump the font to 0x9000
  29. set b, 0x9000
  30. hwi i
  31. set a, 1 ; font is now at 0x9000
  32. hwi i
  33.  
  34. set a, FontEnd-FontStart
  35. set i, 0
  36. set j, 0
  37. :CopyFont
  38. sti [i+ 0x9000], [j+FontStart]
  39. sub a,1
  40. ifn a,0
  41. set pc, CopyFont
  42.  
  43. set i, [CLOCK]
  44. set a, 0 ; clock frequency = 30fps
  45. set b, 1
  46. hwi i
  47.  
  48. ; draw every font character as a test because my actual stuff isn't written yet
  49. set i, 0
  50. :draw_char
  51. set a, i
  52. bor a, 0xF000
  53. set [i + 0x8000], a
  54. add i, 1
  55. ifn i, 0x80
  56. set pc, draw_char
  57.  
  58. :forever
  59. set pc, forever
  60.  
  61. :RenderScreen ; not written yet
  62. set i, 0 ; render index
  63. set x, [ScrollX]
  64. set y, [ScrollY]
  65. :RenderLoop
  66. set j, y
  67. shl j, 6 ; *64
  68. add j, x
  69. set a, 0
  70. bor a, 0x0F00
  71. set [i + 0x8000], a
  72. add i, 1
  73. ifn i, 32*12
  74. set pc, RenderLoop
  75. set pc, pop
  76.  
  77. ; variables section
  78. :DISPLAY dat 0x0000 ; monitor's index
  79. :CLOCK dat 0x0000 ; clock's index
  80. :KEYBOARD dat 0x0000 ; keyboard's index
  81. :PlayerX dat 0x0005
  82. :PlayerY dat 0x0005
  83. :ScrollX dat 0x0000
  84. :ScrollY dat 0x0000
  85.  
  86. :FontStart
  87. dat 0x3c42, 0x8da1, 0xa18d, 0x423c ; player ( a smiley face)
  88. dat 0x0000, 0x0000, 0x0000, 0x0000 ; block type 0
  89. dat 0xff81, 0x8181, 0x8181, 0x81ff ; block type 1
  90. dat 0xffab, 0xd5ab, 0xd5ab, 0xd5ff ; block type 2
  91. dat 0xffb3, 0xcdcd, 0xb3b3, 0xcdff ; block type 3
  92. dat 0xff8f, 0x8f8f, 0xf1f1, 0xf1ff ; block type 4
  93. dat 0xffc3, 0xa599, 0x99a5, 0xc3ff ; block type 5
  94. dat 0xffd5, 0xd5d5, 0xd5d5, 0xd5ff ; block type 6
  95. :FontEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement