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 / M7OS-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  11KB  |  368 lines

  1. ;
  2. ; M7OS-2.ASM  -  Osborne Overlay for MDM7xx - 5/16/84
  3. ;
  4. ; You will want to look this file over carefully.  There are a number of
  5. ; options that can be used to configure the program to suit your taste.
  6. ;
  7. ; Use the "SET" command to change the baudrate when desired.  It starts
  8. ; out at 300 baud when the program is first called up.
  9. ;
  10. ; NOTE:  Any programmer updating the main program should check the
  11. ;     address:  SETUPADR -- it may have changed with your update.
  12. ;     Alter accordingly.
  13. ;
  14. ;
  15. ;    TO USE: First edit this file filling in answers for your own
  16. ;        equipment.  Then assemble with ASM.COM or equivalent
  17. ;        assembler.  Then use DDT to overlay the the results
  18. ;        of this program to the original .COM file:
  19. ;
  20. ;        A>DDT MDM7xx.COM
  21. ;        DDT VERS 2.2
  22. ;        NEXT  PC
  23. ;        4A00 0100
  24. ;        -IM7OS-2.HEX        (note the "I" command)
  25. ;        -R            (loads in the .HEX file)
  26. ;        NEXT  PC
  27. ;        4A00 0000
  28. ;        -G0            (return to CP/M)
  29. ;        A>SAVE 73 MDM7xx.COM    (now have modified .COM file)
  30. ;
  31. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  32. ;
  33. ; 05/16/84 - Added MEX conditional              - Ron Fowler
  34. ; 11/11/83 - Renamed to M7OS-1.ASM, no changes    - Irv Hoff
  35. ; 07/27/83 - Renamed to work with MDM712    - Irv Hoff
  36. ; 07/01/83 - Revised to work with MDM711    - Irv Hoff
  37. ; 06/22/83 - Revised to work with MDM710    - Irv Hoff
  38. ; 05/27/83 - Revised to work with MDM709    - Irv Hoff
  39. ; 05/15/83 - Revised to work with MDM708    - Irv Hoff
  40. ; 04/11/83 - Updated to work with MDM707    - Irv Hoff
  41. ; 04/04/83 - Updated to work with MDM706    - Irv Hoff
  42. ; 02/27/83 - Updated to work with MDM705    - Irv Hoff
  43. ; 02/17/83 - Updated to work with MDM704    - Irv Hoff
  44. ; 02/07/83 - Updated to work with MDM703    - Irv Hoff
  45. ; 01/27/83 - Updated to work with MDM702    - Irv Hoff
  46. ; 01/10/83 - Updated to work with MDM701    - Irv Hoff
  47. ; 11/29/82 - Overlay file for Osborne O-1    - Paul Kelley
  48. ;
  49. ;
  50. ; Set the following equate to 0 if you're running MDM,
  51. ; set it to 1 if you're running MEX (the difference is
  52. ; trivial, but allows the MEX CLONE function to work).
  53. ;
  54. ;
  55. MEX        EQU    1
  56. ;
  57. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  58. ;
  59. BELL:        EQU    07H        ;bell
  60. CR:        EQU    0DH        ;carriage return
  61. ESC:        EQU    1BH        ;escape
  62. LF:        EQU    0AH        ;linefeed
  63. ;
  64. YES:        EQU    0FFH
  65. NO:        EQU    0
  66. ;
  67. ;
  68. MODCTLP:    EQU    2A00H    ;status register for RS232
  69. MODDATP:    EQU    MODCTLP+1 ;data resister for RS232
  70. MODSNDB:    EQU    2    ;bit to test for ready to send
  71. MODSNDR:    EQU    2    ;modem send ready when high
  72. MODRCVB:    EQU    1    ;bit to test for received data
  73. MODRCVR:    EQU    1    ;modem receive ready when high
  74. ;
  75. ;
  76. ;
  77. ; Change CLOCK to match your equipment
  78. ;
  79.         ORG    100H
  80. ;
  81.         DS    3    ;(for  "JMP   START" instruction)
  82. ;
  83. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  84. SMARTMODEM:    DB    YES    ;yes=HAYES Smartmodem, no=non-PMMI    104H
  85. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  86. CLOCK:        DB    40      ;clock speed in MHz x10, 25.5 MHz max.    106H
  87.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  88. MSPEED:        DB    5    ;0=110 1=300 2=450 3=600 4=710 5=1200    107H
  89.                 ;6=2400 7=4800 8=9600 9=19200 default
  90. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms    108H
  91.                 ;default time to send character in ter-
  92.                 ;minal mode file transfer for slow BBS.
  93. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  94.                 ;default time for extra wait after CRLF
  95.                 ;in terminal mode file transfer
  96. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  97. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  98. SCRNTEST:    DB    YES    ;cursor control routine         10CH
  99. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  100.                 ;no=resend a record after a valid NAK
  101. BAKUPBYTE:    DB    YES    ;yes=change any file same name to .BAK    10EH
  102. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  103. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  104. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  105. TOGGLEBK:    DB    YES    ;yes=allow toggling of bksp to rub    112H
  106. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  107.                 ;terminal mode (added by remote echo)
  108. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  109. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  110.                 ;write logon sequence at location LOGON
  111. NOSAVE:        DB    NO    ;DO NOT CHANGE, MUST BE 'NO' FOR OS-1    116H
  112. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  113.                 ;no=external command if EXTCHR precedes
  114. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  115. LSTTST:        DB    NO    ;yes=printer available on printer port    119H
  116. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  117.                 ;sending a file in terminal mode
  118. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  119.                 ;sending a file in terminal mode
  120. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  121. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  122. EXTRA1:        DB    0    ;for future expansion            11EH
  123. EXTRA2:        DB    0    ;for future expansion            11FH
  124. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ma. break tone        120H
  125. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  126. LOGCHR:        DB    'L'-40H    ;^L = Send logon            122H
  127. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  128. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  129. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  130. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  131. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  132.         DS    2        ;                128H
  133. ;
  134. IN$MODCTLP:    CALL    OSTAT    ! RET    ;get the I/O status        12AH
  135.         DS    6
  136. ;
  137. OUT$MODDATP:    CALL    OSOUT    ! RET    ;send a character to the I/O    134H
  138.         DS    6
  139. ;
  140. IN$MODDATP:    CALL    OSIN    ! RET    ;get a character from the I/O    13EH
  141.         DS    6
  142. ;
  143. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready    148H
  144. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rcv. bit when ready    14BH
  145. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    14EH
  146. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    151H
  147.         DS    12        ;                156H
  148. LOGONPTR:    DW    LOGON        ;for user message.        160H
  149.         DS    6        ;                162H
  150. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  151. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  152.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    16EH
  153.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    171H
  154.         RET  !    NOP  !    NOP    ;(by-passes PMMI routine)    174H
  155. JMP$SETUPR:    JMP    SETUPR        ;                177H
  156. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  157. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  158. JMP$BREAK:    JMP    SENDBRK        ;                180H
  159. ;
  160. ;
  161. ; Do not change the following six lines.
  162. ;
  163. JMP$ILPRT:    DS    3        ;                183H
  164. JMP$INBUF    DS    3        ;                186H
  165. JMP$INLNCOMP:    DS    3        ;                189H
  166. JMP$INMODEM    DS    3        ;                18CH
  167. JMP$NXTSCRN:    DS    3        ;                18FH
  168. JMP$TIMER:    DS    3        ;                192H
  169. ;
  170. CLREOS:        CALL    JMP$ILPRT    ;                195H
  171.         DB    0,0,0,0,0    ;O-1 has no clear EOS.        198H
  172.         RET            ;                19DH
  173. ;
  174. CLRSCRN:    CALL JMP$ILPRT        ;                19EH
  175.         DB    1AH,0,0,0,0    ;O-1 clear screen, home cursor    1A1H
  176.         RET            ;                1A6H
  177. ;
  178. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  179.             
  180.         DB    'Version for OSBORNE O-1'
  181.         DB    CR,LF,0
  182.         RET
  183. ;.....
  184. ;
  185. ;
  186. ;-----------------------------------------------------------------------
  187. ;
  188. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  189. ;     end of your last routine should terminate by 0400H (601 bytes
  190. ;     available after start of SYSVER) if using the Hayes Smartmodem
  191. ;     or by address 0C00H (2659 bytes) otherwise.
  192. ;
  193. ;-----------------------------------------------------------------------
  194. ;
  195. ; You can put in a message at this location which can be called up with
  196. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  197. ; desired.  End with a 0.
  198. ;
  199. LOGON:        DB    'xxxxxxxxx',CR,LF,0
  200. ;.....
  201. ;
  202. ;
  203. ; You can put a routine here that sends a break tone to reset time-share
  204. ; computers.
  205. ;
  206. SENDBRK:    RET
  207. ;.....
  208. ;
  209. ;
  210. ; You can put a routine here that sets DTR low and sends a break tone to
  211. ; disconnect the phone line.  End with a RET.
  212. ;
  213. GOODBYE:    RET
  214. ;.....
  215. ;
  216. ;
  217. ; You can put any items in this area you wish to display that are of in-
  218. ; terest to those using this equipment.  If using the Hayes Smartmodem
  219. ; this is unavailable without a special address change.  End the routine
  220. ; with a RET.
  221. ;
  222. SPCLMENU:    RET
  223. ;.....
  224. ;
  225. ;
  226. ; This is the Osborne initialization routine.
  227. ;    
  228. INITMOD:
  229.       IF    NOT MEX        ;NOT NEEDED IN MEX: FOULS UP CLONE
  230.       LDA    FINITFLG    ;FLAG SET YET?
  231.       ORA    A
  232.       RNZ            ;IF YES, ALREADY BEEN THIS WAY ONCE
  233.       INR    A        ;OTHERWISE SET FLAG
  234.       STA    FINITFLG    ;..AND INITIALIZE THIS ROUTINE
  235.       ENDIF
  236. ;
  237.       LHLD    0005H+1        ;FIND START OF BDOS
  238.       LXI    D,-0100H    ;GO TO FIRST PAGE AHEAD OF BDOS
  239.       DAD    D        ;HL NOW POSITIONED ONE PAGE BELOW BDOS
  240.       PUSH    H        ;SAVE THE ADDRESS
  241.       LXI    D,BDJ        ;POINT TO OUR ROUTINE TO PUT THERE
  242.       LXI    B,CDLEN+2    ;SET LENGTH OF CODE
  243.       XCHG
  244.       DB    0EDH,0B0H    ;Z80 LDIR
  245. ;
  246.       LHLD    0005H+1        ;GET BDOS ADDRESS BACK ONCE MORE
  247.       POP    D        ;GET THE STARTING ADDRESS OFF STACK
  248.       PUSH    D        ;PUT IT BACK ON THE STACK
  249.       INX    D        ;POINT TO ADDRESS POSITION
  250.       XCHG            ;PUT INTO 'HL'
  251.       MOV    M,E        ;STORE 'LSP' ADDRESS
  252.       INX    H        ;GET 'LSP' LOCATION
  253.       MOV    M,D        ;STORE 'MSP' ADDRESS
  254.       POP    H        ;GET THE ADDRESS BACK ONCE MORE
  255.       SHLD    0005H+1        ;NEW ADDRESS TO PROTECT FOR OVERWRITE
  256. ;
  257.       LXI    D,OSIN-BDJ    ;GET THE LENGTH OF ROUTINE TO MOVE
  258.       DAD    D        ;COMUTE ADDRESS OF THE 'OSIN' ROUTINE
  259.       SHLD    IN$MODDATP+1    ;PATCH CALL FOR "GET CHAR." ROUTINE
  260.       LXI    D,OSOUT-OSIN
  261.       DAD    D
  262.       SHLD    OUT$MODDATP+1    ;PATCH CALL FOR "SEND CHAR." ROUTINE
  263.       LXI    D,OSTAT-OSOUT
  264.       DAD    D
  265.       SHLD    IN$MODCTLP+1    ;PATCH CALL FOR "GET STATUS" ROUTINE
  266. ;
  267.       MVI    A,1        ;MSPEED 300 baud value
  268.       STA    MSPEED
  269. ;
  270. ;
  271. ; SET THE INITIAL BAUD RATE TO 300
  272. ;
  273.       MVI    C,56H        ;FOR 300 BAUD
  274. ;
  275. STBAUD:      PUSH    H
  276.       CALL    OSET
  277.       POP    H
  278.       XRA    A        ;CLEAR CARRY
  279.       RET
  280. ;.....
  281. ;
  282. ;
  283. OSET:      LHLD    1        ;GET BIOS+3 ADDRESS
  284.       MVI    L,3CH        ;SPECIAL OSBORNE ROUTINE
  285.       PCHL            ;BRANCH TO IT
  286. ;.....
  287. ;
  288. ;
  289. ; Change the baud rate with the SET command
  290. ;
  291. SETUPR:      PUSH    H
  292. ;
  293. AGAIN:      LXI    D,BAUDBUF    ;POINT TO INPUT BUFFER
  294.       CALL    JMP$ILPRT
  295.       DB    'Input Baud Rate (300, 1200): ',0
  296.       CALL    JMP$INBUF
  297.       LXI    D,BAUDBUF+2
  298.       CALL    JMP$INLNCOMP    ;COMPARE BAUDBUF+2 WITH CHARACTERS BELOW
  299.       DB    '300',0
  300.       MVI    A,1        ;MSPEED 300 BAUD
  301.       MVI    C,56H        ;OSBORNE 300 BAUD
  302.       JNC    OK        ;GO IF GOT MATCH
  303. ;
  304.       CALL    JMP$INLNCOMP
  305.       DB    '1200',0
  306.       MVI    A,5        ;MSPEED 1200 BAUD
  307.       MVI    C,55H        ;OSBORNE 1200 BAUD
  308.       JNC    OK
  309.       CALL    JMP$ILPRT    ;ALL MATCHES FAILED - TELL OPERATOR
  310.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  311.       JMP    AGAIN        ;TRY AGAIN
  312. ;...
  313. ;
  314. ;
  315. OK:      STA    MSPEED        ;SET MSPEED
  316.       POP    H
  317.       JMP    STBAUD
  318. ;.....
  319. ;
  320. ;
  321. BAUDBUF:  DB    10,0
  322.       DS    10
  323. ;
  324. FINITFLG: DB    0
  325. ;.....
  326. ;
  327. ;
  328. ; --- ROUTINES THAT GET PLACED JUST UNDER 'BDOS' OVERLAYING 'CCP'
  329. ;
  330. BDJ:    JMP    $-$        ;THIS GETS PATCHED TO JUMP TO BDOS ENTRY
  331. ;
  332. OSIN:    DI            ;DISABLE INTERRUPTS
  333.     OUT    0        ;SWITCH TO ALTERNATE PAGE
  334.     LDA    MODDATP        ;GET DATA BYTE
  335.     OUT    1        ;SWITCH PAGES BACK
  336.     EI            ;RE-ENABLE INTERRUPTS
  337.     RET
  338. ;.....
  339. ;
  340. ;
  341. OSOUT:    DI            ;DISABLE INTERRUPTS
  342.     OUT    0        ;SWITDH TO ALTERNATE PAGE
  343.     STA    MODDATP        ;SEND DATA BYTE
  344.     OUT    1        ;SWITCH PAGES BACK
  345.     EI            ;RE-ENABLE INTERRUPTS
  346.     RET
  347. ;.....
  348. ;
  349. ;
  350. OSTAT:    DI            ;DISABLE INTERRUPTS
  351.     OUT    0        ;SWITCH TO ALTERNATE PAGE
  352.     LDA    MODCTLP        ;GET STATUS BYTE
  353.     OUT    1        ;SWITCH PAGES BACK
  354.     EI            ;RE-ENABLE INTERRUPTS
  355.     RET
  356. ;.....
  357. ;
  358. ;
  359. CDLEN:    EQU    $-BDJ        ;LENGTH OF CODE TO COPY
  360. ;
  361. ;-----------------------------------------------------------------------
  362. ;
  363. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  364. ;                 0C00H (without Smartmodem)
  365. ;
  366.     END
  367. ;
  368.