A collection of tools, code, schematics, and documentation to do with my Kaypro II ROM hacking
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.4 KiB

  1. org 0
  2. di ;interrupts are dumb
  3. ld sp, 0xFFFF ;set up stack
  4. ;;Copy video write code into memory
  5. ld hl, video_write
  6. ld de, 0xEC00
  7. ld bc, video_write_length
  8. ldir
  9. ;; print init string
  10. ld hl, hello_world_str
  11. ld bc, 0x3200
  12. ld (0xEFFE), bc
  13. ld bc, hello_world_str_length
  14. call print_string
  15. ;; set video_address
  16. ld hl, 0x3100
  17. ld (video_address), hl
  18. ;; Serial read is non-blocking
  19. main:
  20. IN A, (7)
  21. AND 1 ;check if char in buffer
  22. jp Z, main
  23. IN A, (5) ;Read from keyboard
  24. ld (0xC000), A
  25. ld hl, 0xC000
  26. ld bc, (video_address)
  27. ld (0xEFFE), bc
  28. inc bc
  29. ld (video_address), bc ;increment video address
  30. ld bc, 1 ;only writing 1 byte
  31. call print_string
  32. jp main
  33. video_address: equ 0xDC00
  34. print_string:
  35. ;; pointer to string in hl
  36. ;; string length in bc
  37. ;; VRAM address at 0xEFFF
  38. push bc
  39. ld de, 0xF000
  40. ldir
  41. pop bc
  42. jp 0xEC00
  43. hello_world_str:
  44. defm "Hello World! ---Stephen's Kaypro II---"
  45. hello_world_str_end:
  46. hello_world_str_length: equ hello_world_str_end - hello_world_str
  47. ;; don't forget this will be copied to upper memory!
  48. video_write:
  49. ;; Switch banks
  50. IN A, (0x1c)
  51. SET 7,A
  52. OUT (0x1c), A
  53. ;; Step 4: Copy string into video memory
  54. ld hl, 0xF000
  55. ld de, (0xEFFE) ;Character framebuffer address
  56. ldir
  57. ;; Swtich banks back
  58. IN A, (0x1C)
  59. RES 7, A
  60. OUT (0x1C), A
  61. ret ;we're done
  62. video_write_end:
  63. video_write_length: equ video_write_end - video_write