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