diff options
Diffstat (limited to 'data/printer.asm')
-rw-r--r-- | data/printer.asm | 114 |
1 files changed, 70 insertions, 44 deletions
diff --git a/data/printer.asm b/data/printer.asm index fb45c7f..616b6b8 100644 --- a/data/printer.asm +++ b/data/printer.asm @@ -30,30 +30,10 @@ pr_jptable: jp notthere ; DELETE jp notthere ; RENAME -prab_jp_init: - call prab_init +prabc_jp_init: + call prabc_init jp 0x6543 ; Initialize DOS -pr_open: - call select - - ld a,128+selcode - out (3),a - - in a,(1) - and a - jr z,done - -pr_close: - call select - call wait_busy - ld a,0FFh - out (0),a - call wait_busy - xor a - out (0),a - jr done - pr_print: call select ld d,0FFh @@ -62,15 +42,13 @@ pr_print_loop: ld a,b or c jr z,done - call wait_busy ld a,(hl) cp d jr nz,pr_print_not_ff - out (0),a - call wait_busy + call send_byte ld a,(hl) pr_print_not_ff: - out (0),a + call send_byte dec bc inc hl @@ -84,20 +62,29 @@ select: out (1),a ret -wait_busy: - push af -wb_loop: +pr_open: + call select + in a,(1) - and 0A0h ; TX busy or TX flow control - jr nz,wb_loop - pop af - ret + and 01Fh + jr z,done + ; fall through to notthere notthere: ld a,128+52 scf ret +pr_close: + call select + ld a,0FFh + call send_byte + ; fall through to send_zero_done + +send_zero_done: + xor a + call send_byte + done: xor a done_err: @@ -357,7 +344,12 @@ psb_found: ; Send a single byte send_byte: - call wait_busy + push af +wb_loop: + in a,(1) + and 0A0h ; TX busy or TX flow control + jr nz,wb_loop + pop af out (0),a ret @@ -443,19 +435,50 @@ rr_done: pop bc ret +prc_jptable: + jp pr_open ; OPEN + jp pr_open ; PREPARE + jp done ; CLOSE + jp notthere ; INPUT + jp prc_print ; PRINT + jp notthere ; RDBLK + jp notthere ; WRBLK + jp notthere ; DELETE + jp notthere ; RENAME + +prc_print: + call select + ld a,0xFF + call send_byte + ld a,0xc0 + call send_byte + +prc_print_loop: + ld a,b + or c + jp z,send_zero_done + ld a,(hl) + and a + jr z,prc_skip + call send_byte +prc_skip: + dec bc + inc hl + jr prc_print_loop + ram_devlst: equ 7B00h -ram_select: equ 7B0Eh ; Previous select code -ram_cmd: equ 7B0Fh ; Latest sent command -ram_serial: equ 7B10h ; Latest serial number -ram_dummy: equ 7B11h ; Scratch byte +ram_select: equ 7B15h ; Previous select code +ram_cmd: equ 7B16h ; Latest sent command +ram_serial: equ 7B17h ; Latest serial number +ram_dummy: equ 7B18h ; Scratch byte -prab_init: - ld hl,prab_device +prabc_init: + ld hl,prabc_device ld de,ram_devlst - ld bc,7*2 + ld bc,7*3 ldir ld hl,(65034) ; Device list - ld (ram_devlst+7),hl + ld (ram_devlst+14),hl ld hl,ram_devlst ld (65034),hl call select @@ -463,10 +486,13 @@ prab_init: call send_cmd jp done -prab_device: +prabc_device: defw ram_devlst+7 defm "PRA" defw pra_jptable - defw 0 + defw ram_devlst+14 defm "PRB" defw prb_jptable + defw 0 + defm "PRC" + defw prc_jptable |