6 extrn charini,?const,?conin
23 ;----------------------------------------------------------------------
42 ;----------------------------------------------------------------------
60 INIWAITS defl INIWAITS+CWAITROM
63 ;----------------------------------------------------------------------
75 ;----------------------------------------------------------------------
80 db rcr,CREFSH ;configure DRAM refresh
81 db dcntl,INIWAITS ;wait states
88 dmclrt: ;clear ram per dma
91 dw nullbyte ;src (fixed)
94 dw romend ;dst (inc), start after "rom" code
96 dw 0-romend ;count (64k)
106 in0 a,(itc) ;Illegal opcode trap?
108 ld a,i ;I register == 0 ?
109 jr z,hw_reset ; yes, harware reset
115 pop af ;restore registers
121 out0 (rcr),a ; configure DRAM refresh
123 out0 (dcntl),a ; wait states
125 ld a,M_NCD ;No Clock Divide
127 ; ld a,M_X2CM ;X2 Clock Multiplier
135 ; check warm start mark
137 ld ix,mark_55AA ; top of common area
148 ld sp,$stack ; mark found, check
149 jp z,wstart ; check ok,
151 ; ram not ok, initialize -- kstart --
163 ; Clear RAM using DMA0
168 ld hl,dmclrt ;load DMA registers
170 ld a,0cbh ;01ef dst +1, src fixed, burst
174 ld a,062h ;01f4 enable dma0,
176 out0 (dstat),a ;01f9 clear (up to) 64k
177 djnz ??cl_1 ; end of RAM?
182 ld hl,055AAh ;set warm start mark
203 ld a,INIDONEVAL ;tell others (CP/M) that hardware and fifos
204 ld (INIDONE),a ; are allready initialized
228 ;----------------------------------------------------------------------
245 push hl ;save fifo_list
253 ; TODO: address translation
257 pop hl ;get fifo_list back
276 ;----------------------------------------------------------------------
278 extrn msginit,msg.sout
279 extrn mtx.fifo,mrx.fifo
280 extrn co.fifo,ci.fifo
367 buftablen equ ($ - buffers)/3
382 ;----------------------------------------------------------------------
388 ld bc,sysrame-sysramw
393 ;----------------------------------------------------------------------
403 ; Let all vectors point to spurious int routines.
417 ;----------------------------------------------------------------------
435 db prt0it_e-prt0itab-2
439 db M_TIE0+M_TDE0 ;enable timer 0 interrupt and down count.
446 ;----------------------------------------------------------------------
453 ld b,0 ;high byte port adress
460 ld c,(hl) ;port address
464 inc b ;outi decrements b
477 ld c,(hl) ;port address
481 dec c ;otim increments c
487 inc b ;stop if count == 0
500 ld c,(hl) ;port address
512 ;----------------------------------------------------------------------
541 ;----------------------------------------------------------------------
545 ;--------------------------------------------------------------------
546 ; Return the BBR value for the given bank number
553 ret z ; Bank 0 is at physical address 0
564 ;--------------------------------------------------------------
569 ;out ahl: Phys. (linear) Address
576 ;--------------------------------------------------------------
583 ; hl hhhhhhhhllllllll
586 ; OP: ahl = (a<<12) + (h<<8) + l
588 ;out ahl: Phys. (linear) Address
604 ;--------------------------------------------------------------
609 ; OP: ahl = (bankbase<<12) + (d<<8) + e
611 ;out ahl: Phys. (linear) Address
618 or 00fh ; log. addr in common1?
622 in0 a,(cbr) ; yes, cbr is address base
625 ld b,16 ; log. address in baked area?
630 in0 a,(bbr) ; yes, bbr is address base
637 pop bc ; bank part is 0, no translation
644 ;----------------------------------------------------------------------
649 jr nc,b2p_1 ;A15=1 --> common
658 ;--------------------------------------------------------------
672 ; ---------------------------------------------------------
679 ; Trampoline for interrupt routines in banked ram.
680 ; Switch stack pointer to "system" stack in top ram
684 ex (sp),hl ;save hl, 'return adr' in hl
687 ex de,hl ;'return address' in de
692 jr nc,isw_1 ;stack allready in top ram
695 push hl ;save user stack pointer
721 ; ---------------------------------------------------------
748 ; ---------------------------------------------------------
753 sp.int.len equ $-sp.int0
773 ; ---------------------------------------------------------
778 ; This routine may not be loaded in page zero
780 ; return Carry clear, if INTs are enabled.
784 xor a ;clear accu and carry
785 push af ;stack bottom := 00xxh
787 ld a,i ;P flag := IFF2
788 ret pe ;exit carry clear, if enabled
790 dec sp ;has stack bottom been overwritten?
792 and a ;if not 00xxh, INTs were
793 ret nz ;actually enabled
794 scf ;Otherwise, they really are disabled
797 ;----------------------------------------------------------------------
831 ret c ;INTs were disabled
835 ;----------------------------------------------------------------------
870 ret nc ;INTs were disabled
876 ;----------------------------------------------------------------------
914 global mm_sio0, mm_sio1
916 @cbnk: db 0 ; current bank (0..2)
925 ;----------------------------------------------------------------------
935 ;-----------------------------------------------------
941 ;ivtab equ 0ffc0h ; 0ffc0h ;int vector table
945 mark_55AA equ 0 - 2 - 4 ;2 byte for trap stack