Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #program asmdrv2
- 10 RUN AT 3
- 20 SAVE "asmdrv2.bas"
- 30 .asm
- 40 ; output "asmdrv2.drv"
- 50 ; db "NDRV" ; Signature
- 60 ; db "P" ; Driver ID
- 70 ; db RELOC_COUNT ; No. relocations
- 80 ; db 0 ; No. 8K DivMMC banks
- 90 ; db 1 ; No. 8K Next banks
- 100 ;;---------------------------------------
- 110 ;; Driver code
- 120 ; org 0
- 130 ; RELOC_START
- 140 ;entry
- 150 ; ld a, b
- 160 ; cp $fb
- 170 ; jp z, output_char
- 180 ; cp $7f
- 190 ; jp z, get_status
- 200 ; ld a,(ix+error)
- 210 ;error
- 220 ; xor a ; A=0 unsupported call id
- 230 ; scf ; CY=1 indicate error
- 240 ; ret
- 250 ;;---------------------------------------
- 260 ;; Call ID $fb - output char
- 270 ;; E - character to print
- 280 ;output_char
- 285 ; ld a, $56
- 290 ; ld bc, $243b
- 300 ; out (c), a ; Select bank register
- 310 ; inc b
- 320 ; in a, (c) ; Get current bank id
- 330 ; ld (banksav), a; Save current bank id
- 340 ; ld a, (bankid) ; Load target bank id
- 350 ; nextreg $56, a ; Swap in the bank
- 360 ; call b_outch ; Call the output char routine
- 370 ; ld a, (banksav); Get saved bank id
- 380 ; nextreg $56, a ; Restore original bank id
- 390 ; ret
- 400 ;;---------------------------------------
- 410 ;; Call ID $7f - output char
- 420 ;get_status
- 430 ; ld bc, $ffff ; Device ready
- 440 ; or a ; CY=0 to indicate no error
- 450 ; ret
- 460 ;banksav db 0
- 470 ;bankid db 0
- 480 ; RELOC_END
- 490 ; ASSERT $ < 513 ; Error if driver too big
- 500 ; ds 512-$ ; Pad to end of driver
- 510 ;;
- 520 ; RELOC_TABLE ; Emit relocation table
- 530 ;;
- 540 ;; Bank Initialization
- 550 ;;
- 560 ; db 1 ; No. patches
- 570 ; dw bank_end - bank_start ; Bytes to initialze
- 580 ; org $c000
- 590 ;bank_start
- 600 ;b_outch
- 610 ; ld a, e ; Get char to print
- 620 ; and 7 ; Mask for border color
- 630 ; out ($fe), a ; Set border color
- 640 ; or a ; CY=0 to indicate no error
- 650 ; ret
- 660 ;bank_end
- 670 ; dw bankid ; Patch offsets for this bank
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement