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 / MODEMS / MODEM7 / M7MH-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  419 lines

  1. ;
  2. ; M7MH-2.ASM -- Morrow Decision MD-11  computer            08/09/84
  3. ;        w/ SmartModem on Auxillary Port
  4. ;        overlay file for MDM7xx.
  5. ;
  6. ;-------------------------------------------------------------------------
  7. ;
  8. ; 08/09/84 - Updated, more baud rates        - George Reding
  9. ; 07/01/84 - First version of M7MH-1.ASM    - George Reding
  10. ;         Modified from M7GP-1.ASM by    - Irv Hoff
  11. ;
  12. ;-------------------------------------------------------------------------
  13. ; Updated version based on additional information obtained from the Morrow
  14. ; Corp via Xerox (local service representative). This will allow operation
  15. ; at most any baudrate - not previously implemented.   This version is for
  16. ; the Zilog SIO/9 chip (identical to  the Zilog SIO  except only channel A
  17. ; is operational).   An Intel 8253 CTC chip is used to control baud rates.
  18. ;
  19. ; Thanks to those who helped me with first version, namely creators of the
  20. ; patch named B3SIO.ASM, plus advice from David Bowerman and Gordon Regar.
  21. ;                        - G.Reding    08/09/84
  22. ;-------------------------------------------------------------------------
  23. ;
  24. ;     TO USE: First edit this file  selecting your desired options,
  25. ;        then assemble with MAC, ASM, or equivalent assembler.
  26. ;        Morrow MD-11 users then use SID or DDT to overlay the
  27. ;        results of this program to the original COM file.
  28. ;
  29. ;
  30. ;    A>SAVE                <-- type this first
  31. ;
  32. ;    A>DDT MDM7xx.COM    
  33. ;    DDT VERS 2.2
  34. ;    NEXT  PC
  35. ;    4A00 0100
  36. ;    -IM7MH-2.HEX            (note the "I" command)
  37. ;    -R                ("R" loads in the .HEX file)
  38. ;    NEXT  PC
  39. ;    4A00 0000
  40. ;    -G0                (return to CP/M)
  41. ;
  42. ;    CP/M 3 SAVE - Version 3.0
  43. ;    Enter file (type RETURN to exit): MDM7xx.COM    <-- new filename
  44. ;    Beginning hex address 0100    <-- from having used DDT or SID
  45. ;    Ending hex address    4A00    <-- you enter both of these
  46. ;
  47. ;    A>                (now have a modified .COM file)
  48. ;
  49. ;-------------------------------------------------------------------------
  50. ;
  51. ;            SIO & CTC Chip Equates
  52. ;            """"""""""""""""""""""
  53. ; Port addresses:
  54. ;
  55. BPORT:        EQU    50H        ;Aux Port divisor latch of 8253 CTC.
  56. BPORT2:        EQU    53H        ;counter timer mode control.
  57. BASEP:        EQU    70H        ;Zilog SIO/9.  Identical to Zilog SIO,
  58.                     ;except only channel A is operational
  59.                     ;   (MD-11 Aux Port uses channel A)
  60. DATPORT:    EQU    BASEP        ;data port
  61. STPORT:        EQU    BASEP+1        ;status/control port
  62. ;
  63. ; STPORT commands (output to STPORT):
  64. ;
  65. RESCHN:        EQU    00011000B    ;reset channel
  66. RESSTA:        EQU    00010000B    ;reset external status
  67. WRREG1:        EQU    00000000B    ;value to write to register 1
  68. WRREG3:        EQU    11000001B    ;8 bits/char, rx on
  69. WRREG4:        EQU    01000100B    ;16x, 1 stop, no parity
  70. DTROFF:        EQU    00000000B    ;dtr and rts off
  71. DTRON:        EQU    11101010B    ;drt on, rts on, tx on, 8 bit/char
  72. ONINS:        EQU    00110000B    ;error reset
  73. BRKON:        EQU    11111010B    ;dtr on, rts on, tx on, break on, 8 bit/char
  74. BRKOFF:        EQU    11101010B    ;dtr on, rts on, tx on, break off, 8 bit/char
  75. ;
  76. ; STPORT status masks:
  77. ;
  78. DAV:        EQU    00000001B    ;data available
  79. TRDY:        EQU    00000100B    ;transmit buffer empty
  80. DCD:        EQU    00001000B    ;data carrier detect
  81. CTS:        EQU    00100000B    ;clear to send input status
  82. ;
  83. ;-------------------------------------------------------------------------
  84. ;
  85. BELL:        EQU    07H        ;bell
  86. CR:        EQU    0DH        ;carriage return
  87. ESC:        EQU    1BH        ;escape
  88. LF:        EQU    0AH        ;linefeed
  89. ;
  90. YES:        EQU    0FFH
  91. NO:        EQU    0
  92. ;
  93. ; Change the following information to match your equipment
  94. ;
  95. MODCTL1:    EQU    STPORT        ;MODEM CONTROL PORT
  96. MODDATP:    EQU    DATPORT        ;MODEM DATA IN PORT
  97. MODDATO:    EQU    DATPORT        ;MODEM DATA OUT PORT
  98. MODDCDB:    EQU    DCD        ;CARRIER DETECT BIT
  99. MODDCDA:    EQU    0        ;VALUE WHEN ACTIVE
  100. MODCTL2:    EQU    STPORT        ;2ND MODEM CONTROL PORT
  101. MODRCVB:    EQU    DAV        ;BIT TO TEST FOR RECEIVE
  102. MODRCVR:    EQU    DAV        ;VALUE WHEN READY
  103. MODSNDB:    EQU    TRDY        ;BIT TO TEST FOR SEND
  104. MODSNDR:    EQU    TRDY        ;VALUE WHEN READY
  105. ;
  106. ;-------------------------------------------------------------------------
  107. ;
  108.         ORG    100H
  109. ;
  110. ; Change the clock speed to suit your system
  111. ;
  112.         DS    3    ;(for  "JMP   START" instruction)
  113. ;
  114. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  115. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  116. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  117. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  118.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  119. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  120.                 ;6=2400 7=4800 8=9600 9=19200 default
  121. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  122.                 ;default time to send character in ter-
  123.                 ;minal mode file transfer for slow BBS.
  124. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  125.                 ;default time for extra wait after CRLF
  126.                 ;in terminal mode file transfer
  127. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  128. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  129. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  130. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  131.                 ;no=resend a record after a valid-NAK
  132. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  133. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  134. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  135. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  136. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  137. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  138.                 ;terminal mode (added by remote echo)
  139. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  140. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  141.                 ;write logon sequence at location LOGON
  142. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  143. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  144.                 ;no=external command if EXTCHR precedes
  145. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  146. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  147. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH
  148.                 ;sending a file in terminal mode
  149. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  150.                 ;sending a file in terminal mode
  151. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  152. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  153. EXTRA1:        DB    0    ;for future expansion            11EH
  154. EXTRA2:        DB    0    ;for future expansion            11FH
  155. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  156. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  157. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  158. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  159. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  160. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  161. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  162. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  163.         DS    2        ;                128H
  164. ;
  165. IN$MODCTL1:    IN    MODCTL1 ! RET    ;in modem control port        12AH
  166.         DS    7
  167. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  168.         DS    7
  169. IN$MODDATP:    IN    MODDATP ! RET    ;in modem data port        13EH
  170.         DS    7
  171. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  172. ;
  173. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  174. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  175. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  176.         DS    6        ;                156H
  177. ;
  178. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;out modem control port #2    15AH
  179. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;out modem control port #1    15DH
  180. ;
  181. LOGONPTR:    DW    LOGON        ;for user message.        160H
  182.         DS    6        ;                162H
  183. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  184. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  185.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  186.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  187.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  188. JMP$SETUPR:    JMP    SETUPR        ;                177H
  189. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  190. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  191. JMP$BREAK:    JMP    SENDBRK        ;                180H
  192. ;
  193. ; Do not change the following six lines.
  194. ;
  195. JMP$ILPRT:    DS    3        ;                183H
  196. JMP$INBUF    DS    3        ;                186H
  197. JMP$INLNCOMP:    DS    3        ;                189H
  198. JMP$INMODEM    DS    3        ;                18CH
  199. JMP$NXTSCRN:    DS    3        ;                18FH
  200. JMP$TIMER    DS    3        ;                192H
  201. ;
  202. ;
  203. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  204. ; SCRNTEST to YES at 010AH (above).
  205. ;
  206. CLREOS:        CALL    JMP$ILPRT    ;                195H
  207.         DB    ESC,59H,0,0,0    ;                198H
  208.         RET            ;                19DH
  209. ;
  210. ;
  211. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  212.         DB    1EH,ESC,59H,0,0    ;                1A1H
  213.         RET            ;                1A6H
  214. ;
  215. ;
  216. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  217.         DB    'Version for Morrow Decision MD-11',CR,LF
  218.         DB    'with SmartModem on Auxillary Port',CR,LF
  219.         DB    0
  220.         RET
  221. ;
  222. ;-----------------------------------------------------------------------
  223. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  224. ;     END of your LAST routine should terminate by 0400H (601 bytes
  225. ;     available after start of SYSVER) if using the Hayes Smartmodem
  226. ;     or by address 0C00H (2659 bytes) otherwise.
  227. ;-----------------------------------------------------------------------
  228. ;
  229. ; Put in a message here which can be called up with CTL-O if TRANLOGON has
  230. ; been set TRUE.  You can use several lines if desired.  End with a 0.
  231. ;
  232. LOGON:        DB    'This is a Morrow Decision MD-11 computer'
  233.         DB    CR,LF
  234.         DB    0,0,0,0,0,0
  235. ;
  236. ;
  237. ;*************************************************************************
  238. ; If any of your routines zap anything other than the Accumulator, then
  239. ; you must preserve all other registers.
  240. ;*************************************************************************
  241. ;
  242. ; This will send a break tone to reset some time-share computers.
  243. ;
  244. SENDBRK:    MVI    A,5        ;setup to write reg 5
  245.         OUT    STPORT
  246.         MVI    A,BRKON        ;dtr on, rts on, tx on, break on, 8 bit/char
  247.         OUT    STPORT
  248.         MVI    B,3        ;300ms of break
  249.         CALL    JMP$TIMER
  250.         MVI    A,5        ;setup to write reg 5
  251.         OUT    STPORT
  252.         MVI    A,BRKOFF    ;dtr on, rts on, tx on, break off, 8 bit/char
  253.         OUT    STPORT
  254.         RET
  255. ;
  256. ;
  257. ; This will turn off DTR, etc causing modem to hangup.
  258. ;
  259. GOODBYE:    MVI    A,5        ;setup to write reg 5
  260.         OUT    STPORT
  261.         MVI    A,DTROFF    ;clear dtr causing hangup
  262.         OUT    STPORT
  263.         MVI    B,3        ;for 300ms
  264.         CALL    JMP$TIMER
  265.         MVI    A,5        ;setup to write reg 5
  266.         OUT    STPORT
  267.         MVI    A,DTRON        ;dtr on, rts on, tx on, 8 bit/char
  268.         OUT    STPORT        ;so we can use modem again
  269.         RET            ;return
  270. ;
  271. ;
  272. ; Setup the modem port (MD-11 Aux Port).
  273. ;
  274. INITMOD:    MVI    A,4        ;setup to write reg 4
  275.         OUT    STPORT
  276.         MVI    A,WRREG4    ;16x, 1 stop, no parity
  277.         OUT    STPORT
  278. ;
  279.         MVI    A,1        ;setup to write reg 1
  280.         OUT    STPORT
  281.         MVI    A,WRREG1    ;value to write to register 1
  282.         OUT    STPORT
  283. ;
  284.         MVI    A,3        ;setup to write reg 3
  285.         OUT    STPORT
  286.         MVI    A,WRREG3    ;initialize receive register
  287.         OUT    STPORT
  288. ;
  289.         MVI    A,5        ;setup to write reg 5
  290.         OUT    STPORT
  291.         MVI    A,DTRON        ;dtr on, 8 bit/char, tx enable, rts
  292.         OUT    STPORT        ;so we can use modem
  293. ;
  294.         IN    DATPORT        ;clean out garbage
  295.         IN    DATPORT        ;make sure its clear
  296.         JMP    SET300        ;setup default baud (300)
  297.                     ;and return
  298. ;
  299. ;
  300. ; The following set the baud rate for the modem.  If you do not support a
  301. ; particular rate, then put the label in front of the SETINV routine.  If
  302. ; the baud rate change was successful, make SURE the Zero flag is set.
  303. ;
  304. SETUPR:        LXI    D,BAUDBUF    ;point to new input buffer
  305.         CALL    JMP$ILPRT
  306.         DB    'Select baud rate '
  307.         DB    '(300, 450, 600, 710, 1200): ',0
  308.         CALL    JMP$INBUF
  309.         LXI    D,BAUDBUF+2
  310.         CALL    JMP$INLNCOMP    ;compare baudbuf+2 with below
  311.         DB    '300',0
  312.         JNC    SET300        ;if match, do it
  313.         CALL    JMP$INLNCOMP    ;else check..
  314.         DB    '450',0
  315.         JNC    SET450
  316.         CALL    JMP$INLNCOMP    ;..until we
  317.         DB    '600',0
  318.         JNC    SET600
  319.         CALL    JMP$INLNCOMP    ;..find a match
  320.         DB    '710',0
  321.         JNC    SET710
  322.         CALL    JMP$INLNCOMP    ;..and do it
  323.         DB    '1200',0
  324.         JNC    SET1200
  325.         CALL    JMP$ILPRT    ;else say no match
  326.         DB    '++ Incorrect entry ++',CR,LF,BELL,0
  327.         JMP    SETUPR        ;try again
  328. ;
  329. ;
  330. SET300:        MVI    A,1        ;value for MSPEED
  331.         STA    MSPEED        ;store it
  332. ;
  333.         MVI    A,3EH        ;Aux:=  Mode 3  (Channel 0)
  334.         OUT    BPORT2        ;counter timer mode control
  335.         LXI    H,BD300        ;baud rate value
  336.         JMP    SETBAUD        ;go finish setting
  337. ;
  338. ;
  339. SET450:        MVI    A,2
  340.         STA    MSPEED
  341.         MVI    A,3EH
  342.         OUT    BPORT2
  343.         LXI    H,BD450
  344.         JMP    SETBAUD
  345. ;
  346. ;
  347. SET600:        MVI    A,3
  348.         STA    MSPEED
  349.         MVI    A,3EH
  350.         OUT    BPORT2
  351.         LXI    H,BD600
  352.         JMP    SETBAUD
  353. ;
  354. ;
  355. SET710:        MVI    A,4
  356.         STA    MSPEED
  357.         MVI    A,3EH
  358.         OUT    BPORT2
  359.         LXI    H,BD710
  360.         JMP    SETBAUD
  361. ;
  362. ;
  363. SET1200:    MVI    A,5
  364.         STA    MSPEED
  365.         MVI    A,3EH
  366.         OUT    BPORT2
  367.         LXI    H,BD1200
  368. ;
  369. ;
  370. SETBAUD:    MOV    A,L
  371.         OUT    BPORT        ;Aux Port divisor latch LOW
  372.         MOV    A,H
  373.         OUT    BPORT        ;Aux Port divisor latch HIGH
  374.         XRA    A        ;say rate okay
  375.         RET            ;return
  376. ;
  377. ;
  378. ; The returns a 255 because we were not able to set to the proper baud rate
  379. ; because either the serial port or the modem cant handle it.
  380. ;
  381. SET110:        DS    0        ;110 baud not supported
  382. ;
  383. SETINV:        ORI    0FFH        ;make sure zero flag is not set
  384.         RET            ;return
  385. ;
  386. ;
  387. ; The following divisors for BPORT (Aux Port divisor latch) for the Morrow
  388. ; MD-11 were obtained from Morrow Corp, except the 450 and 710 bps which I
  389. ; calculated based on the others (correct?). Bauds other than 300 and 1200
  390. ; I haven't tested - no means to do so. Labels correspond with baud rates.
  391. ;                        -G.Reding    08/09/84
  392. BD110:        EQU    08E0H
  393. BD300:        EQU    0341H
  394. BD450:        EQU    022DH
  395. BD600:        EQU    01A1H
  396. BD710:        EQU    0160H
  397. BD1200:        EQU    00D0H
  398. BD2400:        EQU    0068H
  399. BD4800:        EQU    0034H
  400. BD9600:        EQU    001AH
  401. BD19200:    EQU    000DH
  402. ;
  403. ;
  404. BAUDBUF:    DB    10,0
  405.         DS    10
  406. ;
  407. ;
  408. ; If using Hayes Smartmodem following is unavailable without a special
  409. ; change.
  410. ;
  411. SPCLMENU:  RET
  412. ;
  413. ;
  414. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  415. ;                 0C00H (without Smartmodem)
  416. ;
  417.       END
  418. ;
  419.