home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / ftp.demon.co.uk-pub-cpm / foodo-v1.lbr / SUPPORT.LBR / MYZ80.LZB / MYZ80.LIB
Text File  |  1993-12-11  |  3KB  |  164 lines

  1. ; MYZ80.INS - BYE5 insert for MSDOS using MYZ80 CP/M emulator
  2. ;
  3. ; This insert adapts the MYZ80 CP/M emulator to BYE5.
  4. ;
  5. ; Adaptded to suit by:
  6.  
  7. ; Bruce Dudley     24/12/92  SYSOP Z-Node 62 RCPM
  8.  
  9. ; Update to suit MyZ80 v1.1    10-1-93. bld
  10. ;  "     "   "     "   v1.2     8-5-93  bld
  11.  
  12. ;=   =     =   =     =   =     =   =     =   =     =   =     =   =     =   =     =   =
  13. ;-------------------------------------------------
  14. ; These port addresses assume to be at the default MSDOS settings
  15.  
  16. ; Set to the comm port used on your PC for modem communications
  17. ; Note: Only set one of these to 'yes'
  18.  
  19. com1    equ    yes
  20. com2    equ    no
  21.  
  22. ;--------------------------------------------------
  23.     if    com1
  24. portbase    equ    0
  25.     endif
  26.  
  27.     if    com2
  28. portbase    equ    8
  29.     endif
  30.  
  31. ;-----------------------------------------------------------------------
  32. ;
  33. ;
  34. ; See if we still have a carrier - if not, return with the zero flag set
  35. ;
  36. mdcarck:in    a,(portbase+6)
  37.     bit    7,a
  38.     ret
  39. ;.....
  40. ;
  41. ; Disconnect and wait for an incoming call
  42. ;
  43. mdinit:    push    bc
  44.     xor    a
  45.     out    (portbase+1),a    ; Prevent interrupts
  46.     ld    a,00010011b    ; Line control register value set for:
  47.                 ; DLAB off
  48.                 ; Break off
  49.                 ; Parity unstuck
  50.                 ; None...
  51.                 ; 1 stop bit
  52.                 ; 8 data bits
  53.     out    (portbase+3),a
  54.     in    a,(portbase+4)
  55.     set    1,a        ; Make sure RTS is on
  56.     out    (portbase+4),a
  57.     call    mdstop
  58.     ld    b,20        ; 2 second delay
  59. offti:    call    delay        ; 0.1 second delay
  60.     djnz    offti        ; Keep looping until finished
  61.     call    dtron
  62.  
  63.      if    imodem        ; If using intelligent modem
  64.     call    iminit        ; Go initialize modem now
  65.      endif            ; IMODEM
  66.  
  67.     pop    bc
  68.     ret
  69. ;.....
  70. ;
  71. ; Input a character from the modem port
  72. ;
  73. mdinp:    in    a,(portbase+0)
  74.     ret
  75. ;.....
  76. ;
  77. ;
  78. ; Check the status to see if a character is available.    If not, return
  79. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  80. ;
  81. mdinst:    in    a,(portbase+5)
  82.     bit    0,a
  83.     ret    z    ; Return if not ready
  84.     or    -1    ; Set the proper flag
  85.     ret        ; And return
  86. ;.....
  87. ;
  88. ;
  89. ; Send a character to the modem
  90. ;
  91. mdoutp:    out    (portbase+0),a
  92.     ret
  93. ;.....
  94. ;
  95. ;
  96. ; See if the output is ready for another character
  97. ;
  98. mdoutst:in    a,(portbase+5)
  99.     bit    5,a
  100.     ret
  101. ;.....
  102. ;
  103. ;
  104. ; Re-initialize the modem and hang up the phone by dropping DTR and
  105. ; leaving it inactive.
  106. ;
  107. mdquit:     if    imodem        ; If using an intelligent modem
  108.     call    imquit        ; Tell it to shut down
  109.      endif            ; IMODEM
  110. ;
  111. ;
  112. ; Called by the main program after caller types BYE.
  113. ;
  114. mdstop:    in    a,(portbase+4)
  115.     res    0,a        ; Drop DTR
  116.     out    (portbase+4),a
  117.     ret
  118. ;.....
  119.  
  120. dtron:    in    a,(portbase+4)
  121.     set    0,a        ; Assert DTR
  122.     out    (portbase+4),a
  123.     ret
  124.  
  125. ;
  126. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  127. ; speed you have available.
  128. ;
  129. setinv:    or    -1        ; Make sure zero flag is not set
  130.     ret
  131. ;.....
  132. ;
  133. ;
  134. set300:    ld    hl,bd300
  135.     jr    setbaud
  136. ;
  137. set1200:ld    hl,bd1200
  138.     jr    setbaud
  139. ;
  140. set2400:ld    hl,bd2400
  141. ;
  142. setbaud:in    a,(portbase+3)
  143.     set    7,a        ; Set DLAB
  144.     out    (portbase+3),a
  145.     ld    a,l
  146.     out    (portbase+0),a    ; Do low byte
  147.     ld    a,h
  148.     out    (portbase+1),a    ; Do high byte
  149.     in    a,(portbase+3)
  150.     res    7,a        ; Restore DLAB
  151.     out    (portbase+3),a
  152.     xor    a
  153.     ret            ; Return
  154. ;.....
  155. ;
  156. ;
  157. ; The following are baud rates for BPORT -- they will have to be changed
  158. ; for your particular CTC.
  159.  
  160. bd300    equ    180h        ; 300
  161. bd1200    equ    060h        ; 1200
  162. bd2400    equ    030h        ; 2400
  163. ;.....
  164.