]> cloudbase.mooo.com Git - z180-stamp-cpm3.git/blobdiff - cbios/boot.180
New memory map: bank 1 and common are now contiguous
[z180-stamp-cpm3.git] / cbios / boot.180
index 99a8733304b47cc19e161e9ac40c0eda1f0a79c7..2a43b75671a8bc0b88ae76a35248fa1646ca5bfa 100644 (file)
@@ -6,7 +6,7 @@
 \r
        public  f_cpu\r
 \r
 \r
        public  f_cpu\r
 \r
-       extrn   ?boot,?conin\r
+       extrn   boot,?conin\r
        extrn   pr.inln,pr.crlf,pr.dec,pr.decl\r
        extrn   ioini1l,msginit,mmuinit,intinit,cpu_frq\r
        extrn   prt0ini,gs_rtc\r
        extrn   pr.inln,pr.crlf,pr.dec,pr.decl\r
        extrn   ioini1l,msginit,mmuinit,intinit,cpu_frq\r
        extrn   prt0ini,gs_rtc\r
        include z180reg.inc\r
 \r
 \r
        include z180reg.inc\r
 \r
 \r
-bdos   equ     5\r
-\r
 ccpsize        equ     0c80h\r
 \r
 ccpsize        equ     0c80h\r
 \r
+       ; CP/M BDOS Function Interfaces\r
+\r
+resetdsk       equ     13\r
+open           equ     15\r
+read           equ     20\r
+setdma         equ     26\r
+setmulti       equ     44\r
+bdos           equ     5\r
+\r
+\r
         if     banked\r
 tpa$bank equ   1\r
         else\r
         if     banked\r
 tpa$bank equ   1\r
         else\r
@@ -37,11 +45,10 @@ hwinit:
        ld      hl,hwini_tab\r
        call    ioini1l\r
        ld      a,0c3h\r
        ld      hl,hwini_tab\r
        call    ioini1l\r
        ld      a,0c3h\r
-       ld      hl,?boot\r
+       ld      hl,boot\r
        ld      (0),a\r
        ld      (1),hl\r
 hwini_skip:\r
        ld      (0),a\r
        ld      (1),hl\r
 hwini_skip:\r
-       call    mmuinit         ; setup mmu registers\r
        call    msginit\r
        call    cpu_frq\r
        ld      (f_cpu),hl\r
        call    msginit\r
        call    cpu_frq\r
        ld      (f_cpu),hl\r
@@ -49,7 +56,8 @@ hwini_skip:
        ret\r
 \r
 ?init:\r
        ret\r
 \r
 ?init:\r
-       ld      hl,0100000000000000b    ; assign console to ASCI1:\r
+;      ld      hl,1000000000000000b    ; assign console to AVRCON:\r
+       ld      hl,0100000000000000b    ; assign console to ASCI0:\r
        ld      (@civec),hl\r
        ld      (@covec),hl\r
        ld      hl,0000000000000000b    ; assign printer to nothing:\r
        ld      (@civec),hl\r
        ld      (@covec),hl\r
        ld      hl,0000000000000000b    ; assign printer to nothing:\r
@@ -59,11 +67,11 @@ hwini_skip:
        ld      (@aovec),hl\r
 \r
 \r
        ld      (@aovec),hl\r
 \r
 \r
-       ld      c,2\r
-       call    gs_rtc                  ; get time and date\r
        call    intinit                 ; setup interrupts and vectors\r
        call    prt0ini                 ; init timer\r
        ei\r
        call    intinit                 ; setup interrupts and vectors\r
        call    prt0ini                 ; init timer\r
        ei\r
+       ld      c,2\r
+       call    gs_rtc                  ; get time and date\r
 \r
        xor     a\r
        ld      (@cbnk),a               ; right now in bank 0\r
 \r
        xor     a\r
        ld      (@cbnk),a               ; right now in bank 0\r
@@ -72,7 +80,7 @@ hwini_skip:
        db      13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0\r
 \r
        call    pr.inln\r
        db      13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0\r
 \r
        call    pr.inln\r
-       db      'CPU clock [Hz]: ',0\r
+       db      'Estimated CPU clock [Hz]: ',0\r
 \r
        ld      hl,(f_cpu)\r
        ld      de,(f_cpu+2)\r
 \r
        ld      hl,(f_cpu)\r
        ld      de,(f_cpu+2)\r
@@ -89,21 +97,26 @@ hwini_skip:
 \r
 ?ldccp:\r
                                ; First time, load the A:CCP.COM file into TPA\r
 \r
 ?ldccp:\r
                                ; First time, load the A:CCP.COM file into TPA\r
