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 / M7JC-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  14KB  |  459 lines

  1. ; M7JC-2.ASM Apple/J-Cat overlay file for MDM727.  03/10/84
  2. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3. ;
  4. ; This file is a patch of  M7AP-1.ASM overlay designed to
  5. ; allow auto-dialing through a Novation J-Cat modem.
  6. ; The equates and patches in this file are set up for the combination
  7. ; of an Apple Super Serial Card in slot 2, with a Novation J-Cat modem.
  8. ; The J-cat is 300-baud only, so I have eliminated the routine for
  9. ; changing baud rate that was in the original.
  10. ;
  11. ; In order to dial with the J-Cat, the modem's OHK line (pin 7 on the
  12. ; modem's card-edge connector; blue unconnected line in the DB25 
  13. ; connector provided with the modem) must be connected to the Apple's
  14. ; AN(1) annunciator (pin 14 on the game I/O socket). {Actually, it
  15. ; could be connected to one of the other annunciator ports, if the
  16. ; "onhook" and "offhook" equates below are changed to refer to that
  17. ; annunciator.}
  18. ;            -- David W. Walker 71076,411
  19. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  20. ;  
  21. ; This overlay file enables Apple II computers with the Apple Super
  22. ; Serial card and external modem to use the MDM727 phone modem program.
  23. ; It also supports the following Apple modem configurations:
  24. ;
  25. ;    a) CCS 7710 serial interface and external modem
  26. ;    b) SSM serial interface and external modem
  27. ;    c) Apple communications interface and external modem
  28. ;
  29. ; You will want to look this file over carefully. There are a number of
  30. ; options that you can use to configure the program to suit your taste.
  31. ; Much of the information contained here is not in the MDM727.ASM file.
  32. ;
  33. ; Edit this file for your preferences then follow the "TO USE:" example.
  34. ;
  35. ;    TO USE: First edit this file filling in answers for your own
  36. ;        equipment.  Then assemble with ASM.COM or equivalent
  37. ;        assembler.  Then use DDT to overlay the the results
  38. ;        of this program to the original .COM file:
  39. ;
  40. ;        A>DDT MDM727.COM
  41. ;        DDT VERS 2.2
  42. ;        NEXT  PC
  43. ;        4900 0100
  44. ;        -IM7JC-1.HEX        (note the "I" command)
  45. ;        -R            ("R" loads in the .HEX file)
  46. ;        NEXT  PC
  47. ;        4900 0000
  48. ;        -G0            (return to CP/M)
  49. ;        A>SAVE 73 MDM727.COM    (now have a modified .COM file)
  50. ;
  51. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  52. ;
  53. ; 03/10/84 - Addresses for MDM727        - D. W. Walker
  54. ; 02/19/84 - Addresses for MDM724           - D. W. Walker
  55. ; 10/04/83 - J-Cat dialing routines added    - D. W. Walker
  56. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  57. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  58. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  59. ; 05/27/83 - Updated to work with MDM709    - Irv Hoff
  60. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  61. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  62. ; 04/04/83 - Updated to work with MDM706    - Irv Hoff
  63. ; 02/27/83 - Updated to work with MDM705    - Irv Hoff
  64. ; 02/12/83 - Used MDM703CF to make this file
  65. ;         for Apple computers using a var-
  66. ;         iety of serial interface cards
  67. ;         with external modem.        - Bruce Kargol
  68. ;
  69. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  70. ;
  71. BELL:        EQU    07H    ;bell
  72. CR:        EQU    0DH    ;carriage return
  73. ESC:        EQU    1BH    ;escape
  74. LF:        EQU    0AH    ;linefeed
  75. ;
  76. YES:        EQU    0FFH
  77. NO:        EQU    0
  78. ;
  79. ;
  80. CCS:        EQU    NO    ;YES for CCS 7710
  81. COMCARD:    EQU    NO    ;YES for Apple comcard
  82. SSC:        EQU    YES    ;YES for Super Serial Card
  83. SSM:        EQU    NO    ;YES for SSM serial card
  84. ;
  85.          IF    CCS
  86. MODDATP:    EQU    0E0A1H    ;data port of CCS 7710
  87. MODCTL1:    EQU    0E0A0H    ;status port of CCS 7710
  88.           ENDIF        ;endif CCS
  89. ;
  90.          IF    COMCARD
  91. MODDATP:    EQU    0E0AFH    ;data port of Comcard
  92. MODCTL1:    EQU    0E0AEH    ;status port of Comcard
  93.          ENDIF        ;endif Comcard
  94. ;
  95.          IF    SSM
  96. MODDATP:    EQU    0E0A5H    ;data port of SSM
  97. MODCTL1:    EQU    0E0A4H    ;status port of SSM
  98.          ENDIF        ;endif SSM
  99. ;
  100.          IF    SSC
  101. MODDATP:    EQU    0E0A8H    ;data port of Apple Super Serial Card 
  102. MODCTL1:    EQU    0E0A9H    ;modem status port of Super Serial Card
  103. COMMAND:     EQU     0E0AAH    ;SSC command register
  104. MODBDP:        EQU    0E0ABH    ;SSC ACIA control register
  105. ;
  106. MODRCVB:    EQU    08H     ;bit to test for received data
  107. MODRCVR:    EQU    08H     ;modem receive ready
  108. MODSNDB:    EQU    10H    ;bit to test for ready to send
  109. MODSNDR:    EQU    10H    ;modem send ready bit
  110. DTR         EQU     0BH     ;dtr,xmit on(rts low),irq disabled
  111.          ENDIF        ;endif SSC
  112. ;
  113. ;
  114. ; Apple status bit equates for CCS, Comcard and SSM
  115. ;
  116.          IF    NOT SSC
  117. MODSNDB:    EQU    02H    ;bit to test for send
  118. MODSNDR:    EQU    02H    ;value when ready
  119. MODRCVB:    EQU    01H    ;bit to test for receive
  120. MODRCVR:    EQU    01H    ;value when ready
  121.          ENDIF        ;not SSC
  122. ;
  123. ;  Equates for routines in the body of MDM727.COM, needed to make
  124. ;  the J-Cat auto-dialing routines work with the PMMI routines in
  125. ;  MDM727:
  126. ;
  127. ;
  128. DIAL15:        EQU    05DFH
  129. DIALAGN:    EQU    05FBH
  130. CONMADE:    EQU    06A9H
  131. DIALA2:        EQU    0725H
  132. DIALBGN:    EQU    07A9H
  133. DISCONNT:    EQU    0820H
  134. WAIT:        EQU    09BEH
  135. FNKCHR:        EQU    12C9H
  136. RESTART:    EQU    141FH
  137. INITADR:    EQU    1484H
  138. RETURN:        EQU    196EH
  139. GOLIST:        EQU    2033H
  140. BREAK:        EQU    2098H
  141. TYPE:        EQU    2B71H     
  142. ;
  143. ; Values for Novation J-Cat using Ann(1) as offhook line
  144. ;
  145. ONHOOK        EQU    0E05AH
  146. OFFHOOK        EQU    0E05BH
  147. ;
  148. ;
  149.         ORG    100H
  150. ;
  151. ;
  152. ; Change the clock speed to match your equipment
  153. ;
  154.         DS    3    ;(for  "JMP   START" instruction)
  155. ;
  156. ; J-Cat dialing routines patched over PMMI routines {DWW 10-04-83}
  157. ; IF J-Cat OHK line is not connected, set both PMMIMODEM and
  158. ; SMARTMODEM to NO
  159. ;
  160. PMMIMODEM:    DB    YES    ;yes=J-Cat auto-dial enabled         103H
  161. SMARTMODEM:    DB    NO    ;yes=HAYES Smartmodem, no=non-pmmi    104H
  162. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  163. CLOCK:        DB    20    ;clock speed in MHz x10, 25.5 MHz max.    106H
  164.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  165. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200   107H
  166.                 ;6=2400 7=4800 8=9600 9=19200 default
  167. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms   108H
  168.                 ;default time to send character in ter-
  169.                 ;minal mode file transfer for slow BBS.
  170. CRDLY:        DB    3    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  171.                 ;default time for extra wait after CRLF
  172.                 ;in terminal mode file transfer
  173. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  174. SETUPTST:    DB    NO    ;yes=user-added Setup routine        10BH
  175. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  176. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  177.                 ;no=resend a record after a valid NAK
  178. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  179. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  180. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  181. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  182. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  183. ADDLF:        DB    NO    ;no=no LF after CR to send file in'    113H
  184.                 ;terminal mode (added by remote echo)
  185. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  186. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  187.                 ;write logon sequence at location LOGON
  188. SAVCCP:        DB    NO     ;yes=do not overwrite CCP        116H
  189. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  190.                 ;no=external command if EXTCHR precedes
  191. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  192. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  193. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  194.                 ;sending a file in terminal mode
  195. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  196.                 ;sending a file in terminal mode
  197. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  198. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  199. EXTRA1:        DB    0    ;for future expansion            11EH
  200. EXTRA2:        DB    0    ;for future expansion            11FH
  201. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  202. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  203. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  204. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  205. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  206. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  207. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  208. EXTCHR:        DB    '\'-40H    ;^\ = Send next character        127H
  209.         DS    2        ;                128H
  210. ;
  211. IN$MODCTL1:    LDA    MODCTL1 ! RET    ;in modem control port             12AH
  212.         DS    6
  213. OUT$MODDATP:    STA    MODDATP ! RET    ;out modem data port        134H
  214.         DS    6
  215. IN$MODDATP:    LDA    MODDATP ! RET    ;in modem data port        13EH
  216.         DS    6        ;spares if needed
  217. ;
  218. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready    148H
  219. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rcv. bit when ready    14BH
  220. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    14EH
  221. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    151H
  222.         DS    12        ;PMMI only calls        154H
  223. ;
  224. LOGONPTR:    DW    LOGON        ;for user message.        160H
  225.         DS    6        ;                162H
  226. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  227. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  228.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    16EH
  229.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    171H
  230.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    174H
  231. JMP$SETUPR:    JMP    SETUPR        ;                177H
  232. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  233. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  234. JMP$BREAK:    JMP    SENDBRK        ;                180H
  235. ;
  236. ;
  237. ; Do not change the following six lines.
  238. ;
  239. JMP$ILPRT:    DS    3        ;                183H
  240. JMP$INBUF    DS    3        ;                186H
  241. JMP$INLNCOMP:    DS    3        ;                189H
  242. JMP$INMODEM    DS    3        ;                18CH
  243. JMP$NXTSCRN:    DS    3        ;                18FH
  244. JMP$TIMER:    DS    3        ;                192H
  245. ;
  246. ;
  247. CLREOS:        CALL    JMP$ILPRT    ;                195H
  248. EOSCLR:        DB    esc,'Y',0,0,0    ;                198H
  249.         RET            ;                19DH
  250. ;
  251. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  252.         DB    esc,'*',0,0,0    ;                1A1H
  253.         RET            ;                1A6H
  254. ;
  255. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  256.         DB    'Version for Apple II with J-Cat modem'
  257.         DB    CR,LF,0
  258.         RET
  259. ;.....
  260. ;
  261. ;
  262. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  263. ;     end of your last routine should terminate by 0400H (601 bytes
  264. ;     available after start of SYSVER) if using the Hayes Smartmodem
  265. ;     or by address 0C00H (2659 bytes) otherwise.
  266. ;
  267. ;
  268. ; You can put in a message at this location which can be called up with
  269. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  270. ; desired.  End with a 0.
  271. ;
  272. LOGON:        DB    'Logon message here',0
  273. ;
  274. ; The following is used to initialize the Apple SSC on execution of the
  275. ; program.
  276. ;
  277. INITMOD:  mvi    a,1            ;default transfer time to 300
  278.       sta    mspeed
  279.       mvi    a,DTR
  280.       sta    COMMAND
  281.       lda    MODBDP            ;current baudrate from moddll
  282.           ani   0f0h            ;zero the last 4 bits
  283. ;
  284. initmod1: ori   06h            ;get default baudrate (300)
  285.       ani    9fh            ;set 8 data bits
  286.       ani    7fh            ;set 1 stop bit
  287.       sta    MODBDP            ;store default baudrate
  288.       ret
  289. ;.....
  290. ;
  291. SETUPR:   jmp    initmod
  292. ;
  293. ; J-Cat is 300 baud only -- no need to change
  294. ;
  295. ;.....
  296. ;
  297. ; send break through SSC -- 233 msec space
  298. ;
  299. SENDBRK:
  300.     lda    COMMAND     
  301.     push    psw    ; save register content
  302.     ori    0ch    ; set bits 2,3
  303.     sta    COMMAND ; break line
  304.     push    b
  305.     lxi    b,233    ; wait 233 msec
  306.     call    delay
  307.     pop    b
  308.     pop    psw    ; get original register
  309.     sta    COMMAND ; restore it
  310.     ret
  311. ;
  312. GOODBYE:
  313.     sta    ONHOOK
  314.     push    b
  315.     lxi    b,25    ;on hook for 25 msec
  316.     call    delay
  317.     pop    b
  318.     sta    OFFHOOK
  319.     push    b
  320.     lxi    b,20    ;off hook for 20 msec
  321.     call    delay
  322.     pop    b
  323.     sta    ONHOOK    ;final disconnect
  324.     RET
  325. ;
  326. ; wait for the number of millisecs in B,C
  327.  
  328. delay:    push    d    ;save d,e
  329.     inr    b    ;bump b for later dcr
  330. ;
  331. delay1    mvi    e,126    ;delay count for 1 millisec (Apple Z80 clock=2.041mhz)
  332.  
  333. delay2    dcr    e    ;count
  334.     jnz    delay2    ;  down
  335.  
  336.     dcr    c    ;more millisecs?
  337.     jnz    delay1    ;  yes
  338.     dcr    b    ;no - more in hi byte?
  339.     jnz    delay1    ;  yes
  340.     pop    d    ;  no,    restore d,e
  341.     ret
  342. ;
  343. ;-----------------------------------------------------------------------
  344. ;
  345. ; The following routine can be used to display commands on the screen
  346. ; of interest to users of this equipment.  
  347. ;
  348. SPCLMENU: RET
  349. ;
  350. ;-----------------------------------------------------------------------
  351. ;
  352. ;
  353. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  354. ;                 0C00H (without Smartmodem)
  355. ;
  356. ;-----------------------------------------------------------------------
  357. ;
  358. ; J-Cat Dialing Routines
  359. ;
  360. ; Wait for carrier
  361. ;
  362.     org    DIAL15
  363.          
  364.     mvi    d,20h    ; mask for carrier detected bit
  365.     mvi    c,96h    ; limit time waiting for carrier
  366.     call    WAIT
  367.     jnc    CONMADE
  368.     call    hangup
  369.     jmp    DIALAGN
  370.  
  371. ; Dial a digit
  372.  
  373.     org    DIALA2+8
  374.  
  375. pulse:    push    b
  376.     sta    ONHOOK
  377.     lxi    b,61    ;pulse
  378.     call    delay
  379.     sta    OFFHOOK
  380.     lxi    b,39    ;delay between pulses
  381.     call    delay
  382.     pop    b
  383.     dcr    c    ;any more pulses?
  384.     jnz    pulse    ;yes, do them
  385.     lxi    b,300    ;300-millisec delay between digits
  386.     call    delay
  387.     ret
  388.  
  389. ; Wait 2 seconds for dial tone
  390.  
  391.     org    DIALBGN+5     
  392.  
  393.     mvi    a,dtr
  394.     sta    MODCTL1    ; enable modem
  395.     sta    offhook    ; connect phone
  396.     lxi    b,2000
  397.     call    delay
  398.     ora    a    ; clear carry
  399.     ret
  400.  
  401. ; Hang up phone
  402.  
  403.     org    DISCONNT
  404.  
  405. hangup:    jmp goodbye
  406.     
  407. ; Check for carrier
  408.  
  409.     org    WAIT+5
  410.     lda    MODCTL1 ;get modem status
  411.               
  412. ; Patch out PMMI-specific routines, etc.
  413.     
  414.     org    RESTART+20H
  415.     cnz    SETUPR        ; original calls address not used here
  416.  
  417.     org    RETURN+23H
  418.     call    JMP$INITMOD    ; J-Cat needs re-init after dialing
  419.  
  420.     org    BREAK
  421.     jmp    JMP$BREAK    ; don't use PMMI break routine
  422.  
  423. ; The Microsoft CP/M BIOS implementation always returns FALSE
  424. ; for the status of the LST: device, so the MDM727 printer output
  425. ; routine never sends anything to the printer.  To repair that, the
  426. ; simplest patch is to skip over the LST: status test in MDM727.
  427. ; That requires a printer fast enough to keep up with the screen
  428. ; output.  At 300 baud, that may be feasible:
  429.  
  430.     org GOLIST+4
  431.     nop            ; patch out return if LST: not ready
  432.  
  433. ; Another cure, if your printer card can deliver a status byte, would
  434. ; be to patch in a status test (returning zero if printer not ready,
  435. ; non-zero if printer can accept a character) in some unused space
  436. ; and patch a CALL to that routine at GOLIST.  That requires yet another
  437. ; patch, because the INITADR routine in MDM727 automatically patches a
  438. ; call to the BIOS LISTST routine at GOLIST.  Here's an example, for a
  439. ; Videx PSIO card (serial port) in slot 1:
  440.  
  441.     org    0D00H    ; unused space
  442. PRNTST:    lda    0E099H    ; PSIO status port
  443.     ani    10H    ; check bit 4
  444.     ret        ; carry set = ready
  445.  
  446.     org    INITADR+15h
  447.     NOP
  448.     NOP
  449.     NOP
  450.  
  451.     org    GOLIST
  452.     call    PRNTST
  453.     ora    a    ; duplicate original code
  454.     rz
  455.  
  456.     END
  457.