summaryrefslogtreecommitdiff
path: root/z180/msgbuf-a.180
diff options
context:
space:
mode:
Diffstat (limited to 'z180/msgbuf-a.180')
-rw-r--r--z180/msgbuf-a.18084
1 files changed, 75 insertions, 9 deletions
diff --git a/z180/msgbuf-a.180 b/z180/msgbuf-a.180
index 7e8c9cc..3575569 100644
--- a/z180/msgbuf-a.180
+++ b/z180/msgbuf-a.180
@@ -1,12 +1,13 @@
page 255
.z80
- global mrx.fifo,mtx.fifo
+ public mrx.fifo,mtx.fifo
- global msginit,msgi.st,msg.in,msgo.st,msg.out
- global msg.sout
+ public msginit,msgi.st,msg.in,msgo.st
+ public msg.sm,msg.sout
- extrn buf.init
+ extrn bufinit,hwl2phy
+ extrn fifolst
include config.inc
if CPU_Z180
@@ -29,12 +30,25 @@
;
msginit:
+ ld a,(043h)
+;TODO: value should be 0
ld ix,mtx.fifo
- ld a,mtx.fifo.mask
- call buf.init
+ call bufinit
+ push ix
+ pop hl
+ call hwl2phy
+ ld (040h),hl
+ ld (040h+2),a
+ ld a,0ffh
+ ld (043h),a
+ out (AVRINT5),a
+wait:
+ ld a,(043h)
+ or a
+ jr nz,wait
+
ld ix,mrx.fifo
- ld a,mrx.fifo.mask
- jp buf.init
+ jp bufinit
;--------------------------------------------------------------
@@ -136,7 +150,7 @@ bp.wait:
;--------------------------------------------------------------
-
+ if 0
msg.out:
push ix
@@ -165,6 +179,36 @@ bp.wait:
pop ix
ret
+ endif
+
+;----------------------------------------------------------------------
+;
+; Put char in message buffer:
+; ix: buffer to put into
+; c: char
+
+buf.put:
+ push ix ;15
+ push bc ;11
+ ld a,(ix+o.in_idx) ;19
+ ld c,a ;4
+ ld b,0 ;7
+ add ix,bc ;11
+ pop bc ;10
+ ld (ix),c ;7
+ pop ix ;14
+
+ inc a ;4
+ and (ix+o.mask) ;19 =121
+bufp.wait:
+ cp (ix+o.out_idx) ;19
+ jr z,bufp.wait ;12/7
+ ld (ix+o.in_idx),a ;19
+
+ out (AVRINT5),a ;11
+ ld a,c ;4
+ ret ;10 =191
+
;--------------------------------------------------------------
@@ -305,4 +349,26 @@ buf_end:
;----------------------------------------------------------------------
+;----------------------------------------------------------------------
+; Send message MEMORY
+;
+; hl: pointer to message (netto)
+; b: msg length
+
+msg.sm:
+ push ix
+ ld ix,mtx.fifo
+ ld c,0AEh
+ call buf.put
+ ld c,b
+ call buf.put
+msm_l:
+ ld c,(hl)
+ inc hl
+ call buf.put
+ djnz msm_l
+ pop ix
+ ret
+
+
end