From 2fe441224da6410ec112322abf78524589b15498 Mon Sep 17 00:00:00 2001 From: Leo C Date: Fri, 1 May 2015 20:43:26 +0200 Subject: Add polling driver for ASCI0/1 --- z180/init.180 | 66 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 12 deletions(-) (limited to 'z180/init.180') diff --git a/z180/init.180 b/z180/init.180 index 0bd37c1..39b03fc 100644 --- a/z180/init.180 +++ b/z180/init.180 @@ -5,7 +5,6 @@ extrn $stack extrn charini,?const,?conin extrn ?cono,?conos - extrn romend @@ -75,14 +74,12 @@ start: hwini0: if CPU_Z180 - db 3 ;count db rcr,CREFSH ;configure DRAM refresh db dcntl,INIWAITS ;wait states db cbar,SYS$CBAR - else - db 0 endif + db 0 if CPU_Z180 dmclrt: ;clear ram per dma @@ -95,6 +92,7 @@ nullbyte: db 00h ;dst dw 0-romend ;count (64k) dmct_e: + db 0 endif @@ -165,7 +163,7 @@ kstart: if 0 ld hl,dmclrt ;load DMA registers - call io.ini.m + call ioiniml ld a,0cbh ;01ef dst +1, src fixed, burst out0 (dmode),a ;01f1 @@ -434,7 +432,7 @@ prt0_init: inc hl ld (hl),high iprt0 ld hl,prt0itab - call io.ini.m + call ioiniml ret prt0itab: @@ -444,6 +442,7 @@ prt0itab: dw PRT_TC10MS db M_TIE0+M_TDE0 ;enable timer 0 interrupt and down count. prt0it_e: + db 0 endif @@ -451,24 +450,55 @@ prt0it_e: ;---------------------------------------------------------------------- ; + if CPU_Z180 io.ini: + if 0 push bc - if CPU_Z180 - ld b,0 ;high byte port adress +ioi_nxt: ld a,(hl) ;count inc hl or a jr z,ioi_e -ioi_1: + ld c,(hl) ;port address inc hl +ioi_r: outi inc b ;outi decrements b dec a - jr nz,ioi_1 + jr nz,ioi_r + jr ioi_nxt ioi_e: + pop bc + ret + + else ;(if 1/0) + + push bc + jr ioi_nxt +ioi_l: + ld c,(hl) ;port address + inc hl + inc c +ioi_r: + dec c ;otim increments c + otim + jr z,ioi_r +ioi_nxt: + ld b,(hl) ;count + inc hl + inc b ;stop if count == 0 + djnz ioi_l + pop bc + ret + + endif ;(1/0) + else + +io.ini: + push bc jr ioi_nxt ioi_l: ld c,(hl) ;port address @@ -483,16 +513,28 @@ ioi_nxt: pop bc ret +;---------------------------------------------------------------------- + if CPU_Z180 -io.ini.m: + + global ioiniml + +ioiniml: push bc + xor a +ioml_lp: ld b,(hl) inc hl + cp b + jr z,ioml_e + ld c,(hl) inc hl otimr + jr ioml_lp +ioml_e: pop bc - ret + ret z endif io.ini.l: -- cgit v1.2.3