home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / a / cpxtor.asm < prev    next >
Assembly Source File  |  2020-01-01  |  40KB  |  1,230 lines

  1. IF NOT lasm
  2. .printx * CPXTOR.ASM *
  3. ENDIF    ;NOT lasm
  4. ;       KERMIT - (Celtic for "FREE")
  5. ;
  6. ;       This is the CP/M-80 implementation of the Columbia University
  7. ;       KERMIT file transfer protocol.
  8. ;
  9. ;       Version 4.0
  10. ;
  11. ;       Copyright June 1981,1982,1983,1984,1985
  12. ;       Columbia University
  13. ;
  14. ; Originally written by Bill Catchings of the Columbia University Center for
  15. ; Computing Activities, 612 W. 115th St., New York, NY 10025.
  16. ;
  17. ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
  18. ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
  19. ; others.
  20. ;
  21. ;       This file contains the system dependent part for Torch, Superbrains, 
  22. ;       PCI2651 (Loughborough 8" Standard CP/M system) and Cifer computers.
  23. ;
  24. ;       This is the first attempt to break the huge CPXSYS.ASM file
  25. ;       into smaller system dependent files.  To start with I will bunch
  26. ;       several micros to one class.
  27. ;
  28. ;       Please name system dependent files in the form CPXxxx.ASM where
  29. ;       xxx is a three letter abbrev. for the system you are adding.
  30. ;
  31. ; revision history:
  32. ;
  33. ;edit 5, 10-Jan-1991 by MF. Removed references to assembly switch ker09.
  34. ; edit 4, 21 July, 1987 by OBSchou.  Removed routines no in CPXCOM.ASM
  35. ;
  36. ; edit 3, 8 April, 1987 by OBSchou.  Moved the VDU declarations for the
  37. ;    Torch, superbrain and Cifer from CPXVDU.ASM.  Also added code to
  38. ;    see if the MCP/CCCP ROM versions on the Torch is less or grater than
  39. ;    1.  Less than 1 => poor screen control.  Finally adjusted the 
  40. ;    positioning of the filename to cope with a user number and drive 
  41. ;    in the filename field
  42. ;
  43. ;
  44. ; edit 2, 20 March, 1987 by C.J.MILES@UK.AC.UMRCC.  Added support for 
  45. ;    NCR Decision Mate V (2651 USART)
  46. ;
  47. ; edit 1, 22 April, 1986, OBSchou.  Start on splitting off individual 
  48. ;       systems from this huge file.  It is done using the LINK facility 
  49. ;       LASM.  We link to a collection of systems under CPXxxx.ASM.
  50. ;       I have started with the systems I know, the Torch, Cifer and 
  51. ;       pci2651.  These will all be held under CPXTOR.ASM
  52. ;
  53. ;
  54. ; Keep module name, edit number, and last revision date in memory.
  55. family: db      'CPXTOR.ASM (5)  10-Jan-1991  $'
  56. ;
  57. ; Assembly time message to let me know I'm building the right version.
  58. ; LASM generates an 'S' error along with the message, which is messy, but
  59. ; better than trying to put everything inside a IF m80 OR mac80 conditional,
  60. ; because LASM doesn't like nested IF's, either.
  61.  
  62. IF ncrdmv
  63. .printx * Assembling KERMIT-80 for the N.C.R. Decision Mate V *
  64. ENDIF
  65.  
  66. IF brain
  67. .printx * Assembling KERMIT-80 for the Intertec Superbrain *
  68. ENDIF
  69.  
  70. IF brainm
  71. .printx * With main port selected
  72. ENDIF
  73. IF braina
  74. .printx * With Aux port
  75. ENDIF
  76.  
  77. IF pci2651      ;
  78. .printx * assembling Kermit-80 for 2651 PCI as comms device *
  79. ENDIF
  80.  
  81. IF torch
  82. .printx * Assembling Kermit-80 for Torch Unicorn 5 *
  83. ENDIF
  84. ; *******This should be in the original CPXSYS.ASM file
  85. ;
  86. ;=========================================================================
  87. ;       I/O Byte assignments (2-bit fields for 4 devices at loc 3)
  88. ;
  89. ;bits 6+7               LIST field
  90. ;       0               LIST is Teletype device (TTY:)
  91. ;       1               LIST is CRT device (CRT:)
  92. ;       2               LIST is Lineprinter (LPT:)
  93. ;       3               LIST is user defined (UL1:)
  94. ;
  95. ;bits 4+5               PUNCH field
  96. ;       0               PUNCH is Teletype device (TTY:)
  97. ;       1               PUNCH is high speed punch (PUN:)
  98. ;       2               PUNCH is user defined #1 (UP1:)
  99. ;       3               PUNCH is user defined #2 (UP2:)
  100. ;
  101. ;bits 2+3               READER field
  102. ;       0               READER is Teletype device (TTY:)
  103. ;       1               READER is high speed reader (RDR:)
  104. ;       2               READER is user defined #1 (UR1:)
  105. ;       3               READER is user defined #2 (UR2:)
  106. ;
  107. ;bits 0+1               CONSOLE field
  108. ;       0               CONSOLE is console printer (TTY:)
  109. ;       1               CONSOLE is CRT device (CRT:)
  110. ;       2               CONSOLE is in Batch-mode (BAT:);READER = Input,
  111. ;                       LIST = Output
  112. ;       3               CONSOLE is user defined (UC1:)
  113. ;
  114. ;=========================================================================
  115.  
  116. iobyte  EQU     03H     ;Location of I/O byte
  117.  
  118.  
  119. ; [13] modifed to use either main or aux port.  Should really
  120. ;       be selected by set port, but this is urgent, so no frills
  121. IF brain
  122. baudst  EQU     60H     ;
  123. baudrt  EQU     0EF00H  ;Memory location where baud rates are stored.
  124. output  EQU     01H     ;Transmitter ready
  125. input   EQU     02H     ;Input data available
  126. TxEmpty EQU     04h     ;Transmitter empty
  127. z80     SET     TRUE    ;I don't know...
  128. ENDIF;brain
  129. IF brainm               ; Superbrain and main ports
  130. mnport  EQU     58H     ;Modem data port
  131. mnprts  EQU     59H     ;Modem status port
  132. ENDIF   ;brainm
  133. IF braina               ; Superbrain and aux port
  134. mnport  EQU     40H     ;Modem data port
  135. mnprts  EQU     41H     ;Modem status port
  136. ENDIF   ;braina [13]
  137.  
  138. IF ncrdmv
  139. iobase    equ    70h        ; base address of PCI device
  140. modrx    equ    70h        ; Rx data port
  141. mnprts    equ    71h        ; status port
  142. mnmodr    equ    72h        ; mode register read
  143. mncmdr    equ    73h        ; command register read
  144. modtx    equ    74h        ; Tx data port
  145. mnmodw    equ    76h        ; mode register write
  146. mncmdw    equ    77h        ; command register write
  147. txrdy    equ    1
  148. output    equ    txrdy
  149. rxrdy    equ    2
  150. input    equ    rxrdy
  151. baudini    equ    0ah        ; initial baud to 2400
  152. z80    SET    true
  153. cpuspd    SET    40
  154. ENDIF
  155.  
  156. IF pci2651                      ;[28]
  157. iobase  equ     04h             ; base address of PCI device
  158. mnport  equ     iobase          ; rx and tx data ports
  159. mnprts  equ     iobase+1        ; status port
  160. mnmode  equ     iobase+2        ; mode port
  161. mncmd   equ     iobase+3        ; PCI command port
  162.  
  163. txrdy   equ     1               ; tx ready bit set if free
  164. output  equ     txrdy
  165. rxrdy   equ     2               ; RX ready bit
  166. input   equ     rxrdy
  167. baudini equ     7               ; 7 => 1200 baud by default
  168. z80     SET     true            ; For Ithica intersystems it is
  169. cpuspd  SET     40              ; and running at four megs
  170. ENDIF                           ;[28]
  171.  
  172. IF torch        ;[13]
  173. z80     SET     TRUE
  174. ;                       [32] baudini removed as now read current baud rate
  175. ;               settings from base processor.
  176.  
  177. ;baudini        equ     707h    ; Initial Baud rate = 1200 baud
  178.                         ; Entry to be of form x0xh where x is
  179.                         ; the value x in the FX 7,x and FX 8,x
  180.                         ; funtion calls.  4= 1200 baud, 7 = 9600
  181.                         ; 2 = 300 baud.
  182. ENDIF
  183.  
  184. IF brain OR torch
  185. defesc  EQU     ']'-100O        ;The default escape character.
  186. ENDIF;brain OR torch
  187.  
  188. ; If none of the above, default to VT52-EMULATION ON.
  189. IF NOT crt 
  190. vtval   EQU     1
  191. ENDIF;NOT crt
  192.  
  193.  
  194. sysxin:
  195.  
  196. IF brainm                       ;[25]
  197.         lda     baudrt          ; fetch current baud rate
  198.         ani     0F0H            ; extract left nibble
  199.         rrc                     ; shift right 4 places
  200.         rrc
  201.         rrc
  202.         rrc
  203.         sta     speed           ; store as comm port speed
  204.         sta     speed+1         ;  (16 bits, to match speed table entries)
  205. ENDIF;brainm
  206.  
  207. IF braina                       ;[25]
  208.         lda     baudrt          ; fetch current baud rate
  209.         ani     00FH            ; extract right nibble
  210.         sta     speed           ; store as comm port speed
  211.         sta     speed+1         ;  (16 bits, to match speed table entries)
  212. ENDIF;braina
  213.  
  214. IF torch                        ; [13] [32]
  215.         push    h
  216.         mvi     a,0f2h          ; nick code from BBC initialisation
  217.         lxi     h,0ff00h
  218.         call    osbyte          ; Read current speed setting
  219.         mov     a,l
  220.         ani     7
  221.         xri     7               ; Store as two's complement
  222.         inr     a
  223.         sta     speed
  224.         sta     speed+1
  225.         mov     e,a
  226.         call    sysspd          ; Make sure they are both the same!
  227.         mvi     a,15            ; Flush all internal buffers [32]
  228.         mvi     l,0
  229. ;       call    osbyte
  230.         mvi     a,3
  231.         lxi     h,0100h         ; *FX 3,0,1 Enable RS423
  232.         call    osbyte
  233.         mvi     a,2             ; Select keyboard, Enable RS423 input
  234.         mvi     l,2
  235.         call    osbyte
  236.         mvi     a,5             ; Select serial printer [32]
  237.         mvi     l,2
  238.         call    osbyte          ; [30]
  239.         mvi     a,6             ; Must be able to send LF [30]
  240.         mvi     l,0
  241.         call    osbyte          ; [30]
  242.     mvi    a,202        ; FX 202,255 set lower case on
  243.     mvi    l,255
  244.     call    osbyte
  245.         pop     h
  246.  
  247. ; Now see what version of MCP CCP roms.  Assume >1, else copy a few of the 
  248. ;    older Torch VDU declares over the new ones.
  249. ;
  250. ;    lda    0ffffh        ; Address 0ffffh has single byte Version no.
  251. ;    push    psw        ; save for a rainy day
  252. ;    ani    0F0h        ; get ms digit of MCP version
  253. ;    rra            ; move right 4 places
  254. ;    rra
  255. ;    rra
  256. ;    rra
  257. ;    ani    0fh
  258. ;    adi    30h        ; make it a number
  259. ;    sta    mcpver
  260. ;    pop    psw        ; its raining...
  261. ;    push    psw        ; ... its pouring...
  262. ;    ani    0fh        ; get ls digit
  263. ;    adi    30h        ; make it ascii number
  264. ;    sta    mcpver+2
  265. ;    pop    psw        ; restore psw
  266. ;    cpi    10h        ; Version 1.00 or less?
  267. ;    jp    init2        ; yes, so skip next bit
  268. ;    lxi    h,ooutli    ; from old string table
  269. ;    lxi    d,ttab        ; to new ttab
  270. ;    lxi    b,60        ; 60 bytes to move
  271. ;    call    mover
  272. init2:    
  273.  
  274. IF ncrdmv
  275.     mvi    a,00        ; clear out command register
  276.     out    mncmdw
  277.     mvi    a,4eh        ; 1 stop bit, 8 data bits, / by 16 counter
  278.     out    mnmodw
  279.     mvi    a,70h+baudini    ; baud rate and select internal rate gen.
  280.     out    mnmodw
  281.     mvi    a,27h        ; enable tx and rx, RTS and DTR low
  282.     out    mncmdw
  283. ENDIF    ; ncrdmv
  284.  
  285. IF pci2651              ;[28]
  286.         in      mncmd           ; clearw command reg counter
  287.         mvi     a,4eh           ; 1 stop bit, 8 data bits, / by 16 counter
  288.         out     mnmode
  289.         mvi     a,30h+baudini   ; baud rate and select internal rate gen.
  290.         out     mnmode
  291.         mvi     a,27h           ; enable tx and rx, RTS and DTR low
  292.         out     mncmd
  293. ENDIF   ; pci2651 [28]
  294.  
  295.         ret                     ; return from system-dependent routine
  296.  
  297. ;
  298. ;
  299. ;       system-dependent termination processing
  300. ;       If we've changed anything, this is our last chance to put it back.
  301. sysexit:
  302.         ret
  303.  
  304. ;
  305. ;       system-dependent processing for start of CONNECT command
  306. ;
  307. syscon:
  308.         ret
  309.  
  310. conmsg:         ; Messages printed when entering transparent (CONNECT) mode:
  311. ;
  312. ;
  313. ;       syscls - system-dependent close routine
  314. ;       called when exiting transparent session.
  315. ;
  316. syscls:
  317.         ret
  318. ;
  319. ;
  320. ;       sysinh - help for system-dependent special functions.
  321. ;       called in response to <escape>?, after listing all the
  322. ;       system-independent escape sequences.
  323. ;
  324. sysinh:
  325. IF torch OR brain OR pci2651 OR ncrdmv
  326.         lxi     d,inhlps        ; we got options...
  327.         call    prtstr          ; print them.
  328. ENDIF;torch OR brain OR pci2651 OR ncrdmv
  329.  
  330.         ret
  331.  
  332.  
  333. ;additional, system-dependent help for transparent mode
  334. ; (two-character escape sequences)
  335. inhlps:
  336.  
  337. ; [16] [18] have added super brain and Torch to the list of Breaking machines.
  338.  
  339. IF pci2651 OR brain OR torch OR ncrdmv
  340.         db      cr,lf,'B  Transmit a BREAK'
  341. ENDIF   ;pci2651 OR brain OR torch OR ncrdmv
  342.  
  343. IF torch ; added this simply to debug the escape cokebottle D for the apple
  344.         db      cr,lf,'D  Disconnect the modem (Test purposes only)'
  345. ENDIF;Torch
  346.  
  347.         db      '$'                     ;[hh] table terminator
  348.  
  349. ;
  350. ;       sysint - system dependent special functions
  351. ;       called when transparent escape character has been typed;
  352. ;       the second character of the sequence is in A (and in B).
  353. ;       returns:
  354. ;       non-skip: sequence has been processed
  355. ;       skip:   sequence was not recognized
  356. sysint: ani     137O            ; convert lower case to upper, for testing...
  357.  
  358. ; [19] have added superbrain and torch to the list
  359.  
  360. IF brain OR pci2651 OR torch OR ncrdmv
  361.         cpi     'B'             ; send break?
  362.         jz      sendbr          ; yes, go do it.  return nonskip when through.
  363. ENDIF   ;brain OR pci2651 OR torch OR ncrdmv
  364.  
  365. IF Torch; added bit for doing a D...
  366.         cpi     'D'             ;drop the line...
  367.         jz      dropln
  368. ENDIF ;torch
  369.  
  370.         jmp     rskp            ; take skip return - command not recognized.
  371.  
  372.  
  373. IF torch
  374. dropln: lxi     d,dropm         ; tell user line is dropped..
  375.         call    prtstr
  376.         xra     a               ; destroy A
  377.         ret
  378. dropm:  db      bell,cr,lf,'Testing line dropped ',cr,lf,bell
  379.         db      '$'
  380. ENDIF ;torch and dropping them there lines..
  381.  
  382. ;
  383.  
  384. IF brain 
  385. sendbr:
  386. ;
  387. ;       Ensure that the transmitter has finished sending buffered chars
  388. sndbr1: in      mnprts          ; get UART status
  389.         ani     TxEmpty         ; everything sent?
  390.         jz      sndbr1          ; no, wait a bit more
  391. ;
  392. ;       Begin sending a break by setting bit in UART command register
  393.         mvi     a,3Fh           ; Set TxEna, DTR, RxEna, SBreak, ErrRst, RTS
  394.         out     mnprts
  395. ;
  396. ;       Wait for 250 milliseconds (using hundredths second delay routine)
  397.         mvi     a,25
  398.         call    delay
  399. ;
  400. ;       Resume normal operation by clearing the SendBreak command bit
  401.         mvi     a,37h           ;Set TxEna, DTR, RxEna, ErrRst, RTS
  402.         out     mnprts
  403. ;
  404.         ret                     ;done
  405. ENDIF;brain 
  406.  
  407. IF torch ; [18] [27] [30] [32]
  408. ; Send a break.  
  409. ;
  410. ; [30]  Dumping of 6502 code not yet used, but may be for later versions of 
  411. ; the Torch CCCP Rom in the BBC.  This works, so I leave it for now.
  412.  
  413. sendbr:
  414.         push    h               ;save for a monsoon
  415.         mvi     a,0e8h
  416.         lxi     h,0             ; turn interrupts off
  417.         call    osbyte
  418.         push    h
  419. ;
  420.         mvi     a,9ch           ; OSBYTE call 9c is read/write 6850 cntl prt
  421.         lxi     h,0077h         ; H = 6502 Y reg, L = 6502 X reg
  422.         call    osbyte          ; returned new val. = (old value AND Y)XOR X
  423.         push    h               ; save it for return
  424. ;
  425.         mvi     a,30
  426.         call    delay           ; do a delay
  427. ;
  428. ; now clear rx register
  429. ;
  430.         mvi     a,96h           ; do a read sheila address 08h
  431.         mvi     l,8
  432.         mvi     h,0
  433.         call    osbyte          ; read sheila 08h = 6850 rx reg
  434. ;
  435. ; restore 6850 regs...
  436. ;
  437.         pop     h               ; restore previous cntl reg
  438.                                 ; old x reg in l, so leave it there
  439. ;       mov     l,h
  440.         mvi     h,0
  441.         mvi     a,9ch           ; write previous value to 6850
  442.         call    osbyte
  443. ;
  444. ; and Beebs interrupt mask
  445. ;
  446.         pop     h               ; get interrupt mask
  447.                                 ; Once again, old X in L so leave it alone
  448. ;       mov     l,h
  449.         mvi     h,0
  450.         mvi     a,0e8h
  451.         call    osbyte          ; restore interrupts mask
  452. ;
  453.         pop     h
  454.         ret                     ; its raining again, so exit
  455. ENDIF   ; torch [18] [32]
  456.  
  457. IF ncrdmv
  458. sendbr:    in    mnprts        ; get status
  459.     ani    04h        ; make sure shift register is empty
  460.     jz    sendbr
  461.  
  462.     mvi    a,2fh        ; force a break
  463.     out    mncmdw
  464.     mvi    a,100        ; set delay period
  465.     call    delay
  466.     mvi    a,27h        ; restore command register
  467.     out    mncmdw
  468.     ret
  469. ENDIF    ; ncrdmv
  470.  
  471. IF pci2651      ;[28]
  472. sendbr: in      mnprts
  473.         ani     04h             ; make sure shift reg is clear
  474.         jz      sendbr
  475.  
  476.         mvi     a,2fh           ; set foe a break
  477.         out     mncmd
  478.         mvi     a,100           ; wait a bit
  479.         call    delay
  480.         mvi     a,27h           ; restore mode
  481.         out     mncmd
  482.         ret
  483. ENDIF   ;pci2651 [28]
  484.  
  485. ;
  486. ;       sysflt - system-dependent filter
  487. ;       called with character in E.
  488. ;       if this character should not be printed, return with A = zero.
  489. ;       preserves bc, de, hl.
  490. ;       note: <xon>,<xoff>,<del>, and <nul> are always discarded.
  491. sysflt:
  492.         mov     a,e             ; get character for testing
  493.         ret
  494.  
  495. ;       mdmflt - modem filter [30]
  496. ;       called with character to be sent to printer in E
  497. ;       with parity set as appropriate.
  498. ;       return with accumulator = 0 do do nothing,
  499. ;                               <> 0 to send char in E.
  500. mdmflt:
  501.         mov     a,e             ;[30] get character to test
  502. IF torch        ;[30] map del to bs,space,bs
  503.         ani     7fh             ; strip parity
  504.         cpi     7fh             ; is it the delete character
  505.         rnz                     ; no, then a <> 0 so print it
  506.         mvi     e,bs            ; else load a backspace
  507.         call    outmdm          ; little recursion...
  508.         mvi     e,' '           ; then a space
  509.         call    outmdm          ; backspace, space, now another...
  510.         mvi     e,bs            ; backspace
  511.         call    outmdm          ;
  512.         xra     a               ; clear a => on return do nowt.
  513. ENDIF   ;torch [30]
  514.         ret
  515.  
  516.  
  517.  
  518. ;       prtflt - printer filter [30]
  519. ;       called with character to be sent to printer in E
  520. ;       returns with a = 0 to do nothing
  521. ;                    a <> 0 to print it.
  522. ;
  523. ;       this routine for those printer that automatically insert
  524. ;       a lf on cr, or cr for lf.  Should this be shifted to 
  525. ;       the system indep. stuff, in say 4.06?
  526. prtflt:
  527.         mov     a,e             ; [30] get character to test
  528. IF torch        ; strip out lf from printer stream
  529.         ani     7fh             ; make sure it is parity less
  530.         cpi     lf              ; is it a line feed?
  531.         rnz                     ; no, print it
  532. ;       xra     a               ; yes, don't.
  533.         
  534. ENDIF   ;torch [30]
  535.         ret
  536.  
  537.  
  538. ;
  539. ;
  540. ; system-dependent processing for BYE command.
  541. ;  for apmmdm, heath, and lobo, hang up the phone.
  542. sysbye:
  543.         ret
  544. ;
  545. ;       This is the system-dependent command to change the baud rate.
  546. ;       DE contains the two-byte value from the baud rate table; this
  547. ;       value is also stored in 'speed'.
  548. sysspd:
  549.  
  550. ; Set the speed for the Brain (Main Port)
  551. IF brainm                       ;[25]
  552.         lda     baudrt          ;Get the present baud rates.
  553.         ani     0fH             ;turn off the left
  554.         mov     d,a             ;Set it aside.
  555.         mov     a,e             ;Get the new baud rate.
  556.         rlc                     ;Shift left 4 places.
  557.         rlc
  558.         rlc
  559.         rlc
  560.         ora     d               ; combine with the old baud rate
  561.         sta     baudrt          ;Store the new baud rates.
  562.         out     baudst          ;Set the baud rates.
  563.         ret
  564. ENDIF;brainm
  565.  
  566. ; Set the speed for the Brain (Aux Port)
  567. IF braina                       ;[25]
  568.         lda     baudrt          ;Get the present baud rates.
  569.         ani     0f0H            ;turn off the right
  570.         ora     e               ; combine with the new baud rate
  571.         sta     baudrt          ;Store the new baud rates.
  572.         out     baudst          ;Set the baud rates.
  573.         ret
  574. ENDIF;braina
  575.  
  576. If torch        ; Set speed for Torch [14] [32]
  577.         mvi     a,7             ; Osbyte call to set rx rate
  578.         mov     l,e
  579.         call    osbyte          ; 
  580.         mvi     a,8             ; set up for tx rate to be set
  581.         mov     l,e
  582.         call    osbyte
  583.         ret                     ; and now, all rates should be different
  584.  
  585. ENDIF   ;torch  [14] [32]
  586.  
  587. IF ncrdmv    ; Set baud rate for NCR Decision Mate V
  588.     mvi    a,00        ; clear command register
  589.     out    mncmdw
  590.     mvi    a,4eh        ; set for 1 stop, 8 data bits
  591.         out     mnmodw        ; save in mode 1 port
  592.         mvi     a,70h        ; set bits for rate etc..
  593.         add     e        ; add baud rate (bits 0 - 3)
  594.         out     mnmodw        ; set mode port 2
  595.         mvi     a,27h        ; set tx/rx ready, RTS CTS active
  596.         out     mncmdw
  597.         ret
  598. ENDIF   ; ncrdmv
  599.  
  600.  
  601. IF pci2651      ; Set baud for PCI [28]
  602.         in      mncmd           ; Clear register counter
  603.         mvi     a,4eh           ; set for 1 stop, 8 data bits
  604.         out     mnmode          ; save in mode 1 port
  605.         mvi     a,30h           ; set bits for rate etc..
  606.         add     e               ; add baud rate (bits 0 - 3)
  607.         out     mnmode          ; set mode port 2
  608.         mvi     a,27h           ; set tx/rx ready, RTS CTS active
  609.         out     mncmd
  610.         ret
  611. ENDIF   ;pci2651 [28]
  612.  
  613. ;
  614. ;       Speed tables
  615. ; (Note that speed tables MUST be in alphabetical order for later
  616. ; lookup procedures, and must begin with a value showing the total
  617. ; number of entries.  The speed help tables are just for us poor
  618. ; humans.
  619.  
  620. ;       db      string length,string,divisor (2 identical bytes or 1 word)
  621. ; [Toad Hall]
  622.  
  623. IF brain OR pci2651 OR ncrdmv
  624. spdtbl: db      10h                     ;16 entries
  625.         db      03h,'110$',     02h,02h
  626.         db      04h,'1200$',    07h,07h
  627.         db      05h,'134.5$',   03h,03h
  628.         db      03h,'150$',     04h,04h
  629.         db      04h,'1800$',    08h,08h
  630.         db      05h,'19200$',   0fh,0fh
  631.         db      04h,'2000$',    09h,09h
  632.         db      04h,'2400$',    0ah,0ah
  633.         db      03h,'300$',     05h,05h
  634.         db      04h,'3600$',    0bh,0bh
  635.         db      04h,'4800$',    0ch,0ch
  636.         db      02h,'50$',      00h,00h
  637.         db      03h,'600$',     06h,06h
  638.         db      04h,'7200$',    0dh,0dh
  639.         db      02h,'75$',      01h,01h
  640.         db      04h,'9600$',    0eh,0eh
  641.  
  642. sphtbl: db      cr,lf,'   50     75    110    134.5  150    300    600   1200'
  643.         db      cr,lf,' 1800   2000   2400   3600   4800   7200   9600  19200$'
  644. ENDIF;brain OR pci2651 OR ncrdmv
  645.  
  646. IF torch        ;[17]
  647. spdtbl: db      8               ; 8 entries
  648.         db      4,'1200$',      4,4
  649.         db      3,'150$',       2,2
  650.         db      5,'19200$',     8,8
  651.         db      4,'2400$',      5,5
  652.         db      3,'300$',       3,3
  653.         db      4,'4800$',      6,6
  654.         db      2,'75$',        1,1
  655.         db      4,'9600$',      7,7
  656.  
  657. sphtbl: db      cr,lf,'    75    150    300  1200  2400  4800  9600 19200$'
  658. ENDIF;torch [17]
  659.  
  660.  
  661. ; The following conditionals were once a huge if not statement.  There
  662. ; wasn't enough room to add the lobo to the list, so it had to be broken
  663. ; into 2, which you can't do with an if not.  I redid it as two ifs and
  664. ; applied them to those that wouldn't set baud. [Hal Hostetler]
  665. ;
  666. ;       This is the system-dependent SET PORT command.
  667. ;       HL contains the argument from the command table.
  668. sysprt:
  669. IF iobyt
  670.         mov     a,m             ;Get the I/O byte
  671.         sta     prtiob          ;Save the desired IO byte for this port
  672.         inx     h               ;Point at next entry
  673.         mov     a,m             ;Get the output function
  674.         sta     prtfun          ;Save it
  675. ENDIF;iobyt
  676.  
  677.         ret
  678. ;
  679. ;
  680. ;
  681. ;       Port tables for GENERIC CPM 2.2
  682. IF gener
  683. ; help text
  684. prhtbl: db      cr,lf,'CRT device'
  685.         db      cr,lf,'PTR device'
  686.         db      cr,lf,'TTY device'
  687.         db      cr,lf,'UC1 device'
  688.         db      cr,lf,'UR1 device'
  689.         db      cr,lf,'UR2 device$'
  690.  
  691. ; command table
  692. prttbl: db      06H             ;Six devices to choose from
  693.         db      03H,'CRT$'
  694.                 dw      crtptb
  695.         db      03H,'PTR$'
  696.                 dw      ptrptb
  697.         db      03H,'TTY$'
  698.                 dw      ttyptb
  699.         db      03H,'UC1$'
  700.                 dw      uc1ptb
  701.         db      03H,'UR1$'
  702.                 dw      ur1ptb
  703.         db      03H,'UR2$'
  704.                 dw      ur2ptb
  705.  
  706. ; port entry table
  707. ; table entries are:
  708. ;       db      iobyte-value, BDOS output function, reserved
  709. crtptb: db      crtio,conout,0
  710. ptrptb: db      ptrio,punout,0
  711. ttyptb: db      ttyio,conout,0
  712. uc1ptb: db      uc1io,conout,0
  713. ur1ptb: db      ur1io,punout,0
  714. ur2ptb: db      ur2io,punout,0
  715. ENDIF;gener
  716.  
  717. ;
  718. ;
  719. IF iobyt
  720. prtfun: db      punout          ;Function to use for output to comm port
  721. prtiob: db      batio           ;I/O byte to use for communicating
  722. coniob: db      defio           ;I/O byte to use for console
  723. ENDIF;iobyt
  724.  
  725. IF NOT iobyt
  726. prttbl  equ     0               ; SET PORT is not supported
  727. prhtbl  equ     0
  728. ENDIF;NOT iobyt
  729. ;
  730. ;
  731. ;       selmdm - select modem port
  732. ;       selcon - select console port
  733. ;       selmdm is called before using inpmdm or outmdm;
  734. ;       selcon is called before using inpcon or outcon.
  735. ;       For iobyt systems, diddle the I/O byte to select console or comm port;
  736. ;       For Decision I, switches Multi I/O board to console or modem serial
  737. ;       port.  [Toad Hall]
  738. ;       For the rest, does nothing.
  739. ;       preserves bc, de, hl.
  740. selmdm:
  741. IF iobyt
  742.         lda     prtiob          ;Set up for output to go to the comm port
  743.         sta     iobyte          ;Switch byte directly
  744. ENDIF;iobyt
  745.         ret
  746.  
  747. selcon:
  748. IF iobyt
  749.         lda     coniob          ;Set up for output to go to the console port
  750.         sta     iobyte          ;Switch directly
  751. ENDIF;iobyt
  752.  
  753.         ret
  754. ;
  755. ;       Get character from console, or return zero.
  756. ;       result is returned in A.  destroys bc, de, hl.
  757. ;
  758. inpcon:
  759. IF NOT iobyt
  760.         mvi     c,dconio        ;Direct console I/O BDOS call.
  761.         mvi     e,0FFH          ;Input.
  762.         call    BDOS
  763. ENDIF;NOT iobyt
  764.  
  765. IF iobyt
  766.         call    bconst          ;Get the status
  767.         ora     a               ;Anything there?
  768.         rz                      ;No, forget it
  769.         call    bconin          ;Yes, get the character
  770. ENDIF;iobyt
  771.         ret
  772. ;
  773. ;
  774. ;       Output character in E to the console.
  775. ;       destroys bc, de, hl
  776. ;
  777. outcon:
  778.  
  779. IF NOT iobyt
  780.         mvi     c,dconio        ;Console output bdos call.
  781.         call    bdos            ;Output the char to the console.
  782. ENDIF;NOT iobyt
  783.  
  784. IF iobyt
  785.         mov     c,e             ;Character
  786.         call    bcnout          ;to Console
  787. ENDIF;iobyt
  788.         ret
  789. ;
  790. ;
  791. ;       outmdm - output a char from E to the modem.
  792. ;               the parity bit has been set as necessary.
  793. ;       returns nonskip; bc, de, hl preserved.
  794. outmdm:
  795. IF inout AND NOT ncrdmv
  796.         in      mnprts          ;Get the output done flag.
  797.         ani     output          ;Is it set?
  798.         jz      outmdm          ;If not, loop until it is.
  799.         mov     a,e
  800.         out     mnport          ;Output it.
  801.         ret
  802. ENDIF;inout AND NOT ncrdmv
  803.  
  804. IF inout AND ncrdmv
  805.     in    mnprts        ;Get the output done flag
  806.     ani    output        ;Set ?
  807.     jz    outmdm        ;Loop until it is
  808.     mov    a,e
  809.     out    modtx        ;output char
  810.     ret
  811. ENDIF;inout AND ncrdmv
  812.  
  813. IF iobyt
  814. ;**** Note that we enter from outpkt with the I/O byte already set up for
  815. ;  output to go to the comm port
  816.         push    h
  817.         push    b
  818.         lda     prtfun          ;Get the output function
  819.         mov     c,a             ;Into C
  820.         call    bdos            ;And output the character
  821.         pop     b
  822.         pop     h
  823.         ret
  824. ENDIF;iobyt
  825.  
  826.  
  827. IF torch        ; [32] [13] Torch stuff.  Requires some bit bashing
  828.                 ; via the BBC host computer (io computer)
  829.                 ; see also decription of osbyte later on
  830. outdat:
  831.         lda     prinuse         ; get the printer in use flag
  832.         ana     a               ; if set, then must use traditional osbyte,
  833.         jnz     outda2          ; else...
  834.         push    b
  835.         push    h               ; Preserve registers [32]
  836.         call    tx
  837.         db      1               ; MCP send to printer command
  838.         mov     c,e             ; Byte to send is in E [32]
  839.         call    txbyte
  840.         pop     h
  841.         pop     b
  842.         ret
  843.  
  844. outda2:                         ; Preserve registers [32]
  845.         push    h
  846.         mvi     a,138           ; Osbyte insert byte into buffer
  847.         mvi     l,2
  848.         mov     h,e             ; get the byte to be sent s-l-o-w-l-y
  849.         call    osbyte
  850.         pop     h               ; Restore registers and exit
  851.         ret
  852.  
  853. ENDIF   ;[13]
  854.  
  855. ;
  856. ;
  857. ;       get character from modem; return zero if none available.
  858. ;       for IOBYT systems, the modem port has already been selected.
  859. ;       destroys bc, de, hl.
  860. inpmdm:
  861. IF iobyt
  862.         call    bconst          ;Is Char at COMM-Port?
  863.         ora     a               ;something there?
  864.         rz                      ; return if nothing there
  865.         call    bconin          ; data present. read data.
  866. ENDIF;iobyt
  867.  
  868. IF inout AND NOT ncrdmv
  869. ;Note: modem port should already be selected for mdI.  [Toad Hall]
  870.         in      mnprts          ;Get the port status into A.
  871.         ani     input           ;See if the input ready bit is on.
  872.         rz                      ;If not then return.
  873.         in      mnport          ;If so, get the char.
  874. ENDIF;inout AND NOT ncrdmv
  875.  
  876. IF inout AND ncrdmv
  877.     in    mnprts        ;Get input port status
  878.     ani    input        ;Mask input RDY bit
  879.     rz            ;return if no char
  880.     in    modrx        ;get the char
  881. ENDIF;inout AND ncrdmv
  882. IF torch                        ; [32] [13] torch input
  883. indat:
  884.         push    h
  885.         mvi     a,128
  886.         lxi     h,0fffeh        ; Read buffer status
  887.         call    osbyte
  888.         mov     a,h             ; HL has number of characters
  889.         ora     l               ; in the buffer
  890.         jz      indatq          ; None, so skip fetch 
  891.         mvi     a,145           ; Get character from input buffer [32]
  892.         lxi     h,1
  893.         call    osbyte          ; Result returned in 'Y', rather H
  894.         mov     a,h
  895. indatq:
  896.         pop     h
  897.         ani     7fh
  898.         ret                     ; rx data in A
  899. ENDIF ;torch [13] [32]
  900.  
  901. ret                     ; return with character in A
  902.  
  903.  
  904. ;
  905. ;       flsmdm - flush comm line.
  906. ;       Modem is selected.
  907. ;       Currently, just gets characters until none are available.
  908.  
  909. flsmdm: call    inpmdm          ; Try to get a character
  910.         ora     a               ; Got one?
  911.         jnz     flsmdm          ; If so, try for another
  912.         ret                     ; Receiver is drained.  Return.
  913.  
  914.  
  915. ;
  916. ;
  917. ;       lptstat - get the printer status. Return a=0 if ok, or 0ffh if not.
  918. lptstat:
  919. IF torch
  920.     mvi    a,80h        ; read chars remaining in printer buffer
  921.     mvi    l,252        ; do osbyte 80H, X=252 (printer buffer)
  922.     mvi    h,0ffh
  923.     call    osbyte
  924.     mov    a,h
  925.     cpi    10        ; 10 characters left?
  926.     mvi    a,0        ; if pos, yes r better
  927.     rp
  928.     mvi    a,0ffh
  929.     ret
  930. ENDIF    ;torch
  931.  
  932. IF torch
  933.     mvi    a,5        ; got to select the real printer (par. port)
  934.     mvi    l,1        ; ie FX 5,1
  935.     call    osbyte
  936. ENDIF    ;torch
  937.  
  938. IF iobyte       ;[33]
  939.         call    bprtst          ; get status
  940. ENDIF   ;iobyte[33]
  941.  
  942. IF torch
  943.     push    psw
  944.     mvi    a,5        ; restore serial line = printer
  945.     mvi    l,2        ; ie FX 5,2
  946.     call    osbyte
  947.     pop    psw        ; return with code in a
  948. ENDIF    ;torch
  949.  
  950.  
  951. IF NOT iobyte   ;[33]
  952.         xra     a               ; assume it is ok.. this may not be necessary
  953. ENDIF   ;iobyte [33]
  954.         ret
  955. ;
  956. ;
  957. ;       outlpt - output character in E to printer
  958. ;       console is selected.
  959. ;       preserves de.
  960. outlpt:
  961.         push    d               ; save DE in either case
  962.         call    prtflt          ; go through printer filter [30]
  963.         ana     a               ; if A = 0 do nothing,
  964.         jz      outlp1          ; [30] if a=0 do nothing
  965.  
  966. IF torch        ;[30] Must set printer routed to par port
  967.         mvi     a,5             ; fx 5,1 (parallel port selected for printer)
  968.         mvi     l,1             ; Modified for new osbyte form [32]
  969.         call    osbyte
  970. ENDIF   ;torch [30]
  971.  
  972. IF NOT iobyt
  973.         mvi     c,lstout
  974.         call    bdos            ;Char to printer
  975. ENDIF;NOT iobyt
  976. IF iobyt
  977.         mov     c,e
  978.         call    blsout
  979. ENDIF;iobyt
  980. IF torch        ; re-route printer to serial port => faster tx bytes to line [30]
  981.         mvi     a,5             ; Modified for new Osbyte form [32]
  982.         mvi     l,2             ;fx 5,2
  983.         call    osbyte
  984.         mvi     a,6
  985.         mvi     l,0             ;fx 6,0
  986.         call    osbyte
  987. ENDIF   ;torch [30]
  988.  
  989. outlp1: pop     d               ; restore saved register pair
  990.         ret
  991. ;
  992. ;
  993. ;       Screen manipulation routines
  994. ;       csrpos - move to row B, column C
  995. ;
  996. ;       csrpos for terminals that use a leadin sequence followed
  997. ;        by (row + 31.) and (column + 31.)
  998. ;
  999. IF brain
  1000. csrpos: push    b               ; save coordinates
  1001.         lxi     d,curldn        ; get cursor leadin sequence
  1002.         call    prtstr          ; print it
  1003.         pop     h               ; restore coordinates
  1004.         mov     a,h             ; get row
  1005.         adi     (' '-1)         ; space is row one
  1006.         mov     e,a
  1007.         push    h
  1008.         call    outcon          ; output row
  1009.         pop     h
  1010.         mov     a,l             ; get column
  1011.         adi     (' '-1)         ; space is column one
  1012.         mov     e,a
  1013.         jmp     outcon          ; output it and return
  1014. ENDIF;brain
  1015. ;
  1016. ;
  1017. IF torch
  1018. csrpos: push    b               ; save coordinates
  1019.         lxi     d,curldn        ; get cursor leadin sequence
  1020.         call    prtstr          ; print it
  1021.         pop     h               ; restore coordinates
  1022.         mov     a,l             ; [obs] get column
  1023.         adi     0ffh            ; NULL is column one
  1024.         mov     e,a
  1025.         push    h
  1026.         call    outcon          ; output row
  1027.         pop     h
  1028.         mov     a,h             ; [obs] get row
  1029.         adi     0ffh            ; NULL (ie decrement) is row one
  1030.         mov     e,a
  1031.         jmp     outcon          ; output it and return
  1032. ENDIF;torch 
  1033. ;
  1034. ;
  1035. ; delchr - make delete look like a backspace.  Unless delete is a printing
  1036. ;       character, we just need to print a backspace. (we'll output clrspc
  1037. ;       afterwards)
  1038. ;       For Kaypro and Vector General, delete puts a blotch on the screen.
  1039. ;       For Apple and Osborne 1, delete moves but doesn't print.
  1040. delchr:
  1041.  
  1042.  
  1043. IF NOT torch ;[22]
  1044.         mvi     e,bs            ;get a backspace
  1045.         jmp     outcon
  1046. ENDIF;NOT torch
  1047.  
  1048. ; erase the character at the current cursor position
  1049. clrspc: mvi     e,' '
  1050.         call    outcon
  1051.         mvi     e,bs            ;get a backspace
  1052.         jmp     outcon
  1053.  
  1054. ; erase the current line
  1055. clrlin: lxi     d,eralin
  1056.         jmp     prtstr
  1057.  
  1058. ; erase the whole screen, and go home. preserves b (but not c)
  1059. clrtop: lxi     d,erascr
  1060.         jmp     prtstr
  1061.  
  1062.  
  1063. IF torch        ;[13]
  1064. ;
  1065. ; OSBYTE call from Torch to BBC Base Processor.
  1066. ;
  1067. ;               A register has osbyte type
  1068. ;               H register has equivalent Y register of 6502
  1069. ;               L register has equivalent X register of 6502
  1070. ;
  1071. ;               Results (X and Y) are returned in HL respectively
  1072. ;
  1073. ;
  1074.  
  1075. usrimm  equ     0ffc0h          ; MCP user function [32]
  1076. tx      equ     0ffc3h          ; tx routine to talk to base board proc.
  1077. rx      equ     0ffc6h          ; rx ditto
  1078. txbyte  equ     0ffc9h          ; send C to base processor [32]
  1079.  
  1080. osbyte:                         ; Osbyte rewritten [32]
  1081.         push    b               ; Keep these
  1082.         mov     b,a             ; Local copy - use in a moment
  1083.         call    usrimm          ; MCP osbyte function
  1084.         db      15
  1085.         mov     c,b             ; Osbyte function
  1086.         call    txbyte
  1087.         mov     c,l             ; 6502 X register
  1088.         call    txbyte
  1089.         mov     c,h             ; 6502 Y register
  1090.         call    txbyte
  1091.         call    rx              ; fetch results
  1092.         mov     l,a             ; X returned
  1093.         sta     xx              ; save just in case...
  1094.         call    rx
  1095.         mov     h,a             ; Y returned
  1096.         sta     yy
  1097.         mov     a,b             ; return A as called
  1098.         pop     b
  1099.         ret                     
  1100.  
  1101. xx:     db      0
  1102. yy:     db      0               ; temporary space
  1103.  
  1104. prinuse:db      0               ; 0=> fast tx, <>0 => slow tx to serial pt. [30]
  1105.  
  1106. ENDIF   ;torch [13]
  1107.  
  1108. IF pci2651    ; whatever version
  1109. sysver:    db    'Ithaca Intersystems S100$'
  1110. ENDIF    ;pci2651
  1111.  
  1112. IF ncrdmv    ; whatever version
  1113. sysver:    db    'NCR DecisionMate V$'
  1114. ENDIF    ;ncrdmv
  1115.  
  1116. IF torch    ; whatever version
  1117. ttytyp:
  1118. sysver:    db    'Torch Unicorn 5 '
  1119.     db    '$'    ; stop here for now, otherwise say..
  1120.     db    ' MCP version '
  1121.     db    '1.00   $'    ; or whatever...
  1122. ENDIF    ;torch
  1123.  
  1124. ; Assume MCP - CCCP ROMS greater than 1
  1125. ;mcpver:    db    'x.x $'
  1126. ;outlin:    db    esc,'*',cr,lf,tab,'$'
  1127. ;eralin:    db    cr,esc,'&$'        ;Clear to end of line.
  1128. ;erascr:    db    esc,'*$'         ;Clear screen and go home.
  1129. ;curldn:    db    esc,'=$'        ;Cursor lead-in
  1130. ;ttab:                    ;Table start location.
  1131. ;ta:    
  1132.     db    esc,'!$',0        ;Cursor up.
  1133. ;tb:    db    0ah,'$',0,0        ;Cursor down.
  1134. ;tc:    db    esc,'+$',0        ;Cursor right.
  1135. ;td:    db    08h,'$',0,0        ;Cursor left.
  1136. ;te:    db    esc,'*$',0        ;Clear screen and home cursor
  1137. ;tf:    db    '$',0,0,0        ;(can't) Enter Graphics mode
  1138. ;tg:    db    '$',0,0,0        ;(can't) Exit Graphics mode
  1139. ;th:    db    esc,'>$',0        ;Cursor home.
  1140. ;ti:    db    '$',0,0,0        ;(Can't) reverse linefeed
  1141. ;tj:    db    esc,'%$',0        ; Clear to end of screen
  1142. ;tk:    db    esc,'&$',0        ; Clear to end of line.
  1143.  
  1144.  
  1145. ;Older message for MCP - CCCP verstion less than 1
  1146. ;ooutli:    db    0ch,cr,lf,tab,tab,'$';
  1147. ;oerali:    db    '$',0,0,0               ;Clear to end of line.
  1148. ;oerasc:    db    0ch,'$',0               ;Clear screen and go home.
  1149. ;ocurld:    db    1fh,'$',0               ;Cursor lead-in
  1150. ;ottab:                    ;Table start location.
  1151. ;    db    0bh,'$',0,0             ;Cursor up.
  1152. ;    db    0ah,'$',0,0             ;Cursor down.
  1153. ;    db    09h,'$',0,0             ;Cursor right.
  1154. ;    db    08h,'$',0,0             ;Cursor left.
  1155. ;    db    0ch,'$',0,0             ;Clear screen and home cursor
  1156. ;    db    '$',0,0,0               ;(can't) Enter Graphics mode
  1157. ;    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1158. ;    db    1eh,'$',0,0             ;Cursor home.
  1159. ;    db    0bh,'$',0,0             ;reverse linfeed
  1160. ;    db    '$',0,0,0               ;(Can't) Clear to end of screen
  1161. ;    db    '$',0,0,0               ;(Can't) Clear to end of line.
  1162. ;
  1163. ;Specials
  1164. ;spac15:    db    '               '
  1165. ;    db    bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,'$';
  1166. ;spac80:    db    cr
  1167. ;    db    '                                        '
  1168. ;    db    '                                        '
  1169. ;    db    bs,cr,'$'       ;80 spaces, bs and then back to line start
  1170. ;
  1171.  
  1172. IF torch    ; Should be IF ker08 AND torch...
  1173.     db    '$'            ; to terminate the ID string
  1174. outlin:    db    0ch,cr,lf,tab,tab,'$'
  1175. eralin:    db    '$',0,0,0               ;Clear to end of line.
  1176. erascr:    db    0ch,'$',0               ;Clear screen and go home.
  1177. curldn:    db    1fh,'$',0               ;Cursor lead-in
  1178. ttab:                    ;Table start location.
  1179. ta:    db    0bh,'$',0,0             ;Cursor up.
  1180. tb:    db    0ah,'$',0,0             ;Cursor down.
  1181. tc:    db    09h,'$',0,0             ;Cursor right.
  1182. td:    db    08h,'$',0,0             ;Cursor left.
  1183. te:    db    0ch,'$',0,0             ;Clear screen and home cursor
  1184. tf:    db    '$',0,0,0               ;(can't) Enter Graphics mode
  1185. tg:    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1186. th:    db    1eh,'$',0,0             ;Cursor home.
  1187. ti:    db    0bh,'$',0,0             ;reverse linfeed
  1188. tj:    db    '$',0,0,0               ;(Can't) Clear to end of screen
  1189. tk:    db    '$',0,0,0               ;(Can't) Clear to end of line.
  1190.  
  1191. ;Specials
  1192. spac15:    db    '               '
  1193.     db    bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,bs,'$';
  1194. spac80:    db    cr
  1195.     db    '                                        '
  1196.     db    '                                        '
  1197.     db    bs,cr,'$'       ;80 spaces, bs and then back to line start
  1198.  
  1199. ENDIF;ker08 AND torch     [13]
  1200.  
  1201. IF brain
  1202. sysver:    db    'Intertec SuperBrain$'
  1203. outlin:    db    ('A'-100O),esc,'~k',cr,lf,tab,tab,'$'
  1204. erascr:    db    ('A'-100O),esc,'~k$'    ;Clear screen and go home.
  1205. eralin:    db    cr,esc,'~K$'            ;Clear line.
  1206. curldn:    db    esc,'Y$'                ; leadin for cursor positioning
  1207. ttab:                    ;Table start location.
  1208. ta:    db    ('K'-100O),'$',0,0      ;Cursor up.
  1209. tb:    db    12O,'$',0,0             ;Cursor down.
  1210. tc:    db    ('F'-100O),'$',0,0      ;Cursor right.
  1211. td:    db    '$',0,0,0               ;(can't) Cursor left
  1212. te:    db    '$',0,0,0               ;(can't) Clear display
  1213. tf:    db    '$',0,0,0               ;(can't) Enter graphics mode
  1214. tg:    db    '$',0,0,0               ;(can't) Exit graphics mode
  1215. th:    db    ('A'-100O),'$',0,0      ;Cursor home.
  1216. ti:    db    ('K'-100O),'$',0,0      ;Reverse linefeed.
  1217. tj:    db    esc,'~k$',0             ;Clear to end of screen.
  1218. tk:    db    esc,'~K$',0             ;Clear to end of line.
  1219. ENDIF;brain
  1220.  
  1221. IF lasm and not termin    ; we dont want CPXVDU
  1222. ovlend    equ    $        ;Overlay end - start buffer
  1223.     end
  1224. ENDIF    ;lasm and not termin
  1225.  
  1226. IF lasm; we want a terminal
  1227. LINK CPXVDU.ASM
  1228. ENDIF    ;lasm
  1229. 
  1230.