home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol236 / boot.mac < prev    next >
Encoding:
Text File  |  1986-02-13  |  4.3 KB  |  148 lines

  1.         title   'Boot loader module for CP/M 3.0'
  2.                                     ; m80 version
  3.  
  4. true    equ -1
  5. false   equ 0
  6.  
  7. banked  equ true
  8.  
  9.         .Z80
  10.  
  11.         entry    ?init,?ldccp,?rlccp,?time
  12.         external ?pmsg,?conin,?pdec
  13.         external @civec,@covec,@aivec,@aovec,@lovec
  14.         external @scb24,@scb76,@scb77,@scb78,@scb80
  15.                    if banked
  16.         external ?trans,@xmvst
  17.                    endif
  18.  
  19. bdos    equ 5
  20. cr      equ 13
  21. lf      equ 10
  22. nblk    equ 32                      ; number of 128 bytes in CCP
  23.  
  24.         dseg
  25.  
  26. ?init:
  27.         ld hl,08000h 
  28.         ld (@covec),hl              ; assign co to screen
  29.         ld hl,04000h
  30.         ld (@civec),hl              ; assign ci to keyboard
  31.         ld hl,02000h 
  32.         ld (@lovec),hl              ; assign lo to printer
  33.         ld hl,01000h 
  34.         ld (@aivec),hl
  35.         ld (@aovec),hl              ; assign aux to modem
  36.                    if banked
  37.         xor a
  38.         ld (@xmvst),a               ; clear xmove status
  39.                    endif
  40.                                     ; load system control block values
  41.         ld hl,16
  42.         ld (@scb24),hl              ; sub,com search order
  43.         ld hl,0
  44.         ld (@scb76),hl              ; search default disk
  45.         ld hl,1
  46.         ld (@scb77),hl              ; search disk A
  47.         ld hl,255
  48.         ld (@scb78),hl              ; end of search
  49.         ld hl,4
  50.         ld (@scb80),hl              ; disk D is temporary disk
  51.         ld hl,signon
  52.         call ?pmsg                  ; print signon message
  53.         ret
  54.  
  55.     ;   This version of the boot loader loads the CCP from a file
  56.     ;   called CCP.COM on the system drive (A:).
  57.         cseg
  58. ?ldccp:
  59.         ; First time, load the A:CCP.COM file into TPA
  60.  
  61.         xor a 
  62.         ld (ccpfcb+15),a                ; zero extent
  63.         ld hl,0 
  64.         ld (fcbnr),hl                   ; start at beginning of file
  65.         ld de,ccpfcb 
  66.         call open                       ; open file containing CCP
  67.         inc a 
  68.         jp z,noCCP                      ; error if no file...
  69.         ld de,0100h 
  70.         call setdma                     ; start of TPA
  71.         ld de,nblk 
  72.         call setmul                     ; allow up to nblk*128 bytes
  73.         ld de,ccpfcb 
  74.         call read                       ; load the thing
  75.  
  76.                    if banked
  77.                                         ; store ccp in bank 2
  78.         ld c,1                          ; source bank
  79.         ld de,100h                      ; source location
  80.         ld b,2                          ; destination bank
  81.         ld hl,0                         ; destination location
  82.         ld a,nblk                       ; number of blocks
  83.         call ?trans                     ; do copy
  84.         ret
  85.                    else
  86.         ld hl,100h
  87.         ld de,0e800h
  88.         ld bc,128*nblk
  89.         ldir
  90.         ret
  91.                    endif
  92.  
  93. noCCP:                                  ; here if we couldn't find the file
  94.         ld hl,ccpmsg 
  95.         call ?pmsg                      ; report this...
  96.         call ?conin                     ; get a response
  97.         jp ?ldccp                       ; and try again
  98.  
  99. ?rlccp:                                 ; copy ccp from bank 2
  100.                    if banked
  101.         ld c,2                          ; source bank
  102.         ld de,0                         ; source location
  103.         ld b,1                          ; destination bank
  104.         ld hl,100h                      ; destination location
  105.         ld a,nblk                       ; number of blocks
  106.         call ?trans                     ; do copy
  107.         ret
  108.                    else
  109.         ld hl,0e800h
  110.         ld de,100h
  111.         ld bc,128*nblk
  112.         ldir
  113.         ret
  114.                    endif
  115.  
  116. ?time:
  117.         ret
  118.  
  119.         ; CP/M BDOS Function Interfaces
  120.  
  121. open:
  122.         ld c,15 
  123.         jp bdos                         ; open file control block
  124.  
  125. setdma:
  126.         ld c,26 
  127.         jp bdos                         ; set data transfer address
  128.  
  129. setmul:
  130.         ld c,44 
  131.         jp bdos                         ; set record count
  132.  
  133. read:
  134.         ld c,20 
  135.         jp bdos                         ; read records
  136.  
  137.  
  138. signon:         db      cr,lf,cr,lf,'CP/M Version 3.0',cr,lf,0
  139.  
  140. ccpmsg:         db      cr,lf,'BIOS Err on A: No CCP.COM file',0
  141.  
  142.  
  143. ccpfcb:         db      1,'CCP     ','COM',0,0,0,0
  144.                 ds      16
  145. fcbnr:          db      0,0,0
  146.  
  147.         end
  148.