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 / M7AD-4.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  492 lines

  1.  
  2. ; M7AD-4.ASM -- Coleco Adam Sydmodem overlay file for MDM7xx.  03/06/87
  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. ; This file places particular emphasis on using the Coleco Adam equip-
  7. ; ment with 8250 serial I/O.  Much of the information contained here is
  8. ; not in the main file.  If not using the Coleco Adam Sydmodem equipment
  9. ; some of the routines here will illustrate what you could do with your
  10. ; unit.
  11. ;
  12. ; Use the "SET" command to change baudrate when desired.
  13. ;
  14. ; Edit this file for your preferences then follow the "TO USE:" example
  15. ; shown below.
  16. ;
  17. ;
  18. ;    TO USE: First edit this file filling in answers for your own
  19. ;        equipment.  Then assemble with ASM.COM or equivalent
  20. ;        assembler.  Then use DDT to overlay the the results
  21. ;        of this program to the original .COM file:
  22. ;
  23. ;        A>DDT MDM7xx.COM
  24. ;        DDT VERS 2.2
  25. ;        NEXT  PC
  26. ;        4A00 0100
  27. ;        -IM7AD-2.HEX        (note the "I" command)
  28. ;        -R            ("R" loads in the .HEX file)
  29. ;        NEXT  PC
  30. ;        4A00 0000
  31. ;        -G0            (return to CP/M)
  32. ;        A>SAVE 73 MODEM7xx.COM    (now have a modified .COM file)
  33. ;
  34. ;        NOTE: If the MDM7XX file gets bigger the SAVE XX will be
  35. ;        larger. Be sure to check the hex number under NEXT..
  36. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  37. ;
  38. ; 22/06/87 - fixed disconnect bug..................Syd Carter
  39. ; 12/05/87 - Somewhere around this date added a buffer for Adams slow screen
  40. ;            scroll problem at 1200 baud speed.
  41. ;            Syd Carter
  42. ; SAME GUY
  43. ; 06/03/87 - Converted H8-4A to M7AD-2 for the Adam Sydmodem..Syd Carter
  44. ; 03/16/84 - Added SMARTMODEM EQU so IF/ENDIF statements would work
  45. ;  M7H8-4A    work corectly. - Mike Allen
  46. ; 02/26/84 - Corrected to allow SMARTMODEM YES without overrunning
  47. ;  M7H8-4    0400H in assembly. - Bill Wood
  48. ;
  49. ; 02/15/84 - Made default baud-rate follow the MSPEED equate.
  50. ;  M7H8-3                    - Rich Berg
  51. ;
  52. ; 12/11/83 - Restricted baud-rate selection for Hayes users.
  53. ;  M7H8-2    changed signon for Hayes, tells default modem
  54. ;         speed at signon.            - Tom Bering
  55. ;
  56. ; 11/11/83 - Renamed to M7H8-1.ASM, no changes    - Irv Hoff
  57. ; 10/03/82 - First version of this file
  58. ;
  59. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  60. ;
  61. BDOS        EQU    0005
  62. BUFLEN        EQU    01fh
  63. WRITEPOS    EQU    0FF20H
  64. READPOS        EQU    0FF21H
  65. CBUFFER        EQU    0FF22H
  66. BELL:        EQU    07H        ;bell
  67. CR:        EQU    0DH        ;carriage return
  68. ESC:        EQU    1BH        ;escape
  69. LF:        EQU    0AH        ;linefeed
  70. ;
  71. YES:        EQU    0FFH
  72. NO:        EQU    0
  73. ;
  74. ;
  75. ; Change the value at MODDATP if it does not match what you are using.
  76. ;
  77. MODDATP:    EQU    050H        ;data port for Sydmodem
  78. MODCTL1:    EQU    MODDATP+5    ;status port for Sydmodem
  79. MODRCVB:    EQU    1        ;bit to test for received data
  80. MODRCFE:    EQU    8            ;MODEM FRAMING ERROR
  81. MODRCVR:    EQU    1        ;modem receive ready
  82. MODSNDB:    EQU    20H        ;bit to test for ready to send
  83. MODSNDR:    EQU    20H        ;modem send ready bit
  84. ;
  85. SMARTMODEM:    EQU    YES    ;yes=HAYES SmartModem, no=non-Hayes
  86.                 ;put here to make 'IF-ENDIF' happy
  87. ;
  88.         ORG    100H
  89. ;
  90. ; Change the clock speed if needed, to match your system
  91. ;
  92.         DS    3    ;(for  "JMP   START" instruction)
  93. ;
  94. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  95. SMODEM:        DB    SMARTMODEM    ;now prog & 'IF-ENDIF' happy    104H
  96. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  97. CLOCK:        DB    37    ;clock speed in MHz x .1, 25.5 MHz max. 106H
  98.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  99. MSPEED:     DB    5    ;set to desired default. 1=300 2=450    107H
  100.                 ;4=600 5=1200 8=9600 
  101. BYTDLY:     DB    1    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  102.                 ;default time to send character in ter-
  103.                 ;minal mode file transfer for slow BBS.
  104. CRDLY:        DB    1    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  105.                 ;default time for extra wait after CRLF
  106.                 ;in terminal mode file transfer
  107. NOOFCOL:    DB    2    ;number of DIR columns shown        10AH
  108. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  109. SCRNTEST:    DB    NO    ;Cursor control routine         10CH
  110. ACKNAK:     DB    YES    ;yes=resend a record after any non-ACK    10DH
  111.                 ;no=resend a record after a valid NAK
  112. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  113. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  114. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  115. CONVBKSP:    DB    YES    ;yes=convert backspace to rub        111H
  116. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  117. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  118.                 ;terminal mode (added by remote echo)
  119. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  120. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  121.                 ;write logon sequence at location LOGON
  122. SAVCCP:     DB    YES    ;yes=do not overwrite CCP        116H
  123. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  124.                 ;no=external command if EXTCHR precedes
  125. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  126. LSTTST:     DB    YES    ;yes=printer available on printer port    119H
  127. XOFFTST:    DB    YES    ;yes=checks for XOFF from remote while    11AH
  128.                 ;sending a file in terminal mode
  129. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  130.                 ;sending a file in terminal mode
  131. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  132. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  133. EXTRA1:     DB    0    ;for future expansion            11EH
  134. EXTRA2:     DB    0    ;for future expansion            11FH
  135. BRKCHR:     DB    '@'-40H ;^@ = Send a 300 ms. break tone     120H
  136. NOCONNCT:    DB    'N'-40H ;^N = Disconnect from the phone line    121H
  137. LOGCHR:     DB    'L'-40H ;^L = Send logon            122H
  138. LSTCHR:     DB    'P'-40H ;^P = Toggle printer            123H
  139. UNSAVE:     DB    'R'-40H ;^R = Close input text buffer        124H
  140. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  141. SAVECHR:    DB    'Y'-40H ;^Y = Open input text buffer        126H
  142. EXTCHR:     DB    '^'-40H ;^^ = Send next character        127H
  143. ;
  144. ;
  145.         DS    2        ;                128H
  146. ;
  147. IN$MODCTL1:    JMP    CHKBUF
  148.         DS    7
  149. OUT$MODDATP:    OUT    MODDATP ! RET    ;out modem data port        134H
  150.         DS    7
  151. IN$MODDATP:    JMP    READBUF
  152.         DS    7
  153. ANI$MODRCVB:    ANI    MODRCVB+MODRCFE ! RET    ;bit to test for receive ready    148H
  154. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rcv. bit when ready    14BH
  155. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    14EH
  156. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    151H
  157.         DS    12        ;PMMI only calls        154H
  158. ;
  159. ;
  160. LOGONPTR:    DW    LOGON        ;for user message.        160H
  161.         DS    6        ;                162H
  162. JMP$GOODBYE:    JMP    GOODBYE     ;                168H
  163. JMP$INITMOD:    JMP    INIT        ;go to user written routine    16BH
  164.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  165.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  166.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  167. JMP$SETUPR:    JMP    SETUPR        ;                177H
  168. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  169. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  170. JMP$BREAK:    JMP    SENDBRK     ;                180H
  171. ;
  172. ;
  173. ; Do not change the following six lines.
  174. ;
  175. JMP$ILPRT:    DS    3        ;                183H
  176. JMP$INBUF    DS    3        ;                186H
  177. JMP$INLNCOMP:    DS    3        ;                189H
  178. JMP$INMODEM    DS    3        ;                18CH
  179. JMP$NXTSCRN:    DS    3        ;                18FH
  180. JMP$TIMER    DS    3        ;                192H
  181. ;
  182. ;
  183. ; The following clear the screen for the H19 or Sydmodem terminal
  184. ;
  185. CLREOS:     CALL    JMP$ILPRT    ;                195H
  186.         DB    ESC,'J',0,0,0    ;                198H
  187.         RET            ;                19DH
  188. ;
  189. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  190.         DB    ESC,'E',0,0,0    ;                1A1H
  191.         RET            ;                1A6H
  192. ;
  193. ;
  194. SYSVER:     CALL    JMP$ILPRT    ;                1A7H
  195.         IF    SMARTMODEM
  196.         DB    'Version for Coleco Adam + Sydmodem 1200'
  197.         ENDIF
  198.         IF    NOT SMARTMODEM
  199.         DB    'Version for Sydmodem with 8250 I/O'
  200.         ENDIF
  201.         DB    CR,LF,LF,'DEFAULT ',0
  202.         CALL    BAUD
  203.         CALL    JMP$ILPRT
  204.         DB    ' BAUD'
  205.         DB    CR,LF,0
  206.         RET
  207. ;
  208. ;.....
  209. ;
  210. ;
  211. ;-----------------------------------------------------------------------
  212. ;
  213. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  214. ;     end of your last routine should terminate by 0400H (601 bytes
  215. ;     available after start of SYSVER) if using the Hayes Smartmodem
  216. ;     or by address 0C00H (2659 bytes) otherwise.
  217. ;
  218. ;-----------------------------------------------------------------------
  219. ;
  220. ; You can put in a message at this location which can be called up with
  221. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  222. ; desired.  End with a 0.
  223. ;
  224. LOGON:      DB    'A content Adam user',CR,0
  225. ;.....
  226. ;
  227. ;
  228. ; This routine sends a 300 ms. break tone to reset some time-share
  229. ; computers.
  230. ;
  231. SENDBRK:  MVI    A,40H        ;SET BREAK TONE
  232.       OUT    MODDATP+3
  233.       JMP    GOODBYE1    ;SEND A 300 MS. BREAK TONE
  234. ;
  235. ;.....
  236. ;
  237. ;
  238. ; This routine sends a 300 ms. break tone and sets DTR low for the same
  239. ; length of time to disconnect some modems such as the Bell 212A, etc.
  240. ;
  241. GOODBYE:
  242.       DI
  243.       XRA    A
  244.       OUT    MODDATP+4    ;SET DTR AND RTS LOW
  245.       MVI    A,40H        ;SET BREAK TONE
  246.       OUT    MODDATP+3
  247. ;
  248. GOODBYE1: MVI    B,3        ;WAIT 300 MS.
  249.       CALL    JMP$TIMER
  250.       MVI    A,03H        ;RESET TO NORMAL 8 BITS
  251.       OUT    MODDATP+3
  252.       MVI    A,09H
  253.       OUT    MODDATP+4    ;RESET DTR HIGH
  254.       EI
  255.       RET
  256. ;.....
  257. ;
  258. ;
  259. BAUD:    LDA    MSPEED
  260.     CPI    1
  261.     JNZ    BAUD1
  262.     CALL    JMP$ILPRT
  263.     DB    '300',0
  264.     RET
  265. BAUD1:    CPI    2
  266.     JNZ    BAUD2
  267.     CALL    JMP$ILPRT
  268.     DB    '450',0
  269.     RET
  270. BAUD2:    CPI    3
  271.     JNZ    BAUD5
  272.     CALL    JMP$ILPRT
  273.     DB    '600',0
  274.     RET
  275. BAUD5:    CPI    5
  276.     JNZ    BAUD8
  277.     CALL    JMP$ILPRT
  278.     DB    '1200',0
  279.     RET
  280. BAUD8:    CALL    JMP$ILPRT
  281.     DB    '9600',0
  282.     RET
  283. ;
  284. ;
  285. ; The following is used to initialize the SYDMODEM 8250 I/O port
  286. ;
  287. INIT:    LDA    MSPEED
  288.     CPI    1
  289.     JZ    OK300
  290.     CPI    2
  291.     JZ    OK450
  292.     CPI    3
  293.     JZ    OK600
  294.     CPI    5
  295.     JZ    OK1200
  296.     CPI    8
  297.     JZ    OK9600
  298. INITMOD:  MVI    A,5        ;default transfer speed to 1200 baud
  299.       STA    MSPEED
  300.       DI            ;turn off interrupts for init.
  301.       MVI    A,0C9H    ;RETURN
  302.       STA    0020H    ;I HOPE THIS DOES IT.
  303. SET$INT      LXI    H,INT$RTN
  304.       SHLD    0039H
  305.       MVI    A,0C3H
  306.       STA    0038H
  307.       MVI    A,1
  308.       OUT    MODDATP+1    ;interrupt enable register
  309.       MVI    A,82H        ;insure out of mode to set baud rate
  310.       OUT    MODDATP+3    ;line control register
  311.       OUT    MODDATP+3
  312. ;
  313. LSPSPD:   MVI    A,01H        ;default 'LSP' speed for 300 baud
  314.       OUT    MODDATP     ;register for 'LSP' speed if enabled
  315. ;
  316. MSPSPD:   MVI    A,0H        ;default 'MSP' speed for 1200 baud
  317.       OUT    MODDATP+1    ;register for 'MSP' speed if enabled
  318. ;
  319.       MVI    A,03H        ;8-level, 1 stop bit, no parity
  320.       OUT    MODDATP+3    ;line control register
  321.       MVI    A,09H        ;set 'DTR' for proper modem output level
  322.       OUT    MODDATP+4    ;modem control register
  323.       DB    0EDH,056H
  324.       EI
  325.         RET
  326. ;
  327. READBUF:
  328.         DI
  329.         PUSH    D
  330.         PUSH    H
  331.         LDA    READPOS
  332.         LXI    H,CBUFFER
  333.         MOV    E,A
  334.         MVI    D,0
  335.         DAD    D
  336. ;INCREMENT READBUFFER POSITION 
  337.         INR    A
  338.         ANI    BUFLEN
  339.         STA    READPOS
  340. ;PUT CHARACTER INTO A
  341.         MOV    A,M
  342.         POP    H
  343.         POP    D
  344.         EI
  345.         RET
  346. CHKBUF:        PUSH    H
  347.         IN    MODCTL1
  348.         CALL    ANI$MODSNDB
  349.         CALL    CPI$MODSNDR
  350.         JZ    THRE
  351. THRF:        MVI    A,0
  352.         STA    MODCTLBUF
  353.         JMP    INSPBUF
  354. THRE:        STA    MODCTLBUF
  355. INSPBUF:
  356.         LXI    H,WRITEPOS
  357.         LDA    READPOS
  358.         CMP    M
  359.         JZ    SETNOT1
  360. SET1:        MVI    A,1
  361.         JMP    EXIT$CHKBUF
  362. SETNOT1:    MVI    A,0
  363. EXIT$CHKBUF:
  364.         LXI    H,MODCTLBUF
  365.         ADD    M
  366.         POP    H
  367.         RET
  368. INT$RTN        DI
  369.         PUSH    PSW
  370.         IN    MODCTL1
  371.         CALL    ANI$MODRCVB
  372.         CALL    CPI$MODRCVR
  373.         JNZ    EXIT$INT
  374. ;VALID DATA
  375.         PUSH    H
  376.         PUSH    D
  377.         LXI    H,CBUFFER
  378.         LDA    WRITEPOS
  379.         MOV    E,A
  380.         MVI    D,0
  381.         DAD    D
  382. GET$CHAR:    IN    MODDATP
  383.         MOV    M,A
  384. ADJ$WRPOS:    LDA    WRITEPOS
  385.         INR    A
  386.         ANI    BUFLEN
  387.         STA    WRITEPOS
  388.         POP    D
  389.         POP    H
  390. EXIT$INT:
  391.         IN    MODDATP
  392.         POP    PSW
  393.         EI
  394.         DB    0EDH,04DH
  395. MODCTLBUF    DB    0
  396. ;.....
  397. ;
  398. ;
  399. ; The following routine changes the baud rate for the SYDMODEM with the SET
  400. ; command.
  401. ;
  402.     IF    SMARTMODEM
  403. SETUPR: CALL    JMP$ILPRT
  404.     DB    'Select Baud Rate ( 300  1200 ) : ',0
  405.     LXI    D,BAUDBUF    ;point to input buffer for INLNCOMP
  406.     CALL    JMP$INBUF
  407.     LXI    D,BAUDBUF+2    ;compare BAUDBUF+2 w/chars below
  408.     ENDIF
  409. ;
  410. SETUPR1:
  411.     CALL    JMP$INLNCOMP
  412.     DB    '300',0
  413.     JNC    OK300        ;go if got match
  414.     CALL    JMP$INLNCOMP
  415.     DB    '450',0
  416.     JNC    OK450
  417.     CALL    JMP$INLNCOMP
  418.     DB    '1200',0
  419.     JNC    OK1200
  420.     CALL    JMP$ILPRT    ;all matches failed - complain
  421.     DB    '++ INVALID BAUDRATE ++',CR,LF,BELL,0
  422.     JMP    SETUPR        ;try again
  423. ;
  424.     IF    NOT SMARTMODEM
  425. SETUPR: CALL    JMP$ILPRT
  426.     DB    'SELECT BAUD RATE (300, 450, 600, 1200, 9600): ',0
  427.     LXI    D,BAUDBUF
  428.     CALL    JMP$INBUF
  429.     LXI    D,BAUDBUF+2
  430.     CALL    JMP$INLNCOMP
  431.     DB    '600',0
  432.     JNC    OK600
  433.     CALL    JMP$INLNCOMP
  434.     DB    '9600',0
  435.     JNC    OK9600
  436.     JMP    SETUPR1
  437.     ENDIF
  438. ;
  439. OK300:      MVI    A,1        ;MSPEED 300 baud value
  440.       LHLD    BD300        ;get 300 baud parameters in HL
  441.       JMP    LOADBD        ;go load them
  442. ;
  443. OK450:      MVI    A,2
  444.       LHLD    BD450
  445.       JMP    LOADBD
  446. ;
  447. OK600:      MVI    A,3
  448.       LHLD    BD600
  449.       JMP    LOADBD
  450. ;
  451. OK1200:   MVI    A,5
  452.       LHLD    BD1200
  453.       JMP    LOADBD
  454. ;
  455. OK9600:   MVI    A,8
  456.       LHLD    BD9600
  457. ;
  458. LOADBD:   STA    INITMOD+1    ;store speed to show transfer time
  459.       MOV    A,L        ;get least significant baud rate byte
  460.       STA    LSPSPD+1    ;store in INITMOD
  461.       MOV    A,H        ;get most signifcant baud rate byte
  462.       STA    MSPSPD+1    ;store in INITMOD
  463.       JMP    INITMOD     ;reset SYDMODEM 8250
  464. ;
  465. ;
  466. ; Table of baud rate parameters
  467. ;
  468. BD300:      DW    0180H
  469. BD450:      DW    0100H
  470. BD600:      DW    00C0H
  471. BD1200:   DW    0060H
  472. BD9600:   DW    000CH
  473. ;
  474. BAUDBUF:  DB    10,0
  475.       DS    10
  476. ;
  477. ;-----------------------------------------------------------------------
  478. ;
  479. ; This routine can be used for your equipment, be sure to end with RET.
  480. ; If using the Hayes Smartmodem this is unavailable without a special
  481. ; change.
  482. ;
  483. SPCLMENU: RET
  484. ;
  485. ;-----------------------------------------------------------------------
  486. ;
  487. ;
  488. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  489. ;                 0D00H (without Smartmodem)
  490. ;
  491.       END
  492.