home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / MEX / MXO-BW12.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  20KB  |  681 lines

  1. REV    EQU    12        ;overlay revision level
  2. ;
  3. ; MEX STARPLEX OVERLAY VERSION 1.0: written 07/16/84 by Bill Meahan
  4. ;                            1951 S. Globe
  5. ;                            Westland, MI 48185
  6. ;----------------------------------------------------------------------------
  7. ; Modified:  01-Dec-85    Chuck Sadoian
  8. ;            821 Newton Drive
  9. ;            Dinuba, CA  93618
  10. ;            209-591-2631
  11. ;
  12. ; Version 1.2 For the Bondwell 2 portable computer
  13. ;
  14. ; Renamed MXO-BW12.ASM
  15. ;
  16. ; This version has been tested on a Bondwell 2 Portable Computer and
  17. ; Mex version 1.14.  Overlay allows for adjusting the baud rate, parity,
  18. ; stop bits and character length of the Bondwell's USART.  IT DOES NOT,
  19. ; HOWEVER, UPDATE THE BIOS AREAS WHERE THESE VALUES ARE STORED.  Therefore,
  20. ; when the Bondwell program SETUP is run, it will show existing values that
  21. ; may or may not be valid, depending on what USART functions were done while
  22. ; using MEX.
  23. ;----------------------------------------------------------------------------
  24. ;
  25. ;
  26. ; This is a MEX overlay file for the National Semiconductor STARPLEX.
  27. ; Derived from the PMMI overlay by Ronald G. Fowler.
  28. ;
  29. ; This overlay should also work (except for the serial printer support) with
  30. ; systems based on the following single-board computers:
  31. ;         Intel        National
  32. ;         SBC80/20    BLC80/204
  33. ;         SBC80/20-4    BLC80/24
  34. ;         SBC80/24    BLC80/316
  35. ;         SBC80/30
  36. ;
  37. ; Intel development systems may have different addresses for the ports, but
  38. ; use the same arrangement of 8253 baud rate generators and 8251 USART's so
  39. ; this overlay should be EASILY adaptible to those systems as well.
  40. ;
  41. ;------------------------------------------------------------
  42. ;
  43. ; Misc equates
  44. ;
  45. NO    EQU    0
  46. YES    EQU    0FFH
  47. TPA    EQU    100H
  48. CR    EQU    13
  49. LF    EQU    10
  50. TAB    EQU    9
  51. XON    EQU    011H
  52. XOFF    EQU    013H
  53. ;
  54. ; Bondwell port definitions
  55. ;
  56. PORT    EQU    040H        ;bondwell base port (data or status)
  57. MODCT1    EQU    PORT+1        ;modem control port
  58. MODDAT    EQU    PORT        ;modem data port
  59. MODCT2    EQU    PORT+1        ;modem status port
  60. BAUDRP    EQU    010H        ;modem baud rate port
  61. BAUDMD    EQU    013H        ;modem baud rate mode control port
  62. ;
  63. ; Bondwell bit definitions
  64. ;
  65. MDRCVB    EQU    02H        ;modem receive bit (dav)
  66. MDRCVR    EQU    02H        ;modem receive ready
  67. MDSNDB    EQU    01H        ;modem send bit
  68. MDSNDR    EQU    01H        ;modem send ready bit
  69. ;
  70. ;
  71. CTSMSK    EQU    4        ;mask for cts bit
  72. BRKMSK    EQU    8        ;mask to set break
  73. PARMSK    EQU    0CFH        ;mask to remove parity bits
  74. OPARIT    EQU    10H        ;odd-parity bits
  75. EPARIT    EQU    30H        ;even-parity bits
  76. NPARIT    EQU    00H        ;no-parity bits
  77. PARTST    EQU    10H        ;mask to test parity enabled bit
  78. EVNTST    EQU    20H        ;mask to test even parity bit
  79. MODEMK    EQU    06EH        ;mode mask
  80. MODEGO    EQU    027H        ;default control command
  81. RSTCTL    EQU    040H        ;reset usart command
  82. BITS7    EQU    08H        ;mask for 7 bit characters
  83. BITS8    EQU    0CH        ;mask for 8 bit characters
  84. BITS8T    EQU    04H        ;mask to test for 8 bit characters
  85. STBIT1    EQU    040H        ;mask to set 1 stop bit
  86. STBI15    EQU    080H        ;mask to set 1.5 stop bits
  87. STBIT2    EQU    0C0H        ;mask to set 2 stop bits
  88. ;
  89. ;
  90. ; MEX service processor stuff ... MEX supports an overlay service
  91. ; processor, located at 0D00H (and maintained at this address from
  92. ; version to version).    If your overlay needs to call BDOS for any
  93. ; reason, it should call MEX instead; function calls below about
  94. ; 240 are simply passed on to the BDOS (console and list I/O calls
  95. ; are specially handled to allow modem port queueing, which is why
  96. ; you should call MEX instead of BDOS).  MEX uses function calls
  97. ; above about 244 for special overlay services (described below).
  98. ;
  99. ; Some sophisticated overlays may need to do file I/O; if so, use
  100. ; the PARSFN MEX call with a pointer to the FCB in DE to parse out
  101. ; the name.  This FCB should support a spare byte immediately pre-
  102. ; ceeding the actual FCB (to contain user # information).  If you've
  103. ; used MEX-10 for input instead of BDOS-10 (or you're parsing part
  104. ; of a SET command line that's already been input), then MEX will
  105. ; take care of DU specs, and set up the FCB accordingly.  There-
  106. ; after all file I/O calls done through the MEX service processor
  107. ; will handle drive and user with no further effort necessary on
  108. ; the part of the programmer.
  109. ;
  110. MEX    EQU    0D00H        ;address of the service processor
  111. INMDM    EQU    255        ;get char from port to a, cy=no more in 100 ms
  112. TIMER    EQU    254        ;delay 100ms * reg b
  113. TMDINP    EQU    253        ;b=# secs to wait for char, cy=no char
  114. CHEKCC    EQU    252        ;check for ^c from kbd, z=present
  115. SNDRDY    EQU    251        ;test for modem-send ready
  116. RCVRDY    EQU    250        ;test for modem-receive ready
  117. SNDCHR    EQU    249        ;send a character to the modem (after sndrdy)
  118. RCVCHR    EQU    248        ;recv a char from modem (after rcvrdy)
  119. LOOKUP    EQU    247        ;table search: see cmdtbl comments for info
  120. PARSFN    EQU    246        ;parse filename from input stream
  121. BDPARS    EQU    245        ;parse baud-rate from input stream
  122. SBLANK    EQU    244        ;scan input stream to next non-blank
  123. EVALA    EQU    243        ;evaluate numeric from input stream
  124. LKAHED    EQU    242        ;get nxt char w/o removing from input
  125. GNC    EQU    241        ;get char from input, cy=1 if none
  126. ILP    EQU    240        ;inline print
  127. DECOUT    EQU    239        ;decimal output
  128. PRBAUD    EQU    238        ;print baud rate
  129. ;
  130. ;
  131. CONOUT    EQU    2        ;simulated bdos function 2: console char out
  132. PRINT    EQU    9        ;simulated bdos function 9: print string
  133. INBUF    EQU    10        ;input buffer, same structure as bdos 10
  134. ;
  135.     ORG    TPA        ;we begin
  136. ;
  137. ;
  138.     DS    3        ;mex has a jmp start here
  139. ;
  140. ; The following variables are located at the beginning of the program
  141. ; to facilitate modification without the need of re-assembly. They will
  142. ; be moved in MEX 2.0.
  143. ;
  144. STRPLX:    DB    NO        ;yes=bondwell modem \/ these 2 locations are not
  145. SMODEM:    DB    NO        ;yes=smartmodem     /\ referenced by mex
  146. TPULSE:    DB    'T'        ;T=tone, P=pulse (used by smartmodem overlay)
  147. CLOCK:    DB    40        ;clock speed x .1, up to 25.5 mhz.
  148. MSPEED:    DB    5        ;sets display time for sending a file
  149.                 ;0=110    1=300  2=450  3=600  4=710
  150.                 ;5=1200 6=2400 7=4800 8=9600 9=19200
  151. BYTDLY:    DB    1        ;default time to send character in
  152.                 ;terminal mode file transfer (0-9)
  153.                 ;0=0 delay, 1=10 ms, 5=50 ms, 9=90 ms
  154. CRDLY:    DB    1        ;end-of-line delay after crlf in terminal
  155.                 ;mode file transfer for slow bbs systems
  156.                 ;0=0 delay, 1=100 ms, 5=500 ms, 9=900 ms
  157. COLUMS:    DB    5        ;number of directory columns
  158. SETFL:    DB    YES        ;yes=user-defined set command
  159. SCRTST:    DB    YES        ;yes=if home cursor and clear screen
  160.                 ;routine at clrscrn
  161.     DB    0        ;was once acknak, now spare
  162. BAKFLG:    DB    NO        ;yes=make .bak file
  163. CRCDFL:    DB    YES        ;yes=default to crc checking
  164.                 ;no=default to checksum checking
  165. TOGCRC:    DB    YES        ;yes=allow toggling of checksum to crc
  166. CVTBS:    DB    NO        ;yes=convert backspace to rub
  167. TOGLBK:    DB    YES        ;yes=allow toggling of bksp to rub
  168. ADDLF:    DB    NO        ;no=no lf after cr to send file in
  169.                 ;terminal mode (added by remote echo)
  170. TOGLF:    DB    YES        ;yes=allow toggling of lf after cr
  171. TRNLOG:    DB    NO        ;yes=allow transmission of logon
  172.                 ;write logon sequence at location logon
  173. SAVCCP:    DB    YES        ;yes=do not overwrite ccp
  174. LOCNXT:    DB    NO        ;yes=local cmd if extchr precedes
  175.                 ;no=not local cmd if extchr precedes
  176. TOGLOC:    DB    YES        ;yes=allow toggling of locnxtchr
  177. LSTTST:    DB    NO        ;yes=allow toggling of printer on/off
  178.                 ;in terminal mode. set to no if using
  179.                 ;the printer port for the modem
  180. XOFTST:    DB    NO        ;yes=allow testing of xoff from remote
  181.                 ;while sending a file in terminal mode
  182. XONWT:    DB    NO        ;yes=wait for xon after sending cr while
  183.                 ;transmitting a file in terminal mode
  184. TOGXOF:    DB    YES        ;yes=allow toggling of xoff testing
  185. IGNCTL:    DB    YES        ;yes=do not send control characters
  186.                 ;above ctl-m to crt in terminal mode
  187.                 ;no=send any incoming ctl-char to crt
  188. EXTRA1:    DB    0        ;for future expansion
  189. EXTRA2:    DB    0        ;for future expansion
  190. BRKCHR:    DB    '@'-40H        ;^@ = send a 300 ms. break tone
  191. NOCONN:    DB    'N'-40H        ;^N = disconnect from phone line
  192. LOGCHR:    DB    'L'-40H        ;^L = send logon
  193. LSTCHR:    DB    'P'-40H        ;^P = toggle printer
  194. UNSVCH:    DB    'R'-40H        ;^R = close input text buffer
  195. TRNCHR:    DB    'T'-40H        ;^T = transmit file to remote
  196. SAVCHR:    DB    'Y'-40H        ;^Y = open input text buffer
  197. EXTCHR:    DB    'A'-40H        ;^A = send next character
  198. ;
  199. ; Equates used only by Bondwell routines grouped together here.
  200. ;
  201.     DB    0        ;not used
  202.     DB    0        ;not used
  203. ;
  204. ; Low-level modem I/O routines: this will be replaced with
  205. ; a jump table in MEX 2.0 (you can insert jumps here to longer
  206. ; routines if you'd like ... I'd recommend NOT putting part of
  207. ; a routine in this area, then jumping to the rest of the routine
  208. ; in the non-fixed area; that will complicate the 2.0 conversion)
  209. ;
  210. INCTL1:    IN    MODCT1        ;in modem control port
  211.     RET
  212.     DB    0,0,0,0,0,0,0    ;spares if needed for non-bondwell
  213. ;
  214. OTDATA:    OUT    MODDAT        ;out modem data port
  215.     RET
  216.     DB    0,0,0,0,0,0,0    ;spares if needed for non=bondwell
  217. ;
  218. INPORT:    IN    MODDAT        ;in modem data port
  219.     RET
  220.     DB    0,0,0,0,0,0,0    ;spares if needed for non-bondwell
  221. ;
  222. ; Bit-test routines.  These will be merged with the above
  223. ; routines in MEX 2.0 to provide a more reasonable format
  224. ;
  225. MASKR:    ANI MDRCVB ! RET    ;bit to test for receive ready
  226. TESTR:    CPI MDRCVR ! RET    ;value of receive bit when ready
  227. MASKS:    ANI MDSNDB ! RET    ;bit to test for send ready
  228. TESTS:    CPI MDSNDR ! RET    ;value of send bit when ready
  229. ;
  230. ;
  231. ; Unused area: was once used for special Bondwell functions,
  232. ; Now used only to retain compatibility with MDM overlays.
  233. ; You may use this area for any miscellaneous storage you'd
  234. ; like but the length of the area *must* be 12 bytes.
  235. ;
  236.     DS    12
  237. ;
  238. ; Special modem function jump table:
  239. ;
  240. LOGON:    DS    2        ;needed for mdm compat, not ref'd by mex
  241. DIALV:    DS    3        ;dial digit in a (see info at pdial)
  242. DISCV:    DS    3        ;disconnect the modem
  243. GOODBV:    JMP    DUMMY        ;called before exit to cp/m
  244. INMODV:    JMP    NITMOD        ;initialization. called at cold-start
  245. NEWBDV:    JMP    PBAUD        ;set baud rate
  246. NOPARV:    JMP    DUMMY        ;set modem for no-parity
  247. PARITV:    JMP    DUMMY        ;set modem parity
  248. SETUPV:    JMP    SETCMD        ;set cmd: jump to a ret if you don't write set
  249. SPMENV:    DS    3        ;not used with mex
  250. VERSNV:    JMP    SYSVER        ;overlay's voice in the sign-on message
  251. BREAKV:    JMP    PBREAK        ;send a break
  252. ;
  253. ; The following jump vector provides the overlay with access to special
  254. ; routines in the main program (retained and supported in the main pro-
  255. ; gram for MDM overlay compatibility). These should not be modified by
  256. ; the overlay.
  257. ;
  258. ; Note that for MEX 2.0 compatibility, you should not try to use these
  259. ; routines, since this table will go away with MEX 2.0 (use the MEX
  260. ; service call processor instead).
  261. ;
  262. ILPRTV:    DS    3        ;replace with mex function 9
  263. INBUFV:    DS    3        ;replace with mex function 10
  264. ILCMPV:    DS    3        ;replace with table lookup funct. 247
  265. INMDMV:    DS    3        ;replace with mex function 255
  266. NXSCRV:    DS    3        ;not supported by mex (returns w/no action)
  267. TIMERV:    DS    3        ;replace with mex function 254
  268. ;
  269. ;
  270. ; Clear/screen and clear/end-of-screen. Each routine must use the
  271. ; full 9 bytes alloted (may be padded with nulls).
  272. ;
  273. ; These routines (and other screen routines that MEX 2.0 will sup-
  274. ; port) will be accessed through a jump table in 2.0, and will be
  275. ; located in an area that won't tie the screen functions to the
  276. ; modem overlay (as the MDM format does).
  277. ;
  278. CLREOS:    LXI    D,EOSMSG
  279.     MVI    C,PRINT
  280.     CALL    MEX
  281.     RET
  282. ;
  283. ;
  284. CLS:    LXI    D,CLSMSG        ;null unless patched
  285.     MVI    C,PRINT
  286.     CALL    MEX
  287.     RET
  288. ;
  289. ;------------------------------------------------------------
  290. ;
  291. ;    *** END OF FIXED FORMAT AREA ***
  292. ;
  293. ;------------------------------------------------------------
  294. ;
  295. ; Modem initialization.
  296. ;
  297. NITMOD:
  298.     MVI    A,5        ;default to 1200 baud on start-up [cs]
  299.     CALL    PBAUD
  300.     LDA    MODMOD        ;default mode command in a
  301. ALTINI:                ;alternate entry point for mode change routines
  302.     PUSH    PSW        ;save mode command on stack
  303.     XRA    A        ;force 8251 usart to look for reset command
  304.     OUT    MODCT2
  305.     OUT    MODCT2
  306.     OUT    MODCT2
  307.     MVI    A,RSTCTL    ;reset usart
  308.     OUT    MODCT2
  309.     POP    PSW        ;retreive mode command
  310.     STA    MODMOD        ;save copy for future use
  311.     OUT    MODCT2        ;set usart mode
  312.     MVI    A,MODEGO    ;enable transmitter and receiver
  313.     OUT    MODCT2
  314.     RET
  315. ;
  316. ; Bondwell send-break routine
  317. ;
  318. PBREAK:    LDA    MODCTB        ;get the last modem control byte
  319.     ORI    BRKMSK        ;set the transmit break bit low
  320.     OUT    MODCT2        ;send it to the modem
  321.     LXI    B,02FEH        ;b=2, c=254
  322.     CALL    MEX        ;send a space tone for 200 ms.
  323.     LDA    MODCTB        ;get the last modem control byte
  324.     OUT    MODCT2        ;restore to normal
  325. ;
  326. ; exit routine
  327. ;
  328. DUMMY:    RET            ;we don't need one
  329. ;
  330. ;
  331. ;
  332. ; Set baud-rate code in A
  333. ;
  334. PBAUD:    PUSH    H        ;don't alter anybody
  335.     PUSH    D
  336.     PUSH    B
  337.     STA    MSPEED
  338.     ADD    A        ;double value to get word address
  339.     MOV    E,A        ;code to de
  340.     MVI    D,0
  341.     LXI    H,BAUDTB    ;offset into table
  342.     DAD    D
  343.     MOV    C,M        ;fetch code
  344.     INX    H
  345.     MOV    B,M
  346.     MVI    A,076H
  347.     OUT    BAUDMD        ;control counter
  348.     MOV    A,C
  349.     OUT    BAUDRP
  350.     MOV    A,B
  351.     OUT    BAUDRP        ;good rate, set it
  352. PBEXIT:    POP    B        ;all done
  353.     POP    D
  354.     POP    H
  355.     RET
  356. ;
  357. ; table of baud rate divisors for supported rates
  358. ;
  359. BAUDTB:    DW    2160,832,576,416,356    ;110,300,450,600,710
  360.     DW    208,104,52,26,13    ;1200,2400,4800,9600,19200
  361.                     ;note: 450 & 710 not supported on
  362.                     ;on the bondwell [cs]
  363. ;
  364. ; Sign-on message
  365. ;
  366. SYSVER:    LXI    D,SOMESG
  367.     MVI    C,PRINT
  368.     CALL    MEX
  369.     RET
  370. ;
  371. SOMESG:    DB    CR,LF,'Bondwell 2 overlay By Chuck Sadoian, Version '
  372.     DB    REV/10+'0'
  373.     DB    '.'
  374.     DB    REV MOD    10+'0'
  375.     DB    CR,LF,LF,'$'
  376. ;
  377. ;
  378. ;
  379. ;
  380. ; Newline on console
  381. ;
  382. CRLF:    MVI    A,CR
  383.     CALL    TYPE
  384.     MVI    A,LF        ;fall into type
  385. ;
  386. ; type char in A on console
  387. ;
  388. TYPE:    PUSH    H        ;save 'em
  389.     PUSH    D
  390.     PUSH    B
  391.     MOV    E,A        ;align output character
  392.     MVI    C,CONOUT    ;print via mex
  393.     CALL    MEX
  394.     POP    B
  395.     POP    D
  396.     POP    H
  397.     RET
  398. ;
  399. ; strings to clear-to-end-of-screen, and clear-screen
  400. ;
  401. EOSMSG:    DB    01BH,'Y','$'    ;clear to end-of-screen
  402. CLSMSG:    DB    01BH,'*','$'    ;clear whole screen
  403. ;
  404. ; Data area
  405. ;
  406. ERRFLG:    DB    0        ;connection error code
  407. MODMOD    DB    MODEMK        ;uart-control byte image
  408. BAUDSV:    DB    05        ;current baud rate (dflt 1200)
  409. MODCTB:    DB    MODEGO        ;modem control byte
  410. ;
  411. ;------------------------------------------------------------
  412. ;
  413. ; The remainder of this overlay implements a very versatile
  414. ; SET command --
  415. ;
  416. ;
  417. ; Control is passed here after MEX parses a SET command.
  418. ;
  419. SETCMD:    MVI    C,SBLANK    ;any arguments?
  420.     CALL    MEX
  421.     JC    SETSHO        ;if not, go print out values
  422.     LXI    D,CMDTBL    ;parse command
  423.     CALL    TSRCH        ;from table
  424.     PUSH    H        ;any address on stack
  425.     RNC            ;if we have one, execute it
  426.     POP    H        ;nope, fix stack
  427. SETERR:    LXI    D,SETEMS    ;print error
  428.     MVI    C,PRINT
  429.     CALL    MEX
  430.     RET
  431. ;
  432. SETEMS:    DB    CR,LF,'SET command error',CR,LF,'$'
  433. ;
  434. ; SET command table ... note that tables are constructed of command-
  435. ; name (terminated by high bit=1) followed by word-data-value returned
  436. ; in HL by MEX service processor LOOKUP.  Table must be terminated by
  437. ; a binary zero.
  438. ;
  439. ; Note that LOOKUP attempts to find the next item in the input stream
  440. ; in the table passed to it in HL ... if found, the table data item is
  441. ; returned in HL; if not found, LOOKUP returns carry set.
  442. ;
  443. CMDTBL:    DB    '?'+80H            ;"set ?"
  444.     DW    STHELP
  445.     DB    'BAU','D'+80H        ;"set baud"
  446.     DW    STBAUD
  447.     DB    'PARIT','Y'+80H        ;"set parity"
  448.     DW    SETPAR
  449.     DB    'BIT','S'+80H        ;"set bits"
  450.     DW    SETBIT
  451.     DB    'STO','P'+80H        ;"set stop"
  452.     DW    SETSTO
  453. ;
  454.     DB    0        ;<<=== table terminator
  455. ;
  456. ; SET <no-args>: print current statistics
  457. ;
  458. SETSHO:    CALL    CRLF
  459.     LXI    H,SHOTBL    ;get table of show subroutines
  460. SETSLP:    MOV    E,M        ;get table address
  461.     INX    H
  462.     MOV    D,M
  463.     INX    H
  464.     MOV    A,D        ;end of table?
  465.     ORA    E
  466.     JNZ    NEXT        ;continue if non-zero
  467.     CALL    CRLF        ;else this is the end of table, do newline
  468.     RET            ;and exit
  469. NEXT:    PUSH    H        ;save table pointer
  470.     XCHG            ;adrs to hl
  471.     CALL    GOHL        ;do it
  472.     CALL    CRLF        ;print newline
  473.     MVI    C,CHEKCC    ;check for console abort
  474.     CALL    MEX
  475.     POP    H        ;it's done
  476.     JNZ    SETSLP        ;continue if no abort
  477.     RET
  478. ;
  479. GOHL:    PCHL
  480. ;
  481. ; table of SHOW subroutines
  482. ;
  483. SHOTBL:    DW    BDSHOW
  484.     DW    PARSHO
  485.     DW    BITSHO
  486.     DW    STOSHO
  487.     DW    0        ;<<== table terminator
  488. ;
  489. ; SET ?  processor
  490. ;
  491. STHELP:    LXI    D,HLPMSG
  492.     MVI    C,PRINT
  493.     CALL    MEX
  494.     RET
  495. ;
  496. ; The help message
  497. ;
  498. HLPMSG:    DB    CR,LF,LF,'SET command, Bondwell version:',CR,LF,LF
  499.     DB    CR,LF,'SET BAUD (110 300 600 1200 2400 4800 9600 19200)'
  500.     DB    CR,LF,'SET PARITY ODD <or> EVEN <or> OFF'
  501.     DB    CR,LF,'SET BITS 7 <or> 8'
  502.     DB    CR,LF,'SET STOP 1 <or> 1.5 <or> 2'
  503.     DB    CR,LF,LF,'$'
  504. ;
  505. ; SET BAUD processor
  506. ;
  507. STBAUD:    MVI    C,BDPARS    ;function code
  508.     CALL    MEX        ;let mex look up code
  509.     JC    BDBAUD        ;invalid code
  510.     CPI    2        ;code 2, 450 baud?
  511.     JZ    BDBAUD        ;yes, not supported, invalid
  512.     CPI    4        ;code 4, 710 baud?
  513.     JZ    BDBAUD        ;yes, not supported, invalid
  514.     CALL    PBAUD        ;no, try to set it
  515.     JC    SETERR        ;not-supported code
  516. BDSHOW:    CALL    ILPRT        ;display baud
  517.     DB    'Baud rate:     ',0
  518.     LDA    MSPEED
  519.     MVI    C,PRBAUD    ;use mex routine
  520.     CALL    MEX
  521.     RET
  522. ;
  523. BDBAUD:    LXI    D,MSGB        ;report bad baud rate
  524.     MVI    C,PRINT
  525.     CALL    MEX
  526.     RET
  527. ;
  528. MSGB:    DB    CR,LF,'Invalid Baud Rate Specified',CR,LF,LF,'$'
  529. ;
  530. ; SET PARITY processor
  531. ;
  532. SETPAR:
  533.     LXI    D,PARTBL    ;point to argument table
  534.     CALL    TSRCH        ;look for match with allowed arguments
  535.     JC    SETERR        ;process error if found
  536.     LDA    MODMOD        ;get current mode byte
  537.     ANI    PARMSK        ;mask away current parity bits
  538.     ORA    L        ;add new parity bits
  539.     CALL    ALTINI
  540. PARSHO:
  541.     CALL    ILPRT        ;show current status
  542.     DB    'Parity:        ',0
  543.     LDA    MODMOD        ;get current mode word
  544.     ANI    PARTST        ;test for parity enabled
  545.     JNZ    PAR        ;skip if it is
  546.     CALL    ILPRT
  547.     DB    'Off',0
  548.     RET
  549. PAR:
  550.     LDA    MODMOD
  551.     ANI    EVNTST        ;test mode byte for even parity
  552.     JNZ    PAREVN        ;skip if it is
  553.     CALL    ILPRT
  554.     DB    'Odd',0
  555.     RET
  556. PAREVN:
  557.     CALL    ILPRT
  558.     DB    'Even',0
  559.     RET
  560. ;
  561. ;PARITY argument table
  562. ;
  563. PARTBL:    DB    'OD','D'+80H
  564.     DB    OPARIT,0
  565.     DB    'EVE','N'+80H
  566.     DB    EPARIT,0
  567.     DB    'OF','F'+80H
  568.     DB    NPARIT,0
  569.     DB    0
  570. ;
  571. ;SET BITS processor
  572. ;
  573. SETBIT:
  574.     LXI    D,BITTBL    ;point to argument table
  575.     CALL    TSRCH        ;look for match with allowed arguments
  576.     JC    SETERR        ;process error if found
  577.     LDA    MODMOD        ;get current mode command
  578.     ANI    (NOT BITS8) AND    255    ;mask away current bits
  579.     ORA    L        ;set new bits
  580.     CALL    ALTINI        ;change mode
  581. BITSHO:
  582.     CALL    ILPRT        ;show current status
  583.     DB    'Bits:          ',0
  584.     LDA    MODMOD        ;get current mode word
  585.     ANI    BITS8        ;test for number of bits
  586.     JZ    SETERR
  587.     ANI    BITS8T
  588.     JNZ    B8        ;skip if it is
  589.     CALL    ILPRT
  590.     DB    '7',0
  591.     RET
  592. B8:
  593.     CALL    ILPRT
  594.     DB    '8',0
  595.     RET
  596. ;
  597. ;BITS argument table
  598. ;
  599. BITTBL:    DB    '8'+80H
  600.     DB    BITS8,0
  601.     DB    '7'+80H
  602.     DB    BITS7,0
  603.     DB    0
  604. ;
  605. ;SET STOP processor
  606. ;
  607. SETSTO:
  608.     LXI    D,STPTBL    ;point to argument table
  609.     CALL    TSRCH        ;look for match with allowed arguments
  610.     JC    SETERR        ;process error if found
  611.     LDA    MODMOD        ;get current mode command
  612.     ANI    (NOT STBIT2) AND 255     ;mask away current bits
  613.     ORA    L        ;set new bits
  614.     CALL    ALTINI        ;change mode
  615. STOSHO:
  616.     CALL    ILPRT        ;show current status
  617.     DB    'Stop Bits:     ',0
  618.     LDA    MODMOD        ;get current mode word
  619.     ANI    STBIT2        ;test for number of bits
  620.     JZ    SETERR
  621.     RLC
  622.     RLC
  623.     ADD    A        ;form word table index
  624.     LXI    H,STJTBL    ;get address of jump table
  625.     ADD    L        ;point to address of proper routine
  626.     MOV    L,A
  627.     MVI    A,0
  628.     ADC    H
  629.     MOV    H,A
  630.     MOV    A,M        ;get address of proper routine
  631.     INX    H
  632.     MOV    H,M
  633.     MOV    L,A
  634.     PCHL            ;branch to proper routine
  635. PRT1:
  636.     CALL    ILPRT
  637.     DB    '1',0
  638.     RET
  639. PRT2:
  640.     CALL    ILPRT
  641.     DB    '2',0
  642.     RET
  643. PRT15:
  644.     CALL    ILPRT
  645.     DB    '1.5',0
  646.     RET
  647. ;
  648. STJTBL:                ;jump table for stop bit show routines
  649.     DW    SETERR
  650.     DW    PRT1
  651.     DW    PRT15
  652.     DW    PRT2
  653. ;
  654. ;STOP argument table
  655. ;
  656. STPTBL:    DB    '1'+80H
  657.     DB    STBIT1,0
  658.     DB    '1.','5'+80H
  659.     DB    STBI15,0
  660.     DB    '2'+80H
  661.     DB    STBIT2,0
  662.     DB    0
  663. ;
  664. ; Compare next input-stream item in table @DE; CY=1
  665. ; if not found, else HL=matched data item
  666. ;
  667. TSRCH:    MVI    C,LOOKUP    ;get function code
  668.     JMP    MEX        ;pass to mex processor
  669. ;
  670. ; Print in-line message ... blows away C register
  671. ;
  672. ILPRT:    MVI    C,ILP        ;get function code
  673.     JMP    MEX        ;go do it
  674. ;------------------------------------------------------------------------------
  675. ;
  676. ; End of Bondwell MEX modem overlay and patches
  677. ;
  678. ;------------------------------------------------------------
  679. ;
  680.     END
  681.