summaryrefslogtreecommitdiff
path: root/z180
diff options
context:
space:
mode:
authorLeo C2015-05-10 12:54:12 +0200
committerLeo C2015-05-10 12:54:12 +0200
commite4c4b148ced1347935dff6200380e90cb3bfcde3 (patch)
tree9ec51f8058aebc22d1b3ff415f4b15ab01ceedb6 /z180
parent1a2460dcd3bed50d5f2b7ba53e6e21a12935639b (diff)
downloadz180-stamp-e4c4b148ced1347935dff6200380e90cb3bfcde3.zip
Add unique id to fifos
Diffstat (limited to 'z180')
-rw-r--r--z180/asci1-i.18042
-rw-r--r--z180/chario.1807
-rw-r--r--z180/conbuf-a.18017
-rw-r--r--z180/config.inc31
-rw-r--r--z180/fifoio.18017
-rw-r--r--z180/msgbuf-a.1804
-rw-r--r--z180/msgfifo.18027
7 files changed, 74 insertions, 71 deletions
diff --git a/z180/asci1-i.180 b/z180/asci1-i.180
index 2410e38..15e121a 100644
--- a/z180/asci1-i.180
+++ b/z180/asci1-i.180
@@ -4,12 +4,12 @@
extrn buf.init
extrn isv_sw
-
+
global ser.init
global ser.ist,ser.in
global ser.ost,ser.out
-;TODO: define a trampoline area somewhere in top ram.
+;TODO: define a trampoline area somewhere in top ram.
rtxisvjmp equ 0FF60h ;momentan frei...
include config.inc
@@ -19,10 +19,10 @@ rtxisvjmp equ 0FF60h ;momentan frei...
;-----------------------------------------------------
dseg
-
+
buf_start:
- mkbuf ser1.inbuf,s1.rx_len
- mkbuf ser1.outbuf,s1.tx_len
+ mkbuf s1.rx_id, ser1.inbuf, s1.rx_len
+ mkbuf s1.tx_id, ser1.outbuf, s1.tx_len
buf_end:
@@ -33,7 +33,7 @@ buf_end:
;
; Init Serial I/O for console input and output (ASCI1)
;
-
+
ser.init:
; ld a,i
@@ -42,10 +42,10 @@ ser.init:
xor a ;
out0 (stat1),a ;Disable rx/tx interrupts
-
+
ld hl,rxtx_src ;move rx and tx isv to common ram
ld de,rxtx_dst ;
- ld bc,rxtx_src_e-rxtx_src ;
+ ld bc,rxtx_src_e-rxtx_src ;
ldir ;
ld hl,rtxisvjmp ;rx/tx int vector
@@ -59,7 +59,7 @@ ser.init:
; ASCI1: 8N1, highest baudrate (56700), CTS disabled
- ld a,M_MPBT
+ ld a,M_MPBT
out0 (cntlb1),a
ld a,M_RE + M_TE + M_MOD2
out0 (cntla1),a
@@ -89,21 +89,21 @@ buf.empty:
ret z
or 0ffh
ret
-
+
ser.in:
- push hl ;11
+ push hl ;11
push de ;11
- ld hl,ser1.inbuf-1 ; 9 hl = &rx.out_idx
+ ld hl,ser1.inbuf-1 ; 9 hl = &rx.out_idx
ld a,(hl) ; 6 a = rx.out_idx
dec hl ; 4 hl = &rx.in_idx
jr bg.w1
bg.wait:
halt
bg.w1:
- cp (hl) ; 6 while (out_idx==in_idx)
+ cp (hl) ; 6 while (out_idx==in_idx)
jr z,bg.wait ; 6 (/8) ;
- ld e,a ; 4
+ ld e,a ; 4
ld d,0 ; 6
inc de
inc de
@@ -111,20 +111,20 @@ bg.w1:
ex de,hl ; 3
add hl,de ;10
ld l,(hl) ; 6
- ex de,hl ; 3
+ ex de,hl ; 3
inc a ; 4
dec hl ; 4
- and (hl) ; 6
+ and (hl) ; 6
inc hl ; 4
inc hl ; 4
ld (hl),a ; 7
-
+
ld a,e ; 4
pop de ; 9
pop hl ; 9
ret ; 9
- ; 153
+ ; 153
ser.ost:
push ix
@@ -191,7 +191,7 @@ rxtxisv:
in0 d,(rdr1) ;todo: break detection
bit FE,a ;framing error?
jr nz,??ri_1
-
+
push ix
ld ix,ser1.inbuf ;
ld hl,ser1.inbuf ;
@@ -233,7 +233,7 @@ txisv:
??ti_1:
ld l,(hl)
out0 (tdr1),l ;071b
-
+
ld a,(ix+o.out_idx) ;
inc a
and (ix+o.mask)
@@ -254,5 +254,3 @@ rxtx_src_e:
end
-
-
diff --git a/z180/chario.180 b/z180/chario.180
index 8313658..4d37b89 100644
--- a/z180/chario.180
+++ b/z180/chario.180
@@ -2,7 +2,7 @@
.z80
-; CP/M 3 compatible character i/o
+; CP/M 3 compatible character i/o
public ?cinit,?ci,?co,?cist,?cost
public @ctbl
@@ -10,7 +10,7 @@
extrn ff.init,ff.i.st,ff.in,ff.o.st,ff.out
extrn as0init,as0ista,as0inp,as0osta,as0out
extrn as1init,as1ista,as1inp,as1osta,as1out
-
+
include config.inc
include z180reg.inc
include modebaud.inc ; define mode bits and baud eqautes
@@ -98,7 +98,7 @@ null$status:
db mb$in$out
db baud$none
- db 'ASCI1 ' ; device 1
+ db 'ASCI0 ' ; device 1
db mb$in$out+mb$serial+mb$soft$baud
ser0$baud:
db baud$19200
@@ -111,4 +111,3 @@ ser1$baud:
db 0 ; table terminator
end
-
diff --git a/z180/conbuf-a.180 b/z180/conbuf-a.180
index 096bbf9..e86b8b2 100644
--- a/z180/conbuf-a.180
+++ b/z180/conbuf-a.180
@@ -1,6 +1,6 @@
page 255
.z80
-
+
;
; FIFO channels for communication with avr
;
@@ -17,10 +17,10 @@
;--------------------------------------------------------------
dseg
-
- mkbuf co.fifo,co.fifo_len
- mkbuf ci.fifo,ci.fifo_len
+
+ mkbuf co.fifo_id, co.fifo, co.fifo_len
+ mkbuf ci.fifo_id, ci.fifo, ci.fifo_len
;--------------------------------------------------------------
@@ -50,7 +50,7 @@ buf.empty:
ret z
or 0ffh
ret
-
+
ff.in:
push ix
@@ -71,12 +71,12 @@ bg.wait:
inc h
bg.nc:
ld l,(hl)
-
+
ld a,(ix+o.out_idx) ;
inc a
and (ix+o.mask)
ld (ix+o.out_idx),a
-
+
ld a,l
pop hl
pop ix
@@ -122,7 +122,7 @@ bp.wait:
cp (ix+o.out_idx) ;19
jr z,bp.wait ;12/7
ld (ix+o.in_idx),a ;19
-
+
out (AVRINT6),a ;11
ld a,b ;4
pop bc ;10
@@ -163,4 +163,3 @@ bp.wait:
endif
end
-
diff --git a/z180/config.inc b/z180/config.inc
index 33152de..0c945ae 100644
--- a/z180/config.inc
+++ b/z180/config.inc
@@ -47,8 +47,8 @@ CA equ 10h - CSK ;common area start
BA equ 0 ;banked area start
SYS$CBR equ 0
-SYS$CBAR equ CA<<4 + CA ;CBAR in system mode
-USR$CBAR equ CA<<4 + BA ;CBAR in user mode (CP/M)
+SYS$CBAR equ CA*16 + CA ;CBAR in system mode
+USR$CBAR equ CA*16 + BA ;CBAR in user mode (CP/M)
BANKS equ 18 ;max nr. of banks
@@ -57,6 +57,7 @@ BANKS equ 18 ;max nr. of banks
CREFSH equ 0 ;Refresh rate register (disable refresh)
CWAITIO equ 3 shl IWI0 ;Max I/O Wait States, 0 Memory Wait States
+PHI_X2 equ 0 ;set to M_X2CM to enable the clock doubler
endif ;CPU_Z180
if CPU_Z80
@@ -108,14 +109,20 @@ CWAITROM equ 2 shl MWI0
DRSTNUM equ 30h ;DDTZ Restart vector (breakpoints)
-mrx.fifo_len equ 256
-mtx.fifo_len equ 256
+mtx.fifo_len equ 32 ;Message transfer fifos
+mtx.fifo_id equ 0 ; This *must* have #0
+mrx.fifo_len equ 32
+mrx.fifo_id equ 1
-ci.fifo_len equ 128
-co.fifo_len equ 256
+ci.fifo_len equ 32 ;AVRCON Character I/O via AVR
+ci.fifo_id equ 2
+co.fifo_len equ 32
+co.fifo_id equ 3
-s1.rx_len equ 256 ;Serial 1 (ASCI1) buffers
-s1.tx_len equ 256 ;
+s1.rx_len equ 128 ;Serial 1 (ASCI1) buffers
+s1.rx_id equ 4 ;
+s1.tx_len equ 128 ;
+s1.tx_id equ 5 ;
AVRINT5 equ 4Fh
AVRINT6 equ 5Fh
@@ -136,24 +143,26 @@ iv2tab equ ivtab + 2*9
;-----------------------------------------------------
-
+o.id equ -4
o.mask equ -3
o.in_idx equ -2
o.out_idx equ -1
.lall
-mkbuf macro name,size
- if ((size & (size-1)) ne 0) or (size gt 256)
+mkbuf macro id,name,size
+ if ((size AND (size-1)) NE 0) OR (size GT 256)
.printx Error: buffer ^size must be power of 2 and in range 0..256!
name&.mask equ ;wrong size error
else
+ db id
ds 3
name:: ds size
name&.mask equ low (size-1)
if size ne 0
name&.end equ $-1
name&.len equ size
+ name&.id equ id
endif
endif
endm
diff --git a/z180/fifoio.180 b/z180/fifoio.180
index dd99c53..cbcece9 100644
--- a/z180/fifoio.180
+++ b/z180/fifoio.180
@@ -1,6 +1,6 @@
page 255
.z80
-
+
;
; FIFO channels for communication with stm32
;
@@ -15,10 +15,10 @@
;--------------------------------------------------------------
dseg
-
- mkbuf rx.buf,rx.buf_len
- mkbuf tx.buf,tx.buf_len
+
+ mkbuf ci.fifo_id, rx.buf,rx.buf_len
+ mkbuf co.fifo_id, tx.buf,tx.buf_len
;--------------------------------------------------------------
@@ -48,7 +48,7 @@ buf.empty:
ret z
or 0ffh
ret
-
+
f.in:
push ix
@@ -69,12 +69,12 @@ bg.wait:
inc h
bg.nc:
ld l,(hl)
-
+
ld a,(ix+o.out_idx) ;
inc a
and (ix+o.mask)
ld (ix+o.out_idx),a
-
+
ld a,l
pop hl
pop ix
@@ -118,7 +118,7 @@ bp.wait:
jr z,bp.wait
ld (hl),b
ld (ix+o.in_idx),a
-
+
ld a,b
pop bc
pop hl
@@ -126,4 +126,3 @@ bp.wait:
ret
end
-
diff --git a/z180/msgbuf-a.180 b/z180/msgbuf-a.180
index ddb2d93..ff2a657 100644
--- a/z180/msgbuf-a.180
+++ b/z180/msgbuf-a.180
@@ -17,8 +17,8 @@
dseg
- mkbuf mrx.fifo,mrx.fifo_len
- mkbuf mtx.fifo,mtx.fifo_len
+ mkbuf mtx.fifo_id, mtx.fifo, mtx.fifo_len
+ mkbuf mrx.fifo_id, mrx.fifo, mrx.fifo_len
;--------------------------------------------------------------
diff --git a/z180/msgfifo.180 b/z180/msgfifo.180
index 582c219..cf1ae2a 100644
--- a/z180/msgfifo.180
+++ b/z180/msgfifo.180
@@ -1,11 +1,11 @@
page 255
.z80
-
+
global msg_rx_fifo,msg_tx_fifo
global msginit,msgi.st,msg.in,msgo.st,msg.out
global msg.sout,msg.co
-
+
extrn buf.init
include config.inc
@@ -15,8 +15,8 @@
dseg
- mkbuf msg_rx_fifo,msg_rx_fifo_len
- mkbuf msg_tx_fifo,msg_tx_fifo_len
+ mkbuf mtx.fifo_id, msg_tx_fifo, msg_tx_fifo_len
+ mkbuf mrx.fifo_id, msg_rx_fifo, msg_rx_fifo_len
@@ -27,7 +27,7 @@
;
; Init buffer
;
-
+
msginit:
ld ix,msg_rx_fifo
ld a,msg_rx_fifo.mask
@@ -49,7 +49,7 @@ buf.empty:
ret z
or 0ffh
ret
-
+
;--------------------------------------------------------------
msg.in:
@@ -71,12 +71,12 @@ bg.wait:
inc h
bg.nc:
ld l,(hl)
-
+
ld a,(ix+o.out_idx) ;
inc a
and (ix+o.mask)
ld (ix+o.out_idx),a
-
+
ld a,l
pop hl
pop ix
@@ -122,7 +122,7 @@ bp.wait:
jr z,bp.wait
ld (hl),b
ld (ix+o.in_idx),a
-
+
ld a,b
out0 (AVRINT5),a
pop bc
@@ -152,7 +152,7 @@ bp.wait:
ld a,b
out (PMSG),a
ld (ix+o.in_idx),c
-
+
pop bc
pop ix
ret
@@ -171,7 +171,7 @@ msg.sout:
ld b,(hl) ;
inc hl
ex de,hl
-
+
ms.ol:
push ix
pop hl
@@ -242,8 +242,8 @@ msg.co:
pop hl
pop af
ret
-
-
+
+
buf:
db buf_end - $ - 1 ;output string length
db 081h ; message start token
@@ -257,4 +257,3 @@ buf_end:
;----------------------------------------------------------------------
end
-