home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / cpm80 / cpxsy2.asm < prev    next >
Assembly Source File  |  2020-01-01  |  45KB  |  1,365 lines

  1. IF NOT lasm
  2. .printx * CPXSY2.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 code and data for KERMIT.
  22. ;       It will be probably be broken into independent files to generate
  23. ;       overlays for the various systems, one or more overlay possible
  24. ;       from each file.  For now, we will leave it in one piece.
  25. ;
  26. ; revision history:
  27. ;
  28. ;
  29. ;        This is the system-dependent command to change the baud rate.
  30. ;       DE contains the two-byte value from the baud rate table; this
  31. ;       value is also stored in 'speed'.
  32. sysspd:
  33.  
  34.  
  35. IF px8 ; [29]
  36.         push    d
  37.         call    rsclose        ; baud rate can only be set on opening rs232
  38.         pop     d
  39.         mov     a, e
  40.         sta     px8blk+4       ; set param block
  41.         call    rsopen         ; to set rate
  42.         ret
  43. ENDIF ; px8 [29]
  44.  
  45. ; Set the speed for the Osborne I
  46. IF osbrn1
  47.         mvi     a,osbin1        ;Reset the ACIA
  48.         call    osstst          ;Write the control port
  49. osbs1:  inr     c               ;Waiting loop
  50.         jnz     osbs1
  51.         mov     a,e             ; get the specified speed
  52.         jmp     osstst          ;Write the control reg.
  53. ENDIF;osbrn1
  54.  
  55. ;[hh] set the speed for a lobo MAX-80
  56. IF lobo
  57.         mov     a,e             ;[hh] get the parsed value
  58. setbd:  sta     baudrt          ;[hh] and send it to the baud rate port
  59.         ret                     ;[hh]
  60. ENDIF;lobo
  61.  
  62. ; Set the speed for bigboard I or the delphi or the CPT-85xx
  63. ; or Cromemco (TU-ART)
  64. IF delphi OR cpt85xx OR cmemco OR mmate ;[22] [29]
  65.         mov     a,e             ; get the parsed value
  66.         out     baudrt          ; Tell the baud rate generator.
  67.         ret
  68. ENDIF;delphi OR cpt85xx OR cmemco OR mmate [22] [29]
  69.  
  70. ;[22] Set the speed for Acorn BBC
  71. IF bbc
  72.         mov     l,e
  73.         mvi     a,7             ;Set receive baud rate
  74.         call    osbyte          ;*FX7,?e
  75.         mov     l,e
  76.         mvi     a,8             ;Set transmit baud rate
  77.         call    osbyte          ;*FX8,?e
  78.         ret
  79. ENDIF;[22] bbc
  80.  
  81. ;[22] Set speed for RM 380Z
  82. IF rm380z
  83.         mvi     a,4             ;device type (SI/O4) in A
  84.         rst     6               ; EMT
  85.         db      29h             ;     SETLST
  86.         ret
  87. ENDIF;[22] rm380z
  88.  
  89. ; Set the speed for MicroMikko.  DE is baud rate multiplier
  90. IF mikko
  91.         di
  92.         lxi     h,txclk
  93.         mov     m,d             ;LSB first (swapped in memory)
  94.         mov     m,e             ;MSB last
  95.         lxi     h,rxclk
  96.         mov     m,d
  97.         mov     m,e
  98.         mvi     b,0             ;"modifier" for 1 stop bit
  99.         mvi     a,2             ;Test MSB of speed >2 (110 bps or less)
  100.         cmp     e
  101.         jp      miksp1
  102.         mvi     b,00001000B     ;"modifier" for 2 stop bits
  103. miksp1: mvi     a,4             ;Select SIO Reg 4
  104.         lxi     h,sioac
  105.         mov     m,a
  106.         mvi     a,sion4         ;Get values
  107.         ora     b               ;Add modifier
  108.         mov     m,a             ;Set value (stop bits)
  109.         ei
  110.         ret
  111. ENDIF;mikko
  112.  
  113.  
  114. ; Set the speed for the Decision I
  115. IF mdI
  116.         call    selmdm          ;Let's be absolutely sure, huh?
  117.         mvi     a,dlab+wls1+wls0+stb ;Set data latch access bit
  118.         out     lcr             ;Out to Line Control Register
  119.         lhld    speed           ;Load baudrate multiplier
  120.         xchg
  121.         mov     a,d             ;Get low order byte for baud rate
  122.         out     dlm             ;Out to the MSB divisor port
  123.         mov     a,e             ;...and the high order byte
  124.         out     dll             ;Out to the LSB divisor port
  125.         mvi     a,wls1+wls0+stb ;Enable Divisor Access Latch
  126.         out     lcr             ;Out to ACE Line Control Register
  127.         xra     a               ;Clear A
  128.         out     ier             ;Set no interrupts
  129.         out     lsr             ;Clear status
  130.         in      msr             ;Clear Modem Status Register
  131.         in      lsr             ;Clear Line Status Register
  132.         in      rbr             ;Clear Receiver Buffers
  133.         in      rbr
  134.         ret
  135. ENDIF   ;mdI    [Toad Hall]
  136.  
  137. IF teletek
  138.     di
  139.     mov    a,e        ; first speed byte
  140.     out    baudrt
  141.     mov    a,d        ; second speed byte
  142.     out    baudrt
  143.     ei
  144.     ret
  145. ENDIF    ;teletek
  146.  
  147. IF access       ;[29]
  148.         mov     a,e             ;Get the parsed time constant
  149. ;The following code is derived from the Access  initialization code
  150.         sta     savspd          ;Save  the time constant
  151.         mvi     a,14h           ;Code for 'monitor' to set channel A baudrate
  152.         call    monitor
  153.         lda     savspd          ;Get the time constant
  154.         call    monitor         ; and send it to the CRT
  155.         ret
  156. savspd: ds      1
  157. monitor:                        ;Routine to do CRT functions
  158.         out     90h             ;Output the data to the CRT
  159.         mvi     a,1             ;Set DRDY true
  160.         out     23h
  161. mon1:   in      0a0h            ;Wait for CACK* true
  162.         rlc
  163.         jc      mon1
  164.         in      80h             ;Read the input data latch
  165.         push    psw             ;Save the input data
  166.         xra     a               ;Set DRDY false
  167.         out     23h
  168. mon2:   in      0a0h            ;Wait for CACK* false
  169.         rlc
  170.         jc      mon2
  171.         pop     psw
  172.         sta     0ee02h          ;Save the input data
  173.         ret
  174. ENDIF;access [29]
  175.  
  176.  
  177. IF disc ;[29]
  178. ; Assuming that parsing of value from speed table puts low order
  179. ; byte of time constant in the e register and high byte in d.
  180.         mvi     a,12            ;Register 12
  181.         out     mnprts
  182.         mov     a,e             ;Low order byte of time constant
  183.         out     mnprts
  184.         mvi     a,13            ;Register 13
  185.         out     mnprts
  186.         mov     a,d             ;High order byte of time constant
  187.         out     mnprts
  188.         mvi     a,14            ;Register 14
  189.         out     mnprts
  190.         mvi     a,3             ;Enable baud rate generator
  191.         out     mnprts
  192.         mvi     a,11            ;Register 11
  193.         out     mnprts
  194.         mvi     a,52h           ;no Xtal, tclk=rclk=/trxc out=br gen
  195.         out     mnprts
  196.         ret
  197. ENDIF;disc [29]
  198. ;        Speed tables
  199. ; (Note that speed tables MUST be in alphabetical order for later
  200. ; lookup procedures, and must begin with a value showing the total
  201. ; number of entries.  The speed help tables are just for us poor
  202. ; humans.
  203.  
  204. ;       db      string length,string,divisor (2 identical bytes or 1 word)
  205. ; [Toad Hall]
  206.  
  207. IF delphi OR lobo    ;[hh]
  208. spdtbl: db      10h                     ;16 entries
  209.         db      03h,'110$',     02h,02h
  210.         db      04h,'1200$',    07h,07h
  211.         db      05h,'134.5$',   03h,03h
  212.         db      03h,'150$',     04h,04h
  213.         db      04h,'1800$',    08h,08h
  214.         db      05h,'19200$',   0fh,0fh
  215.         db      04h,'2000$',    09h,09h
  216.         db      04h,'2400$',    0ah,0ah
  217.         db      03h,'300$',     05h,05h
  218.         db      04h,'3600$',    0bh,0bh
  219.         db      04h,'4800$',    0ch,0ch
  220.         db      02h,'50$',      00h,00h
  221.         db      03h,'600$',     06h,06h
  222.         db      04h,'7200$',    0dh,0dh
  223.         db      02h,'75$',      01h,01h
  224.         db      04h,'9600$',    0eh,0eh
  225.  
  226. sphtbl: db      cr,lf,'   50     75    110    134.5  150    300    600   1200'
  227.         db      cr,lf,' 1800   2000   2400   3600   4800   7200   9600  19200$'
  228. ENDIF;delphi OR lobo    ;[hh]
  229.  
  230. IF cpt85xx
  231. spdtbl: db      15                      ; 15 entries
  232.         db      03,'110$',      03h,03h
  233.         db      04,'1200$',     09h,09h
  234.         db      05,'134.5$',    04h,04h
  235.         db      03,'150$',      05h,05h
  236.         db      04,'1800$',     0Ah,0Ah
  237.         db      04,'2400$',     0Bh,0Bh
  238.         db      03,'300$',      06h,06h
  239.         db      04,'3600$',     0Ch,0Ch
  240.         db      04,'4800$',     0Dh,0Dh
  241.         db      02,'50$',       01h,01h
  242.         db      03,'600$',      07h,07h
  243.         db      04,'7200$',     0Eh,0Eh
  244.         db      02,'75$',       02h,02h
  245.         db      03,'900$',      08h,08h
  246.         db      04,'9600$',     0Fh,0Fh
  247.  
  248. sphtbl: db      cr,lf,'   50     75    110    134.5  150    300    600    900'
  249.         db      cr,lf,' 1200   1800   2400   3600   4800   7200   9600$'
  250. ENDIF;cpt85xx
  251.  
  252. IF bbc          ;[22]
  253. spdtbl: db      8                       ; 8 entries
  254.         db      04,'1200$',     04h,04h
  255.         db      03,'150$',      02h,02h
  256.         db      05,'19200$',    08h,08h
  257.         db      04,'2400$',     05h,05h
  258.         db      03,'300$',      03h,03h
  259.         db      04,'4800$',     06h,06h
  260.         db      02,'75$',       01h,01h
  261.         db      04,'9600$',     07h,07h
  262.  
  263. sphtbl: db      cr,lf,'   75   150   300   1200   2400   4800   9600   19200$'
  264. ENDIF;[22] bbc
  265.  
  266. IF rm380z       ;[22]
  267. spdtbl: db      7                       ; 7 entries
  268.         db      03,'110$',      00h,00h
  269.         db      04,'1200$',     03h,03h
  270.         db      04,'2400$',     04h,04h
  271.         db      03,'300$',      01h,01h
  272.         db      04,'4800$',     05h,05h
  273.         db      03,'600$',      02h,02h
  274.         db      04,'9600$',     06h,06h
  275.  
  276. sphtbl: db      cr,lf,'   110   300   600   1200   2400   4800   9600$'
  277. ENDIF;[22] rm380z
  278.  
  279. IF px8 ; [29]
  280. spdtbl: db      9                       ; 9 entries
  281.         db      03,'110$',      02h,02h
  282.         db      04,'1200$',     0ah,0ah
  283.         db      03,'150$',      04h,04h
  284.         db      05,'19200$',    0fh,0fh
  285.         db      04,'2400$',     0ch,0ch
  286.         db      03,'300$',      06h,06h
  287.         db      04,'4800$',     0dh,0dh
  288.         db      03,'600$',      08h,08h
  289.         db      04,'9600$',     0eh,0eh
  290. sphtbl: db      cr, lf
  291.         db  '   100   150   300   600   1200   2400   4800   9600   19200$'
  292. ENDIF ; px8 [29]
  293.  
  294. IF mikko
  295. spdtbl: db      9h                      ;9 entries
  296.         db      03h,'110$'
  297.         dw      0369h
  298.         db      04h,'1200$'
  299.         dw      0050h
  300.         db      03h,'150$'
  301.         dw      0280h
  302.         db      04h,'2400$'
  303.         dw      0028h
  304.         db      03h,'300$'
  305.         dw      0140h
  306.         db      04h,'4800$'
  307.         dw      0014h
  308.         db      03h,'600$'
  309.         dw      00A0H
  310.         db      02h,'75$'
  311.         dw      0500h
  312.         db      04h,'9600$'
  313.         dw      000ah
  314.  
  315. sphtbl: db      cr,lf,'  75  110  150  300  600  1200  2400  4800  9600$'
  316. ENDIF;mikko
  317.  
  318. IF osbrn1
  319. spdtbl: db      02h                     ;2 entries
  320.         db      04h,'1200$',    OSBI12,OSBI12
  321.         db      03h,'300$',     OSBI03,OSBI03
  322.  
  323. sphtbl: db      cr,lf,'  300',cr,lf,' 1200$'
  324. ENDIF;osbrn1
  325.  
  326.  
  327. IF mdI
  328. spdtbl: db      0dh                     ; 13 entries
  329.         db      03h,  '110$'
  330.                 dw              1047
  331.         db      04h, '1200$'
  332.                 dw              96
  333.         db      03h,  '150$'
  334.                 dw              768
  335.         db      05h,'19200$'
  336.                 dw              6
  337.         db      04h, '2400$'
  338.                 dw              48
  339.         db      03h,  '300$'
  340.                 dw              384
  341.         db      05h,'38400$'
  342.                 dw              3
  343.         db      03h,  '450$'
  344.                 dw              288
  345.         db      04h, '4800$'
  346.                 dw              24
  347.         db      05h,'56000$'
  348.                 dw              2
  349.         db      03h,  '600$'
  350.                 dw              192
  351.         db      02h,   '75$'
  352.                 dw              1536
  353.         db      04h, '9600$'
  354.                 dw              12
  355.  
  356. sphtbl: db      cr,lf,'   75    110    150    300    450    600   1200'
  357.         db      cr,lf,' 2400   4800   9600  19200  38400  56000$'
  358.  
  359. ;(Lord knows what you'll be communicating with at 56000 baud, but the
  360. ;Multi-I/O board literature says it'll do it, so what the heck....
  361. ;might as well throw it in here just to show off...sure hope the
  362. ;port don't melt...)
  363.  
  364. ENDIF   ;mdI    [Toad Hall]
  365.  
  366. IF cmemco                       ;[25]
  367. spdtbl: db      7               ; 7 entries
  368.         db      3,'110$',       01H,01H
  369.         db      4,'1200$',      88H,88H
  370.         db      3,'150$',       82H,82H
  371.         db      4,'2400$',      90H,90H
  372.         db      3,'300$',       84H,84H
  373.         db      4,'4800$',      0A0H,0A0H
  374.         db      4,'9600$',      0C0H,0C0H
  375.  
  376. sphtbl: db      cr,lf
  377.         db      '   110   150   300  1200  2400  4800  9600$'
  378. ENDIF;cmemco
  379.  
  380. IF access ;Similar to bbI with different values [29]
  381. spdtbl: db      6h                      ;6 entries
  382.         db      04h,'1200$',    28h,28h
  383.         db      04h,'2400$',    14h,14h
  384.         db      03h,'300$',     0a0h,0a0h
  385.         db      04h,'4800$',    0ah,0ah
  386.         db      03h,'600$',     50h,50h
  387.         db      04h,'9600$',    5,5
  388.  
  389. sphtbl: db      cr,lf,'  300  600  1200  2400  4800  9600$'
  390. ENDIF;access [29]
  391.  
  392. IF mmate        ;[29]
  393. spdtbl: db      10h                     ;16 entries
  394.         db      03h,'110$',     0e2h,0e2h
  395.         db      04h,'1200$',    0e7h,0e7h
  396.         db      05h,'134.5$',   0e3h,0e3h
  397.         db      03h,'150$',     0e4h,0e4h
  398.         db      04h,'1800$',    0e8h,0e8h
  399.         db      05h,'19200$',   0efh,0efh
  400.         db      04h,'2000$',    0e9h,0e9h
  401.         db      04h,'2400$',    0eah,0eah
  402.         db      03h,'300$',     0e5h,0e5h
  403.         db      04h,'3600$',    0ebh,0ebh
  404.         db      04h,'4800$',    0ech,0ech
  405.         db      02h,'50$',      0e0h,0e0h
  406.         db      03h,'600$',     0e6h,0e6h
  407.         db      04h,'7200$',    0edh,0edh
  408.         db      02h,'75$',      0e1h,0e1h
  409.         db      04h,'9600$',    0eeh,0eeh
  410.  
  411. sphtbl: db      cr,lf,'   50  75    110    134.5  150    300    600   1200'
  412.         db      cr,lf,' 1800   2000   2400   3600   4800   7200   9600  19200$'
  413. ENDIF;mmate [29]
  414.  
  415. IF disc ;[29]
  416. ; Similar to mikko table but with different time constant values
  417. spdtbl: db      9h                      ;9 entries
  418.         db      03h,'110$'
  419.         dw      1134
  420.         db      04h,'1200$'
  421.         dw      102h
  422.         db      03h,'150$'
  423.         dw      831
  424.         db      04h,'2400$'
  425.         dw      50
  426.         db      03h,'300$'
  427.         dw      415
  428.         db      04h,'4800$'
  429.         dw      24
  430.         db      03h,'600$'
  431.         dw      206
  432.         db      02h,'75$'
  433.         dw      1665
  434.         db      04h,'9600$'
  435.         dw      11
  436.  
  437. sphtbl: db      cr,lf,'  75  110  150  300  600  1200  2400  4800  9600$'
  438. ENDIF;disc      [29]
  439.  
  440. IF teletek
  441. spdtbl:    db    7        ; 7 entries
  442.     db    4, '1200$',    47h,40h
  443.     db    5,'19200$',    47h,04h
  444.     db    4, '2400$',    47h,20h
  445.     db    3,  '300$',    47h,00h
  446.     db    4, '4800$',    47h,10h
  447.     db    3,  '600$',    47h,80h
  448.     db    4, '9600$',    47h,08h
  449.  
  450. sphtbl:    db    cr,lf
  451.     db      '   300   600  1200   2400   4800   9600  19200$'
  452. ENDIF    ;teletk
  453.  
  454.  
  455. ; The following conditionals were once a huge if not statement.  There
  456. ; wasn't enough room to add the lobo to the list, so it had to be broken
  457. ; into 2, which you can't do with an if not.  I redid it as two ifs and
  458. ; applied them to those that wouldn't set baud. [Hal Hostetler]
  459. IF robin OR gener OR dmII OR vector OR trs80;[32]
  460. spdtbl  equ     0               ; SET BAUD not supported.
  461. sphtbl  equ     0
  462. ENDIF;robin OR gener OR dmII OR vector OR trs80 
  463. ;
  464. IF mmdI OR osi OR cpm3 OR S1008 ; [29]
  465. spdtbl  EQU     0               ;[hh] SET BAUD not supported.
  466. sphtbl  EQU     0               ;[hh] ran out of room above...
  467. ENDIF;mmdI OR osi OR cpm3 OR S1008 [29]
  468. ;
  469. IF hp125            ;[MF]
  470. spdtbl  equ     0               ; SET BAUD not supported.
  471. sphtbl  equ     0
  472. ENDIF;hp125 [MF]
  473. ;
  474. ;        This is the system-dependent SET PORT command.
  475. ;       HL contains the argument from the command table.
  476. sysprt:
  477. IF lobo ;[hh]
  478.         mov     a,l             ;[hh] get the data port value and store at
  479.         sta     outmd3+1        ;[hh] the two places we use...
  480.         sta     inpmd2+1        ;[hh] MNPORT in the overlay
  481.         sta     port            ;[hh] inform program of the change in ports
  482.         inr     a               ;[hh] status port = data port + 1 in the Lobo
  483.         sta     outmd1+1        ;[hh] store it at the three places...
  484.         sta     inpmd1+1        ;[hh] we use MNPRTS...
  485.         sta     outctl+1        ;[hh] in the overlay
  486.         mov     a,h             ;[hh] now get the baud rate port value
  487.         sta     getbd+1         ;[hh] store it in the two places we use...
  488.         sta     setbd+1         ;[hh] BAUDRT in the overlay
  489.         sta     port+1          ;[hh] don't need to, but keeps it consistant
  490. getbd:  lda     baudrt          ;[hh] get baud rate value from port
  491.         sta     speed           ;[hh] tell STAT. baud rate for each port
  492.                                 ;[hh] is independant of the other
  493. ENDIF   ;lobo
  494.  
  495. IF iobyt
  496.         mov     a,m             ;Get the I/O byte
  497.         sta     prtiob          ;Save the desired IO byte for this port
  498.         inx     h               ;Point at next entry
  499.         mov     a,m             ;Get the output function
  500.         sta     prtfun          ;Save it
  501. ENDIF;iobyt
  502.  
  503. IF iobyt AND robin
  504.         inx     h               ;Point at next entry
  505.         mov     a,m             ;Get the hardware address for the port
  506.         sta     prtadr          ;Store it
  507. ENDIF;iobyt AND robin
  508. ;
  509. IF hp125            ;[MF]
  510.     push    psw
  511.     push    b
  512.     push    d
  513.     push    h
  514.     xchg            ;Put port connect sequence address in DE
  515.     call    prtstr        ;Connect proper port
  516.     pop    h
  517.     pop    d
  518.     pop    b
  519.     pop    psw
  520. ENDIF;hp125 [MF]
  521. ;
  522.         ret
  523. ;
  524. ;       Port tables for Lobo MAX-80
  525. IF lobo ;[hh]
  526. ; help text
  527. prhtbl: db      cr,lf,'RS-232 port A or B$'
  528. ;
  529. ; command table
  530. prttbl: db      02H                     ;[hh] two entries
  531.         db      01H,'A$',0E4H,0D0H
  532.         db      01H,'B$',0E6H,0D4H
  533. ENDIF   ;lobo
  534. ;
  535. ;       Port tables for GENERIC CPM 2.2
  536. IF gener
  537. ; help text
  538. prhtbl: db      cr,lf,'CRT device'
  539.         db      cr,lf,'PTR device'
  540.         db      cr,lf,'TTY device'
  541.         db      cr,lf,'UC1 device'
  542.         db      cr,lf,'UR1 device'
  543.         db      cr,lf,'UR2 device$'
  544.  
  545. ; command table
  546. prttbl: db      06H             ;Six devices to choose from
  547.         db      03H,'CRT$'
  548.                 dw      crtptb
  549.         db      03H,'PTR$'
  550.                 dw      ptrptb
  551.         db      03H,'TTY$'
  552.                 dw      ttyptb
  553.         db      03H,'UC1$'
  554.                 dw      uc1ptb
  555.         db      03H,'UR1$'
  556.                 dw      ur1ptb
  557.         db      03H,'UR2$'
  558.                 dw      ur2ptb
  559.  
  560. ; port entry table
  561. ; table entries are:
  562. ;       db      iobyte-value, BDOS output function, reserved
  563. crtptb: db      crtio,conout,0
  564. ptrptb: db      ptrio,punout,0
  565. ttyptb: db      ttyio,conout,0
  566. uc1ptb: db      uc1io,conout,0
  567. ur1ptb: db      ur1io,punout,0
  568. ur2ptb: db      ur2io,punout,0
  569. ENDIF;gener
  570.  
  571. ;
  572. ;       Port tables for DECmate II or MicroMikko or Acorn BBC
  573. ;
  574. IF dmII OR mikko OR bbc ;[22]
  575. ; help text
  576. prhtbl: db      cr,lf,'COMMUNICATIONS port$'
  577.  
  578. ; command table
  579. prttbl: db      01H             ;Only one port known at this point
  580.         db      0EH,'COMMUNICATIONS$'
  581.                 dw      comptb  ;address of info
  582.  
  583. ; port entry table
  584. ; table entries are:
  585. ;       db      iobyte-value, BDOS output function, reserved
  586. comptb: db      batio,punout,0
  587.  
  588. ENDIF;[22] dmII OR mikko OR bbc
  589. ;
  590. ;       Port tables for Robin
  591. ;
  592. IF robin
  593. ; help text
  594. prhtbl: db      cr,lf,'COMMUNICATIONS port'
  595.         db      cr,lf,'GENERAL purpose port'
  596.         db      cr,lf,'PRINTER port$'
  597.  
  598. ; command table
  599. prttbl: db      03H             ;Three entries
  600.         db      0EH,'COMMUNICATIONS$'
  601.                 dw      comptb
  602.         db      07H,'GENERAL$'
  603.                 dw      gppptb
  604.         db      07H,'PRINTER$'
  605.                 dw      prnptb
  606.  
  607. ; port entry table
  608. ; table entries are:
  609. ;       db      iobyte-value, BDOS output function, hardware port address
  610. ;                                                   (control/status)
  611. ;
  612. ;At present, the hardware port address is only used for sending a break.
  613. comptb: db      batio,punout,comtst
  614. gppptb: db      gppio,conout,gentst
  615. prnptb: db      lptio,conout,prntst
  616.  
  617. prtadr: db      comtst          ;space for current hardware port address
  618. ENDIF;robin
  619.  
  620. IF iobyt
  621. prtfun: db      punout          ;Function to use for output to comm port
  622. prtiob: db      batio           ;I/O byte to use for communicating
  623. coniob: db      defio           ;I/O byte to use for console
  624. ENDIF;iobyt
  625. ;
  626. IF hp125            ;[MF]
  627. ; Help table
  628. prhtbl:    db    cr,lf,'Communications port'
  629.     db    cr,lf,'Printer port$'
  630. ; command table
  631. prttbl:    db    02H        ;2 entries
  632.     db    0eH,'COMMUNICATIONS$'
  633.     dw    mapon1
  634.     db    07H,'PRINTER$'
  635.     dw    mapon2
  636. ;Port table entries are the addresses of the escape sequences to connect
  637. ;the ports.
  638. ;
  639. ENDIF;hp125 [MF]
  640.  
  641. IF NOT (iobyt OR lobo OR hp125)          ;[hh] [MF]
  642. prttbl  equ     0               ; SET PORT is not supported
  643. prhtbl  equ     0
  644. ENDIF;NOT iobyt OR lobo OR hp125 [MF]
  645. ;
  646. ;       selmdm - select modem port
  647. ;       selcon - select console port
  648. ;       selmdm is called before using inpmdm or outmdm;
  649. ;       selcon is called before using inpcon or outcon.
  650. ;       For iobyt systems, diddle the I/O byte to select console or comm port;
  651. ;       For Decision I, switches Multi I/O board to console or modem serial
  652. ;       port.  [Toad Hall]
  653. ;       For the rest, does nothing.
  654. ;       preserves bc, de, hl.
  655. selmdm:
  656. IF iobyt
  657.     lda     prtiob          ;Set up for output to go to the comm port
  658.         sta     iobyte          ;Switch byte directly
  659. ENDIF;iobyt
  660.  
  661. IF mdI
  662.         lda     group
  663.         ori     mdmgrp          ;Mask modem serial port
  664.         out     grpsel
  665. ENDIF;mdI  [Toad Hall]
  666.  
  667.         ret
  668.  
  669. selcon:
  670. IF iobyt
  671.         lda     coniob          ;Set up for output to go to the console port
  672.         sta     iobyte          ;Switch directly
  673. ENDIF;iobyt
  674.  
  675. IF mdI
  676.         lda     group
  677.         ori     congrp          ;Mask console serial port (1)
  678.         out     grpsel
  679. ENDIF;mdI  [Toad Hall]
  680.  
  681.         ret
  682. ;        Get character from console, or return zero.
  683. ;       result is returned in A.  destroys bc, de, hl.
  684. ;
  685. inpcon:
  686. IF NOT iobyt
  687.         mvi     c,dconio        ;Direct console I/O BDOS call.
  688.         mvi     e,0FFH          ;Input.
  689.         call    BDOS
  690. ENDIF;NOT iobyt
  691.  
  692. IF iobyt
  693.         call    bconst          ;Get the status
  694.         ora     a               ;Anything there?
  695.         rz                      ;No, forget it
  696.         call    bconin          ;Yes, get the character
  697. ENDIF;iobyt
  698.         ret
  699. ;
  700. ;       Output character in E to the console.
  701. ;       destroys bc, de, hl
  702. ;
  703. outcon:
  704.  
  705. IF rm380z       ;[22]
  706.         mov     a,e
  707.         cpi     cr              ;cr produces cr + lf
  708.         jnz     outcn1
  709.         mvi     e,'N'-100O      ;Control-N produces cr only
  710. outcn1:                         ;continue
  711. ENDIF;[22] rm380z
  712.  
  713. IF NOT iobyt
  714.         mvi     c,dconio        ;Console output bdos call.
  715.         call    bdos            ;Output the char to the console.
  716. ENDIF;NOT iobyt
  717.  
  718. IF iobyt
  719.         mov     c,e             ;Character
  720.         call    bcnout          ;to Console
  721. ENDIF;iobyt
  722.         ret
  723. ;
  724. ;       outmdm - output a char from E to the modem.
  725. ;               the parity bit has been set as necessary.
  726. ;       returns nonskip; bc, de, hl preserved.
  727. outmdm:
  728. IF osi OR lobo         ;[hh]
  729.         push    h
  730. outmd1: lxi     h,mnprts        ;address of the port status register
  731. outmd2: mov     a,m             ; get port status in A
  732.         ani     output          ;Loop till ready.
  733.         jz      outmd2
  734. outmd3: lxi     h,mnport        ;address of port data register
  735.         mov     m,e             ; write the character
  736.         pop     h
  737.         ret
  738. ENDIF;osi OR lobo
  739.  
  740. IF osbrn1
  741.         call    osldst          ;Read the status port
  742.         ani     output          ;Loop till ready.
  743.         jz      outmdm
  744.         mov     a,e
  745.         jmp     osstda          ;Write to the data port
  746. ENDIF;osbrn1
  747.  
  748. IF px8 ; [29]
  749.         push    h
  750.         push    b
  751.         push    d
  752. outmd1: call    rsoutst         ; get the output status
  753.         ora     a
  754.         jz      outmd1          ; check if output enabled
  755.         pop     d
  756.         mov     c, e            ; char in C
  757.         push    d
  758.         call    rsput
  759.         pop     d
  760.         pop     b
  761.         pop     h
  762.         ret
  763. ENDIF; px8 [29]
  764.  
  765. IF inout
  766.         in      mnprts          ;Get the output done flag.
  767.         ani     output          ;Is it set?
  768.         jz      outmdm          ;If not, loop until it is.
  769.         mov     a,e
  770.         out     mnport          ;Output it.
  771.         ret
  772. ENDIF;inout
  773.  
  774. IF iobyt
  775. ;**** Note that we enter from outpkt with the I/O byte already set up for
  776. ;  output to go to the comm port
  777.         push    h
  778.         push    b
  779.         lda     prtfun          ;Get the output function
  780.         mov     c,a             ;Into C
  781.         call    bdos            ;And output the character
  782.         pop     b
  783.         pop     h
  784.         ret
  785. ENDIF;iobyt
  786.  
  787. IF cpm3 OR hp125 ;[MF]
  788.         push    h
  789.         push    b
  790.         mvi     c,auxout        ;Output to the aux output device
  791.         call    bdos
  792.         pop     b
  793.         pop     h
  794.         ret
  795. ENDIF;cpm3 OR hp125 [MF]
  796.  
  797. ; org    $+100h AND 0FF00h    ; get rid of phase error
  798.  
  799. ;
  800. ;       get character from modem; return zero if none available.
  801. ;       for IOBYT systems, the modem port has already been selected.
  802. ;       destroys bc, de, hl.
  803. inpmdm:
  804. IF iobyt
  805.         call    bconst          ;Is Char at COMM-Port?
  806.         ora     a               ;something there?
  807.         rz                      ; return if nothing there
  808.         call    bconin          ; data present. read data.
  809. ENDIF;iobyt
  810.  
  811. IF cpm3
  812.         mvi     c,auxist
  813.         call    bdos            ;is char at auxin?
  814.         ora     a               ;something there?
  815.         rz                      ;no
  816.         mvi     c,auxin
  817.         call    bdos            ;read char from auxin
  818. ENDIF;cpm3
  819. ;
  820. IF hp125            ;[MF]
  821.     lxi    b,70ffh        ;SEt subfunction to get RDR (auxin) status
  822.         call    bdos            ;is char at RDR?
  823.         ora     a               ;something there?
  824.         rz                      ;no
  825.         mvi     c,auxin
  826.         call    bdos            ;read char from RDR
  827. ENDIF;hp125 [MF]
  828.  
  829. IF osi OR lobo         ;[hh]
  830. inpmd1: lda     mnprts          ;Get the port status into A.
  831.         ani     input           ;See if the input ready bit is on.
  832.         rz                      ;If not then return.
  833. inpmd2: lda     mnport          ;If so, get the char.
  834. ENDIF;osi OR lobo 
  835.  
  836. IF osbrn1
  837.         call    osldst          ;Read the status port
  838.         ani     input           ;Something there?
  839.         rz                      ;Nope
  840.         call    osldda          ;Read the data port
  841. ENDIF;osbrn1
  842.  
  843. IF inout
  844. ;Note: modem port should already be selected for mdI.  [Toad Hall]
  845.         in      mnprts          ;Get the port status into A.
  846.         ani     input           ;See if the input ready bit is on.
  847.         rz                      ;If not then return.
  848.         in      mnport          ;If so, get the char.
  849. ENDIF;inout
  850.  
  851. IF px8 ; [29]
  852.         call    rserst          ; check error status
  853.         ani     64h             ; this assumes 'not open' cannot occur
  854.         jnz     inpmd1          ; error has occurred!
  855.         call    rsinst          ; any chars outstanding?
  856.         ora     a
  857.         rz                      ; exit if none
  858.         call    rsget           ; get char in A
  859.         ret
  860. ; return the 'no char outstanding' indication on error
  861. inpmd1: mvi     a, 0
  862. ENDIF; px8 [29]
  863.  
  864.     ret                     ; return with character in A
  865.  
  866.  
  867. ;
  868. ;       flsmdm - flush comm line.
  869. ;       Modem is selected.
  870. ;       Currently, just gets characters until none are available.
  871.  
  872. flsmdm: call    inpmdm          ; Try to get a character
  873.         ora     a               ; Got one?
  874.         jnz     flsmdm          ; If so, try for another
  875.         ret                     ; Receiver is drained.  Return.
  876. ;
  877. ;       lptstat - get the printer status. Return a=0ffh if ok, or 0 if not.
  878. lptstat:
  879. IF iobyt                        ;[33]
  880.         call    bprtst          ;
  881. call    bprtst          ; get status
  882. ENDIF   ;iobyt[33]
  883. IF NOT iobyt    ;[33]
  884.         xra     a               ; assume it is ok.. this may not be necessary
  885. ENDIF   ;iobyt [33]
  886.         ret
  887.  
  888. ;
  889. ;       outlpt - output character in E to printer
  890. ;       console is selected.
  891. ;       preserves de.
  892. outlpt:
  893.         push    d               ; save DE in either case
  894.         call    prtflt          ; go through printer filter [30]
  895.         ana     a               ; if A = 0 do nothing,
  896.         jz      outlp1          ; [30] if a=0 do nothing
  897.  
  898. IF NOT iobyt
  899.         mvi     c,lstout
  900.         call    bdos            ;Char to printer
  901. ENDIF;NOT iobyt
  902. IF iobyt
  903.         mov     c,e
  904.         call    blsout
  905. ENDIF;iobyt
  906.  
  907. outlp1: pop     d               ; restore saved register pair
  908.         ret
  909. ;
  910. ;       Screen manipulation routines
  911. ;       csrpos - move to row B, column C
  912. ;
  913. ;       csrpos for terminals that use a leadin sequence followed
  914. ;        by (row + 31.) and (column + 31.)
  915. ;
  916. IF NOT (robin OR dmII OR osi OR vector OR termin OR hp125)
  917.                 ;[MF] Terminals code in CPXVDU
  918. csrpos: push    b               ; save coordinates
  919.         lxi     d,curldn        ; get cursor leadin sequence
  920.         call    prtstr          ; print it
  921.         pop     h               ; restore coordinates
  922.         mov     a,h             ; get row
  923.         adi     (' '-1)         ; space is row one
  924.         mov     e,a
  925.         push    h
  926.         call    outcon          ; output row
  927.         pop     h
  928.         mov     a,l             ; get column
  929.         adi     (' '-1)         ; space is column one
  930.         mov     e,a
  931.         jmp     outcon          ; output it and return
  932. ENDIF;NOT (robin OR dmII OR osi OR vector OR termin OR hp125)[MF]
  933. ;
  934. ;
  935. ;
  936. ;       csrpos for ANSI terminals
  937. ;
  938. IF robin OR dmII 
  939. csrpos: push    b               ; save coordinates
  940.         lxi     d,curldn        ; get cursor leadin sequence
  941.         call    prtstr          ; print it
  942.         pop     h               ; peek at coordinates
  943.         push    h               ;  then save away again
  944.         mov     l,h             ; l = row
  945.         mvi     h,0             ; hl = row
  946.         call    nout            ; output in decimal
  947.         mvi     e,';'           ; follow with semicolon
  948.         call    outcon          ; print it
  949.         pop     h               ; restore column
  950.         mvi     h,0             ; hl = column
  951.         call    nout
  952.         mvi     e,'H'           ; terminate with 'move cursor' command
  953.         jmp     outcon          ; output it and return
  954. ENDIF;robin OR dmII 
  955. ;
  956. ;       csrpos for the HP-125 [MF]
  957. ;
  958. IF hp125                ;[MF]
  959. csrpos:    dcr    b        ;HP-125 uses zero-based addressing
  960.     dcr    c        ;...
  961.  push    b               ; save coordinates
  962.         lxi     d,curldn        ; get cursor leadin sequence
  963.         call    prtstr          ; print it
  964.         pop     h               ; peek at coordinates
  965.         push    h               ;  then save away again
  966.         mov     l,h             ; l = row
  967.         mvi     h,0             ; hl = row
  968.         call    nout            ; output in decimal
  969.         mvi     e,'R'+20h    ;Say it was a row
  970.         call    outcon          ; print it
  971.         pop     h               ; restore column
  972.         mvi     h,0             ; hl = column
  973.         call    nout
  974.         mvi     e,'C'           ; terminate with 'move cursor' command
  975.         jmp     outcon          ; output it and return
  976. ENDIF;hp125 [MF]
  977. ;
  978. ;       csrpos for the Vector General.  It's weird.
  979. ;
  980. IF vector
  981. csrpos: dcr     b               ; vector uses zero-based addressing?
  982.         dcr     c
  983.         push    b               ; save coordinates
  984.         mvi     e,esc           ; print an escape
  985.         call    outcon
  986.         pop     d               ; peek at coordinates
  987.         push    d
  988.         call    outcon          ; output column
  989.         pop     d
  990.         mov     e,d             ; get row
  991.         jmp     outcon          ; output and return
  992. ENDIF;vector
  993.  
  994. IF osi                 ; systems without cursor positioning
  995. csrpos: ret                     ; dummy routine referenced by linkage section
  996. ENDIF;osi
  997.  
  998.  
  999. ;
  1000. ; delchr - make delete look like a backspace.  Unless delete is a printing
  1001. ;       character, we just need to print a backspace. (we'll output clrspc
  1002. ;       afterwards)
  1003. ;       For Kaypro and Vector General, delete puts a blotch on the screen.
  1004. ;       For Apple and Osborne 1, delete moves but doesn't print.
  1005. delchr:
  1006.  
  1007. IF vector OR osbrn1 OR lobo
  1008.         lxi     d,delstr
  1009.         jmp     prtstr
  1010. ENDIF    ;vector OR osbrn1 OR lobo
  1011.  
  1012. IF bbc OR rm380z      ;[22]
  1013.         ret
  1014. ENDIF;bbc OR rm380z
  1015.  
  1016. IF NOT (vector OR osbrn1 OR bbc OR rm380z);[22]
  1017.         mvi     e,bs            ;get a backspace
  1018.         jmp     outcon
  1019. ENDIF;NOT (vector OR osbrn1 OR bbc OR rm380z [22]
  1020.  
  1021. ; erase the character at the current cursor position
  1022. clrspc: mvi     e,' '
  1023.         call    outcon
  1024.         mvi     e,bs            ;get a backspace
  1025.         jmp     outcon
  1026.  
  1027. ; erase the current line
  1028. clrlin: lxi     d,eralin
  1029.         jmp     prtstr
  1030.  
  1031. ; erase the whole screen, and go home. preserves b (but not c)
  1032. clrtop: lxi     d,erascr
  1033.         jmp     prtstr
  1034.  
  1035.  
  1036. IF robin
  1037. sysver:    db    'VT180 Robin$'
  1038. ENDIF;robin
  1039.  
  1040. IF dmII
  1041. sysver:    db    'DECmate II CP/M-80$'
  1042. ENDIF;dmII
  1043.  
  1044. IF delphi    ; [7] new system
  1045. sysver:    db    'Digicomp Delphi 100$'
  1046. endif;delphi
  1047.  
  1048. IF access
  1049. sysver:    db    'Actrix CP/M$'
  1050. endif;
  1051.  
  1052. IF teletek
  1053. sysver:    db    'Teletek SYSTEMASTER CP/M-80$'
  1054. ENDIF    ;teletek
  1055.  
  1056. IF cpt85xx
  1057. sysver:    db    'CPT-85xx under CompuPak CP/M$'
  1058. ENDIF;cpt85xx
  1059.  
  1060. IF mdI
  1061. sysver:    db    'Morrow Decision I$'
  1062. ENDIF;mdI  [Toad Hall]
  1063.  
  1064. IF mmdI
  1065. sysver:    db    'MicroDecision I$'
  1066. ENDIF;mmdI
  1067.  
  1068. IF osi
  1069. sysver:    db    'Ohio Scientific$'
  1070. ENDIF;osi
  1071.  
  1072. IF mmate    ;[29]
  1073. sysver:    db    'PMC Micromate using port I/O$'
  1074. ENDIF;mmate [29]
  1075.  
  1076. IF disc        ;[29]
  1077. sysver:    db    'Discovery using 83U board port B$'
  1078. ENDIF  ;disc [29]
  1079.  
  1080. IF s1008    ;[29]
  1081. sysver:    db 'U. S. MicroSales using printer port$'
  1082. ENDIF ;s1008 [29]
  1083.  
  1084. IF cmemco    ;[25]
  1085. sysver:    db    'Cromemco (TU-ART)$'
  1086. ENDIF;cmemco
  1087. ;
  1088. IF robin OR dmII
  1089. ; Note that we cannot support Graphics Mode or the H19 erase-screen command
  1090. ; (<esc>E), because the sequences are more than three bytes.
  1091. defesc    EQU    '\'-100O        ;Still Control-\ (just ran out of room...)
  1092. vtval    EQU    0        ; we probably don't want VT52 emulation
  1093. outlin:    db    esc,3CH,esc,'[H',esc,'[J',cr,lf,tab,tab,'$'
  1094. erascr:    db    esc,'[H',esc,'[J$'      ;Clear screen and go home.
  1095. eralin:    db    cr,esc,'[K$'            ;Clear line.
  1096. curldn:    db    esc,'[$'                ; Cursor leadin
  1097. ttab:
  1098. ta:    db    esc,'[A$'               ; Cursor up.
  1099. tb:    db    esc,'[B$'               ; Cursor down.
  1100. tc:    db    esc,'[C$'               ; Cursor right.
  1101. td:    db    esc,'[D$'               ; Cursor left
  1102. te:    db    '$',0,0,0               ; (can't) Clear display
  1103. tf:    db    '$',0,0,0               ; (don't) Enter Graphics Mode
  1104. tg:    db    '$',0,0,0               ; (don't) Exit Graphics mode
  1105. th:    db    esc,'[H$'               ; Cursor home.
  1106. ti:    db    esc,'M$',0              ; Reverse linefeed.
  1107. tj:    db    esc,'[J$'               ; Clear to end of screen.
  1108. tk:    db    esc,'[K$'               ; Clear to end of line.
  1109. ENDIF;robin OR dmII
  1110.  
  1111. IF mikko
  1112. sysver:    db    'MikroMikko$'
  1113. outlin:    db    subt,cr,lf,tab,'$'
  1114. erascr:    db    subt,'$'                ;Clear screen and go home.
  1115. eralin:    db    cr,1CH,'$'              ;Clear line.
  1116. curldn:    db    esc,'=$'                ;cursor leadin
  1117. ttab:                    ;Table start location.
  1118. ta:    db    0BH,'$',0,0             ;Cursor up.
  1119. tb:    db    0AH,'$',0,0             ;Cursor down.
  1120. tc:    db    0CH,'$',0,0             ;Cursor right.
  1121. td:    db    bs,'$',0,0              ;Cursor left
  1122. te:    db    subt,'$',0,0            ;Clear display
  1123. tf:    db    '$',0,0,0               ;(can't) Enter Graphics Mode
  1124. tg:    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1125. th:    db    1EH,'$',0,0             ;Cursor home.
  1126. ti:    db    '$',0,0,0               ;(can't) Reverse linefeed.
  1127. tj:    db    1cH,'$',0,0             ;Clear to end of screen.
  1128. tk:    db    1cH,'$',0,0             ;Clear to end of line.
  1129. ENDIF;mikko
  1130. ;
  1131. IF bbc        ;[22]
  1132. sysver:    db    'BBC (Z80)$'
  1133. outlin:    db    0CH,esc,'=',21H,30H,'$'
  1134. erascr:    db    0CH,'$'                 ;Clear screen and go home.
  1135. eralin:    db    cr,esc,'@$'             ;Clear line.
  1136. curldn:    db    esc,'=$'                ;cursor leadin
  1137. ttab:                    ;Table start location.
  1138. ta:    db    0BH,'$',0,0             ;Cursor up.
  1139. tb:    db    0AH,'$',0,0             ;Cursor down.
  1140. tc:    db    tab,'$',0,0             ;Cursor right.
  1141. td:    db    bs,'$',0,0              ;Cursor left
  1142. te:    db    0CH,'$',0,0             ;Clear display
  1143. tf:    db    '$',0,0,0               ;(can't) Enter Graphics Mode
  1144. tg:    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1145. th:    db    1EH,'$',0,0             ;Cursor home.
  1146. ti:    db    '$',0,0,0               ;(can't) Reverse linefeed.
  1147. tj:    db    esc,'?$',0,0            ;Clear to end of screen.
  1148. tk:    db    esc,'@$',0,0            ;Clear to end of line.
  1149. ENDIF;[22] bbc
  1150. ;
  1151. IF rm380z    ;[22]
  1152. sysver:    db    'Research Machines 380Z$'
  1153. outlin:    db    1FH,cr,tab,'$'
  1154. erascr:    db    1FH,'$'                 ;Clear screen and go home.
  1155. eralin:    db    0EH,19H,'$'             ;Clear line.
  1156. curldn:    db    16H,'$'                 ;cursor leadin
  1157. ttab:                    ;Table start location.
  1158. ta:    db    0BH,'$',0,0             ;Cursor up.
  1159. tb:    db    0AH,'$',0,0             ;Cursor down.
  1160. tc:    db    18H,'$',0,0             ;Cursor right.
  1161. td:    db    bs,'$',0,0              ;Cursor left
  1162. te:    db    1FH,'$',0,0             ;Clear display
  1163. tf:    db    '$',0,0,0               ;(can't) Enter Graphics Mode
  1164. tg:    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1165. th:    db    1DH,'$',0,0             ;Cursor home.
  1166. ti:    db    '$',0,0,0               ;(can't) Reverse linefeed.
  1167. tj:    db    1EH,'$',0,0             ;Clear to end of screen.
  1168. tk:    db    19H,'$',0,0             ;Clear to end of line.
  1169. ENDIF;[22] rm380z
  1170.  
  1171. IF lobo    ;[hh]
  1172. sysver:    db    'Lobo MAX-80$'
  1173. outlin:    db    esc,'*',cr,lf,tab,tab,'$'
  1174. erascr:    db    esc,'*$'                ;[hh] clear screen and home cursor
  1175. eralin:    db    cr,esc,'R$'             ;[hh] clear line
  1176. curldn:    db    esc,'=$'                ;[hh] cursor lead-in string
  1177. delstr:    db    bs,' ',bs,bs,'$'        ;[hh] ??adjust for echoing delete
  1178. ttab:                    ;[hh] table start location
  1179. ta:    db    0BH,'$',0,0             ;[hh] cursor up
  1180. tb:    db    0AH,'$',0,0             ;[hh] cursor down
  1181. tc:    db    0CH,'$',0,0             ;[hh] cursor right
  1182. td:    db    08H,'$',0,0             ;[hh] cursor left
  1183. te:    db    esc,'*$',0              ;[hh] clear display (homes cursor)
  1184. tf:    db    '$',0,0,0               ;[hh] (can't) enter graphics mode
  1185. tg:    db    '$',0,0,0               ;[hh] (can't) exit graphics mode
  1186. th:    db    01EH,'$',0,0            ;[hh] home cursor
  1187. ti:    db    esc,'E$',0              ;[hh] reverse linefeed (insert line)
  1188. tj:    db    esc,'Y$',0              ;[hh] clear to end of screen
  1189. tk:    db    esc,'T$',0              ;[hh] clear to end of line
  1190. ENDIF    ;lobo
  1191.  
  1192. IF px8 ; [29]
  1193. sysver:    db    'Epson PX-8$'
  1194. outlin:    db    esc,'*$'
  1195. erascr:    db    esc,'*$'    ; clear screen and home
  1196. eralin:    db    cr,esc,'T$' ; clear line
  1197. curldn:    db    esc,'=$'    ; cursor lead in
  1198. ttab:                ; table start location
  1199. ta:    db    30,'$',0,0  ; cursor up
  1200. tb:    db    31,'$',0,0  ; cursor down
  1201. tc:    db    28,'$',0,0  ; cursor right
  1202. td:    db    29,'$',0,0  ; cursor left
  1203. te:    db    esc,'*$',0  ; clear display
  1204. tf:    db    '$',0,0,0   ; can't enter graphics graphics mode
  1205. tg:    db    '$',0,0,0   ; can't exit graphics mode
  1206. th:    db    11,'$',0,0  ; home cursor
  1207. ti:    db    30,'$',0,0  ; reverse linefeed
  1208. tj:    db    esc,'Y$',0  ; erase to end of screen
  1209. tk:    db    esc,'T$',0  ; erase to end of line
  1210. ENDIF ; px8 [29]
  1211.  
  1212. ;
  1213. IF osbrn1
  1214. sysver:    db    'Osborne 1$'
  1215. outlin:    db    1AH,cr,lf,tab,'$'       ;(Clear screen, home cursor)
  1216. erascr:    db    1AH,'$'                 ;Clear screen and go home.
  1217. eralin:    db    cr,esc,'T$'             ;Clear line.
  1218. delstr:    db    bs,bs,'$'               ; Adjust for delete
  1219. curldn:    db    esc,'=$'                ;Cursor lead-in
  1220. ttab:                    ;Table start location.
  1221. ta:    db    ('K'-100O),'$',0,0      ;Cursor up.
  1222. tb:    db    12O,'$',0,0             ;Cursor down.
  1223. tc:    db    ('L'-100O),'$',0,0      ;Cursor right.
  1224. td:    db    bs,'$',0,0              ;Cursor left.
  1225. te:    db    subt,'$',0,0            ;Clear screen.
  1226. tf:    db    '$',0,0,0               ;(can't) Enter graphics mode
  1227. tg:    db    '$',0,0,0               ;(can't) Exit graphics mode
  1228. th:    db    ('^'-100O),'$',0,0      ;Cursor home.
  1229. ti:    db    ('K'-100O),'$',0,0      ;Reverse linefeed.
  1230. tj:    db    esc,'T$',0              ;(can't) Clear to end of screen.
  1231. tk:    db    esc,'T$',0              ;Clear to end of line.
  1232. ENDIF;osbrn1
  1233. ;
  1234. IF vector
  1235. sysver:    db    'Vector Graphics$'
  1236. outlin:    db    ('D'-100O),cr,lf,tab,tab,'$'
  1237. erascr:    db    ('D'-100O),'$'          ;Clear screen and go home.
  1238. eralin:    db    cr,('Q'-100O),'$'       ;Clear line.
  1239. delstr:    db    bs,' ',bs,bs,'$'        ; adjust for echoing delete character
  1240. ttab:                    ;Table start location.
  1241. ta:    db    ('U'-100O),'$',0,0      ;Cursor up.
  1242. tb:    db    12O,'$',0,0             ;Cursor down.
  1243. tc:    db    ('Z'-100O),'$',0,0      ;Cursor right.
  1244. td:    db    '$',0,0,0               ;(can't) Cursor left
  1245. te:    db    '$',0,0,0               ;(can't) Clear display
  1246. tf:    db    '$',0,0,0               ;(can't) Enter graphics mode
  1247. tg:    db    '$',0,0,0               ;(can't) Exit graphics mode
  1248. th:    db    ('B'-100O),'$',0,0      ;Cursor home.
  1249. ti:    db    ('U'-100O),'$',0,0      ;Reverse linefeed.
  1250. tj:    db    ('P'-100O),'$',0,0      ;Clear to end of screen.
  1251. tk:    db    ('Q'-100O),'$',0,0      ;Clear to end of line.
  1252. ENDIF;vector
  1253.  
  1254. IF trs80lb
  1255. sysver:    db    'TRS-80 II Lifeboat CP/M$'
  1256. outlin:    db    esc,':',cr,lf,tab,tab,'$'
  1257. erascr:    db    esc,':$'                ;Clear screen and go home.
  1258. eralin:    db    cr,esc,'T$'             ;Clear line.
  1259. curldn:    db    esc,'=$'                ;Cursor lead-in
  1260. ttab:                    ;Table start location.
  1261. ta:    db    0BH,'$',0,0             ;Cursor up.
  1262. tb:    db    0AH,'$',0,0             ;Cursor down.
  1263. tc:    db    0CH,'$',0,0             ;Cursor right.
  1264. td:    db    bs,'$',0,0              ;Cursor left
  1265. te:    db    esc,':$',0              ;Clear display
  1266. tf:    db    '$',0,0,0               ;(can't) Enter Graphics Mode
  1267. tg:    db    '$',0,0,0               ;(can't) Exit Graphics mode
  1268. th:    db    1EH,'$',0,0             ;Cursor home.
  1269. ti:    db    0BH,'$',0,0             ;Reverse linefeed.
  1270. tj:    db    esc,'Y$',0              ;Clear to end of screen.
  1271. tk:    db    esc,'T$',0              ;Clear to end of line.
  1272. ENDIF;trs80lb
  1273. ;
  1274. IF trs80pt
  1275. sysver:    db    'TRS-80 II P+T CP/M$'
  1276. outlin:    db    0CH,cr,lf,tab,tab,'$'
  1277. erascr:    db    0CH,'$'                 ;Clear screen and go home.
  1278. eralin:    db    cr,01H,'$'              ;Clear line.
  1279. curldn:    db    esc,'Y$'                ;Cursor lead-in
  1280. ttab:    ;Table start location           ;Must be 4 bytes each
  1281. ta:    db    1EH,'$',0,0             ;Cursor up.
  1282. tb:    db    1FH,'$',0,0             ;Cursor down.
  1283. tc:    db    1DH,'$',0,0             ;Cursor right.
  1284. td:    db    1CH,'$',0,0             ;Cursor left
  1285. te:    db    0CH,'$',0,0             ;Clear display
  1286. tf:    db    11H,'$',0,0             ;Enter Graphics Mode
  1287. tg:    db    14H,'$',0,0             ;Exit Graphics mode
  1288. th:    db    06H,'$',0,0             ;Cursor home.
  1289. ti:    db    1EH,'$',0,0             ;Reverse linefeed.
  1290. tj:    db    02H,'$',0,0             ;Clear to end of screen.
  1291. tk:    db    01H,'$',0,0             ;Clear to end of line.
  1292. ENDIF;trs80pt
  1293.  
  1294. IF osi
  1295. outlin:    db    cr,lf,'Starting ...$'
  1296. erascr    equ    crlf            ;"Home & clear" (best we can do).
  1297. eralin:    db    '^U',cr,lf,'$'          ;Clear line.
  1298. prpack:    db    cr,lf,'RPack: $'
  1299. pspack:    db    cr,lf,'SPack: $'
  1300. ttab    equ    0            ; no VT52 table
  1301. ENDIF;osi
  1302. ;
  1303. IF hp125            ;[MF]
  1304. defesc    EQU    '\'-100O        ;Still Control-\ (just ran out of room...)
  1305. vtval    EQU    0        ; we probably don't want VT52 emulation
  1306. ;
  1307. sysver:    db    'HP-125 Series 100$'
  1308. ;
  1309. outlin:    db    esc,'H',esc,'J',cr,lf,tab,tab,'$'
  1310. erascr:    db    esc,'H',esc,'J$'     ;Clear screen and go home.
  1311. eralin:    db    cr,esc,'K$'        ;Clear line.
  1312. curldn:    db    esc,'&a$'        ;Cursor leadin
  1313. ttab:                    ;Table start location.
  1314. ta:    db    esc,'A$',0        ;Cursor up.
  1315. tb:    db    esc,'B$',0        ;Cursor down.
  1316. tc:    db    esc,'C$',0        ;Cursor right.
  1317. td:    db    esc,'D$',0        ;Cursor left
  1318. te:    db    esc,'J$',0        ;Clear display
  1319. tf:    db    '$',0,0,0        ;[hh] (can't) enter graphics mode
  1320. tg:    db    '$',0,0,0        ;[hh] (can't) exit graphics mode
  1321. th:    db    esc,'H$',0        ;Cursor home.
  1322. ti:    db    esc,'M$',0        ;Reverse linefeed.
  1323. tj:    db    esc,'J$',0        ;Clear to end of screen.
  1324. tk:    db    esc,'K$',0        ;Clear to end of line.
  1325. ;
  1326. ;
  1327. ; Escape sequences to map CP/M Reader/Punch to Data Comm input/output,
  1328. ;    respectively and to turn off these mappings
  1329. ;
  1330. mapon1:    db    esc,'&i10s18d9M'
  1331.     db    esc,'&i2s25d9M'
  1332.     db    esc,'&i10s16d2M'
  1333.     db    esc,'&i0s25d2M$';Esc. sequences to turn off DAtacomm2/turn
  1334.                 ;on Data Comm 1
  1335. mapon2:    db    esc,'&i10s16d9M'
  1336.     db    esc,'&i0s25d9M'
  1337.     db    esc,'&i10s18d2M'
  1338.     db    esc,'&i2s25d2M$';Esc. sequences to turn off Datacomm1/turn
  1339.                 ;on Datacomm 2
  1340. mapoff:    db    esc,'&i0s25d9M'
  1341.     db    esc,'&i10s16d9M'
  1342.     db    esc,'&i2s25d9M'
  1343.     db    esc,'&i10s18d9M$'
  1344. ;
  1345. readin:    call    $-$        ;Read character into b
  1346.     mov    a,b        ;Get 8-bit character
  1347.     ret            ;and return
  1348. ;
  1349. jbuf:    db    7        ;bios dispatch table vector argument block
  1350.     db    0        ;to read RDR routine address
  1351.     db    0c3h        ;...
  1352.     dw    0        ;...
  1353. ;
  1354. ENDIF;hp125 ;[MF]
  1355.  
  1356. IF lasm and termin    ; if no terminal, no need to link
  1357. LINK CPXVDU.ASM
  1358. ENDIF    ; lasm and termin
  1359.  
  1360. ovlend    EQU    $
  1361.  
  1362. IF lasm
  1363.     END    ; If m80 then this ignored
  1364. ENDIF    ; lasm
  1365.