home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / mex / mxo-ne11.aqm / MXO-NE11.ASM
Encoding:
Assembly Source File  |  1985-08-06  |  10.4 KB  |  308 lines

  1. ; MXO-NE11.ASM - NEC PC-8001A OVERLAY FILE FOR MEX10. 25 MAY 1984
  2. ;
  3. REV    EQU    11            ;overlay revision level
  4. ;
  5. ; This file adapts the NEC PC-8001A/Smartmodem 1200 to the MEX modem program.  
  6. ; You must use Chan 1 RS232 port and set the port internally for 1200 baud. 
  7. ; This overlay converts to MEX and no longer fits all features of MDMxx as
  8. ; rewritten.
  9. ;
  10. ; TO USE:  Edit this overlay file as you prefer - then assemble it.
  11. ;            ASM MXO-NE10            ;use ASM
  12. ;          Patch MEX with the resulting hex file using MLOAD.
  13. ;               MLOAD YOURNAME.COM=MEX10.COM,MXO-NE11
  14. ;          Patch YOURNAME with the Smartmodem hex file if needed.
  15. ;            MLOAD YOURNAME.COM=YOURNAME.COM,MXO-SM1x
  16. ;
  17. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  18. ;
  19. ; 05/25/84 - Converted from MDM7xx to MEX10     - David Poskie
  20. ; 11/11/83 - Renamed to M7NE-1.ASM, no changes    - Irv Hoff
  21. ; 07/27/83 - Renamed for use with MDM712    - Irv Hoff
  22. ; 07/01/83 - Revised for use with MDM711    - Irv Hoff
  23. ; 06/22/83 - Revised for use with MDM710    - Irv Hoff
  24. ; 06/22/83 - Altered for use with MDM710    - Irv Hoff
  25. ; 06/22/83 - Altered MDM708DP for the NEC 8001
  26. ;         computer using an external modem    - Irv Hoff
  27. ;
  28. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  29. ;
  30. BELL:        EQU    07H        ;bell
  31. CR:        EQU    0DH        ;carriage return
  32. ESC:        EQU    1BH        ;escape
  33. LF:        EQU    0AH        ;linefeed
  34. TAB:        EQU    09H        ;horizontal tab
  35. TPA:        EQU    100H        ;start of RAM
  36. ;
  37. YES:        EQU    0FFH
  38. NO:        EQU    0
  39. ;
  40. PORT:        EQU    0C0H        ;NEC PC-8001 serial port
  41. MODCTL1:    EQU    PORT+1        ;Modem status port
  42. MODCTL2:    EQU    PORT+1        ;Modem control port
  43. MODDATP:    EQU    PORT        ;Modem data port
  44. MODRCVB:    EQU    02H        ;Modem receive bit
  45. MODRCVR:    EQU    02H        ;Modem receive ready bit
  46. MODSNDB:    EQU    01H        ;Modem send bit
  47. MODSNDR:    EQU    01H        ;Modem send ready bit        
  48. ;
  49. ; MEX service call processor equates
  50. ;
  51. MEX        EQU    0D00H        ;MEX service call processor address
  52. INMDM        EQU    255        ;get char from port to A,
  53.                     ;CY=no more in 100ms
  54. TIMER        EQU    254        ;delay 100ms * reg B
  55. TMDINP        EQU    253        ;B=# secs to wait for char,cy=no char
  56. CHEKCC        EQU    252        ;check for ^C frm kybd,Z=present
  57. SNDRDY        EQU    251        ;test modem-send ready
  58. RCVRDY        EQU    250        ;test modem-receive ready
  59. SNDCHR        EQU    249        ;send char to modem (after SNDRDY)
  60. RCVCHR        EQU    248        ;rcv a char from modem (after RCVRDY)
  61. LOOKUP        EQU    247        ;table search (see CMDTBL comments)
  62. PARSFN        EQU    246        ;parse filename from input stream
  63. BDPARS        EQU    245        ;parse baud-rate from input stream
  64. SBLANK        EQU    244        ;scan input stream to next non-blank
  65. EVALA        EQU    243        ;evaluate numeric from input stream
  66. LKAHED        EQU    242        ;get next char w/o removing from input
  67. GNC        EQU    241        ;get char from input,cy=1 if none
  68. ILP        EQU    240        ;inline print
  69. DECOUT        EQU    239        ;decimal output
  70. PRBAUD        EQU    238        ;print baud-rate
  71. ;    
  72. CONOUT        EQU    2        ;simulated BDOS function 2:con char out
  73. PRINT        EQU     9        ;simulated BDOS function 9:print string
  74. INBUF            EQU    10        ;input buffer,same structure as BDOS 10
  75. ;
  76.         ORG    TPA    ;here we go
  77. ;
  78.         DS    3    ;(for  "JMP   START" instruction)
  79. ;
  80. PMODEM:        DB    NO    ;yes=PMMI S-100 Modem            103H
  81. SMODEM:        DB    YES    ;yes=HAYES Smartmodem            104H
  82. TPULSE:        DB    'P'    ;T=touch, P=pulse (Smartmodem-only)    105H
  83. CLOCK:        DB    40    ;clock speed in MHz *10, 25.5 MHz max.    106H
  84. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  85.                 ;6=2400 7=4800 8=9600 9=19200 default
  86. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  87.                 ;default time to send character in ter-
  88.                 ;minal mode file transfer for slow BB's
  89. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  90.                 ;default extra wait after CRLF in terminal
  91.                 ; mode file transfer for slow BB's
  92. COLUMS        DB    5    ;number of DIR columns shown        10AH
  93. SETFL:        DB    YES    ;yes=user-defined SET Command        10BH
  94. SCRTEST:    DB    YES    ;cursor control routine         10CH
  95. RETRY:          DB      YES     ;reset error count after 10 consec.errors
  96. BAKFLG:        DB    NO    ;yes=change any file same name to .BAK  10EH
  97. CRCDFL:        DB    YES    ;yes=default to CRC checking        10FH
  98. TOGCRC:        DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  99. CVTBK:        DB    NO    ;yes=convert backspace to rub        111H
  100. TOGLBK:        DB    YES    ;yes=allow toggling of bksp to rub    112H
  101. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  102.                 ;terminal mode (added by remote echo)
  103. TOGLLF:        DB    YES    ;yes=allow toggling LF after CR        114H
  104. TRNLOG:        DB    YES    ;yes=allow logon transmission         115H
  105.                 ;write logon sequence at location LOGON
  106. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  107. LOCNXT:      DB    YES    ;yes=local command if EXTCHR precedes    117H
  108.                 ;no=external command if EXTCHR precedes
  109. TOGLOC:        DB    YES    ;yes=allow toggling LOCONEXTCHR        118H
  110. LSTTST:        DB    NO    ;no=using modem on printer port            119H
  111. XOFTST:        DB    YES    ;yes=chcks for XOFF from remote    while    11AH
  112.                 ;sending a file in terminal mode
  113. XONWT:      DB    NO    ;yes=wait for XON after CR while    11BH
  114.                 ;sending a file in terminal mode
  115. TOGXOF:        DB    YES    ;yes=allow toggling of XOFF checking    11CH
  116. IGNCTL:        DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  117. EXTRA1:        DB    0    ;for future expansion            11EH
  118. EXTRA2:        DB    0    ;for future expansion            11FH
  119. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        120H
  120. NOCONN:        DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  121. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  122. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  123. UNSVCH:        DB    'R'-40H    ;^R = Close input text buffer        124H
  124. TRNCHR:        DB    'T'-40H ;^T = Transmit file to remote        125H
  125. SAVCHR:        DB    'Y'-40H    ;^Y = Open input text buffer        126H
  126. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  127. ;
  128.         DS    2       ;not used by MEX            128H
  129. ;
  130. ;low level modem I/O routines.
  131. ;
  132. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port
  133.         DS    7
  134. OUT$MODDATP:    OUT    MODDATP    ! RET    ;out modem data port
  135.         DS    7        
  136. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port
  137.          DS    7
  138. ANI$MODRCVB    ANI    MODRCVB ! RET    ;test bit for receive ready
  139. ANI$MODRCVR    CPI    MODRCVR ! RET    ;receive bit value when ready
  140. ANI$MODSNDB    ANI    MODSNDB ! RET    ;test bit for send ready
  141. ANI$MODSNDR    CPI    MODSNDR ! RET    ;send bit value when ready
  142.         DS      12
  143. ;
  144. LOGON        DS    2        ;req for MDM compat, not ref by MEX
  145. DIALV:        DS    3
  146. DISCV:        JMP    DISCON
  147. GOODBYV:    JMP    GOODBY        ;called before exit to CP/M
  148. INMODV:        JMP    NITMOD        ;cold-st user-written routine   16BH
  149. NEWBAUDV:    JMP    NEWBAUD        ;sets baud-rate 
  150.         RET    ! NOP ! NOP    ;bypasses PMMI routine
  151.         RET    ! NOP ! NOP    ;bypasses PMMI routine
  152. SETUPV:        JMP    SETCMD        ;SET command            177H
  153. SPMENV:        DS    3        ;not used with MEX        17AH
  154. VERSNV:        JMP    VERSN         ;shows overlay version in sign-on 
  155. BREAKV:        JMP    SBREAK        ;send a break            180H
  156. ;
  157. ;  NOTE: For MEX compatibility, don't use these next 6 routines.  
  158. ;  Use the MEX service call processor routines instead.
  159. ;  Do not change the following six routines.
  160. ;                                     vv REPLACE WITH: vv  
  161. ILPRTV:        DS    3        ;MEX funct 9            183H
  162. INBUFV:        DS    3        ;MEX funct 10            186H
  163. INCMPV:        DS    3        ;table lookup funct 247        189H
  164. INMDMV:        DS    3        ;MEX funct 255            18CH
  165. NXSCRV:        DS    3        ;not supported (returns NOP)    18FH
  166. TIMERV:        DS    3        ;MEX funct 254            192H
  167. ;
  168. CLREOS:        MVI    C,ILP
  169.         CALL    MEX
  170.         DB    ESC,59H,0,0,0
  171.         RET
  172. ;
  173. CLS:        MVI    C,ILP
  174.         CALL    MEX
  175.         DB      1EH,ESC,59H,0,0
  176.         RET
  177. ;
  178. ;  end of fixed area
  179. ;.....
  180. ;
  181. VERSN:        MVI    C,ILP
  182.         CALL    MEX
  183.         DB     'NEC PC-8001A <+> SMARTMODEM 1200 '
  184.         DB    REV/10+'0'
  185.         DB    '.'
  186.         DB    REV MOD 10+'0'
  187.         DB    CR,LF,0
  188.         RET
  189. ;        
  190. ;-----------------------------------------------------------------------
  191. ;
  192. ; NOTE:  You can change the VERSN message to be longer or shorter.  The
  193. ;     point is to be done with this overlay by 0B00H if using a 
  194. ;     Smartmodem or by 0D00H otherwise.
  195. ;
  196. ;=======================================================================
  197. ;
  198. ; This routine allows sending a 300 ms. break tone to reset some
  199. ; time-share computers.
  200. ;
  201. SBREAK:      MVI    A,5
  202.       OUT    MODCTL1
  203.       MVI    A,1FH        ;send a break tone 
  204.       JMP    GOODBY1
  205. ;.....
  206. ;
  207. ; This routine sets DTR low and sends a 300 ms. break tone 
  208. ; to disconnect some modems (e.g. Bell 212A)    
  209. ;
  210. DISCON:      MVI   A,5
  211.       OUT   MODCTL1        ;send break
  212.       MVI    A,15H        ;turn off DTR
  213.  
  214. GOODBY1:  OUT    MODCTL1        ;send to status port 
  215.       MVI    B,3        ;wait 300 ms
  216.       MVI   C,TIMER
  217.       CALL  MEX
  218. GOODBY:   MVI   A,5
  219.       OUT   MODCTL1
  220.       MVI    A,07H        ;normal send/receive with DTR
  221.       OUT    MODCTL1        ;send to status port
  222.       RET
  223. ;.....
  224. ;
  225. ; NEC PC-8001 initialization -- sets the 8251A for 8 bits, 1 stop pulse,
  226. ; DTR high.   Requires dip switche be set internally to 1200 baud then
  227. ; divides by 64 for 300, or by 16 for 1200 baud via "SET" command.  Set
  228. ; now to default at 1200 baud.
  229. ;
  230. NITMOD:   MVI    A,5        ;1200 baud transfer time
  231.       STA    MSPEED    
  232.       MVI    A,087H        ;insure out of mode 
  233.       OUT    MODCTL1        ;modem status port 
  234.       OUT    MODCTL1        ;slight delay
  235.       MVI    A,4EH        ;initialize USART
  236.       OUT    MODCTL1        
  237. ;
  238. NITMOD1: MVI    A,4EH        ;default - divide by 16 for 1200 baud
  239.       OUT    MODCTL1        ;modem status port
  240.       MVI    A,17H        ;DTR, RCV, XMT, ERROR reset
  241.       OUT    MODCTL1        
  242.       IN    PORT        ;clear data port
  243.       RET
  244. ;.....
  245. ;
  246. SETCMD      MVI   C,SBLANK    ;any argument?
  247.       CALL  MEX
  248.       JC    TELL        ;if not, display baud-rate
  249.       LXI   D,CMDTBL
  250.       MVI   C,LOOKUP 
  251.       CALL  MEX        ;parse argument
  252.       PUSH  H              ;save any parsed argument adr on stack
  253.       RNC                   ;if argument, return to it
  254.           POP   H        ;OOPS, argument not found in table
  255. SETERR:      MVI   C,ILP           ;inline print
  256.       CALL  MEX         ;say input not valid
  257.       DB    CR,LF,'++ Invalid SET Command ++',CR,LF,BELL,0
  258.       RET
  259. ;
  260. CMDTBL:   DB    '30','0'+80H
  261.       DW    OK300
  262.       DB    '120','0'+80H
  263.       DW    OK1200
  264.       DB    0
  265. ;
  266. TELL:      MVI    C,ILP
  267.       CALL  MEX        ;print current baud-rate
  268.           DB    CR,LF,'Baud-rate is now: ',0
  269.       LDA    MSPEED
  270.       MVI   C,PRBAUD
  271.       CALL  MEX
  272.       RET
  273. ;        
  274. OK300:      MVI    A,1        
  275.       MVI    B,4FH        ;divide by 64 for 300 baud
  276.       JMP    LOADBD        ;go load it
  277. ;
  278. OK1200:      MVI    A,5
  279.       MVI    B,4EH        ;divide by 16 for 1200 baud
  280. ;
  281. ;
  282. LOADBD:      STA    NITMOD+1    ;change time-to-send to match baud-rate
  283.       MOV    A,B        ;get baud-rate byte
  284.       STA   NITMOD1+1    ;store in NITMOD
  285.       JMP    NITMOD        ;reinitialize to new baud-rate and done
  286. ;
  287. ;
  288. BAUDBUF:  DB    10,0
  289.       DS    10
  290. ;
  291. NEWBAUD:  CPI   1
  292.       JZ    OK300
  293.       CPI   5
  294.       JZ    OK1200
  295.       RET   
  296. ;.....
  297. ;           (END OF NITMOD AND SETUP ROUTINES)
  298. ;=======================================================================
  299. ;
  300. ;
  301. ; NOTE:  ABOVE WHEN ASSEMBLED MUST TERMINATE BEFORE 0B00H WITH A 
  302. ;     SMARTMODEM & BEFORE 0D00H WITHOUT.
  303. ;
  304. ;=======================================================================
  305. ;
  306.      END
  307. ;
  308.