summaryrefslogtreecommitdiff
path: root/z180
diff options
context:
space:
mode:
authorLeo C2015-05-11 08:32:57 +0200
committerLeo C2015-05-11 08:32:57 +0200
commitcdc4625b124f725fbc9462d5592d1d3be2aa613a (patch)
treeb53936e854446c3aa4403c351cf24ca08359ecef /z180
parente4c4b148ced1347935dff6200380e90cb3bfcde3 (diff)
downloadz180-stamp-cdc4625b124f725fbc9462d5592d1d3be2aa613a.zip
phys. address 0x00040 points to fifo_list
Diffstat (limited to 'z180')
-rw-r--r--z180/config.inc12
-rw-r--r--z180/ddtz.1809
-rw-r--r--z180/init.18083
-rw-r--r--z180/msgbuf-a.1806
4 files changed, 75 insertions, 35 deletions
diff --git a/z180/config.inc b/z180/config.inc
index 0c945ae..dfb41cd 100644
--- a/z180/config.inc
+++ b/z180/config.inc
@@ -34,7 +34,7 @@ PRT_TC10MS equ PHI / (PRT_PRE/10)
;-----------------------------------------------------
; MMU
-COMMON_SIZE equ 4*1024 ;Common Area size in bytes
+COMMON_SIZE equ 16*1024 ;Common Area size in bytes
;must be multiple of 4K
if (COMMON_SIZE mod 1000h)
@@ -106,13 +106,15 @@ CWAITROM equ 2 shl MWI0
endif
-DRSTNUM equ 30h ;DDTZ Restart vector (breakpoints)
+DDTZRSTVEC equ 030h ;DDTZ Restart vector (breakpoints)
+INIDONE equ 03Fh ;CP/M skip hw init, if this address
+INIDONEVAL equ 080h ; is set to this value.
-mtx.fifo_len equ 32 ;Message transfer fifos
-mtx.fifo_id equ 0 ; This *must* have #0
+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
+mrx.fifo_id equ 1
ci.fifo_len equ 32 ;AVRCON Character I/O via AVR
ci.fifo_id equ 2
diff --git a/z180/ddtz.180 b/z180/ddtz.180
index e5d48e1..e8a26fd 100644
--- a/z180/ddtz.180
+++ b/z180/ddtz.180
@@ -1796,7 +1796,7 @@ l10c5h:
jr z,l10e7h
ld l,(ix+002h)
ld h,(ix+003h)
- ld a,(ddtrst)
+ ld a,(ddtzrst)
comst
cp (hl)
comend
@@ -1859,7 +1859,7 @@ l1144h:
ld h,(ix+003h)
- ld a,(ddtrst)
+ ld a,(ddtzrst)
comst
ld e,(hl)
ld (hl),a
@@ -5944,7 +5944,7 @@ l27dah:
ret
x27ea:
- ld a,(ddtrst)
+ ld a,(ddtzrst)
comst
cp (iy+000h)
comend
@@ -6137,7 +6137,8 @@ ddtram:
; The following 2 params are changeable by user.
; Should these moved to top ram?
;
-ddtrst: rst DRSTNUM ;rst used by ddtz
+ddtzrst:
+ rst DDTZRSTVEC ;rst used by ddtz
ddtei: ei ;ints enabled/disabled while ddtz is running
ret ;
offs.pc:
diff --git a/z180/init.180 b/z180/init.180
index f43aaeb..c3db6a1 100644
--- a/z180/init.180
+++ b/z180/init.180
@@ -163,7 +163,7 @@ kstart:
if CPU_Z180
if 0
-
+
ld hl,dmclrt ;load DMA registers
call ioiniml
ld a,0cbh ;01ef dst +1, src fixed, burst
@@ -174,7 +174,7 @@ kstart:
??cl_1:
out0 (dstat),a ;01f9 clear (up to) 64k
djnz ??cl_1 ; end of RAM?
-
+
endif
endif
@@ -185,10 +185,10 @@ kstart:
; -- wstart --
wstart:
- call sysram_init ;027f
+ call sysram_init
call ivtab_init
if CPU_Z180
- call prt0_init
+; call prt0_init
endif
call charini
@@ -199,20 +199,23 @@ wstart:
call selbnk
endif
- im 2 ;?030e
- ei ;0282
+ ld a,INIDONEVAL ;tell others (CP/M) that hardware and fifos
+ ld (INIDONE),a ; are allready initialized
+
+ im 2
+ ei
- call ?const ;0284
- call ?const ;0287
- or a ;028a
- call nz,?conin ;028d
+ call ?const
+ call ?const
+ or a
+ call nz,?conin
if CPU_Z180
ld e,0 ;Sys$Bank
else
; TODO:
endif
- jp ddtz ;0290
+ jp ddtz
if CPU_Z180
@@ -224,16 +227,51 @@ syscbr: db 1
;----------------------------------------------------------------------
;
-;TODO: Make a ringbuffer module.
-
global buf.init
buf.init:
ld (ix+o.in_idx),0
ld (ix+o.out_idx),0
ld (ix+o.mask),a
+
+ ld a,(ix+o.id)
+ cp 4
+ ret nc
+
+ push de
+ push hl
+ ld hl,fifo_list
+ push hl ;save fifo_list
+ ld e,a
+ ld d,0
+ add hl,de
+ add hl,de
+ add hl,de
+ push ix
+ pop de
+; TODO: address transation
+ ld (hl),e
+ inc hl
+ ld (hl),d
+ pop hl ;get fifo_list back
+ or a
+ jr nz,bufi_ex
+
+ ld (040h),hl
+ ld (040h+2),a
+bufi_ex:
+ pop hl
+ pop de
+
ret
+
+fifo_list:
+ rept 4
+ dw 0
+ db 0
+ endm
+
;----------------------------------------------------------------------
extrn msginit,msg.sout
@@ -259,11 +297,11 @@ bfi_1:
or a
jr nz,bfi_2
- call hwl2phy
- ld (40h+0),hl
- ld (40h+2),a
+; call hwl2phy
+; ld (40h+0),hl
+; ld (40h+2),a
out (AVRINT5),a
- jr bfi_3
+ jr bfi_3
bfi_2:
call hwl2phy
ld (bufdat+1),hl
@@ -426,12 +464,12 @@ ioi_r:
dec a
jr nz,ioi_r
jr ioi_nxt
-ioi_e:
+ioi_e:
pop bc
ret
-
+
else ;(if 1/0)
-
+
push bc
jr ioi_nxt
ioi_l:
@@ -449,7 +487,7 @@ ioi_nxt:
djnz ioi_l
pop bc
ret
-
+
endif ;(1/0)
else
@@ -484,7 +522,7 @@ ioml_lp:
inc hl
cp b
jr z,ioml_e
-
+
ld c,(hl)
inc hl
otimr
@@ -909,4 +947,3 @@ mark_55AA equ 0 - 2 - 4 ;2 byte for trap stack
end
-
diff --git a/z180/msgbuf-a.180 b/z180/msgbuf-a.180
index ff2a657..7e8c9cc 100644
--- a/z180/msgbuf-a.180
+++ b/z180/msgbuf-a.180
@@ -29,11 +29,11 @@
;
msginit:
- ld ix,mrx.fifo
- ld a,mrx.fifo.mask
- call buf.init
ld ix,mtx.fifo
ld a,mtx.fifo.mask
+ call buf.init
+ ld ix,mrx.fifo
+ ld a,mrx.fifo.mask
jp buf.init
;--------------------------------------------------------------