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 / M7AP-6.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  25KB  |  891 lines

  1.  
  2. ; M7AP-6.ASM - Apple overlay file for MDM740 - 08/08/84
  3. ;
  4. ; This overlay intended to be upward compatible with the M7AP-2 overlay
  5. ; for the Apple ][ and an external modem.  The major difference is the
  6. ; addition of code to allow the use of the MDM7xx program with the ALS
  7. ; CP/M Card using CP/M 3.0 or the PCPI Applicard under CP/M 2.2.  This
  8. ; also supports the ASL Dispatcher.
  9. ;
  10. ; This overlay file enables Apple II computers with the Apple Super Ser-
  11. ; ial card and external modem to use the MDM7xx phone modem program.  It
  12. ; also supports the following Apple modem configurations:
  13. ;
  14. ;    a) CCS 7710 serial interface and external modem
  15. ;    b) SSM serial interface and external modem
  16. ;    c) Apple communications interface and external modem
  17. ;    d) Mountain Hardware CPS Multifunction card and external modem
  18. ;    e) Prometheus Versacard with software baud select and ext. modem
  19. ;    f) ALS Dispatcher serial interface.
  20. ;
  21. ;    (note:    When using the ALS Dispatcher at 1200 baud, you must
  22. ;           enable hardware interrupts.)
  23. ;
  24. ; You will want to look this file over carefully. There are a number of
  25. ; options that you can use to configure the program to suit your taste.
  26. ; Much of the information contained here is not in the MDM7xx.ASM file.
  27. ;
  28. ; Edit this file for your preferences then follow the "TO USE:" example.
  29. ;
  30. ; Use the "SET" command to change the baudrate when desired.
  31. ;
  32. ; To use SET with the Prometheus Versacard a small hardware mod must be
  33. ; made, since the Versacard only supports baud rate selection via DIP
  34. ; switches. This Mod will allow the Versacard to be switched between 300
  35. ; and 1200 baud via software.  A wire should be attached from Pin #12 on
  36. ; U16 (IC marked 8126) on the Versacard into Annunciator #3 (Pin #12) on
  37. ; the Apple game port.    This will allow switch #4 on s2 of the Versacard
  38. ; to be toggled by setting or clearing annunciator #3.    The default baud
  39. ; rate is set at MSPEED below either (300 or 1200).  This method could
  40. ; be extended to all other Versacard baud rates and by using Annunciators
  41. ; 0,1,2 but 300 and 1200 are really needed for a modem program.  The DIP
  42. ; switches on the Versacard should be set as follows:
  43. ;
  44. ;      On switch bank #2:
  45. ;            s2 - ON
  46. ;            s3 - OFF
  47. ;            s4 - OFF
  48. ;            s5 - OFF
  49. ;
  50. ;=======================================================================
  51. ;
  52. ; TO USE:  First edit this file filling in answers for your own equip-
  53. ;       ment.  Also edit the phone number library, M7NM-6.ASM, if the
  54. ;       phone directory is desired.    Optionally, M7LIB.COM may be
  55. ;       used to change phone numbers later.    Assemble these files
  56. ;       with ASM.COM or equivalent assembler.
  57. ;
  58. ;
  59. ;==================== ASSEMBLY WITH CP/M 2.2 ===========================
  60. ;
  61. ;        A>DDT MDM740.COM
  62. ;        DDT VERS 2.2
  63. ;        NEXT  PC
  64. ;        4A00 0100
  65. ;        -IM7AP-6.HEX        (note the "I" command)
  66. ;        -R            ("R" loads in the .HEX file)
  67. ;        NEXT  PC
  68. ;        4580 0000
  69. ;          * -IM7NM-6.HEX        (get the optional phone library)
  70. ;          * -R
  71. ;          * NEXT  PC
  72. ;          * 4A00 0000
  73. ;        -G0            (return to CP/M)
  74. ;        A>SAVE 73 MDM740.COM    (now have a modified .COM file)
  75. ;
  76. ;          * optional
  77. ;
  78. ;====================== ASSEMBLY WITH CP/M 3.0 =========================
  79. ;
  80. ;        Use SID to overlay the results of these program(s) to
  81. ;        the original .COM file:
  82. ;
  83. ;        A>SAVE            (load the CP/M 3.0 SAVE transient)
  84. ;                    (note no messages)
  85. ;        A>SID MDM740.COM    (load the original .COM file)
  86. ;        CP/M 3 SID - Version 3.0
  87. ;        NEXT MSZE  PC  END
  88. ;        aaaa bbbb 0100 xxxx    (xxxx depends on your sys)
  89. ;        #RM7AP-6.HEX        (load overlay, note "R" command)
  90. ;        NEXT MSZE  PC  END
  91. ;        xxxx aaaa 0100 xxxx    (xxxx's are insignificant)
  92. ;          * #RM7NM-6.HEX        (get the optional phone # overlay)
  93. ;          * NEXT MSZE  PC  END
  94. ;          * xxxx aaaa 0100 xxxx
  95. ;        #G0            (exit SID)
  96. ;
  97. ;        CP/M 3 SAVE - Version 3.0
  98. ;        Enter file: MDM7.COM    (name new file)
  99. ;        Start hex address 100    (from PC above)
  100. ;        Ending hex address 457F (MSZE - 1)
  101. ;
  102. ;        A>            (now have a modified .COM file)
  103. ;
  104. ;          * This step is optional
  105. ;
  106. ;=======================================================================
  107. ;
  108. ; 08/08/84  Set GOLIST and CMDBUF equates properly for MDM740 and moved
  109. ;        to front of program.  Rewrote SETUPR area so program can be
  110. ;        assembled properly with ASM.COM    - Irv Hoff
  111. ; 06/10/84  Fixed error introduced in SSC baud rate initialization rou-
  112. ;        tine for PCPI card.  This error only occurred when assembled
  113. ;        for the SSC with ALSCARD set YES.    - Mark Howard
  114. ; 06/01/84  Changed to work with MDM740 - Robert Flagg
  115. ; 04/25/84  Revised and renamed to M7AP-5.ASM    - Richard Berg
  116. ; 02/24/84  Revised and renamed to M7AP-4.ASM.    Added PCPI Applicard
  117. ;        support.  Added optional modification to SET command and
  118. ;        corrected CCS coding to provide software baudrate control.
  119. ; 01/14/84  Revised and renamed to M7AP+3.ASM.    Added ALS CP/M Card and
  120. ;        dispatcher.             - Mark Howard
  121. ; 12/26/83  Added Versacard support with software baudrate selection.
  122. ;        Revised to allow easy serial cared relocation.  Made SYSVER
  123. ;        software baud selection. Revised    
  124. ; 11/11/83  Renamed to M7AP-1.ASM, no changes    - Irv Hoff
  125. ; 10/07/83  Added CPS card support        - Wally Hubbard
  126. ; 07/27/83  Renamed to work with MDM712     - Irv Hoff
  127. ; 07/01/83  Revised to work with MDM711     - Irv Hoff
  128. ; 06/22/83  Revised to work with MDM710     - Irv Hoff
  129. ; 05/27/83  Updated to work with MDM709     - Irv Hoff
  130. ; 05/15/83  Revised to work with MDM708     - Irv Hoff
  131. ; 04/11/83  Updated to work with MDM707     - Irv Hoff
  132. ; 04/04/83  Updated to work with MDM706     - Irv Hoff
  133. ; 02/27/83  Updated to work with MDM705     - Irv Hoff
  134. ; 02/12/83  Used MDM703CF to make this file for Apple computers using a
  135. ;        variety of serial interface cards with external modem.
  136. ;                        - Bruce Kargol
  137. ;         for Apple computers using a var-
  138. ;         iety of serial interface cards
  139. ;         with external modem.        - Bruce Kargol
  140. ;
  141. ;=======================================================================
  142. ;
  143. YES:    EQU    0FFH
  144. NO:    EQU    0
  145. ;
  146. ;    *********************************************************
  147. ;    *            C A U T I O N            *
  148. ;    * GOLIST: and CMDBUF: will different addresses depend-    *
  149. ;    * ing on the version of MDM7xx you are currently using. *
  150. ;    *********************************************************
  151. ;
  152. GOLIST:    EQU    2049H    ;MDM740.COM location of GOLIST:
  153. CMDBUF:    EQU    49A7H    ;MDM740.COM location of CMDBUF:
  154. ;
  155. ;
  156. BELL:    EQU    07H    ;bell
  157. CR:    EQU    0DH    ;carriage return
  158. ESC:    EQU    1BH    ;escape
  159. LF:    EQU    0AH    ;linefeed
  160. ;
  161. ;
  162. ;====================== CUSTOMIZATION EQUATES ==========================
  163. ;
  164. SLOT:    EQU    2    ;slot of serial interface
  165. ;
  166. ALSCARD:  EQU    NO    ;YES if using ALS CP/M Card
  167. APPLICARD:EQU    NO    ;if using PCPI Applicard
  168. CPM2CARD: EQU    YES    ;YES if Softcard
  169. ;
  170. ;
  171. CCS:    EQU    NO    ;YES for CCS 7710
  172. VERSA:    EQU    NO    ;YES for Prometheus Versacard
  173. COMCARD:EQU    NO    ;YES for Apple Comcard
  174. SSC:    EQU    YES    ;YES for Super Serial Card
  175. SSM:    EQU    NO    ;YES for SSM serial card
  176. CPS:    EQU    NO    ;YES for CPS card
  177. ALSDSP:    EQU    NO    ;YES for ALS Dispatcher
  178. ;
  179. SETMOD:    EQU    YES    ;if YES, make sure CMDBUF: points to MDM7xx loc.
  180. ;
  181. ;=======================================================================
  182. ;
  183. SLOTOFF:EQU    16*SLOT    ;serial card slot offset
  184. ;
  185.      IF    ALSCARD    OR APPLICARD
  186. MAPOFF:    EQU    0            ;no memory remapping for either
  187.      ENDIF                ;ALSCARD
  188. ;
  189.      IF    CPM2CARD
  190. MAPOFF:    EQU    2000H            ;Microsoft strikes again
  191.      ENDIF                ;CPM2CARD
  192. ;
  193.      IF    VERSA
  194. AN3SET:    EQU    0C05FH+MAPOFF        ;set annunciator #3
  195. AN3CLR:    EQU    0C05EH+MAPOFF        ;clear      "
  196.      ENDIF                ;VERSA
  197. ;
  198.      IF    CCS
  199. MODDATP:EQU    0C081H+SLOTOFF+MAPOFF    ;data port of CCS 7710
  200. MODCTL1:EQU    0C080H+SLOTOFF+MAPOFF    ;status port of CCS 7710
  201.      ENDIF                ;CCS OR ALSDSP
  202. ;
  203.      IF    COMCARD    OR VERSA OR ALSDSP
  204. MODDATP:EQU    0C08FH+SLOTOFF+MAPOFF    ;data port of Comcard
  205. MODCTL1:EQU    0C08EH+SLOTOFF+MAPOFF    ;status port of Comcard
  206.      ENDIF                ;COMCARD OR VERSA OR ALSDSP
  207. ;
  208.      IF    SSM
  209. MODDATP:EQU    0C085H+SLOTOFF+MAPOFF    ;data port of SSM
  210. MODCTL1:EQU    0C084H+SLOTOFF+MAPOFF    ;status port of SSM
  211.      ENDIF                ;SSM
  212. ;
  213.      IF    SSC
  214. MODDATP:EQU    0C088H+SLOTOFF+MAPOFF    ;data port of Apple SSC
  215. MODCTL1:EQU    0C089H+SLOTOFF+MAPOFF    ;modem status port of SSC
  216. MODRCVB:EQU    08H            ;bit to test for received data
  217. MODRCVR:EQU    08H            ;modem receive ready
  218. MODSNDB:EQU    10H            ;bit to test for ready to send
  219. MODSNDR:EQU    10H            ;modem send ready bit
  220.      ENDIF                ;SSC
  221. ;
  222. ;
  223. ; (Any slot with any CPS function assigned to it may be used.)
  224. ;
  225.      IF    CPS
  226. MODCR:    EQU    0C0FEH+SLOT*100H+MAPOFF    ;control port of CPS card
  227. MODDATP:EQU    0C0FAH+SLOT*100H+MAPOFF    ;data port of CPS card
  228. MODCTL1:EQU    0C0FBH+SLOT*100H+MAPOFF    ;status port of CPS card
  229. MODCPST:EQU    0C0F9H+SLOT*100H+MAPOFF    ;printer status port
  230. MODCPRT:EQU    0C0FDH+SLOT*100H+MAPOFF    ;printer data port
  231. MODRCVB:EQU    02H            ;bit to test for receive
  232. MODRCVR:EQU    02H            ;value when ready
  233. MODSNDB:EQU    01H            ;bit to test for send
  234. MODSNDR:EQU    01H            ;value when ready
  235.      ENDIF                ;CPS
  236. ;
  237. ;
  238. ; Apple status bit equates for CCS, Comcard, Versacard, Dispatcher, and
  239. ; SSM
  240. ;
  241.      IF    NOT SSC    AND NOT    CPS
  242. MODSNDB:EQU    02H            ;bit to test for send
  243. MODSNDR:EQU    02H            ;value when ready
  244. MODRCVB:EQU    01H            ;bit to test for receive
  245. MODRCVR:EQU    01H            ;value when ready
  246.      ENDIF                ;NOT SSC AND NOT CPS
  247. ;
  248. ;
  249. ; We have software control over the Super Serial, CPS & CCS cards and
  250. ; Versacard; if hardware mod is made, so SETUPRTST is YES for those
  251. ; cards cards, below.
  252. ;
  253. ;
  254. ;=======================================================================
  255. ;
  256.         ORG    100H
  257. ;
  258. ; Change the clock speed to match your equipment.  The Microsoft Soft-
  259. ; card operates at 2 MHz.  The Applicard operates at either 4 or 6 MHz
  260. ; depending on which card you purchased.  The ALS Card operates at 2
  261. ; MHz.
  262. ;
  263. ;
  264.         DS    3    ;(for  "JMP   START" instruction)
  265. ;
  266. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  267. AUTODIAL:    DB    YES    ;yes=HAYES Smartmodem, no=non-Hayes    104H
  268. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  269. CLOCK:        DB    20    ;clock speed in MHz x10, 25.5 MHz max.    106H
  270.                 ;20=2 MHz, 37=3.68 MHz, 40=4 MHz, etc.
  271. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  272.                 ;6=2400 7=4800 8=9600 9=19200 default
  273. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  274.                 ;default time to send character in ter-
  275.                 ;minal mode file transfer for slow BBS.
  276. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  277.                 ;default time for extra wait after CRLF
  278.                 ;in terminal mode file transfer
  279. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  280. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  281. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  282. RETRY:        DB    YES    ;yes=reset the error limit to try again 10DH
  283.                 ;no=abort after 10 consecutive errors
  284. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  285. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  286. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  287. CONVRUB:    DB    YES    ;yes=convert rub to backspace        111H
  288. TOGGLEBK:    DB    YES    ;yes=allow toggling of rub to backspace 112H
  289. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  290.                 ;terminal mode (added by remote echo)
  291. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  292. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  293.                 ;write logon sequence at location LOGON
  294. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  295. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  296.                 ;no=external command if EXTCHR precedes
  297. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  298. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  299. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  300.                 ;sending a file in terminal mode
  301. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  302.                 ;sending a file in terminal mode
  303. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  304. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  305. EXTRA1:        DB    0    ;for future expansion            11EH
  306. EXTRA2:        DB    0    ;for future expansion            11FH
  307. BRKCHR:        DB    'B'-40H    ;^B = Send 300 ms. break tone        120H
  308. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  309. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  310. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  311. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  312. TRANCHR:    DB    'T'-40H    ;^T = Transmit file to remote        125H
  313. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  314. EXTCHR:        DB    'W'-40H    ;^W = Send next character        127H
  315.         DS    2        ;                128H
  316. ;
  317. IN$MODCTL1:    JMP    LDACTL1        ;in modem control port        12AH
  318.         DS    7
  319. OUT$MODDATP:    JMP    STADATP        ;out modem data port        134H
  320.         DS    7
  321. IN$MODDATP:    JMP    LDADATP        ;in modem data port        13EH
  322.         DS    7        ;spares if needed
  323. ;
  324. ANI$MODRCVB:    ANI    MODRCVB    ! RET    ;bit to test for receive ready    148H
  325. CPI$MODRCVR:    CPI    MODRCVR    ! RET    ;value of rcv. bit when ready    14BH
  326. ANI$MODSNDB:    ANI    MODSNDB    ! RET    ;bit to test for send ready    14EH
  327. CPI$MODSNDR:    CPI    MODSNDR    ! RET    ;value of send bit when ready    151H
  328.         DS    12        ;PMMI only calls        154H
  329. ;
  330. LOGONPTR:    DW    LOGON        ;for user message.        160H
  331.         DS    6        ;                162H
  332. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  333. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  334.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  335.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  336.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  337. JMP$SETUPR:    JMP    SETUPR        ;                177H
  338. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  339. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  340. JMP$BREAK:    JMP    SENDBRK        ;                180H
  341. ;
  342. ;
  343. ; Do not change the following six lines.
  344. ;
  345. JMP$ILPRT:    DS    3        ;                183H
  346. JMP$INBUF:    DS    3        ;                186H
  347. JMP$INLNCOMP:    DS    3        ;                189H
  348. JMP$INMODEM:    DS    3        ;                18CH
  349. JMP$NXTSCRN:    DS    3        ;                18FH
  350. JMP$TIMER:    DS    3        ;                192H
  351. ;
  352. ;
  353. CLREOS:        CALL    JMP$ILPRT    ;                195H
  354. EOSCLR:        DB    'K'-40H,0,0,0,0    ;Apple ][/e 80 col        198H
  355.         RET            ;                19DH
  356. ;
  357. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  358.         DB    'L'-40H,0,0,0,0    ;Apple ][/e 80 col        1A1H
  359.         RET            ;                1A6H
  360. ;
  361. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  362.         DB    'Apple ][ and '
  363. ;
  364.      IF CPM2CARD
  365.     DB    'CP/M 2.2 Card'
  366.      ENDIF
  367. ;
  368.      IF APPLICARD
  369.     DB    'Applicard'
  370.      ENDIF
  371. ;
  372.      IF ALSCARD
  373.     DB    'ALS CP/M Card'
  374.      ENDIF
  375. ;
  376.     DB    CR,LF
  377. ;
  378.      IF VERSA
  379.     DB    'Versacard'
  380.      ENDIF
  381. ;
  382.      IF SSC
  383.     DB    'Super Serial Card'
  384.      ENDIF
  385. ;
  386.      IF COMCARD
  387.     DB    'Comcard'
  388.      ENDIF
  389. ;
  390.      IF CPS
  391.     DB    'CPS card - serial function'
  392.      ENDIF
  393. ;
  394.      IF CCS
  395.     DB    'CCS 7710 Card'
  396.      ENDIF
  397. ;
  398.      IF ALSDSP
  399.     DB    'ALS Dispatcher'
  400.      ENDIF
  401. ;
  402.      IF SSM
  403.     DB    'SSM Serial Interface'
  404.      ENDIF
  405. ;
  406.     DB    ' in slot ',SLOT+30H,CR,LF
  407.     DB    0
  408.     RET
  409. ;.....
  410. ;
  411. ;
  412. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  413. ;     end of your last routine should terminate by 0400H (601 bytes
  414. ;     available after start of SYSVER) if using the Hayes Smartmodem
  415. ;     or by address 0C00H (2659 bytes) otherwise.
  416. ;
  417. ;
  418. ; You can put in a message at this location which can be called up with
  419. ; CTL-L if TRANLOGON has been set TRUE.  You can put in several lines if
  420. ; desired.  End with a 0.
  421. ;
  422. LOGON:    DB    'Hello there from an Apple user',CR,0
  423. ;
  424. ;
  425. ; You can add your own routine here to send a break tone to reset time-
  426. ; share computers, if desired.
  427. ;
  428.      IF NOT    CPS
  429. SENDBRK:RET
  430.      ENDIF            ;NOT CPS
  431. ;
  432.      IF CPS
  433. SENDBRK:MVI    A,80H        ;open the command register
  434.     CALL    STAMDCR        ;by storing 80H in MODCR
  435.     MVI    A,3FH        ;send a break by storing
  436.     CALL    STACTL1        ;3F in    MODCTL1
  437.     XRA    A        ;close the command register
  438.     JMP    STAMDCR        ;by storing 00H in MODCR
  439.      ENDIF            ;CPS
  440. ;.....
  441. ;
  442. ;
  443. ; You can add your own routine here to set DTR low and/or send a break
  444. ; tone to disconnect.
  445. ;
  446. GOODBYE:RET
  447. ;.....
  448. ;
  449. ;
  450. INITMOD:EQU    $
  451. ;
  452.      IF    ALSCARD
  453.     LHLD    1        ;initialize our local jumps to the BIOS
  454.     LXI    D,60H
  455.     DAD    D
  456.     SHLD    APREAD+1
  457.     INX    H
  458.     INX    H
  459.     INX    H
  460.     SHLD    APWRITE+1
  461.      ENDIF            ;ALSCARD
  462. ;.....
  463. ;
  464. ;
  465. ; The following address is used to set data bits, parity, stop bits and
  466. ; baud rate on the Super Serial Card.
  467. ;
  468.      IF SSC
  469. MODDLL:    EQU    0C08BH+SLOTOFF+MAPOFF    ;SSC ACIA control register
  470. ;
  471. ;
  472. ; Control over number of data bits, parity and number of stop bits
  473. ; (through MSB300:) has not been implemented.  These must be set using
  474. ; the slide switches on the Super Serial Card.
  475. ;
  476. ; The following is used to initialize the Apple SSC on execution of the
  477. ; program.  Change it to initialize the modem port on your micro if you
  478. ; wish.  It initializes to 300 baud.
  479. ;
  480. INITBR:    MVI    A,1        ;default transfer time to 300
  481.     STA    MSPEED
  482.     CALL    LDAMODL        ;current baudrate from MODDLL
  483.     ANI    0F0H        ;zero the last 4 bits
  484. ;
  485. INITMOD1:
  486.     ORI    06H        ;get default baudrate (300)
  487.     CALL    STAMODL        ;store default baudrate
  488.      ENDIF            ;SSC
  489. ;.....
  490. ;
  491. ;
  492. ; The following may be used to initialize the Mountain Hardware CPS
  493. ; Multifunction Card for eight bits, no parity, one stop bit, and
  494. ; 300 baud.  This does not alter the CPS defaults outside of MDM7xx.
  495. ;
  496.      IF CPS
  497. INITBR:    MVI    A,1        ;set MSPEED at 1 (=300 baud)
  498.     STA    MSPEED
  499.     MVI    A,80H        ;open the command register
  500.     CALL    STAMDCR        ;by storing 80H in MODCR
  501.     MVI    A,37H        ;initialize the serial chip
  502.     CALL    STACTL1        ;by storing 37H in MODCTL1
  503.     MVI    A,4EH        ;set 1 stop bit, no parity
  504.     CALL    STADATP        ;by storing $4E in MODDATP
  505. ;
  506. INITMOD1:
  507.     MVI    A,35H        ;set baud rate at 300 by storing
  508.     CALL    STADATP        ;35H in MODDATP (same address - the two 
  509.                 ;registers cycle with each write)
  510.     XRA    A        ;close the command register
  511.     CALL    STAMDCR        ;by storing 00 in MODCR
  512. ;
  513. ;
  514. ; The MDM740.COM routine that checks to see if the printer is ready does
  515. ; not work with the CPS card.  This routine changes it.  Check to make
  516. ; sure the original code sequence CALL 0000H, ORA A, RZ, is located at
  517. ; GOLIST.  A new routine to send the character to the printer is also
  518. ; provided, to eliminate the need for the CPS patches.
  519. ;
  520.     LXI    H,PRCHECK    ;store the address of the
  521.     SHLD    GOLIST+1    ;PRCHECK routine at GOLIST+1
  522.     LXI    H,PRINTCHAR    ;store the address of the
  523.     SHLD    GOLIST+15    ;PRINTCHAR routine
  524.      ENDIF            ;CPS
  525. ;.....
  526. ;
  527. ;
  528. ; The following routine initializes the Versacard to the default baud
  529. ; rate which is set at MSPEED above.  If MSPEED is set to something
  530. ; other than 300 or 1200 this routine does not alter the annunciator
  531. ; settings.
  532. ;
  533.      IF VERSA
  534. INITBR:    LDA    MSPEED        ;set annunciators to known state
  535.     CPI    1        ;is it 300 ?
  536.     JZ    OK300
  537.     CPI    5        ;is it 1200 ?
  538.     JZ    OK1200
  539.      ENDIF            ;VERSA
  540. ;
  541.     RET            ;RET is for INITMOD
  542. ;.....
  543. ;
  544. ;
  545. ; Substitute routines for status checks and printing:
  546. ;
  547.      IF    CPS
  548. PRCHECK:CALL    LDACPST         ;read the status port
  549.     ANI    040H         ;mask off unused bits
  550.     RET
  551. ;.....
  552. ;
  553. ;
  554. PRINTCHAR:
  555.     MOV    A,C        ;move char to A
  556.     JMP    STACPRT        ;send it to the printer
  557.      ENDIF            ;CPS
  558. ;
  559.      IF    CCS
  560. INITBR:    MVI    A,5        ;set default speed to 1200 baud
  561.     STA    MSPEED        ;
  562. INITMOD1:
  563.     MVI    A,00010101B    ;set 8 data, 1 stop bit, 1200 baud
  564.                 ;use 00010110B for 300 baud-
  565.                 ;make sure card switches are set for
  566.                 ;1200 bps!
  567.     CALL    STACTL1        ;CCS ACAI control register
  568.     RET
  569.      ENDIF            ;CCS
  570. ;.....
  571. ;
  572. ;
  573.      IF NOT    SSC AND    NOT CPS    AND NOT    VERSA AND NOT CCS
  574. SETUPR:    RET            ;routine to change baud rates, if needed
  575.      ENDIF            ;NOT SSC AND NOT CPS AND NOT VERSA
  576. ;.....
  577. ;
  578. ;
  579. ; Changes the modem baud rate with SET command.
  580. ;
  581.      IF SSC    OR CPS OR VERSA    OR CCS
  582. SETUPR:     IF    SETMOD
  583.     LXI    D,CMDBUF+6    ;point to loc of speed in command buffer
  584.     CALL    JMP$INLNCOMP    ;when command is of form SET 300, etc
  585.     DB    '300',0
  586.     JNC    OK300
  587.     CALL    JMP$INLNCOMP
  588.     DB    '600',0
  589.     JNC    OK600
  590.     CALL    JMP$INLNCOMP
  591.     DB    '1200',0
  592.     JNC    OK1200
  593.                 ;fall thru if speed is not properly
  594.                 ;indicated in SET command
  595.      ENDIF            ;SETMOD
  596.      ENDIF            ;SSC OR CPS OR VERSA OR CCS
  597. ;    
  598.      IF SSC    OR CPS OR VERSA    OR CCS
  599.     LXI    D,BAUDBUF    ;point to input buffer for INLNCOMP
  600.     CALL    JMP$ILPRT
  601. ;
  602.      IF    NOT CCS
  603.     DB    'Input Baud Rate (300,600,1200): ',0
  604.      ENDIF            ;NOT CCS
  605.      ENDIF            ;SSC OR CPS OR VERSA OR CCS
  606. ;
  607.      IF SSC    OR CPS OR VERSA    OR CCS
  608.      IF    CCS
  609.     DB    'Input Baud Rate (300,1200): ',0
  610.     ENDIF            ;CCS
  611.      ENDIF            ;SSC OR CPS OR VERSA OR CCS
  612. ;
  613.      IF SSC    OR CPS OR VERSA    OR CCS
  614.     CALL    JMP$INBUF
  615.     LXI    D,BAUDBUF+2
  616.     CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  617.     DB    '300',0
  618.     JNC    OK300        ;go if got match
  619.     CALL    JMP$INLNCOMP
  620.     DB    '600',0
  621.     JNC    OK600
  622.     CALL    JMP$INLNCOMP
  623.     DB    '1200',0
  624.     JNC    OK1200
  625.     CALL    JMP$ILPRT    ;all matches failed - tell operator
  626.     DB    '++ Incorrect entry ++',CR,LF,BELL,0
  627.     JMP    SETUPR        ;try again
  628.      ENDIF            ;SSC OR CPS OR VERSA OR CCS
  629. ;
  630.      IF    SSC OR CCS OR CPS
  631. OK300:    MVI    A,1        ;MSPEED 300 baud value
  632.     LHLD    BD300        ;get 300 baud parameters in HL
  633.     JMP    LOADBD        ;go load them
  634. ;
  635. OK600:    MVI    A,3
  636.     LHLD    BD600
  637.     JMP    LOADBD
  638. ;
  639. OK1200:    MVI    A,5
  640.     LHLD    BD1200
  641. ;
  642. LOADBD:    STA    INITBR+1
  643.     MOV    A,L        ;get baud rate byte
  644.     STA    INITMOD1+1    ;store in INITMOD
  645.     JMP    INITBR        ;reset ACIA baud rate
  646.      ENDIF            ;SSC OR CCS OR CPS
  647. ;
  648.      IF VERSA
  649. OK300:    CALL    LDAAN3C        ;clear Annunciator #3 for 300 baud
  650.     MVI    A,1        ;set MSPEED..
  651.     STA    MSPEED        ;..for 300 baud
  652.     RET
  653. ;
  654. OK600:    CALL    JMP$ILPRT
  655.     DB    '300 or 1200 baud only on Versacard',CR,LF,0
  656.     RET
  657. ;
  658. OK1200:    CALL    LDAAN3S        ;set Annunciator #3 for 1200 baud
  659.     MVI    A,5        ;set MSPEED..
  660.     STA    MSPEED        ;..for 1200 baud
  661.     RET
  662.      ENDIF            ;VERSACARD
  663. ;
  664. ;
  665. ; Table of baud rate parameters
  666. ;
  667.      IF SSC
  668. BD300:    DW    0006H
  669. BD600:    DW    0007H
  670. BD1200:    DW    0008H
  671.      ENDIF            ;SSC
  672. ;
  673.      IF CPS
  674. BD300:    DW    0035H
  675. BD600:    DW    0036H
  676. BD1200:    DW    0037H
  677.      ENDIF            ;CPS
  678. ;
  679.      IF    CCS
  680. BD300:    DW    0016H
  681. BD1200:    DW    0015H
  682.      ENDIF            ;CCS
  683. ;
  684. BAUDBUF:DW    10,0        ;tells CLEARBUF routine it can clear..
  685.     DS    10        ;..out the next 10 bytes
  686. ;
  687. ;============================= APPLE I/O ===============================
  688. ;
  689.      IF    CPM2CARD
  690. STACTL1:STA    MODCTL1    ! RET
  691. STADATP:STA    MODDATP    ! RET
  692. LDACTL1:LDA    MODCTL1    ! RET
  693. LDADATP:LDA    MODDATP    ! RET
  694.      ENDIF            ;CPMCARD
  695. ;
  696.      IF    CPM2CARD AND CPS
  697. STACPRT:STA    MODCPRT    ! RET
  698. STAMDCR:STA    MODCR    ! RET
  699. LDACPST:LDA    MODCPST    ! RET
  700.      ENDIF            ;CPM2CARD AND CPS
  701. ;
  702.      IF    CPM2CARD AND SSC
  703. LDAMODL:LDA    MODDLL    ! RET
  704. STAMODL:STA    MODDLL    ! RET
  705.      ENDIF            ;CPM2CARD AND SSC
  706. ;
  707.      IF    CPM2CARD AND VERSA
  708. LDAAN3C:LDA    AN3CLR    ! RET
  709. LDAAN3S:LDA    AN3SET    ! RET
  710.      ENDIF            ;CPM2CARD AND VERSA
  711. ;
  712.      IF    ALSCARD    AND SSC
  713. STAMODL:PUSH    H
  714.     LXI    H,MODDLL
  715.     JMP    APWRT
  716.      ENDIF            ;ALSCARD AND SSC
  717. ;
  718.      IF ALSCARD
  719. STACTL1:PUSH    H
  720.     LXI    H,MODCTL1
  721.     JMP    APWRT
  722. ;
  723. STADATP:PUSH    H
  724.     LXI    H,MODDATP
  725. ;
  726. APWRT:    PUSH    D
  727.     PUSH    B
  728.     CALL    APWRITE
  729.     POP    B
  730.     POP    D
  731.     POP    H
  732.     RET
  733.      ENDIF            ;ALSCARD
  734. ;
  735.      IF ALSCARD AND    SSC
  736. LDAMODL:PUSH    H
  737.     LXI    H,MODDLL
  738.     JMP    APRD
  739.      ENDIF            ;ALSCARD AND SSC
  740. ;
  741.      IF    ALSCARD
  742. LDACTL1:PUSH    H
  743.     LXI    H,MODCTL1
  744.     JMP    APRD
  745. ;
  746. LDADATP:PUSH    H
  747.     LXI    H,MODDATP
  748. ;
  749. APRD:    PUSH    D
  750.     PUSH    B
  751.     CALL    APREAD
  752.     POP    B
  753.     POP    D
  754.     POP    H
  755.     RET
  756. ;
  757. ;
  758. ; These are the jump locations to the ALS BIOS
  759. ;
  760. APREAD:    JMP    $-$
  761. APWRITE:JMP    $-$
  762.      ENDIF            ;ALSCARD
  763. ;
  764.      IF    ALSCARD    AND CPS
  765. STACPRT:PUSH    H
  766.     LXI    H,MODCPRT
  767.     JMP    APWRT
  768. ;
  769. STAMDCR:PUSH    H
  770.     LXI    H,MODCR
  771.     JMP    APWRT
  772. ;
  773. LDACPST:PUSH    H
  774.     LXI    H,MODCPST
  775.     JMP    APRD
  776.      ENDIF            ;ALSCARD AND CPS
  777. ;
  778.      IF    ALSCARD    AND SSC
  779. LDAMODL:PUSH    H
  780.     LXI    H,MODDLL
  781.     JMP    APRD
  782. ;
  783. STAMODL:PUSH    H
  784.     LXI    H,MODDLL
  785.     JMP    APWRT
  786.      ENDIF            ;ALSCARD AND SSC
  787. ;
  788.      IF    ALSCARD    AND VERSA
  789. LDAAN3C:PUSH    H
  790.     LXI    H,AN3CLR
  791.     JMP    APRD
  792. ;
  793. LDAAN3S:PUSH    H
  794.     LXI    H,AN3SET
  795.     JMP    APRD
  796.      ENDIF            ;ALSCARD AND VERSA
  797. ;
  798.      IF    APPLICARD    ;
  799. RDBYTE:    EQU    0FFE0H        ;READ 1 BYTE FROM APPLE (A = BYTE)
  800. WRBYTE:    EQU    0FFE3H        ;WRITE 1 BYTE TO APPLE (C = BYTE)
  801. RDWORD:    EQU    0FFE6H        ;READ 2 BYTES FROM APPLE (DE = WORD)
  802. WRWORD:    EQU    0FFE9H        ;WRITE 2 BYTES TO APPLE (DE = WORD)
  803. PEEK1BYTE:EQU    6        ;COMMAND
  804. POKE1BYTE:EQU    7        ;COMMAND
  805. ;
  806. STACTL1:PUSH    D
  807.     LXI    D,MODCTL1
  808.     JMP    APWRT    
  809. ;
  810. STADATP:PUSH    D
  811.     LXI    D,MODDATP
  812. ;
  813. APWRT:    PUSH    B
  814.     MOV    B,A
  815.     MVI    C,POKE1BYTE
  816.     CALL    WRBYTE
  817.     CALL    WRWORD
  818.     MOV    C,B
  819.     CALL    WRBYTE
  820.     POP    B
  821.     POP    D
  822.     RET
  823. ;
  824. LDACTL1:PUSH    D
  825.     LXI    D,MODCTL1
  826.     JMP    APRD
  827. ;
  828. LDADATP:PUSH    D
  829.     LXI    D,MODDATP
  830. ;
  831. APRD:    PUSH    B
  832.     MVI    C,PEEK1BYTE
  833.     CALL    WRBYTE
  834.     CALL    WRWORD
  835.     CALL    RDBYTE
  836.     POP    B
  837.     POP    D
  838.     RET
  839.      ENDIF            ;APPLICARD
  840. ;
  841.      IF    APPLICARD AND CPS
  842. STACPRT:PUSH    D
  843.     LXI    D,MODCPRT
  844.     JMP    APWRT
  845. ;
  846. STAMDCR:PUSH    D
  847.     LXI    D,MODCR
  848.     JMP    APWRT
  849. ;
  850. LDACPST:PUSH    D
  851.     LXI    D,MODCPST
  852.     JMP    APRD
  853.      ENDIF            ;APPLICARD AND CPS
  854. ;
  855.      IF APPLICARD AND SSC
  856. LDAMODL:PUSH    D
  857.     LXI    D,MODDLL
  858.     JMP    APRD
  859. ;
  860. STAMODL:PUSH    D
  861.     LXI    D,MODDLL
  862.     JMP    APWRT
  863.      ENDIF            ;APPLICARD AND SSC
  864. ;
  865.      IF APPLICARD AND VERSA
  866. LDAAN3C:PUSH    D
  867.     LXI    H,AN3CLR
  868.     JMP    APRD
  869. ;
  870. LDAAN3S:PUSH    D
  871.     LXI    H,AN3SET
  872.     JMP    APRD
  873.      ENDIF            ;APPLICARD AND VERSA
  874. ;
  875. ;
  876. ;-----------------------------------------------------------------------
  877. ;
  878. ; The following routine can be used to display commands on the screen
  879. ; of interest to users of this equipment.  If using the Hayes Smartmodem
  880. ; this is unavailable without a special address change.
  881. ;
  882. SPCLMENU: RET
  883. ;
  884. ;-----------------------------------------------------------------------
  885. ;
  886. ;
  887. ; NOTE: MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  888. ;                0C00H (without Smartmodem)
  889. ;
  890.     END
  891.