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 / M7AM-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  419 lines

  1.  
  2. ; M7AM-1.ASM -- Apple ][ with Mountain Computer CPS card overlay for
  3. ;        MDM7xx.ASM - 11/11/83.
  4. ;
  5. ; This overlay adapts the MDM7xx program to the Mountain Computer CPS
  6. ; card and the Soroc IQ-120 emulator within Apple CP/M.  The LSTSTS BIOS
  7. ; entry is configured into the PARPRINT driver at the end by Ron Heiby.
  8. ; If you don't implement it, printer buffering won't work at all.
  9. ;
  10. ; Edit this file for your preferences then follow the "TO USE:" example
  11. ; shown below.
  12. ;
  13. ;    TO USE: First edit this file filling in answers for your own
  14. ;        equipment.  Then assemble with ASM.COM or equivalent
  15. ;        assembler.  Then use DDT to overlay the the results
  16. ;        of this program to the original .COM file:
  17. ;
  18. ;        A>DDT MDM7xx.COM
  19. ;        DDT VERS 2.2
  20. ;        NEXT  PC
  21. ;        4300 0100
  22. ;        -IM7AM-1.HEX        (note the "I" command)
  23. ;        -R            ("R" loads in the .HEX file)
  24. ;        NEXT  PC
  25. ;        4300 0000
  26. ;        -G0            (return to CP/M)
  27. ;        A>SAVE 66 MDM7xx.COM    (now have a modified .COM file)
  28. ;
  29. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  30. ;
  31. ; 11/11/83 - Renamed to M7AM-1.ASM, no changes    - Irv Hoff
  32. ; 10/01/83 - Added MARK/NOMARK parity.        - Ron Heiby
  33. ; 08/17/83 - Extended SETable items.        - Ron Heiby
  34. ; 08/09/83 - Changed log message character.    - Ron Heiby
  35. ; 08/17/83 - Modified to M707GP for Apple    - Ron Heiby
  36. ;
  37. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  38. ;
  39. BELL:        EQU    07H    ;bell
  40. CR:        EQU    0DH    ;carriage return
  41. ESC:        EQU    1BH    ;escape
  42. LF:        EQU    0AH    ;linefeed
  43. ;
  44. YES:        EQU    0FFH
  45. NO:        EQU    0
  46. ;
  47.         ORG    100H
  48. ;
  49. ;
  50. ; Change the clock speed to suit your system
  51. ;
  52.         DS    3    ;(for  "JMP   START" instruction)
  53. ;
  54. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  55. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  56. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  57. CLOCK:        DB    20    ;clock speed in MHz x10, 25.5 MHz max.    106H
  58.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  59. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  60.                 ;6=2400 7=4800 8=9600 9=19200 default
  61. BYTDLY:        DB    1    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  62.                 ;default time to send character in ter-
  63.                 ;minal mode file transfer for slow BBS.
  64. CRDLY:        DB    1    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  65.                 ;default time for extra wait after CRLF
  66.                 ;in terminal mode file transfer
  67. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  68. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  69. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  70. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  71.                 ;no=resend a record after a valid-NAK
  72. BAKUPBYTE:    DB    YES    ;yes=change any file same name to .BAK    10EH
  73. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  74. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  75. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  76. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  77. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  78.                 ;terminal mode (added by remote echo)
  79. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  80. TRANLOGON:    DB    NO    ;yes=allow transmission of logon    115H
  81.                 ;write logon sequence at location LOGON
  82. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  83. LOCONEXTCHR:    DB    YES    ;yes=local command if EXTCHR precedes    117H
  84.                 ;no=external command if EXTCHR precedes
  85. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  86. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  87. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH
  88.                 ;sending a file in terminal mode
  89. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  90.                 ;sending a file in terminal mode
  91. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  92. IGNORCTL:    DB    NO    ;yes=CTL-chars above ^M not displayed    11DH
  93. EXTRA1:        DB    0    ;for future expansion            11EH
  94. EXTRA2:        DB    0    ;for future expansion            11FH
  95. BRKCHR:        DB    '@'-40H    ;^@ = Send 300 ms. break tone        120H
  96. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  97. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  98. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  99. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  100. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  101. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  102. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  103. ;
  104. ;
  105.         DS    2        ;                128H
  106. ;
  107. IN$MODCTL1:    RET            ;in modem control port        12AH
  108.         DS    9
  109. OUT$MODDATP:    ORI    0        ;OUT$MODDATP+1 is mask location 134H
  110.         JMP    RH$OUTDATP    ;out modem data port        136H
  111.         DS    5
  112. IN$MODDATP:    JMP    RH$INDATP    ;in modem data port        13EH
  113.         DS    7
  114. ANI$MODRCVB:    RET  !    NOP  !    NOP    ;bit to test for receive ready    148H
  115. CPI$MODRCVR:    JMP    RH$MODRCVR    ;value of rcv. bit when ready    14BH
  116. ANI$MODSNDB:    RET  !    NOP  !    NOP    ;bit to test for send ready    14EH
  117. CPI$MODSNDR:    XRA A ! RET  !    NOP    ;value of send bit when ready    151H
  118.         DS    6        ;                154H
  119. ;
  120. OUT$MODCTL1:    RET  !    NOP  !    NOP    ;out modem control port #2    15AH
  121. OUT$MODCTL2:    RET  !    NOP  !    NOP    ;out modem control port #1    15DH
  122. ;
  123. LOGONPTR:    DW    LOGON        ;for user message.        160H
  124.         DS    6        ;                162H
  125. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  126. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  127.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  128.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  129.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  130. JMP$SETUPR:    JMP    SETUPR        ;                177H
  131. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  132. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  133. JMP$BREAK:    JMP    SENDBRK        ;                180H
  134. ;
  135. ;
  136. ; Do not change the following six lines.
  137. ;
  138. JMP$ILPRT:    DS    3        ;                183H
  139. JMP$INBUF    DS    3        ;                186H
  140. JMP$INLNCOMP:    DS    3        ;                189H
  141. JMP$INMODEM    DS    3        ;                18CH
  142. JMP$NXTSCRN:    DS    3        ;                18FH
  143. JMP$TIMER    DS    3        ;                192H
  144. ;
  145. ;
  146. ; Routine to clear to end of screen.  If using CLREOS and CLRSCRN, set
  147. ; SCRNTEST to YES at 010AH (above).
  148. ;
  149. CLREOS:        CALL    JMP$ILPRT    ;                195H
  150.         DB    ESC,'Y',0,0,0    ;                198H
  151.         RET            ;                19DH
  152. ;
  153. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  154.         DB    ESC,'*',0,0,0    ;                1A1H
  155.         RET            ;                1A6H
  156.     
  157. ;
  158. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  159.         DB    'Apple ][ with CPS card',CR,LF,0
  160.         RET
  161. ;.....
  162. ;
  163. ;
  164. ;-----------------------------------------------------------------------
  165. ;
  166. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  167. ;     end of your last routine should terminate by 0400H (601 bytes
  168. ;     available after start of SYSVER) if using the Hayes Smartmodem
  169. ;     or by address 0C00H (2659 bytes) otherwise.
  170. ;
  171. ;-----------------------------------------------------------------------
  172. ;
  173. ; You can put in a message at this location which can be called up with
  174. ; CTL-L if TRANLOGON has been set TRUE.  You can use several lines if
  175. ; desired.  End with a 0.
  176. ;
  177. LOGON:    DB    'L',0
  178. ;.....
  179. ;
  180. ;
  181. ; Add your own routine here to send a break tone to reset some Tym-Shar
  182. ; computers, if desired.
  183. ;
  184. SENDBRK:PUSH    PSW
  185.     PUSH    D
  186.     MVI    A,80H
  187.     STA    0E2FEH
  188.     MVI    A,2FH
  189.     STA    0E2FBH
  190.     LXI    D,10000        ;pause here
  191. ;
  192. SLEEP1:    DCX    D
  193.     MOV    A,D
  194.     ORA    E        ;both d&e zero?
  195.     JNZ    SLEEP1
  196.     MVI    A,27H
  197.     STA    0E2FBH
  198.     MVI    A,00H
  199.     STA    0E2FEH
  200.     POP    D
  201.     POP    PSW
  202.     RET
  203. ;.....
  204. ;
  205. ;
  206. ; Add your own routine here to put DTR low and/or send a break tone.
  207. ; Check other routines such as MDM709DP.ASM which is using this feature.
  208. ;
  209. GOODBYE:RET
  210. ;.....
  211. ;
  212. ;
  213. ; You can use this area for any special initialization or setup you may
  214. ; wish to include.  Each must stop with a RET.    You can check the other
  215. ; available overlays for ideas how to write your own routines if that
  216. ; may be of some help.
  217. ;
  218. INITMOD:LDA    MSPEED        ;be sure baud rate set
  219.     CPI    1        ;300 baud?
  220.     JZ    OK300
  221.     CPI    5        ;1200 baud?
  222.     JZ    OK1200
  223.     CALL    JMP$ILPRT
  224.     DB    'Bad baud. Use SET.',CR,LF,BELL,0
  225.     RET
  226. ;.....
  227. ;
  228. ;
  229. SETUPR:    LXI    D,BAUDBUF    ;point to input buffer for inlncomp
  230.     CALL    JMP$ILPRT
  231.     DB    'All but HAYES and baud set NOHAYES!',CR,LF,LF
  232.     DB    'HAYES, NOHAYES, TOUCH, PULSE, BAK, NOBAK,',CR,LF
  233.     DB    'IGNORECTL, NOIGNORE, MARK or NOMARK parity,',CR,LF
  234.     DB    'or cps rate (30 or 120): ',0
  235.     CALL    JMP$INBUF
  236.     LXI    D,BAUDBUF+2
  237.     CALL    JMP$INLNCOMP    ;cmpr baudbuf+2 with chars below
  238.     DB    '30',0
  239.     JNC    OK300        ;go if got match
  240.     CALL    JMP$INLNCOMP
  241.     DB    '120',0
  242.     JNC    OK1200
  243.     MVI    A,NO        ;kill off hayes to avoid sending
  244.     STA    SMARTMODEM    ;"at" to the modem.
  245.     CALL    JMP$INLNCOMP
  246.     DB    'NOHAYES',0
  247.     RNC
  248.     CALL    JMP$INLNCOMP
  249.     DB    'HAYES',0
  250.     JC    LBL2
  251.     MVI    A,YES
  252.     STA    SMARTMODEM
  253.     RET
  254. ;.....
  255. ;
  256. ;
  257. LBL2:    CALL    JMP$INLNCOMP
  258.     DB    'TOUCH',0
  259.     JC    LBL3
  260.     MVI    A,'T'
  261.     STA    TOUCHPULSE
  262.     RET
  263. ;.....
  264. ;
  265. ;
  266. LBL3:    CALL    JMP$INLNCOMP
  267.     DB    'PULSE',0
  268.     JC    LBL4
  269.     MVI    A,'P'
  270.     STA    TOUCHPULSE
  271.     RET
  272. ;.....
  273. ;
  274. ;
  275. LBL4:    CALL    JMP$INLNCOMP
  276.     DB    'BAK',0
  277.     JC    LBL5
  278.     MVI    A,YES
  279.     STA    BAKUPBYTE
  280.     RET
  281. ;.....
  282. ;
  283. ;
  284. LBL5:    CALL    JMP$INLNCOMP
  285.     DB    'NOBAK',0
  286.     JC    LBL6
  287.     MVI    A,NO
  288.     STA    BAKUPBYTE
  289.     RET
  290. ;.....
  291. ;
  292. ;
  293. LBL6:    CALL    JMP$INLNCOMP
  294.     DB    'IGNORECTL',0
  295.     JC    LBL7
  296.     MVI    A,YES
  297.     STA    IGNORCTL
  298.     RET
  299. ;.....
  300. ;
  301. ;
  302. LBL7:    CALL    JMP$INLNCOMP
  303.     DB    'MARK',0
  304.     JC    LBL8
  305.     MVI    A,80H
  306.     STA    OUT$MODDATP+1
  307.     RET
  308. ;.....
  309. ;
  310. ;
  311. LBL8:    CALL    JMP$INLNCOMP
  312.     DB    'NOMARK',0
  313.     JC    LBL9
  314.     MVI    A,0
  315.     STA    OUT$MODDATP+1
  316.     RET
  317. LBL9:    CALL    JMP$INLNCOMP
  318.     DB    'NOIGNORE',0
  319.     JC    SETUPR        ;none of above, so try again
  320.     MVI    A,NO        ;do set to allow control chars
  321.     STA    IGNORCTL
  322.     RET
  323. ;.....
  324. ;
  325. ;
  326. OK300:    MVI    A,1
  327.     STA    MSPEED
  328.     MVI    A,35H        ;baud parameter
  329.     PUSH    PSW
  330.     JMP    COMMONBAUD
  331. ;
  332. OK1200:    MVI    A,5
  333.     STA    MSPEED
  334.     MVI    A,37H        ;baud parameter
  335.     PUSH    PSW
  336. ;
  337. COMMONBAUD:
  338.     MVI    A,0
  339.     STA    0E2F8H        ;1st baud location on cps
  340.     POP    PSW
  341.     STA    0E2F2H        ;2nd baud location on cps
  342.     LXI    H,CPSINIT+1000H    ;use memory map offset for 6502
  343.     SHLD    0F3D0H
  344.     LHLD    0F3DEH
  345.     MOV    M,A
  346.     RET
  347. ;.....
  348. ;
  349. ;
  350. CPSINIT:DB    20H,000H,0C2H    ;jsr $c200 (to init card)
  351.     DB    60H        ;rts
  352. ;
  353. BAUDBUF:DW    15,0        ;tells clearbuf routine it can...
  354.     DS    15        ;..clear next fifteen bytes.
  355. ;
  356. RH$OUTDATP:
  357.     PUSH    PSW
  358.     PUSH    B
  359.     PUSH    D
  360.     PUSH    H
  361.     MOV    C,A
  362.     CALL    0F285H        ;'XOUT' serial output routine for cps
  363.     POP    H
  364.     POP    D
  365.     POP    B
  366.     POP    PSW
  367.     RET
  368. ;.....
  369. ;
  370. ;
  371. RH$INDATP:
  372.     PUSH    B
  373.     PUSH    D
  374.     PUSH    H
  375.     CALL    0F28AH        ;make sure a character is available
  376.     ANI    01H
  377.     JZ    NOGET        ;before actually trying to get it
  378.     CALL    0F280H        ;'XINP' serial input routine
  379. ;
  380. NOGET:    POP    H
  381.     POP    D
  382.     POP    B
  383.     RET
  384. ;.....
  385. ;
  386. ;
  387. RH$MODRCVR:
  388.     PUSH    B        ;value receive ready (0 if char present)
  389.     PUSH    D
  390.     PUSH    H
  391.     CALL    0F28AH        ;'XSTAT' get serial status
  392.     ANI    01H        ;mask off all other bits
  393.     RAR            ;put it into carry
  394.     CMC            ;complement it
  395.     RAL            ;put it back into accumulater
  396.     ANA    A        ;set the flags
  397.     POP    H
  398.     POP    D
  399.     POP    B
  400.     RET
  401. ;.....
  402. ;
  403. ;
  404. ; If using the Hayes Smartmodem this is unavailable without a special
  405. ; change.
  406. ;
  407. SPCLMENU:
  408.     RET
  409. ;.....
  410. ;
  411. ;
  412. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  413. ;                 0C00H (without Smartmodem)
  414. ;.....
  415. ;
  416.     END
  417. ;
  418. learbuf routine it can...
  419.     DS    15        ;..clear next fifteen bytes