home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / repair.lbr / PHYCP.1Z0 / PHYCP.180
Encoding:
Text File  |  1993-10-25  |  14.1 KB  |  773 lines

  1.     title    PHYCP (PHYsical CoPy) disk utility 
  2. ; Program:  PHYCP
  3. ; Author:   Malcom Kemp
  4. ; Date:     December 27, 1987
  5. ; Version:  1.0
  6. ;
  7. vers    equ    1        ; Version number 
  8.  
  9. ctrl_c    equ    3
  10. lf    equ    10
  11. cr    equ    13
  12. no    equ    0
  13. yes    equ    not no
  14.  
  15. wboot    equ    0        ; Warm boot
  16. bdos    equ    5        ; BDOS entry 
  17. dfcb    equ    5Ch        ; Default FCB
  18. dfcb2    equ    6Ch        ; Second file
  19. dbuf    equ    80h        ; Default buffer
  20. llrec        equ    128        ; Length of logical record
  21.  
  22. wrty_dw    equ    1        ; Directory write
  23. wrty_un    equ    2        ; Unallocated write
  24.  
  25.     public    $memry
  26.     extrn    print,pstr,pa2hc,padc,phl4hc,phldc,cout,pafdc,phlfdc
  27.     extrn    retud,logud
  28.     extrn    z3vinit,tinit
  29.     extrn    cin,caps
  30.     extrn    cls,ereol,gxymsg,at,gotoxy,vprint
  31.     extrn    bbline,zfname,eval10
  32.  
  33.     maclib    xcpm
  34.     maclib    xsys
  35.  
  36. test    equ    no
  37.  
  38.  
  39.  
  40. ; Start of routine
  41. ;
  42. ; Environment Definition
  43. ;
  44. z3env     equ    0FE00h        ; Environment descriptor
  45. ;
  46. ; External ZCPR3 Environment Descriptor
  47. ;
  48.     jp    start
  49.     db    'Z3ENV'        ; This is a zcpr3 utility
  50.     db    1        ; External environment descriptor
  51. z3eadr:
  52.     dw    z3env
  53.  
  54. start:
  55.     ld    hl,(z3eadr)    ; Hl -> zcpr3 environment
  56.  
  57.     call    z3vinit
  58.     call    tinit
  59.  
  60. ; Get our home user/disk
  61.  
  62.     call    retud
  63.     ld    (home_ud),bc
  64.     ld    (dos_ud),bc    ; Initialize parameter
  65.  
  66.     ld    hl,(bdos+1)    ; Get protect address
  67.     ld    l,0        ; Make page aligned
  68.     dec    h        ; Leave room for stack
  69.     ld    (top),hl    ; And save for memory allocator
  70.     ld    sp,(bdos+1)    ; Set stack
  71.     ld    hl,($memry)
  72.     ld    (bottom),hl    ; Set bottom of memory
  73.     ld    (group_buf),hl    ; Just use this memory
  74.  
  75.     ld    a,(dfcb)    ; Get input disk
  76.     or    a,a        ; See if we have one
  77.     jp    z,baddisk
  78.     dec    a
  79.     cp    a,'P'-'A'+1
  80.     jp    nc,baddisk
  81.     ld    (ifp+disk),a    ; save
  82.  
  83.     ld    a,(dfcb2)    ; Get output disk
  84.     or    a,a        ; See if we have one
  85.     jp    z,baddisk
  86.     dec    a
  87.     cp    a,'P'-'A'+1
  88.     jp    nc,baddisk
  89.     ld    (ofp+disk),a    ; Save for i/o
  90.  
  91.      if    test
  92.       call    print
  93.      db    cr,lf,'PHYCP drive ',0
  94.      push    af
  95.      add    a,'A'
  96.      call    cout
  97.      pop    af
  98.      endif
  99.  
  100.     ld    ix,ifp
  101.     call    getdpb        ; Initialize input DPB structure
  102.     ld    ix,ofp
  103.     call    getdpb        ; Initialize output DPB structure
  104.  
  105. ; Test for compatibility
  106.  
  107.     ld    a,(ifp+dpb+dpb_bs)
  108.     ld    b,a
  109.     ld    a,(ofp+dpb+dpb_bs)
  110.     cp    a,b
  111.     jp    nz,bserr
  112.     ld    a,(ifp+dpb+dpb_bm)
  113.     ld    b,a
  114.     ld    a,(ofp+dpb+dpb_bm)
  115.     cp    a,b
  116.     jp    nz,bmerr
  117.     ld    a,(ifp+dpb+dpb_em)
  118.     ld    b,a
  119.     ld    a,(ofp+dpb+dpb_em)
  120.     cp    a,b
  121.     jp    nz,emerr
  122.     ld    hl,(ifp+dpb+dpb_maxb)
  123.     ld    de,(ofp+dpb+dpb_maxb)
  124.     or    a,a
  125.     sbc    hl,de
  126.     jp    nz,maxberr
  127.     ld    hl,(ifp+dpb+dpb_dire)
  128.     ld    de,(ofp+dpb+dpb_dire)
  129.     or    a,a
  130.     sbc    hl,de
  131.     jp    nz,direerr
  132.     ld    hl,(ifp+dpb+dpb_allblk)
  133.     ld    de,(ofp+dpb+dpb_allblk)
  134.     or    a,a
  135.     sbc    hl,de
  136.     jp    nz,allblkerr
  137.  
  138. do_copy    .new
  139.     call    print
  140.     db    cr,lf,lf,'Physical Copy Disk "',0
  141.     ld    a,(ifp+disk)
  142.     add    a,'A'
  143.     call    cout
  144.     call    print
  145.     db    '" to Disk "',0
  146.     ld    a,(ofp+disk)
  147.     add    a,'A'
  148.     call    cout
  149.     call    print
  150.     db    '", Destroying Disk "',0
  151.     call    cout
  152.     call    print
  153.     db    '".  Continue (Y or N)?',0
  154.     call    cin_cc
  155.     cp    a,'Y'
  156.     jp    nz,exit
  157.  
  158.     ld    bc,0        ; Load counter
  159. 1$:
  160.     ld    hl,(ifp+dpb+dpb_maxb)
  161.     or    a,a        ; Clear carry
  162.     sbc    hl,bc        ; Test for end
  163.     jr    c,do_copy_end
  164.     push    bc
  165.     pop    hl
  166.     call    print
  167.     db    cr,lf,'Group ',0
  168.     call    phlfdc
  169.  
  170.     push    bc
  171.     call    readgr
  172.     pop    bc
  173.     jr    nz,2$
  174.     push    bc
  175.     call    writegr
  176.     pop    bc
  177.     jr    nz,3$
  178.     inc    bc
  179.     jr    1$        ; Do next one
  180.  
  181. msg1:    db    'read group',0
  182. msg2:    db    'write group',0
  183.  
  184. 2$:
  185.     ld    hl,msg1
  186.     jr    4$
  187. 3$:
  188.     ld    hl,msg2
  189. 4$:
  190.     call    print
  191.     db    cr,lf,'Error: ',0
  192.     call    pstr
  193.  
  194. do_copy_end:
  195.     ld    hl,(home_ud)
  196.     ld    (dos_ud),hl    ; Set to default UD
  197.     call    log_default
  198.     call    print
  199.     db    cr,lf,'Copy complete.',0
  200.     jp    exit
  201.     
  202. ;
  203. ; Read group
  204. ;  Input:
  205. ;    BC = group number
  206. ;
  207. readgr:    .new
  208.     ld    hl,(group_buf)        ; Get buffer address
  209.     ld    (curdma),hl        ; And save
  210.  
  211.     ld    hl,(ifp+dpb+dpb_maxb)    ; Get maximum block
  212.     inc    hl            ; +1
  213.     or    a,0FFh            ; Clear carry, set return error status
  214.     sbc    hl,bc
  215.     ret    c            ; Bad block number
  216.  
  217.     push    bc
  218.     pop    hl            ; Get Group number in HL
  219.  
  220.      if    test
  221.      call    print
  222.      db    cr,lf,' grp:',0
  223.      call    phl4hc
  224.      endif
  225.  
  226.     ld    a,(ifp+sec_grp)        ; Sectors/group
  227.     ld    e,a            ; Into E
  228.     call    mlt16x8            ; Find sector number
  229.     ld    a,(ifp+dpb+dpb_spt)    ; Sectors per track
  230.     ld    e,a            ; Into E
  231.     call    div16x8            ; Assume sectors < 16 bits
  232.                     ; HL = track, E = Sector
  233.     ld    a,e
  234.     ld    (cursec),a        ; Save sector
  235.     ld    de,(ifp+dpb+dpb_tbfdir)    ; Add in tracks before directory
  236.     add    hl,de
  237.     ld    (curtrk),hl        ; Save track
  238.     ld    a,(ifp+disk)        ; Get our target disk
  239.     ld    c,a
  240.     ld    b,0            ; Load BC with disk
  241.     ld    e,1            ; Show no new mount
  242.     ld    hl,(wboot+1)
  243.     ld    l,b_seldsk        ; Get bios entry
  244.     call    callhl            ; And go there
  245.  
  246.     ld    a,(ifp+sec_grp)        ; Get number of sectors to be read
  247.     ld    b,a            ; Into counter
  248. 1$:
  249.  
  250.      if    test
  251.      call    print
  252.      db    ' trk:',0
  253.      ld    hl,(curtrk)
  254.      call    phl4hc
  255.      call    print
  256.      db    ' sec:',0
  257.      ld    a,(cursec)
  258.      call    pa2hc
  259.      endif
  260.  
  261.     push    bc            ; Save counter
  262.     ld    bc,(curtrk)
  263.     ld    hl,(wboot+1)
  264.     ld    l,b_settrk
  265.     call    callhl            ; Set track
  266.  
  267.     ld    bc,(cursec)        ; Get logical sector
  268.     ld    b,0            ; Sector is only one byte
  269.     ld    de,(ifp+skew)        ; Get skew
  270.     ld    hl,(wboot+1)
  271.     ld    l,b_sectran        ; Get entry
  272.     call    callhl            ; Get our physical sector
  273.  
  274.     ld    b,h
  275.     ld    c,l            ; Put physical sector in BC
  276.     ld    hl,(wboot+1)
  277.     ld    l,b_setsec        ; Get entry
  278.     call    callhl            ; And set sector
  279.  
  280.     ld    bc,(curdma)        ; Get DMA
  281.     ld    hl,(wboot+1)
  282.     ld    l,b_setdma        ; Get entry
  283.     call    callhl            ; And set DMA
  284.  
  285.  
  286.     ld    hl,(wboot+1)
  287.     ld    l,b_read        ; Get entry
  288.     call    callhl            ; And read record
  289.     or    a,a            ; Check status
  290.     ret    nz            ; Had a problem
  291.  
  292.     ld    hl,(curdma)
  293.     ld    de,llrec
  294.     add    hl,de
  295.     ld    (curdma),hl        ; Bump up DMA
  296.  
  297.     ld    a,(ifp+dpb+dpb_spt)    ; Get sectors per track
  298.     ld    b,a            ; Into B
  299.     ld    a,(cursec)
  300.     inc    a            ; Bump up sector
  301.     ld    (cursec),a
  302.     cp    a,b
  303.     jr    c,2$            ; O.K., go on
  304.  
  305.     xor    a,a            ; Get zero
  306.     ld    (cursec),a        ; And set sector to zero
  307.     ld    hl,(curtrk)
  308.     inc    hl
  309.     ld    (curtrk),hl        ; Bump track
  310.  
  311. 2$:
  312.     pop    bc            ; Get our counter
  313.  
  314.      if    test
  315.     dec    b
  316.     jp    nz,1$
  317.      else
  318.     djnz    1$            ; Loop through again
  319.      endif
  320.  
  321.     xor    a,a            ; Set good status
  322.     ret
  323. ;
  324. ; Write group
  325. ;  Input:
  326. ;    IY -> Window index
  327. ;    dfcb is set to file and opened
  328. ;    dos_ud is set to output UD
  329. ;
  330. writegr:    .new
  331.     ld    hl,(group_buf)        ; Get buffer address
  332.     ld    (curdma),hl        ; And save
  333.  
  334.     ld    hl,(ofp+dpb+dpb_maxb)    ; Get maximum block
  335.     inc    hl            ; +1
  336.     or    a,0FFh            ; Clear carry, set return error status
  337.     sbc    hl,bc
  338.     ret    c            ; Bad block number
  339.  
  340.     push    bc
  341.     pop    hl            ; Get Group number in HL
  342.  
  343.      if    test
  344.      call    print
  345.      db    cr,lf,' grp:',0
  346.      call    phl4hc
  347.      endif
  348.  
  349.     ld    a,(ofp+sec_grp)        ; Sectors/group
  350.     ld    e,a            ; Into E
  351.     call    mlt16x8            ; Find sector number
  352.     ld    a,(ofp+dpb+dpb_spt)    ; Sectors per track
  353.     ld    e,a            ; Into E
  354.     call    div16x8            ; Assume sectors < 16 bits
  355.                     ; HL = track, E = Sector
  356.     ld    a,e
  357.     ld    (cursec),a        ; Save sector
  358.     ld    de,(ofp+dpb+dpb_tbfdir)    ; Add in tracks before directory
  359.     add    hl,de
  360.     ld    (curtrk),hl        ; Save track
  361.     ld    a,(ofp+disk)        ; Get our target disk
  362.     ld    c,a
  363.     ld    b,0            ; Load BC with disk
  364.     ld    e,1            ; Show no new mount
  365.     ld    hl,(wboot+1)
  366.     ld    l,b_seldsk        ; Get bios entry
  367.     call    callhl            ; And go there
  368.  
  369.     ld    a,(ofp+sec_grp)        ; Get number of sectors to be read
  370.     ld    b,a            ; Into counter
  371. 1$:
  372.  
  373.      if    test
  374.      call    print
  375.      db    ' trk:',0
  376.      ld    hl,(curtrk)
  377.      call    phl4hc
  378.      call    print
  379.      db    ' sec:',0
  380.      ld    a,(cursec)
  381.      call    pa2hc
  382.      endif
  383.  
  384.     push    bc            ; Save counter
  385.     ld    bc,(curtrk)
  386.     ld    hl,(wboot+1)
  387.     ld    l,b_settrk
  388.     call    callhl            ; Set track
  389.  
  390.     ld    bc,(cursec)        ; Get logical sector
  391.     ld    b,0            ; Sector is only one byte
  392.     ld    de,(ofp+skew)        ; Get skew
  393.     ld    hl,(wboot+1)
  394.     ld    l,b_sectran        ; Get entry
  395.     call    callhl            ; Get our physical sector
  396.  
  397.     ld    b,h
  398.     ld    c,l            ; Put physical sector in BC
  399.     ld    hl,(wboot+1)
  400.     ld    l,b_setsec        ; Get entry
  401.     call    callhl            ; And set sector
  402.  
  403.     ld    bc,(curdma)        ; Get DMA
  404.     ld    hl,(wboot+1)
  405.     ld    l,b_setdma        ; Get entry
  406.     call    callhl            ; And set DMA
  407.  
  408.  
  409.     ld    hl,(wboot+1)
  410.     ld    l,b_write        ; Get entry
  411.     pop    bc
  412.     push    bc            ; Get count
  413.     ld    c,wrty_un
  414.     djnz    2$            ; See if this is last one
  415.     ld    c,wrty_dw        ; Yes, make it a directory write
  416. 2$:
  417.     call    callhl            ; And write record
  418.     or    a,a            ; Check status
  419.     ret    nz            ; Had a problem
  420.  
  421.     ld    hl,(curdma)
  422.     ld    de,llrec
  423.     add    hl,de
  424.     ld    (curdma),hl        ; Bump up DMA
  425.  
  426.     ld    a,(ofp+dpb+dpb_spt)    ; Get sectors per track
  427.     ld    b,a            ; Into B
  428.     ld    a,(cursec)
  429.     inc    a            ; Bump up sector
  430.     ld    (cursec),a
  431.     cp    a,b
  432.     jr    c,3$            ; O.K., go on
  433.  
  434.     xor    a,a            ; Get zero
  435.     ld    (cursec),a        ; And set sector to zero
  436.     ld    hl,(curtrk)
  437.     inc    hl
  438.     ld    (curtrk),hl        ; Bump track
  439.  
  440. 3$:
  441.     pop    bc            ; Get our counter
  442.  
  443.      if    test
  444.     dec    b
  445.     jp    nz,1$
  446.     call    cin_cc
  447.      else
  448.     djnz    1$            ; Loop through again
  449.      endif
  450.  
  451.     xor    a,a            ; Set good status
  452.     ret
  453.  
  454. ;
  455. ; Get disk parameter block--fill in skew, dpb structure
  456. ;  Call:
  457. ;    IX -> file parameters
  458. ;  Destroys all registers
  459. ;
  460. getdpb:    .new
  461.     ld    a,(ix+disk)        ; Get disk
  462.     ld    c,a
  463.     ld    b,0            ; Into BC
  464.     ld    hl,(wboot+1)
  465.     ld    l,b_seldsk        ; Get entry
  466.     call    callhl            ; And do select
  467.     ld    a,h
  468.     or    a,l
  469.     jp    z,getdpberr        ; Disk not legal
  470.     ld    c,(hl)
  471.     inc    hl
  472.     ld    b,(hl)            ; Get skew
  473.     ld    (ix+skew+1),b
  474.     ld    (ix+skew),c        ; And save
  475.  
  476.      if    test
  477.     push    hl
  478.     push    bc
  479.     pop    hl
  480.     call    print
  481.     db    ' skew ',0
  482.     call    phl4hc
  483.     pop    hl
  484.      endif
  485.  
  486.     ld    de,dhb_dpbp-1        ; Offset to dpb pointer
  487.     add    hl,de
  488.     ld    e,(hl)
  489.     inc    hl
  490.     ld    d,(hl)            ; Get pointer to bios structure
  491.     push    ix
  492.     pop    hl            ; Parameter pointer
  493.     ld    bc,dpb            ; Offset to DPB
  494.     add    hl,bc            ; HL -> our copy of DPB
  495.     ex    de,hl            ; DE -> our copy, HL -> real DPB
  496.     ld    bc,dpb_length        ; And length
  497.     ldir                ; Move into place
  498.  
  499.      if    test
  500.      call    print
  501.      db    cr,lf,'DPB ',0
  502.      push    ix
  503.      pop    hl
  504.      ld    bc,dpb
  505.      add    hl,bc
  506.      ld    b,15
  507. xxx:
  508.      ld    a,(hl)
  509.      call    pa2hc
  510.      call    print
  511.      db    ' ',0
  512.      inc    hl
  513.      djnz    xxx
  514.      endif
  515.  
  516.  
  517.     ld    a,(ix+dpb+dpb_bs) ; Get block shift
  518.     ld    b,a        ; Into B
  519.     ld    a,1        ; Base (2^0)
  520. 1$:
  521.     add    a,a        ; * 2
  522.     djnz    1$        ; Loop
  523.     ld    (ix+sec_grp),a    ; Save sectors per group
  524.  
  525.      if    test
  526.      call    print
  527.      db    ' sec/grp ',0
  528.      call    pa2hc
  529.      endif
  530.  
  531.     ld    b,a
  532.     ld    c,llrec
  533.     mlt    bc        ; Get length of group
  534.     ld    (ix+grp_len+1),b
  535.     ld    (ix+grp_len),c    ; And save
  536.  
  537.     ret            ; Return
  538.  
  539. getdpberr:
  540.     call    print
  541.     db    cr,lf,'Illegal drive in select.',0
  542.     jp    exit
  543.  
  544. ;
  545. ; Routine to multiply HL by E (16bit X 8bit)
  546. ;    Return:
  547. ;        A = MSB
  548. ;        HL = lower two bytes
  549. ; Destroys DE
  550. ;
  551. mlt16x8:
  552.     ld    d,h        ; Save upper byte
  553.     ld    h,e        ; Get multiplier
  554.     mlt    hl        ; First product
  555.     mlt    de        ; And second
  556.     ld    a,d        ; High byte of product
  557.     ld    d,e        ; Move middle byte into position for add
  558.     ld    e,0        ; This product has zero lower byte
  559.     add    hl,de        ; Add for middle and lower byte
  560.     adc    a,0        ; Adjust high byte
  561.     ret
  562. ;
  563. ; Routine to divide HL by E (16bit / 8bit)
  564. ;    Return:
  565. ;        HL = Integer quotient
  566. ;        E = Remainder
  567. ; Destroys D
  568. ;
  569. div16x8:
  570.     push    af
  571.     push    bc        ; Save registers
  572.  
  573.     push    hl
  574.     pop    bc        ; Get dividend in BC
  575.     ld    a,e        ; Check divisor
  576.     or    a,a
  577.     jr    nz,dv16x8    ; O. K., go on
  578.     ld    c,0        ; Simulate divide by 1
  579.     jr    dv16x8r    
  580. dv16x8:
  581.     ld    hl,0        ; Clear quotient
  582. dv16x8l:
  583.     inc    hl        ; Count in dividend
  584.     ld    a,c        ; Lower byte
  585.     sub    a,e        ; Subtract divisor
  586.     ld    c,a        ; Back to byte
  587.     ld    a,b        ; Get upper byte
  588.     sbc    a,0        ; Get the whole thing
  589.     ld    b,a
  590.     jr    nc,dv16x8l    ; Do next one
  591.     ld    a,c        ; One too many, get it back
  592.     add    a,e
  593.     ld    c,a
  594.     ld    a,b
  595.     adc    a,0
  596.     ld    b,a
  597.     dec    hl        ; And take off count
  598. dv16x8r:
  599.     push    bc
  600.     pop    de        ; Get remainder
  601.  
  602.     pop    bc
  603.     pop    af        ; Restore registers
  604.     ret
  605. ;
  606. ; Call service to simulate call (hl)
  607. ;
  608. callhl:
  609.     jp    (hl)
  610.  
  611. ;
  612. ; Allocate memory
  613. ;  Call:
  614. ;    BC = requested length
  615. ;  Return:
  616. ;    HL -> beginning of block (HL = 0 means no allocation made)
  617. ;  All registers destroyed
  618. ;
  619. alloc:
  620.     ld    hl,(top)
  621.     ld    de,(bottom)
  622.     or    a,a        ; Clear carry
  623.     sbc    hl,de        ; Get available memory
  624.     sbc    hl,bc        ; And see if we have enough
  625.     ld    hl,0        ; Get error ready
  626.     ret    c        ; No room
  627.     ld    hl,(bottom)    ; Get current bottom
  628.     push    hl        ; Save for return
  629.     add    hl,bc        ; Add requested
  630.     ld    (bottom),hl    ; Bump up
  631.     pop    hl        ; Get pointer
  632.     ret
  633.  
  634. ; Edited cin with ctrl_c check
  635. cin_cc:
  636.     call    cin_e
  637.     cp    a,ctrl_c
  638.     jp    z,exit
  639.     ret
  640. ; Edited cin
  641. cin_e:
  642.     call    cin
  643.     call    caps
  644.     ret
  645. sak:
  646.     call    print
  647.     db    cr,lf,'Strike any key to continue.',0
  648.     jr    cin_cc
  649. ; Error reporting
  650. bserrmsg
  651.     db    'BS not same.',0
  652. bserr:
  653.     ld    hl,bserrmsg
  654.     jr    error
  655. bmerrmsg
  656.     db    'BM not same.',0
  657. bmerr:
  658.     ld    hl,bmerrmsg
  659.     jr    error
  660. emerrmsg
  661.     db    'EM not same.',0
  662. emerr:
  663.     ld    hl,emerrmsg
  664.     jr    error
  665. maxberrmsg
  666.     db    'Max group not same.',0
  667. maxberr:
  668.     ld    hl,maxberrmsg
  669.     jr    error
  670. direerrmsg
  671.     db    'Num dir entries not same.',0
  672. direerr:
  673.     ld    hl,direerrmsg
  674.     jr    error
  675. allblkerrmsg
  676.     db    'Directory groups not same.',0
  677. allblkerr:
  678.     ld    hl,allblkerrmsg
  679.     jr    error
  680.  
  681. error:
  682.     call    print
  683.     db    cr,lf,'Error: ',0
  684.     call    pstr
  685.     jp    exit
  686.  
  687. ds_alloc_err:
  688. overflow:
  689.  
  690. baddisk:
  691. help:
  692.     call    print
  693.     db    cr,lf,'Usage:'
  694.     db    cr,lf,'  PHYCP <source>: <target>:'
  695.  
  696.     db    0
  697.  
  698.     jp    exit
  699. exit:
  700.     call    log_default        ; Sync DOS, BIOS-- log in default
  701.     jp    wboot
  702. ;
  703. ; Force sync of DOS, BIOS selected disk. Log in default DU
  704. ;  Destroys all registers
  705. ;
  706. log_default:
  707.  
  708.      if    test
  709.     call    print
  710.     db    'LD ',0
  711.     ld    a,(dos_ud+1)        ; Get disk
  712.     add    a,'A'
  713.     call    cout
  714.     ld    a,(dos_ud)
  715.     call    pafdc
  716.     ld    a,':'
  717.     call    cout
  718.      endif
  719.  
  720.     ld    a,(dos_ud+1)        ; Get DOS current disk
  721.     ld    c,a
  722.     ld    b,0            ; Into BC
  723.     ld    e,1            ; Show no new mount
  724.     ld    hl,(wboot+1)
  725.     ld    l,b_seldsk
  726.     call    callhl            ; And Select at BIOS
  727.     ld    bc,(dos_ud)
  728.     call    logud
  729.     ret
  730.  
  731. ; Memory management
  732. ;  Map:
  733. ;    $memry       - bottom       -- structure allocations (gs_ and fs_)
  734. ;    bottom       - top          -- empty
  735. ;    top          - gr1buf       -- window2 group buffer
  736. ;    gr1buf       - protect-106h -- window1 group buffer
  737. ;    protect-106h - protect      -- stack
  738. ;
  739. ;    bottom      - gr1buf        -- Used by initialize for directory buffer
  740. ;
  741. $memry    ds    2
  742. bottom    ds    2            ; Bottom of unallocated memory
  743. top    ds    2            ; Top of unallocated memory
  744.  
  745. ; Read and Write group working storage
  746.  
  747. home_ud    ds    2            ; Home user/disk
  748. dos_ud    ds    2            ; Current BDOS user, disk
  749. curdma    ds    2            ; Current DMA address
  750. curtrk    ds    2            ; Current track
  751. cursec    ds    1            ; Current sector
  752. group_buf  ds    2            ; Group buffer
  753.  
  754. ; File parameters
  755.  
  756. disk    equ    0            ; Disk (A = 0)
  757. skew    equ    1            ; Skew word
  758. sec_grp    equ    3            ; Sectors per group
  759. grp_len equ    4            ; Length of group in bytes
  760. dpb    equ    6            ; Disk parameter block
  761.  
  762.   ; Input file parameters
  763.  
  764. ifp:
  765.     ds    dpb_length+6
  766.  
  767.   ; Output file parameters
  768.  
  769. ofp:
  770.     ds    dpb_length+6
  771.  
  772.     end
  773.