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 / M7LO-2.AQM / M7LO-2.ASM
Assembly Source File  |  2000-06-30  |  13KB  |  396 lines

  1.  
  2. ; M7LO-2.ASM -- Lobo Max-80 overlay file for MDM7xx.  06/01/84
  3. ;
  4. ; This overlay adapts the MDM7xx program to Max-80 computers from Lobo.
  5. ;    N O T E  -  This overlay sets the default baud rate to 1200 and
  6. ;            starts off using serial port A.  It includes code to
  7. ;            initialize the SIO so that XCONFIG need not be used.
  8. ;            It also allows you to change the serial port used
  9. ;            via the SET command. (fv)
  10. ;
  11. ; You will want to look this file over carefully.  There are a number of
  12. ; options that you can use to configure the program to suit your taste.
  13. ; This file places particular emphasis on using an external modem that
  14. ; does not match one of the other special overlays.
  15. ;
  16. ; Edit this file for your preferences then follow the "TO USE:" example
  17. ; shown below.
  18. ;
  19. ;    TO USE: First edit this file filling in answers for your own
  20. ;        equipment.  Then assemble with ASM.COM or equivalent
  21. ;        assembler.  Then use DDT to overlay the the results
  22. ;        of this program to the original .COM file:
  23. ;
  24. ;        A>DDT MDM7xx.COM
  25. ;        DDT VERS 2.2
  26. ;        NEXT  PC
  27. ;        4x00 0100
  28. ;        -IM7LO-2.HEX        (note the "I" command)
  29. ;        -R            ("R" loads in the .HEX file)
  30. ;        NEXT  PC
  31. ;        4x00 0000
  32. ;        -G0            (return to CP/M)
  33. ;        A>SAVE 73 MDM7xx.COM    (now have a modified .COM file)
  34. ;            ^
  35. ;            This Value may vary depending upon vers of MDM7xx
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. ; 06/01/84 - Cleaned up vers. nr. and Save      - Dennis Recla
  40. ; 12/20/83 - Revised set baud routine & set default
  41. ;         1200 Baud. Also adds init coding    - Fred Viles
  42. ; 11/11/83 - Renamed to M7LO-1.ASM, no changes    - Irv Hoff
  43. ; 10/07/83 - Revised to include modem break    - Steven J. Davidson
  44. ; 08/22/83 - Revised to work with Max-80    - Larry Richards
  45. ; 07/27/83 - Revised to work with MDM712    - Irv Hoff
  46. ; 04/04/83 - 1st version of M712GP        - Irv Hoff
  47. ;
  48. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  49. ;
  50. BELL:        EQU    07H        ;bell
  51. CR:        EQU    0DH        ;carriage return
  52. ESC:        EQU    1BH        ;escape
  53. LF:        EQU    0AH        ;linefeed
  54. ;
  55. YES:        EQU    0FFH
  56. NO:        EQU    0
  57. ;
  58. ;
  59. ; Change the following information to match your equipment
  60. ;    For port B use 0F7E6 (PORT) and 0F7D4 (BAUDRP).
  61. ;
  62. ;    For port A use:
  63. ;
  64. PORT:        EQU    0F7E4H        ;MAX-80 data port
  65. MODCTL1:    EQU    PORT+1        ;modem control port MAX-80
  66. MODDATP:    EQU    PORT        ;modem data in port
  67. MODDATO:    EQU    PORT        ;modem data out port
  68. MODDCDB:    EQU    4        ;carrier detect bit
  69. MODDCDA:    EQU    0        ;value when active
  70. BAUDRP:        EQU    0F7D0H        ;baud rate port MAX-80
  71. MODCTL2:    EQU    PORT+1        ;2nd modem control port
  72. MODRCVB:    EQU    1        ;bit to test for receive
  73. MODRCVR:    EQU    1        ;value when ready
  74. MODSNDB:    EQU    4        ;bit to test for send
  75. MODSNDR:    EQU    4        ;value when ready
  76. ;
  77.         ORG    100H
  78. ;
  79. ;
  80. ; Change the clock speed to suit your system
  81. ;
  82.         DS    3    ;(for  "JMP   START" instruction)
  83. ;
  84. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  85. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  86. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  87. CLOCK:        DB    50    ;clock speed in MHz x10, 25.5 MHz max.    106H
  88.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  89. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  90.                 ;6=2400 7=4800 8=9600 9=19200 default
  91. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  92.                 ;default time to send character in ter-
  93.                 ;minal mode file transfer for slow BBS.
  94. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  95.                 ;default time for extra wait after CRLF
  96.                 ;in terminal mode file transfer
  97. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  98. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  99. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  100. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  101.                 ;no=resend a record after a valid-NAK
  102. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  103. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  104. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  105. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  106. TOGGLEBK:    DB    NO    ;yes=allow toggling of bksp to rub    112H
  107. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  108.                 ;terminal mode (added by remote echo)
  109. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  110. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  111.                 ;write logon sequence at location LOGON
  112. SAVCCP:        DB    NO    ;yes=do not overwrite CCP        116H
  113. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  114.                 ;no=external command if EXTCHR precedes
  115. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  116. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  117. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  118.                 ;sending a file in terminal mode
  119. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  120.                 ;sending a file in terminal mode
  121. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  122. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  123. EXTRA1:        DB    0    ;for future expansion            11EH
  124. EXTRA2:        DB    0    ;for future expansion            11FH
  125. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  126. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  127. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  128. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  129. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  130. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  131. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  132. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  133. ;
  134. ;
  135.         DS    2        ;                128H
  136. ;
  137. IN$MODCTL1:    LDA    MODCTL1 ! RET    ;in modem control port MAX-80    12AH
  138.         DS    6
  139. OUT$MODDATP:    STA    MODDATP ! RET    ;out modem data port MAX-80    134H
  140.         DS    6
  141. IN$MODDATP:    LDA    MODDATP ! RET    ;in modem data port MAX-80    13EH
  142.         DS    6
  143. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  144.  
  145. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  146. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  147. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  148.         DS    6        ;                156H
  149. ;                The following are only used for PMMI
  150. ;                routines in MDM7xx, but OUT$MODCTL1 is
  151. ;                called from this overlay
  152. OUT$MODCTL1:    STA    MODCTL1        ;out modem control port #1    15AH
  153. OUT$MODCTL2:    RET  !    NOP    ! NOP    ;out modem control port #2    15DH
  154. ;
  155. LOGONPTR:    DW    LOGON        ;for user message.        160H
  156.         DS    6        ;                162H
  157. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  158. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  159.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  160.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  161.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  162. JMP$SETUPR:    JMP    SETUPR        ;                177H
  163. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  164. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  165. JMP$BREAK:    JMP    SENDBRK        ;                180H
  166. ;
  167. ;
  168. ; Do not change the following six lines.
  169. ;
  170. JMP$ILPRT:    DS    3        ;                183H
  171. JMP$INBUF    DS    3        ;                186H
  172. JMP$INLNCOMP:    DS    3        ;                189H
  173. JMP$INMODEM    DS    3        ;                18CH
  174. JMP$NXTSCRN:    DS    3        ;                18FH
  175. JMP$TIMER    DS    3        ;                192H
  176. ;
  177. ;
  178. ; Routine to clear to end of screen.
  179. ;
  180. ;
  181. CLREOS:        CALL    JMP$ILPRT    ;                195H
  182.         DB    1BH,59H,0,0,0    ;                198H
  183.         RET            ;                19DH
  184. ;
  185. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  186.         DB    1BH,2AH,0,0,0    ;                1A1H
  187.         RET            ;                1A6H
  188.     
  189. ;
  190. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  191.         DB    'Version for Lobo Max-80, defaults to Serial '
  192.         DB    'port A at 1200 Baud',CR,LF,0
  193.         RET
  194. ;.....
  195. ;
  196. ;
  197. ;-----------------------------------------------------------------------
  198. ;
  199. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  200. ;     end of your last routine should terminate by 0400H (601 bytes
  201. ;     available after start of SYSVER) if using the Hayes Smartmodem
  202. ;     or by address 0C00H (2659 bytes) otherwise.
  203. ;
  204. ;-----------------------------------------------------------------------
  205. ;
  206. ; You can put in a message at this location which can be called up with
  207. ; CTL-O if TRANLOGON has been set TRUE.  You can use several lines if
  208. ; desired.  End with a 0.
  209. ;
  210. LOGON:      DB    'Hello from a Lobo MAX-80 computer',CR,LF,0
  211. ;.....
  212. ;
  213. ;
  214. ; This routine allows a 300 ms. break tone to be sent to reset some
  215. ; time-share computers.
  216. ;
  217. SENDBRK:  MVI    A,5
  218.       CALL    OUT$MODCTL1
  219.       MVI    A,0F8H        ;send a break tone
  220.       JMP    GOODBYE1
  221. ;.....
  222. ;
  223. ;
  224. ; This routine sends a 300 ms. break tone and/or sets DTR low for the
  225. ; same length of time to disconnect some modems such as the Bell 212A,
  226. ; etc.    The second entry (GOODBYE1) just sends the modem break, needed
  227. ; to "alert" some timesharing services.
  228. ;
  229. ;
  230. GOODBYE:  MVI    A,5
  231.       CALL    OUT$MODCTL1    ;send to the status port
  232.       MVI    A,68H        ;turn off dtr
  233. ;
  234. GOODBYE1: CALL    OUT$MODCTL1
  235.       MVI    B,3        ;wait for 300 ms.
  236.       CALL    JMP$TIMER
  237.       MVI    A,5
  238.       CALL    OUT$MODCTL1
  239.       MVI    A,0E8H        ;restore to normal, 8 bits, dtr on, etc.
  240.       CALL    OUT$MODCTL1
  241.       RET
  242. ;.......
  243. ;
  244. ;
  245. ; --- Initialize Serial Port hardware and establish default baud rate.
  246. ;
  247. INITMOD:
  248. ;                    Set the default baud rate
  249.     CALL    SETDEFB
  250. ;                    Initialize the SIO
  251. REINIT:
  252.     MVI    A,01
  253.     CALL    OUT$MODCTL1    ; SELECT REGISTER
  254.     MVI    A,0    ; SET TO DISABLE INTERRUPTS ON THIS CHANNEL
  255.     CALL    OUT$MODCTL1
  256.     MVI    A,04H
  257.     CALL    OUT$MODCTL1    ; SELECT REGISTER
  258.     MVI    A,044H    ; 16X CLOCK, 1 STOP BIT, NO PARITY
  259.     CALL    OUT$MODCTL1
  260.     MVI    A,03
  261.     CALL    OUT$MODCTL1    ; SELECT REGISTER
  262.     MVI    A,0C1H    ; 8 BITS/CHAR., RX ENABLE, AUTO DISABLE
  263.     CALL    OUT$MODCTL1
  264.     MVI    A,05
  265.     CALL    OUT$MODCTL1    ; SELECT REGISTER
  266.     MVI    A,0EAH    ; DTR, 8 BITS/CHAR., TX ENABLE, RTS
  267.     JMP    OUT$MODCTL1
  268. ;
  269. ;.....
  270. ;
  271. ; --- Set modem speed via the SET command.---
  272. ;    First get the desired baud rate from the user.
  273. ;     NOTE: only the first 3 characters of the
  274. ;          baud rate string entered by the user
  275. ;          is used.
  276. ;
  277. SETUPR:
  278.     LXI    D,BAUDBUF    ;POINT TO NEW INPUT BUFFER
  279.     CALL    JMP$ILPRT
  280.     DB    'Input Baud Rate (300, 1200, 9600, etc - space for 1200)',CR,LF
  281.     DB    '   or Port (A or B) or both (A300, B19200, etc): ',0
  282.     CALL    JMP$INBUF
  283.     LXI    H,BAUDBUF+2    ; Point to users entry
  284.     MOV    A,M        ; Get first character
  285.     CPI    20h        ; Space?
  286.     JZ    SETDEFB        ; Yes, go set default baud rate
  287.     STA    APORT        ; Store character in msg just in case
  288.     SUI    '0'
  289.     CPI    10        ; Digit?
  290.     JC    FINDBD        ; Yes, go find baud rate in table
  291.     SUI    17
  292.     CPI    2        ; 'A' or 'B'?
  293.     JNC    SETERR        ; No, invalid entry
  294. ;
  295. ;            Reset the Serial port in use
  296. ;
  297.     RLC            ; 'A' = 0, 'B' = 2
  298.     PUSH    PSW        ; Save it
  299.     ADI    0E4h        ; Data port address low byte
  300.     STA    IN$MODDATP+1
  301.     STA    OUT$MODDATP+1
  302.     INR    A        ; Control Port address low byte
  303.     STA    IN$MODCTL1+1
  304.     STA    OUT$MODCTL1+1
  305.     POP    PSW        ; Restore 0 or 2
  306.     RLC            ; Make 0 or 4
  307.     ADI    0D0h        ; Baud rate port address low byte
  308.     STA    BDOUT+1
  309.     CALL    REINIT        ; Re-do initialization for new port
  310.     CALL    JMP$ILPRT
  311.     DB    CR,LF,'Serial port '
  312. APORT:    DS    1
  313.     DB    ' is now in use.',CR,LF,0
  314. ;
  315.     LXI    H,BAUDBUF+3    ; Point to next byte in user entry
  316.     MOV    A,M        ; Get it
  317.     SUI    '0'
  318.     CPI    10        ; Digit?
  319.     RNC            ; No, We are all done
  320. ;                  Yes, fall thru to set the baud rate
  321. FINDBD: SHLD    PTR        ; Save ptr to user entry
  322.     LXI    D,BDTAB    ; Point to baud rate table
  323.     MVI    B,NTAB    ; Get # of entries to search thru
  324. ;                TOP OF LOOP - scanning baud rate table
  325. SLOOP:    LHLD    PTR    ; Get ptr to users entry
  326.     PUSH    D    ; Save the table pointer
  327. ;
  328.     MVI    C,3    ; Compare 3 characters of string
  329. SLOOP1:    LDAX    D    ; Get next character from table entry
  330.     CMP    M    ; Match user string?
  331.     JNZ    X1    ; No, so try next table entry
  332.     INX    H    ; Yes, so check next character if any
  333.     INX    D
  334.     DCR    C    ;
  335.     JNZ    SLOOP1    ; Loop to test all 3 characters
  336. ;
  337. X1:    POP    H    ; Restore pointer to current table entry
  338.     JZ    SETUP    ; If match, set baud rate and return
  339.     LXI    D,BWDS+4
  340.     DAD    D    ; Point to the next table entry
  341.     XCHG
  342.     DCR    B    ; Count down # of table entries
  343.     JNZ    SLOOP    ; Loop to test next entry if any
  344. ;
  345. SETERR:    CALL    JMP$ILPRT  ; No match found in table, tell operator
  346.     DB    '++ Incorrect entry ++',CR,LF,BELL,0
  347.     JMP    SETUPR    ; Give user another try
  348. ;
  349. ;        Set up the baud rate. HL points to the command string
  350. ;
  351. SETDEFB:        ;    This entry sets the baud rate to the default
  352.     LXI    D,DEFBD+3
  353. ;
  354. SETUP:    LDAX    D    ; Get new MSPEED value
  355.     STA    MSPEED    ; Store it
  356. ;                Loop sending baud rate control bytes
  357.     MVI    C,BWDS    ; Init loop counter
  358. SULOOP:    INX    D    ; Increment control string pointer
  359.     LDAX    D    ; Get next control byte
  360. BDOUT:    STA    BAUDRP    ; Send it to the baud rate port
  361.     DCR    C    ; Decrement the loop conter
  362.     JNZ    SULOOP    ; Loop til done
  363.     RET
  364. ;
  365. ; --- BAUDRATE TABLE FOR CCS 2719 BAUD RATE GENERATOR ---
  366. ;
  367. BWDS    EQU    1    ; # OF BYTES TO SEND TO BAUD RATE CHIP
  368. BDTAB:
  369.     DB    '110',0,2
  370.     DB    '300',1,5
  371.     DB    '600',3,6
  372. DEFBD:    DB    '120',5,7    ; 1200 BAUD (default)
  373.     DB    '240',6,0Ah    ; 2400
  374.     DB    '480',7,0Ch    ; 4800
  375.     DB    '960',8,0Eh    ; 9600
  376.     DB    '192',9,0Fh    ; 19200
  377. ;
  378. ENTAB    EQU    $
  379. ;
  380. NTAB    EQU    (ENTAB-BDTAB)/(BWDS+4)    ; # OF TABLE ENTRYS
  381. ;
  382. PTR:    DS    2
  383. ;
  384. BAUDBUF:  DB    10,0
  385.       DS    10
  386. ;.....
  387. ;
  388. ;
  389. ; If using the Hayes Smartmodem this is unavailable without a special
  390. ; change.
  391. ;
  392. SPCLMENU:  RET
  393. ;
  394. ;
  395. ; NOTE:  Must terminate prior to 0400H (with Smartmodem)
  396. ;