Advertisement
taylorza

Untitled

Jan 24th, 2024 (edited)
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | Source Code | 0 0
  1. #program asmdrv2
  2. 10 RUN AT 3
  3. 20 SAVE "asmdrv2.bas"
  4. 30 .asm
  5. 40 ; output "asmdrv2.drv"
  6. 50 ; db "NDRV" ; Signature
  7. 60 ; db "P" ; Driver ID
  8. 70 ; db RELOC_COUNT ; No. relocations
  9. 80 ; db 0 ; No. 8K DivMMC banks
  10. 90 ; db 1 ; No. 8K Next banks
  11. 100 ;;---------------------------------------
  12. 110 ;; Driver code
  13. 120 ; org 0
  14. 130 ; RELOC_START
  15. 140 ;entry
  16. 150 ; ld a, b
  17. 160 ; cp $fb
  18. 170 ; jp z, output_char
  19. 180 ; cp $7f
  20. 190 ; jp z, get_status
  21. 200 ; ld a,(ix+error)
  22. 210 ;error
  23. 220 ; xor a ; A=0 unsupported call id
  24. 230 ; scf ; CY=1 indicate error
  25. 240 ; ret
  26. 250 ;;---------------------------------------
  27. 260 ;; Call ID $fb - output char
  28. 270 ;; E - character to print
  29. 280 ;output_char
  30. 285 ; ld a, $56
  31. 290 ; ld bc, $243b
  32. 300 ; out (c), a ; Select bank register
  33. 310 ; inc b
  34. 320 ; in a, (c) ; Get current bank id
  35. 330 ; ld (banksav), a; Save current bank id
  36. 340 ; ld a, (bankid) ; Load target bank id
  37. 350 ; nextreg $56, a ; Swap in the bank
  38. 360 ; call b_outch ; Call the output char routine
  39. 370 ; ld a, (banksav); Get saved bank id
  40. 380 ; nextreg $56, a ; Restore original bank id
  41. 390 ; ret
  42. 400 ;;---------------------------------------
  43. 410 ;; Call ID $7f - output char
  44. 420 ;get_status
  45. 430 ; ld bc, $ffff ; Device ready
  46. 440 ; or a ; CY=0 to indicate no error
  47. 450 ; ret
  48. 460 ;banksav db 0
  49. 470 ;bankid db 0
  50. 480 ; RELOC_END
  51. 490 ; ASSERT $ < 513 ; Error if driver too big
  52. 500 ; ds 512-$ ; Pad to end of driver
  53. 510 ;;
  54. 520 ; RELOC_TABLE ; Emit relocation table
  55. 530 ;;
  56. 540 ;; Bank Initialization
  57. 550 ;;
  58. 560 ; db 1 ; No. patches
  59. 570 ; dw bank_end - bank_start ; Bytes to initialze
  60. 580 ; org $c000
  61. 590 ;bank_start
  62. 600 ;b_outch
  63. 610 ; ld a, e ; Get char to print
  64. 620 ; and 7 ; Mask for border color
  65. 630 ; out ($fe), a ; Set border color
  66. 640 ; or a ; CY=0 to indicate no error
  67. 650 ; ret
  68. 660 ;bank_end
  69. 670 ; dw bankid ; Patch offsets for this bank
  70.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement