home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / C128Telecom / QTERM128.ARK / QT-C128.Z < prev    next >
Text File  |  1989-09-27  |  6KB  |  255 lines

  1. ; QT-C128.Z - patch code for QTERM on the Commodore C128
  2.  
  3. ; added break code 12/31/89, D.Goodenough, and upgraded to work with QTERM 4.2
  4.  
  5. ; written 7/8/89 D. Goodenough from the IMP patch
  6.  
  7. ; modist - return with z flag clear iff there is a char waiting at modem port
  8.  
  9. .org    0x0110
  10. modist:    ld    a,(0xfd4f)
  11.     and    1
  12.     ret
  13.  
  14. ; modin - read char from modem port: modist has been used to check it's there
  15.  
  16. .org    0x0120
  17. modin:    ld    a,(0xfd51)
  18.     ld    hl,0xfd4f
  19.     res    0,(hl)
  20.     ret
  21.  
  22. ; modost - return with z flag clear iff the modem can accept another char
  23.  
  24. .org    0x0130
  25. modost:    ld    a,(0xfd4f)
  26.     cpl
  27.     and    0x80
  28.     ret
  29.  
  30. ; modout - send char to modem port
  31.  
  32. .org    0x0140
  33. modout:    ld    (0xfd50),a
  34.     ld    hl,0xfd4f
  35.     set    7,(hl)
  36.     ret
  37.  
  38. ; sbreak - start a break condition on line
  39.  
  40. .org    0x0150
  41. sbreak:    ld    a,1        ; we'll set the baud rate to 50 BPS
  42.     call    baudns        ; do it, but leave original baud alone
  43.     xor    a
  44.     jr    modout        ; now send a null
  45.  
  46. ; ebreak - terminate break condition
  47.  
  48. .org    0x0160
  49. ebreak:    call    modost
  50.     jr    z,ebreak    ; make sure the 50 BPS char is gone
  51.     ld    a,(origb)
  52.     jp    dobaud        ; and reset the baud rate
  53.  
  54. ; dtroff - disable dtr to cause modem to hang up
  55.  
  56. .org    0x0170
  57. dtroff:    ret            ; 1670 doesn't grok dtr, but it's
  58.     db    10        ; Hayes compatible, so we send the stock
  59.     db    0xfe        ; Hayes hangup string to it
  60.     db    '+++'
  61.     db    0xfe
  62.     db    'ATH0\r'
  63.  
  64. ; dtron - re-enable dtr - not needed with string above
  65.  
  66. .org    0x0180
  67. dtron:    ret            ; but it's here for the sake of completeness
  68.  
  69. ; setbd - take byte in a, from baud table, use it to set baud rate
  70.  
  71. .org    0x0190
  72. setbd:    jp    dobaud        ; done elsewhere - see patch area
  73.  
  74. ; these next eight are byte pairs - the first byte is used by setbd above.
  75. ; the second is a -1 for an active baud rate entry, and a 0 for inactive
  76.  
  77. .org    0x01a0
  78. b38400:    db    0,0
  79. b19200:    db    0,0
  80. b9600:    db    0,0
  81. b4800:    db    0,0
  82. b2400:    db    0,0
  83. b1200:    db    8,-1        ; we only talk 1200 .....
  84. b600:    db    0,0
  85. b300:    db    6,-1        ; and 300
  86.  
  87. ; setmod - take a byte from the mode table, use it to set the uart mode
  88.  
  89. .org    0x01b0
  90. setmod:    ret            ; no mode setting
  91.  
  92. ; now the twelve mode bytes for setting comm format
  93.  
  94. .org    0x01c0
  95. modtab:
  96. n17:    db    0
  97. n18:    db    0
  98. n27:    db    0
  99. n28:    db    0
  100. e17:    db    0
  101. e18:    db    0
  102. e27:    db    0
  103. e28:    db    0
  104. o17:    db    0
  105. o18:    db    0
  106. o27:    db    0
  107. o28:    db    0        ; empty table
  108.  
  109. .org    0x01cc
  110. resrvd:    db    0        ; reserved
  111.  
  112. ; xfersz - number of K to read / write to disk during protocol transfers:
  113. ; must be 1 / 2 / 4 / 8. Generally this is best left at 8 unless you have
  114. ; a REALLY slow disk, when writing / reading 8K at a time causes timeouts.
  115. ; Drop this to 4 or 2 to do disk access in smaller chunks to help avoid
  116. ; the timeout problem
  117.  
  118. .org    0x01cd
  119. xfersz:    db    2        ; send 2K at a time: CBM disks are slooowww.
  120.                 ; this can be bumped to 8 if you're using a
  121.                 ; 1750 REU as drive M:
  122.  
  123. ; speed - simply the cpu speed for a z80 in mhz.
  124.  
  125. .org    0x01ce
  126. speed:    db    1        ; A slow CPU (which is odd, because they
  127.                 ; put a Z80B in there)
  128.  
  129. ; escape - this is the character used as the escape char: since the addresses
  130. ; in the table tend to move, we just put the byte here, and then transfer
  131. ; to the table later
  132.  
  133. .org    0x01cf
  134. escape:    db    '\e'        ; use the ESC key on the C128
  135.  
  136. ; the signon message - change this to be appropriate for your system
  137.  
  138. .org    0x01d0
  139. signon:    db    'Commodore 128 / 1670 Modem\0'
  140.  
  141. ; now the string for clear screen
  142.  
  143. .org    0x01f0
  144. clrs:    db    'z' & 0x1f, 0
  145.  
  146. ; moveto - this routine is called with a word in hl - h = row &
  147. ; l = column to move to, at 109 is a routine to print a char in c,
  148. ; at 10c is a routine to print a decimal number in hl (for ansi tubes)
  149.  
  150. .var    scrout    0x0109
  151. .var    decout    0x010c
  152.  
  153. .org    0x0200
  154. moveto:    push    hl        ; save row,col
  155.     ld    c,'\e'        ; send escape
  156.     call    scrout
  157.     ld    c,'='        ; send =
  158.     call    scrout
  159.     pop    hl        ; get row,col
  160.     ld    de,0x2020    ; add offset
  161.     add    hl,de
  162.     push    hl        ; and save
  163.     ld    c,h        ; send row+offset
  164.     call    scrout
  165.     pop    bc        ; get col+offset
  166.     jp    scrout        ; send
  167.  
  168. ; these next strings are used to do various screen functions. There are
  169. ; eight of them, and immediately preceding them is a flag byte. Each string
  170. ; has a bit in the byte, and if a capability is present, its bit should
  171. ; be set. This byte is an absolute necessity, as various programs use it
  172. ; to tell if various things are present.
  173.  
  174. .org    0x022f
  175. tcbits:    db    0b11111111    ; bits are:
  176.                 ; 0: bright        b_brite    1
  177.                 ; 1: dim        b_dim    2
  178.                 ; 2: delete line    b_delln    4
  179.                 ; 3: insert line    b_insln    8
  180.                 ; 4: delete character    b_delch    16
  181.                 ; 5: insert character    b_insch    32
  182.                 ; 6: clear end line    b_cleol    64
  183.                 ; 7: clear end screen    b_cleos    128
  184.  
  185. .org    0x0230
  186. brites:    db    '\e(\0'
  187.  
  188. .org    0x0238
  189. dims:    db    '\e)\0'
  190.  
  191. .org    0x0240
  192. dlstr:    db    '\eR\0'
  193.  
  194. .org    0x0248
  195. ilstr:    db    '\eE\0'
  196.  
  197. .org    0x0250
  198. dcstr:    db    '\eW\0'
  199.  
  200. .org    0x0258
  201. icstr:    db    '\eQ\0'
  202.  
  203. .org    0x0260
  204. ceol:    db    '\eT\0'
  205.  
  206. .org    0x0268
  207. ceos:    db    '\eY\0'
  208.  
  209. ; Entry and exit hooks. These are provided to perform custom initialisation
  210. ; on startup, and also to perform custom code on exit.
  211.  
  212. .org    0x0270
  213. entry:    jp    doent
  214.  
  215. .org    0x0273
  216. exit:    jp    doexit
  217.  
  218. .org    0x0276
  219. user:    ret
  220.  
  221. .org    0x0279
  222. kbmap:    ret
  223.  
  224. .var    prompt    0x027c
  225.  
  226. ; finally a patch area that is provided for patching odd systems that need
  227. ; a lot of space.
  228.  
  229. .org    0x0280
  230.  
  231. doexit:    ld    a,1        ; slow the scan right down to get some
  232.     jr    baudns        ; performance from the kbd
  233.  
  234. doent:    ld    a,1
  235.     ld    (0xfd4e),a
  236.     ld    a,8
  237.  
  238. dobaud:    ld    (origb),a    ; save the new baud rate
  239. baudns:    push    af        ; and put it on the stack
  240.     ld    hl,(1)
  241.     ld    l,0x3c
  242.     call    cbios
  243.     ld    de,0x37
  244.     add    hl,de
  245.     pop    af
  246.     ld    (hl),a
  247.     ld    hl,(1)
  248.     ld    l,0x3f
  249.     ld    c,6
  250. cbios:    jp    (hl)
  251.  
  252. origb:    db    8        ; original baud rate
  253.  
  254. ; MUST terminate by 0x04ff
  255.