X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp-cpm3.git/blobdiff_plain/43bb4ff67fde0e90e80b0ad8d96947d90d9a2286..a894545eb628dd3899b970132a29bd87a30e760f:/cbios/bioskrnl.180 diff --git a/cbios/bioskrnl.180 b/cbios/bioskrnl.180 index 2a00c90..39927be 100644 --- a/cbios/bioskrnl.180 +++ b/cbios/bioskrnl.180 @@ -20,9 +20,6 @@ ; can be combined to support a particular system ; configuration. -cr equ 13 -lf equ 10 -bell equ 7 ctlQ equ 'Q'-'@' ctlS equ 'S'-'@' @@ -65,22 +62,12 @@ ccp equ 0100h ; Console Command Processor gets loaded extrn ?time ; signal time operation - ; general utility routines - - public ?pmsg ; print message - public pr.dec,pr.decl ; print 16 or 32 bit decimal number - public ?pderr ; print BIOS disk error message header - public pr.inln,pr.crlf ; print message inline - public phex4,phex2 ; print 4 digit hex (HL), or 2 digit hex (A) - - extrn div32_16 ; divide 32 bit by 16 bit number - include modebaud.inc ; define mode bits ; External names for BIOS entry points - public ?boot,?wboot,?const,?conin,?cono,?list,?auxo,?auxi + public ?boot,?wboot,boot,?const,?conin,?cono,?list,?auxo,?auxi public ?home,?sldsk,?sttrk,?stsec,?stdma,?read,?write public ?lists,?sctrn public ?conos,?auxis,?auxos,?dvtbl,?devin,?drtbl @@ -142,6 +129,10 @@ ccp equ 0100h ; Console Command Processor gets loaded dseg ; this part can be banked boot: + ld a,SYS$CBR + out0 (cbr),a + ld a,USR$CBAR + out0 (cbar),a ld sp,bs$stack call hwinit ; first time hardware initialisation @@ -169,27 +160,13 @@ d$init$loop: or d jr z,d$init$next ; if null, no drive push hl ; save @drv pointer - if 0 - ex de,hl ; XDPH address in - dec hl - dec hl - ld b,(hl) ; get relative drive code - ld (@ADRV),bc ; save absolute and relative drive code - dec hl ; point to init pointer - ld d,(hl) - dec hl - ld e,(hl) ; get init pointer - ex de,hl - call ipchl ; call init routine - else push de - pop ix + pop ix ; XDPH address in ld b,(ix-2) 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 - endif pop hl ; recover @drv pointer d$init$next: pop bc ; recover counter and drive # @@ -232,7 +209,7 @@ set$jumps: ret - ds 64 + ds bs$stack$size bs$stack equ $ @@ -253,13 +230,12 @@ getdrv: - ; CONOUT - ; Console Output. Send character in - ; to all selected devices - -conout: + ; LIST + ; List Output. Send character in + ; to all selected devices. - ld hl,(@covec) ; fetch console output bit vector +list: + ld hl,(@lovec) ; fetch list output bit vector jr out$scan @@ -272,12 +248,13 @@ auxout: jr out$scan - ; LIST - ; List Output. Send character in - ; to all selected devices. + ; CONOUT + ; Console Output. Send character in + ; to all selected devices -list: - ld hl,(@lovec) ; fetch list output bit vector +conout: + + ld hl,(@covec) ; fetch console output bit vector out$scan: ld b,0 ; start with device 0 @@ -285,12 +262,12 @@ co$next: add hl,hl ; shift out next bit jr nc,not$out$device push hl ; save the vector - push bc ; save the count and character -not$out$ready: - call coster - or a - jp z,not$out$ready - pop bc +; push bc ; save the count and character +;not$out$ready: +; call coster +; or a +; jr z,not$out$ready +; pop bc push bc ; restore and resave the character and device call ?co ; if device selected, print it pop bc ; recover count and character @@ -303,13 +280,13 @@ not$out$device: ret - ; CONOST - ; Console Output Status. Return true if - ; all selected console output devices + ; LISTST + ; List Output Status. Return true if + ; all selected list output devices ; are ready. -conost: - ld hl,(@covec) ; get console output bit vector +listst: + ld hl,(@lovec) ; get list output bit vector jr ost$scan @@ -323,13 +300,13 @@ auxost: jr ost$scan - ; LISTST - ; List Output Status. Return true if - ; all selected list output devices + ; CONOST + ; Console Output Status. Return true if + ; all selected console output devices ; are ready. -listst: - ld hl,(@lovec) ; get list output bit vector +conost: + ld hl,(@covec) ; get console output bit vector ost$scan: ld b,0 ; start with device 0 @@ -410,16 +387,6 @@ ci1: ; get input, saving & ret - ; CONST - ; Console Input Status. Return true if - ; any selected console input device - ; has an available character. - -const: - ld hl,(@civec) ; get console input bit vector - jr ist$scan - - ; AUXIST ; Auxiliary Input Status. Return true if ; any selected auxiliary input device @@ -427,6 +394,16 @@ const: auxist: ld hl,(@aivec) ; get aux input bit vector + jr ist$scan + + + ; CONST + ; Console Input Status. Return true if + ; any selected console input device + ; has an available character. + +const: + ld hl,(@civec) ; get console input bit vector ist$scan: ld b,0 ; start with device 0 @@ -444,21 +421,21 @@ cis$next: ret - ; CONIN - ; Console Input. Return character from first - ; ready console input device. - -conin: - ld hl,(@civec) - jr in$scan - - ; AUXIN ; Auxiliary Input. Return character from first ; ready auxiliary input device. auxin: ld hl,(@aivec) + jr in$scan + + + ; CONIN + ; Console Input. Return character from first + ; ready console input device. + +conin: + ld hl,(@civec) in$scan: push hl ; save bit vector @@ -489,189 +466,6 @@ ipchl: ; vectored CALL point jp (hl) -;------------------------------------------------------------------------------- -; print message @ up to a null -; saves & - -?pmsg: - push bc - push de -pmsg$loop: - ld a,(hl) - or a - jr z,pmsg$exit - ld c,a - push hl - call ?cono - pop hl - inc hl - jr pmsg$loop -pmsg$exit: - pop de - pop bc - ret - -;------------------------------------------------------------------------------- -; print message inline up to a null -; saves all registers - -pr.inln: - ex (sp),hl - push af - call ?pmsg - pop af - ex (sp),hl - ret - -;------------------------------------------------------------------------------- -; print -; saves all registers - -pr.crlf: - call pr.inln - db 13,10,0 - ret - -;------------------------------------------------------------------------------- -; print hl as a 4 digit hexadecimal number -; saves all registers - -phex4: - ld a,h - call phex2 - ld a,l - ; fall thru - -;------------------------------------------------------------------------------- -; print a as a 2 digit hexadecimal number -; saves all registers - -phex2: - push af - rra - rra - rra - rra - call print.digit - pop af - -print.digit: - push hl - push de - push bc - push af - and 00fh - cp 10 - jr c,prd_1 - add a,007h -prd_1: - add a,'0' - - ld c,a - call ?cono - pop af - pop bc - pop de - pop hl - ret - - -;------------------------------------------------------------------------------- -; print decimal 16 bit number from HL -; -; HL: unsigned binary number to print -; C: minimum print field width -; number is prined right-aligned -; B: pad character, typically ' ' or '0' - -pr.dec: - push de - ld de,0 - call pr.decl - pop de - ret - -;------------------------------------------------------------------------------- -; print decimal 32 bit number from DEHL -; -; DEHL: unsigned binary number to print -; C: minimum print field width -; number is prined right-aligned -; B: pad character, typically ' ' or '0' - -pr.decl: - push bc ;save width and fillchar - push bc - exx ;(alt) - ex (sp),hl ;save hl', get width and fill - push de ;save de' - - xor a - ld d,a ;clear counter - ld e,a - push af ; string terminator - inc sp - -prd_divloop: ;do - exx ; (main) - ld bc,10 ; - call div32_16 ; get a digit - ld a,c ; - add a,'0' ; make it printable - push af ; - - ld a,h ; - or l ; - or d ; - or e ; - exx ; (alt) - inc sp ; - inc de ; - jr nz,prd_divloop ; - -prd_filloop: ;h=filler, l=field width - ld a,e - cp l - jr nc,prd_out - push hl - inc sp - inc de - jr prd_filloop -prd_out: - ld hl,0 - add hl,sp ;ptr to beginning of number string (hl==0 here) - call ?pmsg - ex de,hl - add hl,sp - ld sp,hl - inc sp ;remove string terminator - pop de - pop hl - exx ;(main) - pop bc - ret - - -;------------------------------------------------------------------------------- -; -?pderr: - ld hl,drive$msg - call ?pmsg ; error header - ld a,(@adrv) - add a,'A' - ld c,a - call ?cono ; drive code - ld hl,track$msg - call ?pmsg ; track header - ld c,0 - ld hl,(@trk) - call pr.dec ; track number - ld hl,sector$msg - call ?pmsg ; sector header - ld hl,(@sect) - call pr.dec ; sector number - ret - ; BNKSEL ; Bank Select. Select CPU bank for further execution. @@ -686,12 +480,8 @@ xofflist: db -1,-1,-1,-1,-1,-1,-1,-1 ; ctl-s clears to zero db -1,-1,-1,-1,-1,-1,-1,-1 - - dseg ; following resides in banked memory - - ; Disk I/O interface routines @@ -842,13 +632,6 @@ flush: ret ; return with no error - - ; error message components -drive$msg: db cr,lf,bell,'BIOS Error on ',0 -track$msg: db ': T-',0 -sector$msg: db ', S-',0 - - ; disk communication data items ; do not change order. sd driver depends on this