X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/bad2d92d98f9990ee5ccf509c0eafe5b3af9f4dc..cb52e1e0dbfdf6c6defe20b3711e0c50285748f5:/z180/r3init.180 diff --git a/z180/r3init.180 b/z180/r3init.180 index 1936c9b..9edeaf2 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 + ; ;---------------------------------------------------------------------- ; @@ -313,7 +324,7 @@ buf.init: ret ;---------------------------------------------------------------------- - +if 0 extrn msginit,msg_tx_fifo,msg_rx_fifo extrn msg.sout @@ -325,19 +336,19 @@ bufferinit: ld (40h+0),hl ld (40h+2),a - ld (bufdat+1),hl - ld (bufdat+3),a - xor a - ld (bufdat+0),a - ld hl,inimsg - call msg.sout +; ld (bufdat+1),hl +; ld (bufdat+3),a +; ld a,1 +; ld (bufdat+0),a +; ld hl,inimsg +; call msg.sout ld de,msg_rx_fifo in0 a,cbr call log2phys ld (bufdat+1),hl ld (bufdat+3),a - ld a,1 + ld a,2 ld (bufdat+0),a ld hl,inimsg call msg.sout @@ -346,7 +357,7 @@ bufferinit: inimsg: db inimsg_e - $ - 1 - db 81h + db 0AEh db inimsg_e - $ - 1 db 0 bufdat: @@ -355,51 +366,64 @@ bufdat: db 0 inimsg_e: +endif ;---------------------------------------------------------------------- ; -if 0 - extrn msginit,msg.sout,msg_fifo - extrn tx.buf,rx.buf + extrn msginit,msg.sout + extrn mtx.fifo,mrx.fifo + extrn co.fifo,ci.fifo bufferinit: call msginit ld hl,buffers - ld bc,0300h ; b:count, c:buffer nr + ld b,buftablen bfi_1: + ld a,(hl) + inc hl + ld (bufdat+0),a ld e,(hl) inc hl ld d,(hl) inc hl push hl + + or a + jr nz,bfi_2 + in0 a,cbr + call log2phys + ld (40h+0),hl + ld (40h+2),a + out0 (AVRINT5),a + jr bfi_3 +bfi_2: in0 a,cbr call log2phys ld (bufdat+1),hl ld (bufdat+3),a - ld a,c - ld (bufdat+0),a ld hl,inimsg call msg.sout +bfi_3: pop hl - inc c djnz bfi_1 ret - rept 20 - db 0 - endm - buffers: - dw msg_fifo - dw tx.buf - dw rx.buf + db 0 + dw mtx.fifo + db 1 + dw mrx.fifo + db 2 + dw co.fifo + db 3 + dw ci.fifo +buftablen equ ($ - buffers)/3 inimsg: - db inimsg_e - $ -2 - db PMSG - db 81h + db inimsg_e - $ -1 + db 0AEh db inimsg_e - $ -1 db 0 bufdat: @@ -408,7 +432,6 @@ bufdat: db 0 inimsg_e: -endif ; ;----------------------------------------------------------------------