Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. |200|00e0: cls
  2. |202|6000: ld v0, 0 ; Number of letters drawn
  3. |204|6100: ld v1, 0 ; X variable
  4. |206|6200: ld v2, 0 ; Y variable
  5. |208|6304: ld v3, 5 ; I increment
  6. | |
  7. |20a| draw_letter:
  8. | |d125: drw v1, v2, 5 ; Draws the current letter
  9. |20c|400f: sne v0, 0x0f ; We check if we have drawn all the letters
  10. x|20e|1222: jp draw_smiley ; We jump to the `draw_smiley` if that's the case
  11. |210|7001: add v0, 1 ; We increment by 1 the number of letters drawn
  12. |212|f31e: add i, v3 ; We add 5 to the I register
  13. |214|413c: sne v1, 60 ; If we reached the width of the screen,
  14. |216|121c: jp next_line ; we jump to the `next_line` label
  15. |218|7105: add v1, 5 ; We move the next sprite by five pixels
  16. x|21a|120a: jp draw_letter ; We draw the next letter
  17. | |
  18. |21c| next_line:
  19. | |6100: ld v1, 0x00 ; We clear X
  20. |21e|7206: add v2, 6 ; We add 6 to Y
  21. x|220|120a: jp draw_letter ; We draw the next letter
  22. | |
  23. |222| draw_smiley:
  24. | |601d: ld v0, 29 ; We set our v0 and v1 registers to 24 and 8, representing the
  25. |224|610c: ld v1, 12 ; middle of the screen minus the width & height of the sprite.
  26. |226|a22c: ld i, __data_smiley_bitmap ; We load the pointer of the sprite to I
  27. |228|d017: drw v0, v1, 7 ; We draw our sprite
  28. | |
  29. |22a| : halt:
  30. x| |122a: jp halt ; We loop forever here.
  31. | |
  32. |22c| : __data_smiley_bitmap: ; Definition of a smiley bitmap
  33. | |fe : .binary 0b11111110,
  34. | | 82: 0b10000010,
  35. |22e|aa : 0b10101010,
  36. | | 82: 0b10000010,
  37. |230|c6 : 0b11000110,
  38. | | ba: 0b10111010,
  39. |232|fe00: 0b11111110
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement