From 30d1329e8e5c029a87f657baace698d1d7031f9e Mon Sep 17 00:00:00 2001 From: Leo C Date: Tue, 28 Oct 2014 10:29:13 +0100 Subject: CP/M 3 compatible character i/o handling --- z180/r3init.180 | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'z180/r3init.180') diff --git a/z180/r3init.180 b/z180/r3init.180 index 2dd1bb8..9adbdd8 100644 --- a/z180/r3init.180 +++ b/z180/r3init.180 @@ -3,7 +3,7 @@ extrn ddtz,bpent extrn $stack - extrn $coninit,$cists,$ci + extrn charini,?const,?conin extrn romend @@ -73,17 +73,20 @@ hwini0: ;---------------------------------------------------------------------- start: - push af ;003c - in0 a,(itc) ;003d Illegal opcode trap? - jp p,??st01 ;0040 - pop af ;0043 - jp bpent ;0044 yes, handle + ld (tmpstack),sp + ld sp,tmpstack + push af + in0 a,(itc) ;Illegal opcode trap? + jp m,??st01 + ld a,i ;I register == 0 ? + jr z,??st02 ; yes, harware reset ??st01: - ld a,i ;0047 I register == 0 ? - jr z,??st02 ;004b yes, harware reset - pop af ;004d - jp bpent ;004e no, allready set up + ld a,(syscbr) + out0 (cbr),a + pop af ;restore registers + ld sp,(tmpstack) ; + jp bpent ; ??st02: di ;0058 @@ -189,6 +192,8 @@ ramok: alloc: out0 (cbr),c ;01de + ld a,c + ld (syscbr),a ld sp,$stack ;01e1 ; Clear RAM using DMA0 @@ -280,7 +285,7 @@ wstart: call prt0_init - call $coninit + call charini call bufferinit @@ -289,15 +294,21 @@ wstart: im 2 ;?030e ei ;0282 - call $cists ;0284 - call $cists ;0287 + call ?const ;0284 + call ?const ;0287 or a ;028a - call nz,$ci ;028d + call nz,?conin ;028d ld a,(banktab) ; ld e,a ; jp ddtz ;0290 + + ds 8 +tmpstack: + dw 2 +syscbr: db 1 + ; ;---------------------------------------------------------------------- ; -- cgit v1.2.3