home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / asmutl / asmlib1.lbr / CPMIO.AYM / CPMIO.AYM
Encoding:
Text File  |  1994-05-31  |  3.1 KB  |  120 lines

  1. ;----------------------------------------------------------------
  2. ;         This is a module in the ASMLIB library.
  3. ;
  4. ;                 CP/M I/O Drivers
  5. ;
  6. ; This is the I/O driver module of ASMLIB and has ALL the I/O routines
  7. ; for the system (EXCEPT from line input). The routines are.
  8. ;
  9. ; COE    Send accumulator to console.
  10. ; CIE   Get console into accumulator. No echo.
  11. ; CST   Get console status, 00 = no character there.
  12. ; LOE   Send accumulator to list device.
  13. ; LST   Get list device status.
  14. ; IONUM Get the number of the I/O driver, for later identification.
  15. ;
  16. ;            Written         R.C.H.     22/10/83
  17. ;            Last Update    R.C.H.       23/02/84
  18. ;
  19. ;----------------------------------------------------------------
  20.     name    'CPMIO'
  21. ;
  22.     public    coe,cie,cst,loe,lst,ionum
  23. ;
  24.     maclib    z80
  25. ;
  26. bdos    equ    5
  27. num    equ    01            ; 01 = CPMIO i/o driver module
  28. in$off    equ    6        ; Bios table offset from entry 00
  29. ot$off    equ    9
  30. st$off    equ    3
  31. ;
  32. ionum:
  33.     mvi    l,num
  34.     ret                ; The i/o identification number
  35. ;
  36. ;****************************************************************
  37. ;            CP/M    I/O drivers.             *
  38. ;          Send the accumulator to the screen            *
  39. ;****************************************************************
  40. ;
  41. coe:
  42.     push    h
  43.     push    b
  44.     push    d            ; save all registers
  45.     push    psw            ; Save the character that is sent
  46.     mov    c,a            ; Load the character to be sent
  47.     lxi    d,ot$off        ; input offset
  48.     lxi    h,retadr1
  49.     jr    get$con$com
  50. ;
  51. ;----------------------------------------------------------------
  52. ;     Send the accumulator character to the list device
  53. ;----------------------------------------------------------------
  54. ;
  55. loe:
  56.     push    psw
  57.     push    h
  58.     push    b
  59.     push    d
  60.     mov    e,a            ; load the character to print
  61.     mvi    c,5              ; print list function
  62.     call    bdos
  63.     pop    d
  64.     pop    b
  65.     pop    h
  66.     pop    psw
  67.     ret
  68. ;
  69. ;----------------------------------------------------------------
  70. ;           Get a character from the console
  71. ;----------------------------------------------------------------
  72. ;
  73. cie:
  74.     push    h
  75.     push    b
  76.     push    d            ; save all registers
  77.     lxi    d,in$off        ; input offset
  78.     lxi    h,retadr2
  79. ;
  80. get$con$com:
  81.     push    h            ; Load a return address
  82.     lhld    1            ; get the warm boot vector
  83.     dad    d            ; Now hl = bios table address to use
  84.     pchl            ; do the routine
  85. ;
  86. ; Return here to restore all registers
  87. retadr1:
  88.     pop    psw        
  89. ; To skip PSW, return here
  90. retadr2:
  91.     pop    d
  92.     pop    b
  93.     pop    h
  94.     ora    a            ; Set flags, clear carry
  95.     ret
  96. ;
  97. ;----------------------------------------------------------------
  98. ; Get the console status. 00 = no character all else = read.
  99. ;----------------------------------------------------------------
  100. ;
  101. cst:    ; Get the status
  102.     push    h
  103.     push    b
  104.     push    d            ; save all registers
  105.     lxi    d,st$off        ; input offset
  106.     lxi    h,retadr2        ; load the required return address
  107.     jr    get$con$com        ; read the console common code
  108. ;
  109. ;----------------------------------------------------------------
  110. ; Get the list output status. If = 00 then no character may be
  111. ; sent to the device.
  112. ;----------------------------------------------------------------
  113. ;
  114. lst:
  115.     mvi    a,0ffh            ; Not supported yet
  116.     ret                ; return the device as ready
  117. ;
  118.     end
  119.  
  120.