Guest User

Untitled

a guest
Jul 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. # Print to LCD Code
  2. # LCD Command on 0xB8
  3. # LCD Data on 0xB9
  4. # Characters are [Top][Side] eg 32 = 2
  5. # End String with 0x00
  6.  
  7. main:
  8. ei
  9. im 2
  10. ld a, 0x01
  11. out0 (0xb8), a
  12. call delay
  13. ld a, 0x38
  14. out0 (0xb8), a
  15. call delay
  16. jp next
  17.  
  18.  
  19. next:
  20. ld a, 0xe0
  21. inc de
  22. ld de, lcd_data
  23.  
  24. wait:
  25. in a, (0xb4)
  26. cp 0xe3
  27. jp z, wait
  28. cp 0xe2
  29. jp z, main
  30. jp lcd
  31.  
  32. lcd:
  33. ld a, (de)
  34. cp 0
  35. jp z, next
  36. out0 (0xb9), a
  37. call delay
  38. inc de
  39. jr lcd
  40.  
  41. lcd_data:
  42. "INPUT! "
  43. .byte 0x00 # Indicates End of String
  44.  
  45. delay:
  46. push hl # save h-l
  47. ld h, 0x40 # start counting from zero
  48. del1:
  49. dec hl # reduce count
  50. ld a, h # get high value
  51. or l # test for zero with low value
  52. jp nz, del1 # if not, keep counting
  53. pop hl # restore h-l
  54. ret
Add Comment
Please, Sign In to add comment