aboutsummaryrefslogtreecommitdiffstats
path: root/data/printer.asm
diff options
context:
space:
mode:
Diffstat (limited to 'data/printer.asm')
-rw-r--r--data/printer.asm79
1 files changed, 59 insertions, 20 deletions
diff --git a/data/printer.asm b/data/printer.asm
index 55e5e52..1a19b16 100644
--- a/data/printer.asm
+++ b/data/printer.asm
@@ -23,12 +23,12 @@ pr_jptable:
jp pr_open ; OPEN
jp pr_open ; PREPARE
jp pr_close ; CLOSE
- jp nothere ; INPUT
+ jp notthere ; INPUT
jp pr_print ; PRINT
- jp nothere ; Block to buf
- jp nothere ; Block from buf
- jp nothere ; DELETE???
- jp nothere ; RENAME???
+ jp notthere ; Block to buf
+ jp notthere ; Block from buf
+ jp notthere ; DELETE???
+ jp notthere ; RENAME???
prab_jp_init:
jp prab_init
@@ -92,13 +92,10 @@ wb_loop:
pop af
ret
-nothere:
- rst 0x10
- defb 128+52 ; Err 52 = ej till denna enhet
-
-notready:
- rst 0x10
- defb 128+51 ; Err 51 = enheten upptagen
+notthere:
+ ld a,128+52
+ scf
+ ret
done:
xor a
@@ -110,6 +107,10 @@ done_err:
pop af
and a
ret p
+ cp 128+34 ; ERR 34 = end of file
+ jr nz,not_eof
+ xor a ; ... end of file is signalled by A=0
+not_eof:
scf
ret
@@ -120,10 +121,10 @@ pra_jptable:
jp pra_close ; CLOSE
jp pra_input ; INPUT
jp pra_print ; PRINT
- jp nothere ; Block to buf
- jp nothere ; Block from buf
- jp nothere ; DELETE???
- jp nothere ; RENAME???
+ jp notthere ; Block to buf
+ jp notthere ; Block from buf
+ jp notthere ; DELETE???
+ jp notthere ; RENAME???
prb_jptable:
jp prb_open ; OPEN
@@ -133,8 +134,8 @@ prb_jptable:
jp 001Bh ; PRINT
jp prb_rdblk ; Block to buf
jp prb_wrblk ; Block from buf
- jp nothere ; DELETE???
- jp nothere ; RENAME???
+ jp notthere ; DELETE???
+ jp notthere ; RENAME???
pra_open:
ld c,0xA0
@@ -206,10 +207,47 @@ done_err2:
jp done_err
pra_input:
+ call select
+ ld a,0xA4 ; INPUT
+ call send_cmd
+ call recv_reply
+ and a
+ jr nz,done_err2
+ call recv_byte
+ jr c,prai_timeout
+ ld e,a
+ call recv_byte
+ jr c,prai_timeout
+ ld d,a
+ ; Now HL -> target buf; DE -> expected byte count;
+ ; BC -> buffer size
+prai_loop:
+ ld a,d
+ or e
+ jp z,done
+ dec de
+ ld a,b
+ or c
+ jr nz,prai_space
+ ld hl,ram_dummy
+ inc c
+prai_space:
+ dec bc
+ call recv_byte
+ jr c,prai_timeout
+ ld (hl),a
+ inc hl
+ jr prai_loop
+prai_skip:
+ pop af
+ jr prai_loop
+prai_timeout:
+ ld a,128+42
+ jr done_err2
+
prb_wrblk:
prb_rdblk:
- scf ; Not implemented yet
- ret
+ jp notthere
; Set up a BUF for PRB:
prb_setup_buf:
@@ -342,6 +380,7 @@ 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
prab_init:
ld hl,prab_device