-       call    resetdsk\r
+       ld      c,resetdsk\r
+       call    bdos\r
        xor     a\r
        ld      (ccp$fcb+15),a  ; zero extent\r
        ld      hl,0\r
        ld      (fcb$nr),hl     ; start at beginning of file\r
        ld      de,ccp$fcb\r
        xor     a\r
        ld      (ccp$fcb+15),a  ; zero extent\r
        ld      hl,0\r
        ld      (fcb$nr),hl     ; start at beginning of file\r
        ld      de,ccp$fcb\r
-       call    open            ; open file containing CCP\r
+       ld      c,open          ; open file containing CCP\r
+       call    bdos\r
        inc     a\r
        jp      z,no$ccp        ; error if no file...\r
        ld      de,0100h\r
        inc     a\r
        jp      z,no$ccp        ; error if no file...\r
        ld      de,0100h\r
-       call    setdma          ; start of TPA\r
+       ld      c,setdma                ; start of TPA\r
+       call    bdos\r
        ld      de,128\r
        ld      de,128\r
-       call    setmulti        ; allow up to 16k bytes\r
+       ld      c,setmulti      ; allow up to 16k bytes\r
+       call    bdos\r
        ld      de,ccp$fcb\r
        ld      de,ccp$fcb\r
-       call    read            ; load the thing\r
+       ld      c,read          ; load the thing\r
+       call    bdos            ; read records\r
                                ; now,\r
                                ;   copy CCP to bank 0 for reloading\r
        ld      hl,0100h\r
                                ; now,\r
                                ;   copy CCP to bank 0 for reloading\r
        ld      hl,0100h\r
@@ -119,11 +132,8 @@ ld$1:
        call    ?bnksl          ; select extra bank\r
        pop     af\r
        ld      (hl),a          ; save the byte\r
        call    ?bnksl          ; select extra bank\r
        pop     af\r
        ld      (hl),a          ; save the byte\r
-       inc     hl\r
-       dec     bc              ; bump pointer, drop count\r
-       ld      a,b\r
-       or      c               ; test for done\r
-       jp      nz,ld$1\r
+       cpi                     ; bump pointer, drop count\r
+       jp      pe,ld$1\r
        pop     af\r
        call    ?bnksl          ; restore original bank\r
        ret\r
        pop     af\r
        call    ?bnksl          ; restore original bank\r
        ret\r
@@ -142,44 +152,17 @@ no$ccp:                           ; here if we couldn't find the file
 rl$1:\r
        ld      a,2\r
        call    ?bnksl          ; select extra bank\r
 rl$1:\r
        ld      a,2\r
        call    ?bnksl          ; select extra bank\r
-       ld      a,(hl)\r
-       push    af              ; get a byte\r
+       ld      a,(hl)          ; get a byte\r
+       ex      af,af'\r
        ld      a,tpa$bank\r
        call    ?bnksl          ; select TPA\r
        ld      a,tpa$bank\r
        call    ?bnksl          ; select TPA\r
-       pop     af\r
+       ex      af,af'\r
        ld      (hl),a          ; save the byte\r
        ld      (hl),a          ; save the byte\r
-       inc     hl\r
-       dec     bc              ; bump pointer, drop count\r
-       ld      a,b\r
-       or      c               ; test for done\r
-       jp      nz,rl$1\r
+       cpi                     ; bump pointer, drop count\r
+       jp      pe,rl$1\r
        ret\r
 \r
 \r
        ret\r
 \r
 \r
-       ; CP/M BDOS Function Interfaces\r
-\r
-resetdsk:\r
-       ld      c,13\r
-       jp      bdos            ; reset disk system\r
-\r
-open:\r
-       ld      c,15\r
-       jp      bdos            ; open file control block\r
-\r
-setdma:\r
-       ld      c,26\r
-       jp      bdos            ; set data transfer address\r
-\r
-setmulti:\r
-       ld      c,44\r
-       jp      bdos            ; set record count\r
-\r
-read:\r
-       ld      c,20\r
-       jp      bdos            ; read records\r
-\r
-\r
-\r
 ccp$fcb:db     1,'CCP     ','COM',0,0,0,0\r
        ds      16\r
 fcb$nr:        db      0,0,0\r
 ccp$fcb:db     1,'CCP     ','COM',0,0,0,0\r
        ds      16\r
 fcb$nr:        db      0,0,0\r