home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / Z80DOS10.ARC / Z80DCHAR.Z80 < prev    next >
Text File  |  1989-09-15  |  17KB  |  623 lines

  1. ; Z80DOS - Z80 Disk Operating System
  2. ;
  3. ; Version 1.0 - 05 Sept. 87 by Carson Wilson
  4. ;
  5.  
  6. ; -------------------------------------------------------------------
  7. ;
  8. ; Z80DCHAR.Z80 - DOS Entry Points, Character I/O, and Error Routines
  9. ;
  10. ; -------------------------------------------------------------------
  11.  
  12.     org    DOS+6        ; Preserve serial number for CP/M
  13.                 ; ..overlay
  14. ;
  15. ; Start DOS
  16. ;
  17. start:    jp    entry            ; Jump to entry point DOS
  18. ;
  19. ; Error messages DOS - for programs which intercept DOS errors
  20. ;
  21.     defw    0            ; Bad Sector - not implemented
  22. StSel:    defw    SelErr            ; Select error
  23. stro:    defw    rdonly            ; Drive read only
  24. sfilro:    defw    filro            ; File read only
  25.  
  26. ;
  27. ; Run-time configurable options:
  28. ;
  29.  
  30. timead:    defw    BIOStim            ; Dummy or address of BIOS routine
  31.                     ; ..configurable at run time
  32. flags:    defb    options            ; Flag bite
  33.  
  34. ;
  35. ; Entry point for DOS commands
  36. ;
  37. Entry:    ld    a,c            ; Get function number
  38.     ld    (funct),a        ; Save it for later use
  39.     ld    hl,0            ; Set hl to zero
  40.     ld    (pexit),hl        ; Clear exit code
  41.     xor    a            ; Clear a
  42.     ld    (fldrv),a        ; Reset drive select done flag
  43.     ld    (rdwr),a        ; Reset read/write flag
  44.     ld    (spsave),sp        ; Save stack pointer
  45.     ld    sp,DOSs            ; Get internal stack pointer
  46.     push    ix            ; Save index register
  47.     push    de            ; Save parameter register
  48.     pop    ix            ; Get it back in ix
  49.     ld    hl,p2exit        ; Get exit address DOS
  50.     push    hl            ; Save it on stack to return from DOS
  51.     ld    a,c            ; Get function code
  52.     cp    105            ; Test get time <crw>
  53.     jp    z,gettim        ; Yes then get time
  54.     cp    104            ; Test set time <crw>
  55.     jp    z,settim        ; Yes then set time
  56.     cp    55            ; Test use time stamp <crw>
  57.     jp    z,UseStp
  58.     cp    54            ; Test get time stamp <crw>
  59.     jp    z,Getstp
  60.     cp    MaxCmd+1        ; Test greater then MaxCmd
  61.     ret    nc            ; If so return to caller and do nothing
  62.     ld    hl,ctable        ; Load table
  63.     ld    b,0            ; Prepare 16 bit add
  64.     add    hl,bc            ; Add
  65.     add    hl,bc            ; Add twice to get word value
  66.     ld    a,(hl)            ; Get LSB
  67.     inc    hl            ; Pointer to MSB
  68.     ld    h,(hl)            ; Get MSB
  69.     ld    l,a            ; Save LSB in l
  70.     jp    (hl)            ; Jump to routine
  71. ;
  72. ; Command Jump Table
  73. ;
  74. CTable:    defw    WBoot            ; Warm boot
  75.     defw    rdcon            ; Console input
  76.     defw    bwrcon            ; Console output
  77.     defw    rdrdr            ; Reader input
  78.     defw    wpunch            ; Punch output
  79.     defw    wlist            ; List output
  80.     defw    dcio            ; Direct console I/O
  81.     defw    giost            ; Get I/O byte
  82.     defw    siost            ; Set I/O byte
  83.     defw    mess            ; Print string
  84.     defw    rdbuf            ; Read console buffer
  85.     defw    tstcs            ; Get console status
  86.     defw    cmnd12            ; Return version number
  87.     defw    cmnd13            ; Reset disk system
  88.     defw    cmnd14            ; Select disk
  89.     defw    cmnd15            ; Open file
  90.     defw    cmnd16            ; Close file
  91.     defw    cmnd17            ; Search for first
  92.     defw    cmnd18            ; Search for next
  93.     defw    cmnd19            ; Delete file
  94.     defw    cmnd20            ; Read sequential
  95.     defw    cmnd21            ; Write sequential
  96.     defw    cmnd22            ; Make file
  97.     defw    cmnd23            ; Rename file
  98.     defw    cmnd24            ; Return login vector
  99.     defw    cmnd25            ; Return current disk
  100.     defw    cmnd26            ; Set DMA address
  101.     defw    cmnd27            ; Get address allocation vector
  102.     defw    cmnd28            ; Write protect disk
  103.     defw    cmnd29            ; Get R/O vector
  104.     defw    cmnd30            ; Set file attributes
  105.     defw    cmnd31            ; Get address disk parameter header(dph)
  106.     defw    cmnd32            ; Get/set user code
  107.     defw    cmnd33            ; Read random
  108.     defw    cmnd34            ; Write random
  109.     defw    cmnd35            ; Compute file size
  110.     defw    cmnd36            ; Set random record
  111.     defw    cmnd37            ; Reset multiple drive
  112.     defw    dummy            ; Access drive - not implemented
  113.     defw    dummy            ; Free drive - not implemented
  114.     defw    cmnd40            ; Write random with zero fill
  115.  
  116.  
  117. ; ---------------------------------
  118.  
  119. ;    Character Routines
  120.  
  121. ; ---------------------------------
  122.  
  123. ; DOS console input
  124. ;
  125. ; Read character from console and echo
  126. ;  if char=cr, lf, tab, ContH or >=space
  127. ;
  128. RdCon:    call    getch            ; Get character
  129.     call    tstch            ; Test if cr,lf,tab,ContH or >=space
  130.     jr    c,exit            ; No then exit
  131.     call    wrcon            ; Echo character
  132. exit:    ld    (pexit),a        ; Return character
  133. dummy:    ret                ; And exit DOS
  134. ;
  135. ; DOS write console
  136. ;
  137. bwrcon:    ld    a,e            ; Copy character
  138.     jr    wrcon            ; And output it
  139. ;
  140. ; read reader
  141. ;
  142. rdrdr:    call    reader            ; Get character from reader
  143.     jr    exit            ; And return it to caller
  144. ;
  145. ; write punch
  146. ;
  147. wpunch:    ld    c,e            ; Copy character
  148.     jp    punch            ; And output it to punch device
  149. ;
  150. ; Write list
  151. ;
  152. wlist:    ld    c,e            ; Copy character
  153.     jp    list            ; And output it to list device
  154. ;
  155. ; Direct console input/output
  156. ;
  157. DCIO:    ld    c,e            ; Copy character
  158.     inc    e            ; Test if 0ffh
  159.     jr    z,dcio0            ; Yes do input
  160.     inc    e            ; Test if 0feh
  161.     jp    nz,ConOut        ; No then output character
  162.     call    ConSt            ; Get console status
  163.     and    1            ; Test it
  164.     jr    exit            ; And return it to caller
  165. DCIO0:    call    ConSt            ; Get console status
  166.     and    1            ; Test it
  167.     ret    z            ; Exit if no character present
  168.     call    ConIn            ; Get character
  169.     jr    exit            ; And return it to caller
  170. ;
  171. ; Get I/O status byte
  172. ;
  173. giost:    ld    a,(RamLow+00003h)    ; Get I/O byte from ram
  174.     jr    exit            ; And return it to caller
  175. ;
  176. ; Set I/O status byte
  177. ;
  178. siost:    ld    a,e            ; Copy I/O byte
  179.     ld    (RamLow+00003h),a    ; And save it in ram
  180.     ret                ; Exit to caller
  181. ;
  182. ; Test console status
  183. ;
  184. tstcs:    call    gConSt            ; Get console status
  185.     jr    exit            ; And return it to caller
  186. ;
  187. ; Output char (control char = ^char)
  188. ;
  189. outch:    call    tstch            ; Test it cr,lf,tab,ContH or >=space
  190.     jr    nc,wrcon        ; Yes then jump
  191.     push    af            ; Save character
  192.     ld    a,'^'            ; Load a with '^'
  193.     call    wrcon            ; Output it
  194.     pop    af            ; Get character back
  195.     push    af            ; Save it again
  196.     add    a,'A'-1            ; Add offset
  197.     call    wrcon            ; Output it
  198.     pop    af            ; Get character
  199.     ret                ; Return to caller
  200. ;
  201. ; Echo cr,lf
  202. ;
  203. CROut:    ld    a,cr            ; A=carriage return
  204.     call    wrcon            ; Output it
  205.     ld    a,lf            ; A=line feed
  206.                     ; Fall through to output routine
  207. ;
  208. ; Write character on console
  209. ;
  210. wrcon:    cp    tab            ; Test if tab
  211.     jr    nz,wrcon1        ; No then jump
  212. wrcon0:    ld    a,' '            ; Expand tab with spaces
  213.     call    wrcon            ; Write space
  214.     ld    a,(tabcnt)        ; Get tab count
  215.     and    7            ; Test if done
  216.     jr    nz,wrcon0        ; No then repeat
  217.     ld    a,tab            ; Return tab
  218.     ret                ; Return to caller
  219. wrcon1:    push    af            ; Save character
  220.     call    gConSt            ; Test status and ContS/ContC
  221.     pop    af            ; Get character back
  222.     push    af            ; Save it again
  223.     ld    c,a            ; Copy it
  224.     call    ConOut            ; Output it
  225.     pop    af            ; Get character back
  226.     push    af            ; Save it again
  227.     ld    c,a            ; Copy it
  228.     ld    a,(fContP)        ; Get printer echo flag
  229.     or    a            ; Test it
  230.     call    nz,list            ; Non zero => output char to printer
  231.     ld    a,(flags)        ; Get flag byte
  232.     bit    1,a            ; Test delay 256 bytes active
  233.     jr    z,wrcon2        ; No then exit
  234.     ld    hl,delay        ; Get delay counter
  235.     xor    a            ; A=0
  236.     or    (hl)            ; Test counter=0
  237.     jr    z,wrcon2        ; Yes then exit
  238.     dec    (hl)            ; Else decrement counter
  239. wrcon2:    pop    af            ; Restore character
  240.                     ; Fall through to count routine
  241. ;
  242. ; Count characters in line
  243. ;
  244. countc:    ld    hl,tabcnt        ; Get pointer to tab counter
  245.     inc    (hl)            ; Increment tab counter
  246.     cp    ' '            ; Test if char >= ' '
  247.     ret    nc            ; Yes, normal character then exit
  248.     dec    (hl)            ; Control character, decrement tab count
  249.     cp    ContH            ; Test backspace
  250.     jr    nz,count0        ; No backspace then jump
  251.     dec    (hl)            ; Decrement tab counter
  252.     ret                ; And exit
  253. count0:    cp    cr            ; Test carriage return
  254.     jr    nz,count1        ; No then jump
  255.     ld    (hl),0            ; Reset tab count
  256.     ret                ; And exit
  257. count1:    cp    tab            ; Test tab character
  258.     ret    nz            ; No then exit
  259.     push    af            ; Save character
  260.     ld    a,(hl)            ; Get tab count
  261.     add    a,8            ; Advance it 8 position
  262.     and    0f8h            ; Set it to next tab position
  263.     ld    (hl),a            ; Save it
  264.     pop    af            ; Restore character
  265.     ret                ; And exit
  266. ;
  267. ; Get character from console
  268. ;
  269. getch:    ld    hl,lastch        ; Get pointer to last input character
  270.     ld    a,(hl)            ; Get character
  271.     ld    (hl),0            ; Reset last character
  272.     or    a            ; Test if character present
  273.     ret    nz            ; Return if so
  274.     jp    ConIn            ; Else get character
  275. ;
  276. ; Get console status
  277. ;
  278. gConSt:    ld    a,(delay)        ; Get 256 bytes delay
  279.     or    a            ; Test it
  280.     jr    nz,gcons0        ; Non zero, delay stil active or disabled
  281.     call    ConSt            ; Get console status
  282.     and    1            ; Test it
  283.     jr    nz,gcons1        ; Non zero then get character
  284. gcons0:    ld    a,(lastch)        ; Get last character
  285.     or    a            ; Test it
  286.     jr    nz,gcons3        ; Non zero then character present
  287.     call    ConSt            ; Get console status
  288.     and    1            ; Test it
  289.     ret    z            ; Return if no character present
  290. gcons1:    call    ConIn            ; Get character
  291.     cp    ContS            ; Test stop character
  292.     jr    nz,gcons2        ; Not then exit character
  293.     call    ConIn            ; Get next character
  294.     cp    ContC            ; Test if user wants to exit
  295.     jp    z,RamLow+00000h        ; Yes then warm boot
  296.     jr    gConSt            ; Test again
  297. gcons2:    ld    (lastch),a        ; Save character
  298.     ld    a,0ffh            ; Set delay counter
  299.     ld    (delay),a        ; And save it
  300. gcons3:    ld    a,1            ; Character present code
  301.     ret                ; Return to caller
  302. ;
  303. ; Test character
  304. ;  exit carry=0: cr,lf,tab,ContH or >=space
  305. ;    carry=1: all other characters
  306. ;
  307. tstch:    cp    cr            ; Test carriage return
  308.     ret    z            ; Return if so
  309.     cp    tab            ; Test tab
  310.     ret    z            ; Return if so
  311.     cp    ContH            ; Test backspace
  312.     ret    z            ; Return if so
  313.     cp    rubout
  314.     ret    z
  315.     cp    ' '            ; Test >=space
  316.     ret                ; Return to caller
  317. ;
  318. ; Write backspace, space, backspace
  319. ;
  320. wContH:    call    wcont0            ; Write backspace
  321.     ld    c,' '            ; Load space
  322.     call    ConOut            ; And output it
  323. wcont0:    ld    c,ContH            ; Load backspace
  324.     jp    ConOut            ; And output it
  325. ;
  326. ; Output message
  327. ;
  328. mess:    ld    a,(de)            ; Get byte from buffer
  329.     cp    '$'            ; Test last byte
  330.     ret    z            ; Yes, then return to caller
  331.     inc    de            ; Point to next byte
  332.     push    de            ; Save pointer
  333.     call    wrcon            ; Output character
  334.     pop    de            ; Restore pointer
  335.     jr    mess            ; And test again
  336. ;
  337. again:    ld    hl,tabcnt        ; Get tab count pointer
  338.     ld    a,(tabcx1)        ; Get position first character line
  339.     cp    (hl)            ; Check it
  340.     ret    z            ; Return if on same position
  341.     ld    a,' '            ; Load space
  342.     call    wrcon            ; Output it
  343.     jr    again            ; And test again
  344. ;
  345. ; Delete char
  346. ;  entry : HL = start buffer - 1
  347. ;       B  = character counter (always > 0)
  348. ;
  349. delch:    dec    b            ; Decrement character counter
  350.     ld    a,(tabcnt)        ; Get tab counter
  351.     push    af            ; Save it
  352.     push    bc            ; Save character counter
  353.     ld    a,(tabcx1)        ; Get position first character line
  354.     ld    (tabcnt),a        ; Save it in tab counter
  355. delch0:    ld    a,b            ; Copy character counter
  356.     or    a            ; Test if 0
  357.     jr    z,delch2        ; Yes then jump
  358.     dec    b            ; Decrement it
  359.     inc    hl            ; Increment buffer pointer
  360.     ld    a,(hl)            ; Get character from buffer
  361.     push    hl            ; Save buffer pointer
  362.     call    tstch            ; Test if cr,lf,tab,ContH or >=sp
  363.     jr    nc,delch1        ; Yes then jump
  364.     rra                ; Else must be control character
  365.     call    countc            ; Count control character twice
  366. delch1:    call    countc            ; Count character
  367.     pop    hl            ; Get buffer pointer
  368.     jr    delch0            ; And test again
  369. delch2:    pop    bc            ; Restore character counter
  370.     pop    af            ; And tab counter
  371.     push    hl            ; Save buffer pointer
  372.     push    bc            ; And character counter
  373.     ld    hl,tabcnt        ; Get tab counter pointer
  374.     sub    (hl)            ; Calculate difference
  375. delch3:    dec    a            ; Decrement it
  376.     cp    8            ; Compare with 8
  377.     jr    nc,delch4        ; Jump if >=8
  378.     push    af            ; Save difference
  379.     call    wContH            ; Remove character end line
  380.     pop    af            ; Restore counter
  381.     jr    delch3            ; Remove more characters
  382. delch4:    pop    bc            ; Restore character counter
  383.     pop    hl            ; Restore buffer pointer
  384.     ret                ; And return to caller
  385. ;
  386. ; Read buffer
  387. ;
  388. rdbuf:    ld    a,(tabcnt)        ; Get current position cursor
  389.     ld    (tabcx1),a        ; Save it
  390. rdbuf0:    push    ix            ; Save start address buffer
  391.     pop    hl            ; Get it in hl
  392.     ld    c,(hl)            ; Get maximum line lenght
  393.     inc    hl            ; Increment to line lenght position
  394.     ld    b,0            ; Clear line lenght counter
  395.     push    hl            ; Save start line - 1
  396. rdbuf1:    push    hl            ; Save registers
  397.     push    bc
  398. rdbuf2:    call    getch            ; Get character
  399.     pop    bc            ; Restore registers
  400.     pop    hl
  401.     and    07fh            ; Mask character
  402. rdbuf3:    cp    ContH            ; Test backspace
  403.     jr    nz,rdbuf4        ; Not then jump
  404. doback:    ld    a,b            ; Test if deleting char from empty line
  405.     or    a
  406.     jr    z,rdbuf1        ; Yes then get next char
  407.     pop    hl            ; Get start line
  408.     push    hl            ; And save it again
  409.     call    delch            ; Delete character
  410.     jr    rdbuf1            ; Get next character
  411. rdbuf4:    cp    ContP            ; Test print enable/disable
  412.     jr    nz,rdbufC        ; Not then jump
  413.     ld    a,(fContP)        ; Complement print flag
  414.     cpl
  415.     ld    (fContP),a
  416. rdbufc:    cp    ContX            ; Test delete line
  417.     jr    nz,rdbufe        ; Not then jump
  418. rdbufd:    pop    hl            ; Get start line
  419.     ld    a,b            ; Test if last character deleted
  420.     or    a
  421.     jp    z,RDBUF            ; Yes start routine again
  422.     push    hl            ; Save pointer
  423.     call    delch            ; Delete last character line
  424.     jr    rdbufd            ; Test last character deleted
  425. rdbufe:    cp    rubout            ; Test delete last character
  426.     jr    nz,rdbuff        ; Not then jump
  427.     jr    doback            ; Part of delete key fix
  428. rdbuff:    cp    cr            ; Test carriage return
  429.     jr    z,rdbufi        ; Yes, then exit
  430.     inc    hl            ; Increment pointer
  431.     ld    (hl),a            ; And save character
  432.     inc    b            ; Increment line counter
  433. rdbufg:    push    hl            ; Save registers
  434.     push    bc
  435.     call    outch            ; Echo character
  436.     pop    bc            ; Restore registers
  437.     pop    hl
  438.     cp    ContC            ; Test warm boot
  439.     ld    a,b            ; Get line count
  440.     jr    nz,rdbufh        ; No warm boot then jump
  441.     cp    1            ; Test ContC is first character line
  442.     jp    z,RamLow+00000h        ; Yes then execute warm boot
  443. rdbufh:    cp    c            ; Test line length=maximum line length
  444.     jp    nz,rdbuf1        ; Not then get next character
  445. rdbufi:    pop    hl            ; Get start line - 1
  446.     ld    (hl),b            ; Save line counter
  447.     ld    a,cr            ; Load carriage return
  448.     jp    wrcon            ; And echo it
  449.  
  450.  
  451. ;---------------------------
  452.  
  453. ;    Error routines
  454.  
  455. ;---------------------------
  456.  
  457. SelErr:    ld    de,msel            ; Load selected error message
  458.     jr    derror            ; And display error
  459. ;
  460. ; File read only error
  461. ;
  462. FilRO:    ld    de,mfilro        ; Load file R/O message
  463.     ld    a,0ffh            ; Set file R/O message flag
  464.     jr    error            ; And display error
  465. ;
  466. ; Read error message--b.h.
  467. ;
  468. rderr:    ld    de,mrderr
  469.     jr    derror
  470. ;
  471. ; Write error message--b.h.
  472. wrterr:    ld    de,mwrter
  473.     jr    derror
  474. ;
  475. ; Drive read only error
  476. ;
  477. rdonly:    ld    de,mro            ; Load drive R/O message
  478. derror:    xor    a            ; Set no file R/O message
  479.  
  480. ;
  481. ; Display error message
  482. ;
  483.  
  484. ; "Error message" error on d:
  485. ; Function    nn
  486. ; File        filename.typ
  487.  
  488. ;
  489. error:    ld    c,a            ; Save file R/O message flag
  490.     push    bc
  491.     push    de            ; Save error message pointer
  492.     call    crout            ; Display cr/lf
  493.     pop    de
  494.     call    mess            ; Display error
  495.     ld    a,(defdrv)        ; Get current drive
  496.     add    a,'A'            ; Make ASCII
  497.     ld    (mdrive),a        ; Save it
  498.     ld    de,mberr        ; Load message " error on d:"
  499.     call    mess            ; Display message
  500.     ld    de,mbfunc        ; Load message "function "
  501.     call    mess            ; Display message
  502.     ld    a,(funct)        ; Get function number
  503.     push    af            ; Save it
  504.     ld    bc,100            ; Display number / 100
  505.     call    num
  506.     ld    c,10            ; Display number / 10
  507.     call    num
  508.     ld    bc,101h            ; Always display number / 1
  509.     call    num
  510.     pop    af            ; Get function number
  511.     pop    bc            ; Get file R/O flag
  512.     cp    15            ; Test if FCB used in command
  513.     jr    c,error3        ; Commands <16, don't show filename
  514.     cp    24
  515.     jr    c,error1        ; Commands 16..23 show file
  516.     cp    30
  517.     jr    z,error1        ; Command 30 show file
  518.     cp    33
  519.     jr    c,error3        ; Other commands 24..32 no file
  520.     cp    37
  521.     jr    c,error1        ; 33..36 show
  522.     cp    40
  523.     jr    nz,error3        ; 37 don't show
  524.  
  525. error1:    push    ix            ; Display "file ="
  526.     sub    19            ; Test delete file function
  527.     jr    nz,error2        ; Not then jump
  528.     or    c            ; Test file R/O flag
  529.     jr    z,error2        ; No file R/O then jump
  530.     call    caldir            ; Get FCB from directory buffer
  531.     ex    (sp),hl            ; Save it
  532. error2:    ld    de,mfile        ; Get message " file ="
  533.     call    mess            ; Display message
  534.     pop    hl            ; Get pointer FCB
  535.     ld    b,8            ; Display first 8 characters
  536.     call    filenm
  537.     ld    a,'.'            ; Load '.'
  538.     push    hl            ; Save FCB pointer
  539.     call    wrcon            ; Echo it
  540.     pop    hl            ; Restore FCB pointer
  541.     ld    b,3            ; Display last 3 characters
  542.     call    filenm
  543.  
  544. ; Absorb any pending characters:
  545.  
  546. error3:    call    gConSt            ; Test if character pending
  547.     or    a
  548.     jr    z,error4        ; No then jump
  549.     call    getch            ; Get character
  550.     jr    error3            ; And test again
  551. ;
  552. ; Allow retry on read/write errors
  553. ;
  554. error4:
  555.     ld    a,(retflg)        ; Allow retry?
  556.     or    a
  557.     jr    z,error5        ; No
  558.     xor    a
  559.     ld    (retflg),a        ; Reset flag <crw>
  560.     call    getch
  561.     cp    ContC            ; Control-c entered?
  562.     ret    nz            ; No, retry
  563. error5:    jp    RamLow+00000h        ; Do warm boot
  564. ;
  565. ; Display number
  566. ;
  567. num:    ld    d,-1            ; Load number -1
  568. num1:    inc    d            ; Increment number
  569.     sub    c            ; Divide by c
  570.     jr    nc,num1            ; Not finished then loop
  571.     add    a,c            ; Restore last value
  572.     push    af            ; Save it
  573.     ld    a,d            ; Test if "0"
  574.     or    b            ; And if leading zero
  575.     jr    z,num2            ; Yes, then exit
  576.     ld    b,a            ; Set no leading zero
  577.     ld    a,d            ; Get number
  578.     add    a,'0'            ; Make ASCII
  579.     push    bc            ; Save registers
  580.     call    wrcon            ; Echo number
  581.     pop    bc            ; Restore registers
  582. num2:    pop    af            ; Restore number
  583.     ret                ; And exit
  584. ;
  585. ; Display filename.typ
  586. ;
  587. filenm:    inc    hl            ; Increment pointer FCB
  588.     ld    a,(hl)            ; Get character from FCB
  589.     and    07fh            ; Mask it
  590.     push    hl            ; Save registers
  591.     push    bc
  592.     call    wrcon            ; Echo character
  593.     pop    bc            ; Restore registers
  594.     pop    hl
  595.     djnz    filenm            ; Repeat b times
  596.     ret                ; And exit
  597. ;
  598. ; Error messages
  599. ; Made more meaningful--b.h.
  600. ;
  601.  
  602. msel:    defm    'Illegal drive$'
  603.  
  604. mfilro:    defm    'File '
  605.  
  606. mro:    defm    'R/O$'
  607.  
  608. mrderr:    db    'Read$'
  609.  
  610. mwrter:    db    'Write$'
  611.  
  612. mberr:    defm    ' error on '
  613. mdrive:    defb    0
  614.     defb    DrvSep
  615.     defm    '$'
  616.  
  617. mbfunc:    defm    cr,lf,'Function', tab, '$'
  618.  
  619. mfile:    defm    cr,lf,'File', tab, tab,    '$'
  620.  
  621. ; END Z80DCHAR.Z80
  622.  
  623.