home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols100 / vol170 / m7ac-1.asm < prev    next >
Encoding:
Assembly Source File  |  1994-07-13  |  13.8 KB  |  518 lines

  1.  
  2. ; M7AC-1.ASM -- APPLE-CAT II overlay file for MDM7xx.  11/11/83
  3. ;
  4. ; You will want to look this file over carefully.  There are a number of
  5. ; options that you can use to configure the program to suit your taste.
  6. ; Much of the information contained here is not in the main file.
  7. ;
  8. ; Edit this file for your preferences then follow the "TO USE:" EXAMPLE
  9. ; shown below.
  10. ;
  11. ;
  12. ; SPECIAL NOTES FOR THE APPLE CAT II VERSION:
  13. ; ------------------------------------------
  14. ;
  15. ;      The distribution version of this file is configured for an Apple-
  16. ;   Cat II in slot 2.  If you are runing your modem in a different slot,
  17. ;   you need merely change the 'CATSLOT' equate before assembling.  (A
  18. ;   side note, if you are experiencing thermal problems with your Apple
  19. ;   try moving the Apple-Cat board away from the 80-column card.)
  20. ;
  21. ;      This overlay supports the Apple-Cat II at 300 and 1200 baud, as-
  22. ;   suming you have the 212A option board).  With this board, you must
  23. ;   use the 'slot saver' configuration.  The 'SET' command has been im-
  24. ;   plemented to allow the user to set either baud rate, and well as
  25. ;   'answer' or 'originate' mode.  It also allows the user to change
  26. ;   modem baud rate on the fly, if desired.  The 'TIM' function is set
  27. ;   automatically.
  28. ;
  29. ;      A 'quick INIT' feature has been added.  The command from the CP/M
  30. ;   level is either A>MDM 3 (300 baud) or A>MDM 2 (1200 baud).    These
  31. ;   commands will cause automatic initialization of the modem at 300 or
  32. ;   1200 baud respectively (originate mode only).  The program then falls
  33. ;   directly into the terminal mode.  Just calling up the program with:
  34. ;   A>MDM will result in the program not being initialized, so the user
  35. ;   will then need to use the 'SET' command to initialize for 300 or for
  36. ;   1200 baud.
  37. ;
  38. ; IMPORTANT NOTE REGARDING THE PRINTER BUFFER FUNCTION:
  39. ;
  40. ;     As distributed, this overlay has the printer buffer function dis-
  41. ;   abled.  This is because the Apple (Microsoft) BIOS does not support
  42. ;   the LISTST function (BIOS 14).   Thus it returns with "Printer busy"
  43. ;   status. Printer handshaking is not important if you have plenty of
  44. ;   buffering.    Some printers have 64k, although most only have 2-4k.
  45. ;   It is also of no importance, if the throughput of your printer is
  46. ;   higher than the speed of the incoming information.    For example when
  47. ;   using 300 baud (30 characters per second), nearly all printers are
  48. ;   capable of printing at this relatively slow speed.    However at 1200
  49. ;   baud, very few printers in the under-$1000 class are capable of 120
  50. ;   character/second throughput.  In this case a modest-sized buffer
  51. ;   might fill before you finished copying the information you wished to
  52. ;   print.  It would probably start to lose characters as a result.  A
  53. ;   special routine in the initialization code has been added so that
  54. ;   BIOS 14 always returns "Printer ready".  This special patch is used
  55. ;   only if the printer option LSTTST in this overlay is set to YES.  Be
  56. ;   careful about using this option if you do not have a large printer
  57. ;   buffer and frequently run at 1200 baud.
  58. ;
  59. ;    TO USE:    First edit this file filling in answers for your own
  60. ;        equipment.  Then assemble with ASM.COM or equivalent
  61. ;        assembler.  Then use DDT to overlay the results of
  62. ;        this program to the original  .COM file:
  63. ;
  64. ;        A>DDT MDM7xx.COM
  65. ;        DDT VERS 2.2
  66. ;        NEXT  PC
  67. ;        4300 0100
  68. ;        -IM7AC-1.HEX        (note the "I" command)
  69. ;        -R            ("R" load in the  .HEX file)
  70. ;        NEXT  PC
  71. ;        4300 0000
  72. ;        -G0            (return to CP/M)
  73. ;        A>SAVE 66 MDM7xx.COM    (now have a modified .COM file)
  74. ;
  75. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  76. ;
  77. ; 11/11/83 - Renamed to M7AC-1.ASM, no changes    - Irv Hoff
  78. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  79. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  80. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  81. ; 06/07/83 - Converted GP file for APPLECAT    - Chris Hays
  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. ;
  94. ; CHANGE THE FOLLOWING INFORMATION TO MATCH YOUR EQUIPMENT
  95. ;
  96. MODCTL1:    EQU    0        ;DUMMY MODEM CONTROL PORT
  97. MODCTL2:    EQU    0        ;DUMMY MODEM CONTROL PORT
  98. ;
  99. CATSLOT        EQU    2        ;SET FOR SLOT OF APPLE CAT
  100. ;
  101. SLOT        EQU    CATSLOT*16
  102. COM        EQU    0E08CH+SLOT
  103. XMTBYT        EQU    0E08DH+SLOT
  104. CON        EQU    0E08AH+SLOT
  105. BSRBYT        EQU    0E083H+SLOT
  106. SHBYT        EQU    0E082H+SLOT
  107. TONBYT        EQU    0E081H+SLOT
  108. SQUBYT        EQU    0E081H+SLOT
  109. SWBYT        EQU    0E080H+SLOT
  110. RECBYT        EQU    0E089H+SLOT
  111. INDAT        EQU    0E08BH+SLOT
  112. OUTDAT        EQU    0E08EH+SLOT
  113. SPDBYT        EQU    0E08BH+SLOT
  114. STATUS        EQU    0E08FH+SLOT
  115. ACBYT        EQU    0E08DH+SLOT
  116. DEVBYT        EQU    0E08FH+SLOT
  117. XMTRAM        EQU    0F01BH        ;TO CLEAR STATUS
  118. ;
  119. MODDCD3        EQU    0
  120. MODDCD12    EQU    0        ;FOR 212 BOARD
  121. MODRCVB:    EQU    2        ;BIT TO TEST FOR RECEIVE
  122. MODRCVR:    EQU    2        ;VALUE WHEN READY
  123. MODSNDB:    EQU    1        ;BIT TO TEST FOR SEND
  124. MODSNDR:    EQU    1        ;VALUE WHEN READY
  125. ;
  126.         ORG    100H
  127. ;
  128. ;
  129. ; CHANGE THE CLOCK SPEED TO SUIT YOUR SYSTEM
  130. ;
  131.         DS    3    ;(For "JMP   START" instruction)
  132. ;
  133. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  134. SMARTMODEM:    DB    NO    ;yes=HAYES Smartmodem            104H
  135. TONEPULSE:    DB    'T'    ;T=tone, P=pulse (Smartmodem-only)    105H
  136. CLOCK:        DB    20    ;clock speed in MHz x10, 25.5 MHz max.    106H
  137.                 ;20=2 MHz, 37=3.68 MHz, 40=4 MHz, etc.
  138.  
  139. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  140.                 ;6=2400 7=4800 8=9600 9=19200 default
  141. BYTDLY:        DB    5    ;0=0 delay  1=10 ms 5=50 ms - 9=90 ms    108H
  142.                 ;default time to send character in ter-
  143.                 ;minal mode file transfer for slow BBS.
  144. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  145.                 ;default time for extra wait after CRLF
  146.                 ;in terminal mode file transfer
  147. NOOFCOL:    DB    5    ;number of directory columns shown    10AH
  148. SETUPTST:    DB    YES    ;yes=user-added setup routine        10BH
  149. SCRNTEST:    DB    NO    ;cursor control routine            10CH
  150. ACKNAK:        DB    YES    ;yes=resend a record after a non-ACK    10DH
  151.                 ;no=resend a record only after NAK
  152. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  153. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  154. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to checksum    110H
  155. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  156. TOGGLEBK:    DB    NO    ;yes=allow toggling of BKSP to RUB    112H
  157. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  158.                 ;termianl mode (added by remote echo)
  159. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  160. TRANLOGON:    DB    YES    ;yes=allow transmission of LOGON    115H
  161.                 ;write logon sequence at location LOGON
  162. NOCCP:        DB    NO    ;MUST BE NO FOR APPLE CP/M 2.23        116H
  163. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  164.                 ;no=external command if EXTCHR precedes    
  165. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  166. LSTTST:        DB    NO    ;yes=printer available on printer port    119H
  167.                 ;(See special printer note above)
  168. XOFFTST:    DB    NO    ;yes=checks for X-OFF from remote while    11AH
  169.                 ;sending a file in terminal mode
  170. XONWAIT:    DB    NO    ;yes=wait for X-ON after CR while    11BH
  171.                 ;sending a file in terminal mode
  172. TOGXOFF:    DB    YES    ;yes=allow toggling of X-OFF checking    11CH
  173. IGNORCTL:    DB    YES    ;yes=CTL-chars. above ^M not displayed    11DH
  174. EXTRA1:        DB    0    ;for future expansion            11EH
  175. EXTRA2:        DB    0    ;for future expansion            11FH
  176. BRKCHR:        DB    '@'-40H    ;^@ = send a 300 ms. break tone        120H
  177. NOCONNCT    DB    'N'-40H    ;^N = disonnect from phone line        121H
  178. LOGCHR:        DB    'L'-40H    ;^L = send LOGON            122H
  179. LSTCHR:        DB    'P'-40H    ;^P = toggle printer            123H
  180. UNSAVE:        DB    'R'-40H    ;^R = close input text buffer        124H
  181. TRANCHR:    DB    'T'-40H ;^T = transmit file to remote        125H
  182. SAVECHR:    DB    'Y'-40H    ;^Y = open input text buffer        126H
  183. EXTCHR:        DB    '^'-40H    ;^^ = send next character to modem    127H
  184. ;
  185. ;
  186.         DS    2        ;                128H
  187. ;    
  188. IN$MODCTL1:    LDA    STATUS    ! RET    ;IN MODEM CONTROL PORT        12AH
  189.         DS    6
  190. OUT$MODDATP:    STA    OUTDAT    ! RET    ;OUT MODEM DATA PORT        134H
  191.         DS    6
  192. IN$MODDATP:    LDA    XMTRAM        ;                13EH
  193.         STA    XMTBYT
  194.         LDA    INDAT
  195.         RET
  196. ANI$MODRCVB:    ANI    00001000B ! RET    ;BIT TO TEST FOR RECEIVE READY    148H
  197.  
  198. CPI$MODRCVR:    CPI    00001000B ! RET    ;VALUE OF RCV BIT WHEN READY    14BH
  199. ANI$MODSNDB:    ANI    00010000B ! RET    ;BIT TO TEST FOR SEND READY    14EH
  200. CPI$MODSNDR:    CPI    00010000B ! RET    ;VALUE OF SEND BIT WHEN READY    151H
  201.         DS    6        ;                154H
  202. ;
  203. OUT$MODCTL1:    OUT    MODCTL1    ! RET    ;OUT MODEM CONTROL PORT #2    15AH
  204. OUT$MODCTL2:    OUT    MODCTL2    ! RET    ;OUT MODEM CONTROL PORT #1    15DH
  205. ;
  206. LOGONPTR:    DW    LOGON        ;FOR USER MESSAGE.        160H
  207.         DS    6        ;                162H
  208. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  209. JMP$INITMOD:    JMP    INITMOD        ;GO TO USER WRITTEN ROUTINE    16BH
  210.         RET  !    NOP  !    NOP    ;(BY-PASSES PMMI ROUTINE)    16EH
  211.         RET  !    NOP  !    NOP    ;(BY-PASSES PMMI ROUTINE)    171H
  212.         RET  !    NOP  !    NOP    ;(BY-PASSES PMMI ROUTINE)    174H
  213. JMP$SETUPR:    JMP    SETUPR        ;                177H
  214. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  215. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  216. JMP$BREAK:    JMP    SENDBRK        ;                180H
  217. ;
  218. ;
  219. ; DO NOT CHANGE THE FOLLOWING SIX LINES.
  220. ;
  221. JMP$ILPRT:    DS    3        ;                183H
  222. JMP$INBUF    DS    3        ;                186H
  223. JMP$INLNCOMP:    DS    3        ;                189H
  224. JMP$INMODEM    DS    3        ;                18CH
  225. JMP$NXTSCRN:    DS    3        ;                18FH
  226. JMP$TIMER:    DS    3        ;                192H
  227. ;
  228. ;
  229. ; ROUTINE TO CLEAR TO END OF SCREEN.  IF USING CLREOS AND CLRSCRN, SET
  230. ; SCRNTEST TO YES AT 010AH (ABOVE).
  231. ;
  232. CLREOS:        CALL    JMP$ILPRT    ;                195H
  233.         DB    0,0,0,0,0    ;                198H
  234.         RET            ;                19DH
  235. ;
  236. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  237.         DB    0,0,0,0,0    ;                1A1H
  238.         RET            ;                1A6H
  239.     
  240. ;
  241. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  242.         DB    'Version for APPLE-CAT II modem'    
  243.         DB    CR,LF,0
  244.         RET
  245. ;.....
  246. ;
  247. ;
  248. ;-----------------------------------------------------------------------
  249. ;
  250. ; NOTE:  You can change the SYSVER message ta be longer or shorter.  The
  251. ;    end of your last routine should terminate by 0400H (601 bytes
  252. ;    available after start of SYSVER) if using the Hayes Smartmodem
  253. ;    or by address 0C00H (2659 bytes) otherwise.
  254. ;
  255. ;-----------------------------------------------------------------------
  256. ;
  257. ; You can put in a message at this location which can be called up with
  258. ; CTL-O if TRANLOGON has been set YES.    You can use several lines if
  259. ; desired.  End with a 0.
  260. ;
  261. LOGON:      DB    'HOW ARE YOU TODAY?',CR,LF,0
  262. ;.....
  263. ;
  264. ;
  265. ; You can add a routine here to send a 300 ms. break tone to reset some
  266. ; time-share computers.  (See examples in other overlays, such as the
  267. ; MDM710DP for Datapoint computers.
  268. ;
  269. SENDBRK:  RET
  270. ;.....
  271. ;
  272. ;
  273. GOODBYE:  MVI    A,0
  274.       STA    SHBYT
  275.       MVI    A,1FH
  276.       STA    XMTBYT
  277.       STA    XMTRAM
  278.       MVI    A,0A1H
  279.       STA    SQUBYT
  280.       RET
  281. ;.....
  282. ;
  283. ;
  284. ;
  285. INITMOD:
  286. ;
  287. ; This routine patches the printer test in the Apple so that is always
  288. ; returns "printer ready".  (See notes at the beginning about using this
  289. ; routine.)
  290. ;
  291. INITMOD:  LDA    LSTTST        ;CHECK IF PRINT FUNCTION ENABLED
  292.       CPI    0
  293.       JZ    FIRSTIN        ;DON'T PATCH BIOS IF WE AREN'T PRINTING
  294.       LHLD    0001
  295.       MOV    A,L
  296.       ADI    02AH
  297.       MOV    L,A
  298.       MVI    A,03EH
  299.       MOV    M,A
  300.       INR    L
  301.       MVI    A,0FFH
  302.       MOV    M,A
  303.       INR    L
  304.       MVI    A,0C9H
  305.       MOV    M,A
  306. ;
  307. ;
  308. ;Now begins the actual modem initialization
  309. ;
  310. FIRSTIN:  LDA    80H        ;CHECK FOR BAUD CODE
  311.       CPI    0
  312.       JZ    NOINMSG        ;DON'T INITIALIZE IF NOTHING THERE
  313.       LDA    5DH        ;GET FIRST CHARACTER OF OBJECT
  314.       ANI    0FH
  315.       CPI    3        ;ASCII 3 FOR 300 BAUD
  316.       JNZ    CK2
  317.       CALL    INIT3
  318.       JMP    ORIG103
  319. ;.....
  320. ;
  321. ;
  322. CK2:      CPI    2H        ;ASCII 2 FOR 1200 BAUD
  323.       JNZ    NOINMSG
  324.       CALL    INIT2
  325.       JMP    ORIG212
  326. ;.....
  327. ;
  328. ;
  329. NOINMSG:  CALL    JMP$ILPRT
  330.       DB    ESC,'(','NOT INITIALIZED',ESC,')',CR,LF,0
  331.       RET
  332. ;.....
  333. ;
  334. ;
  335. INIT3:      CALL    PICKUP        ;PICKUP PHONE
  336.       MVI    A,0A1H
  337.       STA    RECBYT
  338.       MVI    A,00000011B    ;8 DATA NO PARITY 1 STOP
  339.       STA    CON
  340.       MVI    A,22H
  341.       STA    SPDBYT
  342.       MVI    A,1
  343.       STA    MSPEED
  344.       RET
  345. ;.....
  346. ;
  347. ;
  348. ORIG103:
  349.       MVI    A,11H        ;103 ORIG, NO RING IRQ
  350.       STA    XMTBYT
  351.       STA    XMTRAM
  352.       MVI    A,65H
  353.       STA    RECBYT
  354.       RET
  355. ;.....
  356. ;
  357. ;
  358. ANS103:      MVI    A,10H
  359.       STA    XMTBYT
  360.       STA    XMTRAM
  361.       MVI    A,64H
  362.       STA    RECBYT
  363.       RET
  364. ;.....
  365. ;
  366. ;
  367. INIT2:      CALL    PICKUP
  368.       MVI    A,0
  369.       STA    SPDBYT        ;1200 BAUD
  370.       MVI    A,18H
  371.       STA    XMTBYT
  372.       STA    XMTRAM
  373.       MVI    A,0AH
  374.       STA    DEVBYT
  375.       MVI    A,13H
  376.       STA    CON
  377.       MVI    A,05H
  378.       STA    COM
  379.       STA    MSPEED
  380.       RET
  381. ;.....
  382. ;
  383. ;
  384. ORIG212:  MVI    A,0A1H
  385.       STA    SQUBYT
  386.       CALL    DELAY5
  387.       MVI    A,21H
  388.       STA    SQUBYT
  389.       RET
  390. ;.....
  391. ;
  392. ;
  393. ANS212:      MVI    A,81H
  394.       STA    SQUBYT
  395.       CALL    DELAY5
  396.       MVI    A,01
  397.       STA    SQUBYT
  398.       RET
  399. ;.....
  400. ;
  401. ;
  402. SETORIG:  LDA    MSPEED
  403.       CPI    1
  404.       JZ    ORIG103
  405.       JMP    ORIG212        ;SELECT 212 OR 103
  406. ;.....
  407. ;
  408. ;
  409. SETANS:   LDA    MSPEED
  410.       CPI    1
  411.       JZ    ANS103
  412.       JMP    ANS212
  413. ;.....
  414. ;
  415. ;
  416. PICKUP:      MVI    A,0A1H
  417.       STA    SQUBYT
  418.       MVI    A,'T'
  419.       STA    5DH        ;FORCE TERMINAL MODE AFTER INIT
  420.       MVI    A,2
  421.       STA    SHBYT
  422.       MVI    A,0FH
  423.       STA    BSRBYT
  424.       MVI    A,13H
  425.       STA    CON
  426.       MVI    A,05H
  427.       STA    COM
  428.       MVI    A,0
  429.       STA    DEVBYT
  430.       RET
  431. ;.....
  432. ;
  433. ;
  434. SETUPR1:  CALL    JMP$ILPRT
  435.       DB    'ENTER ''O'' FOR Originate, ''A'' FOR Answer '
  436.       DB    'OR ''D'' FOR Disconnect:',0
  437.       MVI    C,1
  438.       CALL    0005
  439.       PUSH    PSW
  440.       CALL    JMP$ILPRT
  441.       DB    CR,LF,0
  442.       POP    PSW
  443.       ANI    01011111B    ;FORCE UPPER CASE AND HI BIT OFF
  444.       CPI    'O'
  445.       JZ    SETORIG
  446.       CPI    'A'
  447.       JZ    SETANS
  448.       CPI    'D'
  449.       JZ    GOODBYE
  450.       CALL    JMP$ILPRT
  451.       DB    'INVALID: MUST BE ONE OF THE THREE',CR,LF,0
  452.       JMP    SETUPR1
  453. ;.....
  454. ;
  455. ;
  456. SETUPR:      CALL    JMP$ILPRT
  457.       DB    'ENTER 3 FOR 300 BAUD OR 2 FOR 1200 BAUD:',0
  458.       MVI    C,1
  459.       CALL    0005        ;GET THE USER'S INPUT
  460.       PUSH    PSW
  461.       CALL    JMP$ILPRT
  462.       DB    CR,LF,0
  463.       POP    PSW
  464.       SUI    30H
  465.       CPI    3
  466.       JNZ    CK2A
  467.       CALL    INIT3
  468.       JMP    SETUPR1
  469. ;.....
  470. ;
  471. ;
  472. CK2A:      CPI    2
  473.       JNZ    NOT2
  474.       CALL    INIT2
  475.       JMP    SETUPR1
  476. ;.....
  477. ;
  478. ;
  479. NOT2:      CALL    JMP$ILPRT
  480.       DB    'INVALID MUST BE 2 OR 3',CR,LF,0
  481.       JMP    SETUPR
  482.       RET
  483. ;.....
  484. ;
  485. ;
  486. SPCLMENU: CALL    JMP$ILPRT
  487.       DB    'APPLECAT MODE CAN BE CHANGED WITH THE <SET>'
  488.       DB    'COMMAND AT THE COMMAND PROMPT',CR,LF,0
  489.       RET
  490. ;.....
  491. ;
  492. ;
  493. DELAY5:      PUSH    PSW
  494.       PUSH    B
  495.       LXI    B,1000        ;5-10 MS HARDWARE DELAY
  496. ;
  497. DELAY5A:  DCX    B
  498.       MOV    A,B
  499.       ORA    C
  500.       JNZ    DELAY5A
  501.       POP    B
  502.       POP    PSW
  503.       RET
  504. ;.....
  505. ;
  506. ;
  507. ; NOTE:  Must terminate prior to 0C00H
  508. ;.....
  509. ;
  510.       END
  511. ;
  512. ASE AND HI BIT OFF
  513.       CPI    'O'
  514.       JZ    SETORIG
  515.       CPI    'A'
  516.       JZ    SETANS
  517.       CPI    'D'
  518.       JZ    GOOD