home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol220 / mxo-rs13.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  17.3 KB  |  574 lines

  1.     Title    'MEX overlay for the TRS-80 MOD IV version 1.2'
  2. ;                      Montezuma Micro CP/M 2.2
  3. ;   (delete the above title if not assembling with MAC)
  4. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  5. ; MEX TRS-80 MOD IV OVERLAY VERSION 1.0: Written 09/10/84 by Ed Richter 
  6. ;
  7. ; VERSION 1.3 10/10/84 - Fixed bug in the Printer ready test
  8. ;                                                 Ed Richter
  9. ; VERSION 1.2 09/18/84 - Added the comments to 1.1 and changed the
  10. ;             configuration of the SET message that is
  11. ;             output to the console
  12. ;                           Ed Richter 
  13. ; VERSION 1.1 09/16/84 - Added code to fully control the SIO USART
  14. ;                 via the SET command. This overlay now 
  15. ;             supports-- SET BAUD -- SET PARITY --
  16. ;             SET STOP BITS -- SET WORD LENGTH --
  17. ;                                                   Ed Richter
  18. ; This file was derived from the MDM7xx overlay M7R4-5.ASM, and the 
  19. ; file MXOPM10.ASM. It is a MEX overlay for use with the TRS-80 MOD
  20. ; IV, and an external modem. It has a SET command that supports 300
  21. ; and 1200 baud.  
  22. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  23. REV:         EQU    10
  24. ;
  25. CR:        EQU    0DH    ;carriage return
  26. LF:        EQU    0AH    ;linefeed
  27. TPA:        EQU    0100H
  28. TAB:        EQU    09H    
  29. YES:        EQU    0FFH
  30. NO:        EQU    0
  31. ;
  32. ;
  33. ; Change the following information to match your equipment.
  34. ; PORT should be set to the base port address for the RS-232 port.
  35. ;
  36. PORT:        EQU    0E8H    ;master reset port   
  37. MODCT1:        EQU    PORT+2    ;modem control port
  38. MODDAT:        EQU    PORT+3    ;modem data in port
  39. MODCT2:        EQU    PORT+2    ;not used mod iv
  40. BAUDRP:        EQU    PORT+1    ;baud rate port
  41. MDRCVB:        EQU    080H    ;bit to test for receive
  42. MDRCVR:        EQU    080H    ;value when ready
  43. MDSNDB:        EQU    040H    ;bit to test for send
  44. MDSNDR:        EQU    040H    ;value when ready
  45. ;
  46. MODCTB:        EQU    0ECH    ;dtr,rts,8,no,1 for port initialize
  47. CTSMSK:        EQU    020H    ;carrier detect mask
  48. ISOCD:        EQU    0DFH    ;port ready mask
  49. PRPORT:        EQU    0F8H    ;printer port
  50. PRSTAT:        EQU    0C0H    ;printer ready mask
  51. BRKMSK:        EQU    0E3H    ;send break
  52. DTRMSK:        EQU    0EBH    ;drop dtr
  53. ;
  54. ;MEX SERVICE PROCESSOR STUFF
  55. ;
  56. MEX:        EQU    0D00H    ;address of the service processor
  57. INMDM:        EQU    255    ;get char from port,CY=no more in 100ms
  58. TIMER:        EQU    254    ;delay 100 ms * reg b
  59. TMDINP:        EQU    253    ;b=# secs to wait for char,CY=no char
  60. CHEKCC:        EQU    252    ;check for ^C from kbd, Z=present
  61. SNDRDY:        EQU    251    ;test for modem-send ready
  62. RCVRDY:        EQU    250    ;test for modem-receive ready
  63. SNDCHR:        EQU    249    ;send to modem (after SNDRDY)
  64. RCVCHR:        EQU    248    ;recv a char from modem after (RCVRDY)
  65. LOOKUP:        EQU    247    ;table search: see CMDTBL for info 
  66. PARSFN:        EQU    246    ;parse filename from input stream 
  67. èBDPARS:        EQU    245    ;parse baud-rate from input stream
  68. SBLANK:        EQU    244    ;scan input stream to next non-blank
  69. EVALA:        EQU    243    ;evaluate numeric from input stream
  70. LKAHED:        EQU    242    ;get nxt char w/o removing from input
  71. GNC:        EQU    241    ;get char from input, CY=1 if none
  72. ILP:        EQU    240    ;inline print
  73. DECOUT:        EQU    239    ;decimal output
  74. PRBAUD:        EQU    238    ;print baud rate
  75. CONOUT:        EQU    2    ;simulated BDOS funct 2:CONSOLE OUT
  76. PRINT:        EQU    9    ;simulated BDOS funct 9: PRINT STRING
  77. INBUF:        EQU    10    ;input buffer, same as BDOS FUNCT 10
  78. ;
  79.         ORG    0D11H    ;install printer ready test
  80.         DW    PRTSTS
  81.         ORG    TPA
  82. ;
  83. ; Change the clock speed to suit your system
  84. ;
  85.         DS    3    ;(for  "JMP   START" instruction)
  86. PMODEM:        DB    NO    ;Not used by MEX            103H
  87. SMODEM:        DB    NO    ;Not used by MEX
  88. TPULSE:        DB    'P'    ;Not used by MEX            105H
  89. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  90.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  91. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  92.                 ;6=2400 7=4800 8=9600 9=19200 default
  93. BYTDLY:        DB    0    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  94.                 ;default time to send character in ter-
  95.                 ;minal mode file transfer for slow BBS.
  96. CRDLY:        DB    0    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  97.                 ;default time for extra wait after CRLF
  98.                 ;in terminal mode file transfer
  99. COLUMS:        DB    4    ;number of DIR columns shown        10AH
  100. SETFL:        DB    YES    ;yes=user-added Setup routine        10BH
  101. SCRTST:        DB    YES    ;Cursor control routine         10CH
  102.         DS    1    ;reserved (old ACKNAK flag)        10DH
  103. BAKFLG:        DB    YES     ;yes=change any file same name to .BAK    10EH
  104. CRCDFL:        DB    YES    ;yes=default to CRC checking        10FH
  105. TOGCRC:        DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  106. CVTBS:        DB    NO    ;yes=convert backspace to rub        111H
  107. TOGLBK:        DB    YES    ;yes=allow toggling of bksp to rub    112H
  108. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  109.                 ;terminal mode (added by remote echo)
  110. TOGLF:        DB    YES    ;yes=allow toggling of LF after CR    114H
  111. TRNLOG:        DB    NO    ;yes=allow transmission of logon    115H
  112.                 ;write logon sequence at location LOGON
  113. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  114. LOCNXT:        DB    NO    ;yes=local command if EXTCHR precedes    117H
  115.                 ;no=external command if EXTCHR precedes
  116. TOGLOC:        DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  117. LSTTST:        DB    YES    ;yes=allow toggling of printer on/off    119H
  118. XOFTST:        DB    YES    ;yes=checks for XOFF from remote while    11AH
  119.                 ;sending a file in terminal mode
  120. XONWT:        DB    YES    ;yes=wait for XON after CR while    11BH
  121. è                ;sending a file in terminal mode
  122. TOGXOF:        DB    YES    ;yes=allow toggling of XOFF checking    11CH
  123. IGNCTL:        DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  124. EXTRA1:        DB    0    ;for future expansion            11EH
  125. EXTRA2:        DB    0    ;for future expansion            11FH
  126. BRKCHR:        DB    'K'-40H    ;^K = Send 300 ms. break tone        120H
  127. NOCONN:        DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  128. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  129. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  130. UNSVCH:        DB    'R'-40H    ;^R = Close input text buffer        124H
  131. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  132. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  133. EXTCHR:        DB    '^'-40h    ;^^ = Send next character        127H
  134.         DS    2
  135. INCTL1:        JMP     STATSND    ;go to "get status"             12AH
  136.         DS    7
  137. OTDATA:        OUT    MODDAT  ! RET    ;out modem data port        134H
  138.         DS    7
  139. INPORT:        IN    MODDAT  ! RET    ;in modem data port
  140.         DS    7
  141. MASKR:        ANI    MDRCVB    ! RET    ;bit to test for receive ready    148H
  142. TESTR:        CPI    MDRCVR    ! RET    ;value of rcv. bit when ready    14BH
  143. MASKS:        ANI    MDSNDB    ! RET    ;bit to test for send ready    14EH
  144. TESTS:        CPI    MDSNDR    ! RET    ;value of send bit when ready    151H
  145.         DS    12        ;unused by MEX
  146. LOGON:        DS    2        ;for user message        160H
  147. DIALV:        DS    3        ;autodial rtn jump        162H
  148. DISCV:        JMP    DISCON        ;disconnect rtn
  149. GOODBV:        DS    3        ;not needed            168H
  150. INMODV:        JMP    NITMOD        ;go to user written routine    16BH
  151. NEWBDV:        JMP    PBAUD        ;set new baud-rate           16EH
  152. NOPARV:        DS    3        ;(by-pass PMMI routine)        171H
  153. PARITV:        DS    3        ;(by-pass PMMI routine)        174H
  154. SETUPV:        JMP    SETCMD        ;initialize USART and modem    177H
  155. SPMENV:        DS    3        ;not used with MEX        17AH
  156. VERSNV:        JMP    SYSVER        ;print header msg        17DH
  157. BREAKV:        JMP    PBREAK        ;send header            180H
  158. ; Do not change the following six lines.
  159. ILPRTV:        DS    3        ;                183H
  160. INBUFV:        DS    3        ;                186H
  161. ILCMPV:        DS    3        ;                189H
  162. INMDMV:        DS    3        ;                18CH
  163. NXSCRV:        DS    3        ;                18FH
  164. TIMERV:        DS    3        ;                192H
  165. ;
  166. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  167. ; SCRNTEST to YES at 010AH (above).
  168. ;
  169. CLREOS:        LXI    D,EOSMSG    ;clear to end of screen         195H
  170.         MVI    C,PRINT        ;from cursor
  171.         CALL    MEX        ;                198H
  172.         RET            ;                19DH
  173. ;
  174. CLS:        LXI    D,CLSMSG    ;clear sreen            19EH
  175.         MVI    C,PRINT
  176. è        CALL    MEX        ;                1A1H
  177.         RET            ;                1A6H
  178.     
  179. ;
  180. SYSVER:        LXI    D,SOMESG    ;print the sys version msg    1A7H
  181.         MVI    C,PRINT
  182.         CALL    MEX        
  183.         CALL    CRLF        
  184. ;
  185. CARRSH        LXI    D,NOMESG    ;no carrier present msg
  186.         CALL    CARRCK
  187.         MVI    C,PRINT
  188.         CNZ    MEX        ;print if no carrier
  189.         LXI    D,CARMSG    ;carrier present
  190.         MVI    C,PRINT
  191.         CALL    MEX        ;say so and continue
  192.         RET
  193. ;
  194. ; Send a break tone to reset some time-share computers.
  195. ;
  196. PBREAK:        MVI    A,BRKMSK    ;send break
  197.         OUT    MODCT1
  198.          RET
  199. ;
  200. ; Routine to return status of the modem port
  201. ;
  202. STATSND:    IN    MODCT1        ;in modem contol port
  203.         PUSH     B        ;just in case
  204.         ANI    ISOCD        ;isolate status and clear CD bit
  205.         MOV    B,A        ;save status
  206.         IN     PORT        ;get CD bit
  207.         ANI    CTSMSK        ;isolate CD bit
  208.         ORA    B        ;merge CD with status
  209.         POP    B        ;restore B
  210.         RET
  211. ;
  212. ; This routine will hang up the phone by dropping DTR.
  213. ;
  214. DISCON:          MVI     A,DTRMSK    ;DTR off, send BRK
  215.               OUT    MODCT1        ;send cmd
  216.           MVI    B,5        
  217.           MVI    C,TIMER
  218.           CALL    MEX        ;delay 500 msec
  219.         MVI    A,MODCTB    ;normal setup DTR on
  220.           OUT    MODCT1
  221.           RET
  222. ;
  223. ; This area sets the SIO-UART to an initial value of 8 bits, no parity,
  224. ; DTR on, and RTS on. 
  225. ;
  226. NITMOD:          MVI    A,1
  227.           OUT    PORT        ;reset the USART to
  228. è          MVI    A,MODCTB    ;8,no,1,DTR, and RTS
  229.           OUT    MODCT1
  230.           RET
  231. ;
  232. ;  Sets the modem speed via the SET COMMAND.
  233. ;
  234. SETCMD:        MVI    C,SBLANK    ;any arguments
  235.         CALL    MEX
  236.         JC    SETSHO        ;if not print out values
  237.         LXI    D,CMDTBL    ;parse commands
  238.         CALL    TSRCH        ;from table
  239.         PUSH    H        ;address on stack
  240.         RNC            ;if yes then execute it
  241.         POP    H        ;no fix stack
  242. SETERR:          LXI    D,SETEMS    ;no then print error
  243.           MVI     C,PRINT
  244.           CALL    MEX
  245.           RET
  246. CMDTBL:        DB    '?'+80H        ;"set ?"
  247.         DW    STHELP
  248.         DB    'BAU','D'+80H    ;"set baud ?'
  249.         DW    STBAUD
  250.         DB    'WOR','D'+80H    ;set word length
  251.         DW    STWORD
  252.         DB    'PARIT','Y'+80H ;set parity
  253.         DW    STPAR
  254.         DB    'STO','P'+80H    ;set stop bits
  255.         DW    STSTOP
  256.         DB    0    
  257. SETSHO:        CALL    CLS        ;clear screen
  258.         CALL    CARRSH        ;carrier present
  259.         LXI    H,SHOTBL    ;show subroutines table
  260. SETSLP:     MOV    E,M        ;get table address
  261.         INX    H
  262.         MOV    D,M
  263.         INX    H
  264.         MOV    A,D        ;end of table
  265.         ORA    E
  266.         RZ            ;exit if yes
  267.         PUSH    H        ;save table pointer
  268.         XCHG            ;addrs to HL
  269.         CALL    GOHL        ;do it
  270.         CALL    CRLF        ;print newline
  271.         MVI    C,CHEKCC    ;check for console abort
  272.         CALL    MEX        
  273.         POP    H        ;its done
  274.         JNZ    SETSLP        ;continue if no abort
  275.         RET
  276. GOHL:        PCHL
  277. SHOTBL:        DW    BDSHOW        ;table
  278.         DW    PARSHOW
  279.         DW    WLSHOW
  280.         DW    STSHOW
  281.         DW    0
  282. STHELP:        LXI    D,HLPMSG    ;print help message
  283.         MVI    C,PRINT
  284. è        CALL    MEX
  285.         RET
  286. STBAUD:        MVI    C,BDPARS    ;MEX find baud rate        
  287.         CALL    MEX
  288.         JC     SETERR        ;none then exit
  289.         CALL    PBAUD        ;valid baud rate then set it
  290.         JC     SETERR        ;exit if not supported by overlay
  291. BDSHOW:        CALL    ILPRT
  292.         DB    'Baud Rate:',TAB,' ',0
  293.         LDA    MSPEED        ;get MSPEED to determine present
  294.         MVI    C,PRBAUD    ;baud rate
  295.         CALL    MEX
  296.         RET    
  297. STPAR:        LXI    D,PARTBL    ;find parity function requested
  298.         CALL    TSRCH
  299.         PUSH    H
  300.         RNC            ;execute it
  301.         POP    H
  302.         JMP    SETERR        ;not valid then say so                 
  303. STWORD:        LXI    D,WLTBL        ;find word length function requested
  304.         CALL    TSRCH
  305.         PUSH    H
  306.         RNC            ;execute it
  307.         POP    H
  308.         JMP    SETERR        ;not valid then say so
  309. STSTOP:        LXI    D,STTBL        ;find how many stop bits 
  310.         CALL    TSRCH
  311.         PUSH    H
  312.         RNC            ;execute it
  313.         POP    H
  314.         JMP    SETERR        ;not valid then say so 
  315. ;
  316. HLPMSG:    DB    CR,LF,'SET command, TRS MOD 4 version 1.1',CR,LF
  317.     DB    CR,LF,'SET BAUD 300 <or> 1200 <or> 2400 <or> 4800 <or> 9600'
  318.     DB    CR,LF,'SET PARITY ON <or> OFF <or> ODD <or> EVEN'
  319.     DB    CR,LF,'SET WORD 5 <or> 6 <or> 7 <or> 8'
  320.     DB    CR,LF,'SET STOP 1 <or> 2'
  321.     DB    CR,LF,'$'        
  322. SETEMS:          DB    CR,LF,'SET command error',CR,LF,LF,'$'
  323. TSRCH:        MVI    C,LOOKUP
  324.           JMP    MEX
  325. ;
  326. ILPRT:        MVI    C,ILP        ;MEX print function
  327.         JMP    MEX
  328. ;
  329. CRLF:        MVI    A,CR        ;newline on console
  330.         CALL    TYPE
  331.         MVI    A,LF
  332. TYPE:        PUSH    H        ;save em
  333.         PUSH    D
  334.         PUSH    B
  335.         MOV    E,A
  336.         MVI    C,CONOUT    ;align output char
  337.         CALL    MEX        ;print via mex
  338.         POP    B        ;restore em
  339. è        POP    D
  340.         POP    H
  341.         RET        
  342. ;
  343. ; Test for printer ready
  344. ;
  345. PRTSTS:          IN    PRPORT        ;get printer status
  346.           ANI    PRSTAT        ;isolate it
  347.           JNZ    PRTSTS1        ;return if not ready A=00
  348.           MVI    A,0FFH        ;ready A=FF 
  349.         RET
  350. PRTSTS1:    XRA    A
  351.         RET
  352. ; Carrier detect  0=CARRIER
  353. ;
  354. CARRCK:        IN    PORT        ;get carrier bit
  355.         ANI    CTSMSK
  356.         RET
  357. ;    
  358. ; Baud rate set routine 
  359. ;
  360. PBAUD:          PUSH    H        ;save everybody
  361.           PUSH    B
  362.           PUSH    D
  363.         MOV    E,A        ;get speed
  364.         MVI    D,0        ;zero the other half of reg pair
  365.         LXI    H,BAUDTB    ;get baud rate table address
  366.         DAD    D        ;add speed offset
  367.         MOV    A,M        ;get baud rate  
  368.         ORA    A        ;0=not valid baud rate
  369.         JZ    PBEXIT        ;not valid baud rate then exit
  370.         OUT    BAUDRP        ;good baud rate then set it
  371.         MOV    A,E        ;get speed 
  372.         STA    MSPEED        ;set speed
  373.         JMP    PBEXIT1        ;return 
  374. PBEXIT:        STC
  375. PBEXIT1:    POP    B        ;no carrier or incorrect baud rate
  376.           POP    D
  377.           POP       H
  378.           RET
  379. ;
  380. BAUDTB:        DB    0,055H,0,0,0        ;110,300,450,610,710
  381.         DB    077H,0AAH,0CCH,0EEH,0    ;1200,2400,4800,9600,19200
  382. ;
  383. STTBL:        DB    '1'+80H        ;stop bit tabe
  384.         DW    STONE        ;set one bit
  385.         DB    '2'+80H
  386.         DW    STTWO        ;set two bits
  387.         DB    0
  388. ;
  389. PARTBL:        DB    'O','N'+80H    ;parity table
  390.         DW    STON        ;enable parity
  391.         DB    'OF','F'+80H
  392.         DW    STOFF        ;disable parity
  393.         DB    'EVE','N'+80H
  394. è        DW    STEVE        ;even parity
  395.         DB    'OD','D'+80H
  396.         DW    STODD        ;odd parity    
  397.         DB    0
  398. ;
  399. WLTBL:        DB    '5'+80H        ;word length table
  400.         DW    STFIVE        ;5 bit length
  401.         DB    '6'+80H
  402.         DW    STSIX        ;6 bit length
  403.         DB    '7'+80H
  404.         DW    STSEV        ;7 bit length
  405.         DB    '8'+80H
  406.         DW    STATE        ;8 bit length
  407.         DB    0
  408. ;
  409. STFIVE:        MVI     A,MODCTB    ;get current port info
  410.         ANI    09FH        ;change to 5 bits
  411.         STA    MODCTB        ;put back new port info
  412.         MVI    A,'5'        ;set 5 bit flag
  413. STFIVE1:    STA    WLTEL        
  414.         CALL    CARRCK        ;carrier present
  415.         RZ            ;yep then continue
  416.         CALL    TYPE        ;position cursor
  417.         CALL    WLSHOW        ;nope show word length
  418.         RET
  419. STSIX:        MVI    A,MODCTB    ;get current port info 
  420.         ORI    040H        ;set six bits    
  421.         ANI    0DFH
  422.         STA    MODCTB        ;put new 
  423.         MVI    A,'6'        ;set six bit flag
  424.         JMP    STFIVE1
  425. STSEV:        MVI    A,MODCTB    ;get current port info
  426.         ORI    020H        ;set seven bits
  427.         ANI    0BFH
  428.         STA    MODCTB        ;put back new port info
  429.         MVI    A,'7'        ;set 7 bit flag            
  430.         JMP    STFIVE1
  431. STATE:        MVI    A,MODCTB    ;get current port info
  432.         ORI    060H        ;set eight bit
  433.         STA    MODCTB        ;put back new port info
  434.         MVI    A,'8'        ;set 8 bit flag
  435.         JMP    STFIVE1
  436. ;
  437. STON:        MVI    A,MODCTB    ;get current port info
  438.         ANI    0F7H        ;set parity on
  439.               STA    MODCTB        ;put back new port info
  440.         MVI    A,YES
  441. STON1:        STA    PARTEL        ;set parity on flag
  442.         CALL    CARRCK        ;carrier present
  443.         RZ            ;yep then continue
  444.         CALL    TYPE        ;position cursor
  445.         CALL    PARSHOW        ;nope then show parity info 
  446.         RET
  447. STOFF:        MVI    A,MODCTB    ;get curent port info
  448.         ORI    008H        ;set parity off
  449.         STA    MODCTB        ;put back new port info
  450.         MVI    A,NO        ;set no parity flag
  451.         JMP    STON1    
  452. STODD:        MVI    A,MODCTB    ;get current port info
  453.         ANI    07FH        ;set parity odd
  454.         STA    MODCTB        ;put back new port info
  455.         MVI    A,YES        ;set parity odd flag
  456. èSTODD1:        STA    PARTEL1
  457.         CALL    CARRCK        ;carrier present
  458.         RZ            ;yep then return
  459.         CALL    TYPE        ;position cursor
  460.         CALL    PARSHOW        ;nope show parity info
  461.         RET
  462. STEVE:        MVI    A,MODCTB    ;get current port info
  463.         ORI    080H        ;set even parity
  464.         STA    MODCTB        ;put back new port info
  465.         MVI    A,NO        ;set even parity flag
  466.         JMP    STODD1
  467. STONE:        MVI    A,MODCTB    ;get current port info
  468.         ANI    0EFH        ;set one stop bit 
  469.         STA    MODCTB        ;put back new port info
  470.         MVI    A,YES        ;set one stop bit flag
  471. STONE1:        STA    STTEL        
  472.         CALL    CARRCK        ;carrier present
  473.         RZ            ;yep then continue
  474.         CALL    STSHOW        ;nope show stop bit info 
  475.         RET
  476. STTWO:        MVI    A,MODCTB    ;get current port info
  477.         ORI    010H        ;set two stop bits
  478.         STA    MODCTB        ;put back new port info
  479.         MVI    A,NO        ;set two stop bit flag
  480.         JMP    STONE1            
  481. ;
  482. PARSHOW:    LXI    D,PARMSG    ;get parity message
  483.         MVI    C,PRINT        ;print it
  484.         CALL    MEX
  485.         LXI    D,PONMSG    ;get set for parity on
  486.         MVI    C,PRINT
  487.         LDA    PARTEL        ;get flag
  488.         CPI    YES         ;is it on
  489.         JZ    PARSHOW1    ;yes then say so
  490.         LXI    D,POFMSG    ;no then get parity off message
  491.         MVI    C,PRINT        ;print it
  492.         CALL    MEX
  493.         RET
  494. PARSHOW1:    CALL    MEX
  495.         LXI    D,ODDMSG    ;get parity odd message
  496.         MVI    C,PRINT
  497.         LDA    PARTEL1        ;get odd parity flag
  498.         CPI    YES        ;is it odd
  499.         JNZ      PARSHOW2    ;nope get even message
  500.         CALL    MEX        ;yes then say so 
  501.         RET
  502. PARSHOW2:    LXI    D,EVEMSG    ;get even parity message
  503.         MVI    C,PRINT        
  504.         CALL    MEX        ;print it
  505.         RET
  506. ;
  507. WLSHOW:        LXI    D,WLMSG        ;get word length message
  508. è        MVI    C,PRINT
  509.         CALL    MEX        ;print it
  510.         LXI    D,FIVEMSG    ;load five bit message
  511.         MVI    C,PRINT    
  512.         LDA    WLTEL        ;get word length flag 
  513.         CPI    '5'        ;is it five
  514.         JNZ     SIX        ;nope try six
  515.         CALL    MEX        ;yes then show it
  516.         RET
  517. SIX:        LXI    D,SIXMSG    ;load six bit message
  518.         MVI    C,PRINT
  519.         CPI    '6'        ;is it six
  520.         JNZ    SEV        ;nope try seven
  521.         CALL    MEX        ;yep then show it
  522.         RET
  523. SEV:        LXI    D,SEVMSG    ;load seven bit message
  524.         MVI    C,PRINT
  525.         CPI    '7'        ;is it seven
  526.         JNZ    ATE        ;nope try eight
  527.         CALL    MEX        ;yep then show it
  528.         RET
  529. ATE:        LXI    D,ATEMSG    ;load eight bit message
  530.         MVI    C,PRINT
  531.         CALL    MEX        ;print it
  532.         RET
  533. ;
  534. STSHOW:        LXI    D,STOPMSG    ;get stop bit message
  535.         MVI    C,PRINT        ;print it
  536.         CALL    MEX
  537.         LXI    D,STOPMSG1    ;get stop bit 1 message
  538.         MVI    C,PRINT
  539.         LDA    STTEL        ;is it 1 bit
  540.         CPI    YES
  541.         JNZ    STSHOW1        ;nope try two
  542.         CALL    MEX        ;yep then show it 
  543.         RET
  544. STSHOW1:    LXI    D,STOPMSG2    ;get stop bit 2 message
  545.         MVI    C,PRINT
  546.         CALL    MEX        ;print it
  547.         RET
  548. ;
  549. ; Message area
  550. ;
  551. PARTEL:        DB    NO        ;yes=parity, no=no parity
  552. PARTEL1:    DB    NO         ;yes=odd parity, no=even
  553. WLTEL:        DB    '8'        ;5=5 bits,6=6 bits, etc.
  554. STTEL:        DB    YES        ;yes=1 stop, no=2 stop 
  555. STOPMSG:    DB    'Number of stop bits is $'
  556. STOPMSG1:    DB    '1$'
  557. èSTOPMSG2:    DB    '2$'        
  558. WLMSG:        DB    'Word length is $'
  559. FIVEMSG:    DB    '5 bits$'
  560. SIXMSG:        DB    '6 bits$'
  561. SEVMSG:        DB    '7 bits$'
  562. ATEMSG:        DB    '8 bits$'      
  563. PARMSG:        DB    'Parity is: $'
  564. PONMSG:        DB    'on and $'
  565. POFMSG:        DB    'off$'
  566. ODDMSG:        DB    'odd$'
  567. EVEMSG:        DB    'even$'
  568. CLSMSG:          DB    CR,LF,1AH,'$'
  569. EOSMSG:          DB    CR,LF,19H,'$'
  570. SOMESG:          DB    'TRS Mod 4 CP/M 2.2 overlay V'
  571.           DB    REV/10+'0'
  572.           DB    '.'
  573.           DB    REV MOD 10+'2','$'
  574. NOMESG:        DB    'no $'
  575. CARMSG:        DB    'carrier present',CR,LF,'$'
  576. ;
  577. ;----------------------------------------------------------------------
  578. ; NOTE:  MUST TERMINATE PRIOR TO 0B00H (with Smartmodem or Anchor)
  579. ;----------------------------------------------------------------------
  580. ; End of TRS-80 MOD IV  MEX modem overlay
  581.           END
  582.