X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/aeb747d4d09db894700b4c7e53323284f20dece2..e8a98308cd28da296993a9085df28dc5957de86d:/cbios/bioskrnl.180 diff --git a/cbios/bioskrnl.180 b/cbios/bioskrnl.180 index 6c8366f..0610b31 100644 --- a/cbios/bioskrnl.180 +++ b/cbios/bioskrnl.180 @@ -2,8 +2,8 @@ ; version 1.0 15 Sept 82 - include config.inc - include z180reg.inc + maclib z180reg.inc + maclib config.inc ; Copyright (C), 1982 @@ -44,6 +44,7 @@ ccp equ 0100h ; Console Command Processor gets loaded extrn ?ci,?co,?cist,?cost ; each take device in extrn ?cinit ; (re)initialize device in + extrn ioctl extrn @ctbl ; physical character device table ; disk communication data items @@ -63,7 +64,10 @@ ccp equ 0100h ; Console Command Processor gets loaded extrn ?time ; signal time operation - include modebaud.inc ; define mode bits + extrn stampf + extrn ijphl ; vectored call + + maclib modebaud.inc ; define mode bits ; External names for BIOS entry points @@ -74,7 +78,8 @@ ccp equ 0100h ; Console Command Processor gets loaded public ?conos,?auxis,?auxos,?dvtbl,?devin,?drtbl public ?mltio,?flush,?mov,?tim,?bnksl,?stbnk,?xmov - public bs$stack + extrn bs$stack + extrn _b0call ; BIOS Jump vector. @@ -119,9 +124,17 @@ ccp equ 0100h ; Console Command Processor gets loaded ?stbnk: jp setbnk ; select different bank for disk I/O DMA operations ?xmov: jp ?xmove ; set source and destination banks for one operation + jp stampf ; stamp system specific functions + ; reserved for system implementor jp 0 ; reserved for future expansion jp 0 ; reserved for future expansion - jp 0 ; reserved for future expansion +?ioctl jp ioctl ; + + + rept 48 + db '|' + endm +boot$stack: ; BOOT @@ -134,7 +147,7 @@ boot: out0 (cbr),a ld a,USR$CBAR out0 (cbar),a - ld sp,bs$stack + ld sp,boot$stack call hwinit ; first time hardware initialisation @@ -167,7 +180,7 @@ d$init$loop: ld (@ADRV),bc ; save absolute and relative drive code ld l,(ix-4) ld h,(ix-3) ; get init pointer - call ipchl ; call init routine + call ijphl ; call init routine pop hl ; recover @drv pointer d$init$next: pop bc ; recover counter and drive # @@ -187,7 +200,7 @@ boot$1: ; Entry for system restarts. wboot: - ld sp,bs$stack + ld sp,boot$stack call set$jumps ; initialize page zero call ?rlccp ; reload CCP jp ccp ; then reset jmp vectors and exit to ccp @@ -210,9 +223,6 @@ set$jumps: ret - ds bs$stack$size -bs$stack equ $ - ; DEVTBL ; Return address of character device table @@ -381,12 +391,31 @@ auxin: conin: ld hl,(@civec) + ;check if only one device assigned + + push hl ; save bit vector + ld b,0 +insc_0: + or a ; clear carry + adc hl,hl ; shift out next bit + jr nc,insc_1 ; + jr z,ci$rdy ; single device + jr ci$check ; + +insc_1: + inc b ; else, next device + ld a,h + or l ; see if any more devices + jr nz,insc_0 ; no, + pop hl + in$scan: push hl ; save bit vector ld b,0 ci$next: xor a ; assume next device not ready add hl,hl ; shift out next bit +ci$check: call c,cist1 ; see if the device has a character jr nz,ci$rdy ; this device has a character inc b ; else, next device @@ -404,12 +433,6 @@ ci$rdy: ;------------------------------------------------------------------------------- ; Utility Subroutines - -ipchl: ; vectored CALL point - jp (hl) - - - ; BNKSEL ; Bank Select. Select CPU bank for further execution. @@ -461,7 +484,10 @@ seldsk: inc hl ld h,(hl) ld l,a - call ipchl ; call LOGIN + ld (bs$stack),sp + ld sp,bs$stack + call ijphl ; call LOGIN + ld sp,(bs$stack) notfirst: ld hl,(@xdph) ; recover DPH pointer ret @@ -539,13 +565,16 @@ sectrn: ; extended disk parameter header (XDPH). read: + ld (bs$stack),sp + ld sp,bs$stack ld a,1 ld (@op),a ld ix,(@xdph) ; get drive descriptor pointer ld l,(ix-8) ; get read routine entry ld h,(ix-7) - jp (hl) - + call ijphl ; call LOGIN + ld sp,(bs$stack) + ret ; WRITE ; Write physical sector from currently selected drive. @@ -553,12 +582,16 @@ read: ; extended disk parameter header (XDPH). write: + ld (bs$stack),sp + ld sp,bs$stack ld a,2 ld (@op),a ld ix,(@xdph) ; get drive descriptor pointer ld l,(ix-10) ; get write routine entry ld h,(ix- 9) - jp (hl) + call ijphl ; call LOGIN + ld sp,(bs$stack) + ret @@ -597,5 +630,4 @@ flush: @cbnk: db 0 ; bank for processor operations - end