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 ;----------------------------------------------------------------------
244 push hl ;save fifo_list
254 pop hl ;get fifo_list back
272 ;----------------------------------------------------------------------
274 extrn msginit,msg.sout
275 extrn mtx.fifo,mrx.fifo
276 extrn co.fifo,ci.fifo
363 buftablen equ ($ - buffers)/3
378 ;----------------------------------------------------------------------
384 ld bc,sysrame-sysramw
389 ;----------------------------------------------------------------------
399 ; Let all vectors point to spurious int routines.
413 ;----------------------------------------------------------------------
415 ; Reload value for 10 ms Int. (0.1KHz):
416 ; tc10ms = phi/prescale/0.1KHz = phi / (prescale/10)
418 PRT_TC10MS equ 18432 / (PRT_PRE/10)
437 db prt0it_e-prt0itab-2
441 db M_TIE0+M_TDE0 ;enable timer 0 interrupt and down count.
448 ;----------------------------------------------------------------------
455 ld b,0 ;high byte port adress
462 ld c,(hl) ;port address
466 inc b ;outi decrements b
479 ld c,(hl) ;port address
483 dec c ;otim increments c
489 inc b ;stop if count == 0
502 ld c,(hl) ;port address
514 ;----------------------------------------------------------------------
543 ;----------------------------------------------------------------------
547 ;--------------------------------------------------------------------
548 ; Return the BBR value for the given bank number
555 ret z ; Bank 0 is at physical address 0
566 ;--------------------------------------------------------------
571 ;out ahl: Phys. (linear) Address
578 ;--------------------------------------------------------------
585 ; hl hhhhhhhhllllllll
588 ; OP: ahl = (a<<12) + (h<<8) + l
590 ;out ahl: Phys. (linear) Address
606 ;--------------------------------------------------------------
611 ; OP: ahl = (bankbase<<12) + (d<<8) + e
613 ;out ahl: Phys. (linear) Address
620 or 00fh ; log. addr in common1?
624 in0 a,(cbr) ; yes, cbr is address base
627 ld b,16 ; log. address in baked area?
632 in0 a,(bbr) ; yes, bbr is address base
639 pop bc ; bank part is 0, no translation
646 ;----------------------------------------------------------------------
651 jr nc,b2p_1 ;A15=1 --> common
660 ;--------------------------------------------------------------
674 ; ---------------------------------------------------------
681 ; Trampoline for interrupt routines in banked ram.
682 ; Switch stack pointer to "system" stack in top ram
686 ex (sp),hl ;save hl, 'return adr' in hl
689 ex de,hl ;'return address' in de
694 jr nc,isw_1 ;stack allready in top ram
697 push hl ;save user stack pointer
723 ; ---------------------------------------------------------
750 ; ---------------------------------------------------------
755 sp.int.len equ $-sp.int0
775 ; ---------------------------------------------------------
780 ; This routine may not be loaded in page zero
782 ; return Carry clear, if INTs are enabled.
786 xor a ;clear accu and carry
787 push af ;stack bottom := 00xxh
789 ld a,i ;P flag := IFF2
790 ret pe ;exit carry clear, if enabled
792 dec sp ;has stack bottom been overwritten?
794 and a ;if not 00xxh, INTs were
795 ret nz ;actually enabled
796 scf ;Otherwise, they really are disabled
799 ;----------------------------------------------------------------------
833 ret c ;INTs were disabled
837 ;----------------------------------------------------------------------
872 ret nc ;INTs were disabled
878 ;----------------------------------------------------------------------
916 global mm_sio0, mm_sio1
918 @cbnk: db 0 ; current bank (0..2)
927 ;----------------------------------------------------------------------
937 ;-----------------------------------------------------
943 ;ivtab equ 0ffc0h ; 0ffc0h ;int vector table
947 mark_55AA equ 0 - 2 - 4 ;2 byte for trap stack