X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/50f3b8f0cb6ccbdc5c1ea8f916f3d95b197d3d04..3ba537752998f2d8554cecee5d586fd1a70256b6:/cbios/misc.180 diff --git a/cbios/misc.180 b/cbios/misc.180 index b3e486d..d39f632 100644 --- a/cbios/misc.180 +++ b/cbios/misc.180 @@ -1,9 +1,10 @@ - global intinit - global bufinit - global cpu_frq + public intinit + public bufinit + public cpu_frq + public get_tmr - global fifolst + public fifolst extrn div32_r,?pmsg extrn msg.sm,msg.recv,hwl2phy @@ -94,7 +95,7 @@ cpu_frq: ld hl,0 ld d,h ld e,l - call get_timer + call get_tmr push de push hl @@ -112,7 +113,7 @@ dly_lp: pop hl pop de - call get_timer + call get_tmr ld b,h ld c,l @@ -132,10 +133,11 @@ cpuf_done: ;-------------------------------------------------------------------- -get_timer: + dseg +get_tmr: push de push hl - ld hl,1*256 + 3 ; d = subcommand, e = command + ld hl,1*256 + 3 ; h = subcommand, l = command push hl ld hl,0 add hl,sp @@ -156,12 +158,11 @@ get_timer: ;-------------------------------------------------------------------- - cseg + dseg fifolst: rept 4 dw 0 - db 0 endm ;-------------------------------------------------------------------- @@ -169,85 +170,46 @@ fifolst: dseg bufinit: + ld (ix+o.in_idx),0 ;reset pointers (empty fifo) + ld (ix+o.out_idx),0 ld a,(ix+o.id) - cp 4 - jr nc,bfi_doit2 - ld hl,fifolst ld e,a ld d,0 add hl,de add hl,de - add hl,de - - if 0 - ld e,(hl) - inc hl - ld d,(hl) - dec hl - ld a,e - or d - jr z,bfi_doit - -; TODO: address translation - push de - pop ix - ret - endif - -bfi_doit: push ix pop de -; TODO: address translation + cp 4 + jr nc,bfi_skip + ld (hl),e inc hl ld (hl),d - ld a,(ix+o.id) - or a - jr nz,bfi_doit2 - ld hl,fifolst - ld (040h),hl - ld (040h+2),a - -bfi_doit2: - ld (ix+o.in_idx),0 ;reset pointers - ld (ix+o.out_idx),0 - - push ix ;get phys. address of fifo - pop hl - call hwl2phy +bfi_skip: ex de,hl + call hwl2phy ;get phys. address of fifo ld c,a ld a,(ix+o.id) ;fifo id or a ;test if fifo 0 - jr nz,bfi_1 - - out (AVRINT5),a - ret - -bfi_1: - ld hl,bfi_msg_end - ld (hl),c - dec hl - ld (hl),d - dec hl - ld (hl),e - dec hl - ld (hl),a - dec hl - ld b,bfi_msg_len + ret z + + ld b,a + push bc ;c: bank-addr, b: ignored + push hl ;address + ld c,0 + push bc ;c: function, b:subf + ld b,5 + ld h,c + ld l,c + add hl,sp call msg.sm + pop hl + pop hl + pop hl ret -bfi_msg: - db 0 ;function: 0 - db 0 ;subfunc: gets overwritten with buf id - dw 0 ;physical - db 0 ; address -bfi_msg_len equ $ - bfi_msg -bfi_msg_end equ $ - 1 - ;----------------------------------------------------------------------