home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol093 / mcosb798.asm < prev    next >
Encoding:
Assembly Source File  |  1984-04-29  |  7.9 KB  |  287 lines

  1. ;
  2. ;              MCOSB797.ASM
  3. ;
  4. ;    Patches for overlaying distribution version of MODEM797,
  5. ;        for use with the Osborne O-1.
  6. ;
  7. ;You will want to look this file over carefully, there are a number
  8. ;of options that you can use to configure MODEM797 to suit your taste.
  9. ;
  10. ;
  11. ;    TO USE: First edit this file filling in answers for your own
  12. ;        equipment.  Then assemble with ASM.COM or equivalent
  13. ;        assembler.  Then use DDT to overlay the the results
  14. ;        of this program to the original MODEM797.COM file:
  15. ;
  16. ;        A>DDT MODEM797.COM
  17. ;        DDT VERS 2.2
  18. ;        NEXT  PC
  19. ;        4080 0100
  20. ;        -IMCOSB797.HEX        (note the "I" command)
  21. ;        -R            (loads in the .HEX file)
  22. ;        NEXT  PC
  23. ;        4080 0000
  24. ;        -G0            (return to CP/M)
  25. ;        A>SAVE 64 MODEM797.COM  (now have modified .COM file)
  26. ;
  27. ;
  28. ;12/17/82 - Revised for MODEM796                PLK
  29. ;
  30. ;12/01/82 - The file is left in the 11/29/82 form as an example of
  31. ;        memory mapped I/O. Osborne owners may want to use the
  32. ;        approach Frank Wancho describes.            PLK
  33. ;
  34. ;11/30/82 - This file stills uses an old-style and now obsolete form of
  35. ;        accessing the RS232 port directly thru the bank-switching
  36. ;        technique with code in memory above 4000H, all OSBORNEs
  37. ;        should have now been upgraded to at least ROM 1.2, if not
  38. ;           1.3 - the latest version. Combined with that upgrade is a
  39. ;           new BIOS that supports the IOBYTE. All that has to be done
  40. ;        is toggle the first of the two CON: bits in the IOBYTE
  41. ;        as follows:
  42. ;
  43. ;            0 - keyboard + crt (TTY:)
  44. ;            1 - serial port (CRT:)
  45. ;                                F. J. Wancho
  46. ;
  47. ;11/29/82 - Version of MODEM797 overlay file for Osborne-1. The
  48. ;        Osborne routines come from an earlier version.    P. L. Kelley
  49. ;
  50. TRUE    EQU    0FFH
  51. FALSE    EQU    0
  52. ;
  53. BELL    EQU    07H    ;bell
  54. CR    EQU    0DH    ;carriage return
  55. LF    EQU    0AH    ;linefeed
  56. ;
  57. MODCTLP    EQU    2A00H        ;status register for RS232
  58. MODSNDB    EQU    2        ;bit to test for ready to send
  59. MODSNDR    EQU    MODSNDB        ;change to 0 if bit is 0 when
  60.                 ;ready to send
  61. MODRCVB    EQU    1        ;bit to test for received data
  62. MODRCVR    EQU    MODRCVB        ;change to 0 if bit is 0 when
  63.                 ;data received
  64. MODDATP    EQU    MODCTLP+1    ;data resister for RS232
  65. ;
  66. CLR1    EQU    0        ;there is no O-1 clear to end
  67. CLR2    EQU    0        ;of screen sequence
  68. CLR3    EQU    0        ;so all bytes MUST be 0
  69. CLR4    EQU    0
  70. ;
  71. SCLR1    EQU    'Z'-40H        ;ctrl-Z for O-1 clear screen
  72. SCLR2    EQU    0        ;and home cursor
  73. SCLR3    EQU    0        ;the unused bytes MUST be 0
  74. SCLR4    EQU    0
  75. ;
  76. ;
  77. ;You can change locations 107H to 120H to suit your taste.
  78. ;
  79. ;*** WARNING - DO NOT INSERT OR DELETE LINES BEFORE SYSVERMSG: ***
  80. ;      THE DEFINED LOCATIONS ARE GIVEN ON THE RIGHT MARGIN.
  81. ;
  82. ;
  83.         ORG    100H
  84. ;
  85.         DS    3    ;(for  JMP  START)
  86. PMMIBYTE:    DB    FALSE    ;don't change this line            103H
  87. SETUPTST:    DB    TRUE    ;don't change this line            104H
  88. SCRNTEST:    DB    TRUE    ;don't change this line            105H
  89. CLOCK:        DB    2    ;don't change this line            106H
  90. BAKUPBYTE:    DB    FALSE    ;true=make .BAK file            107H
  91. CKSUMDFLT:    DB    FALSE    ;true=default to Checksum checking    108H
  92.                 ;false=default to CRC checking
  93. TOGGLECRC:    DB    TRUE    ;true=allow toggling of Checksum to CRC    109H
  94. CONVBKSP:    DB    FALSE    ;true=convert backspace to rub        10AH
  95. TOGGLEBK:    DB    TRUE    ;true=allow toggling of bksp to rub    10BH
  96. ADDLF:        DB    FALSE    ;true=add LF after CR            10CH
  97. TOGGLELF:    DB    TRUE    ;true=allow toggling of LF after CR    10DH
  98. TRANLOGON:    DB    FALSE    ;true=allow transmission of logon    10EH
  99.                 ;write logon sequence at location LOGON
  100. SAVCCP:        DB    FALSE    ;true=do not overwrite CCP        10FH
  101. LOCONEXTCHR:    DB    FALSE    ;true=local command if EXTCHR precedes    110H
  102.                 ;false=not local command if EXTCHR precedes
  103. TOGGLELOC:    DB    TRUE    ;true=allow toggling of LOCONEXTCHR    111H
  104. LSTTST:        DB    TRUE    ;true=allow toggling of printer on/off    112H
  105.                 ;in terminal mode, set to false if your
  106.                 ;printer can't keep up with the modem
  107. XOFFTST:    DB    FALSE    ;true=allow testing of XOFF from remote 113H
  108.                 ;while transmitting a file in terminal mode
  109. XONWAIT:    DB    FALSE    ;true=wait for XON after sending CR    114H
  110.                 ;while transmitting a file in terminal mode
  111. TOGXOFF:    DB    TRUE    ;true=allow toggling of XOFF testing    115H
  112. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200   116H
  113.                 ;default modem speed, PMMI routines
  114.                 ;reset this value and so should your own
  115.                 ;modem routines
  116. BYTDLY:        DB    0    ;0=0 delay, 1=0.02 sec, -- ,9=0.18 sec  117H
  117.                 ;default time to send character in
  118.                 ;terminal mode file transfer
  119. CRDLY:        DB    0    ;0=0 delay, 1=0.08 sec, -- ,9=0.72 sec    118H
  120.                 ;default time for extra wait after CR
  121.                 ;in terminal mode file transfer
  122. BELRPT:        DB    30    ;bell repeat time = value*0.03 sec    119H
  123. EXITCHR:    DB    'E'-40H    ; ^E = Exit without disconnect        11AH
  124. LOGCHR:        DB    'O'-40H    ; ^O = Send logon            11BH
  125. LSTCHR:        DB    'P'-40H    ; ^P = Toggle printer            11CH
  126. UNSAVE:        DB    'R'-40H    ; ^R = Close input text buffer        11DH
  127. TRANCHR:    DB    'T'-40H ; ^T = Transmit file to remote        11EH
  128. SAVECHR:    DB    'Y'-40H    ; ^Y = Open input text buffer        11FH
  129. EXTCHR:        DB    'W'-40H    ; ^W = Send next character        120H
  130.         DS    6    ;don't change, used only by PMMI    121H
  131. IN$MODCTLP:    JMP    MXSTAT        ;test for status        127H
  132. OUT$MODDATP:    JMP    MXOUT        ;output data to modem        12AH
  133. IN$MODDATP:    JMP    MXIN        ;get data from modem        12DH
  134. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    130H
  135. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    133H
  136. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready    136H
  137. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rcv. bit when ready    139H
  138.         DS    15        ;PMMI only calls        13CH
  139. LOGONPTR:    DW    LOGON        ;                14BH
  140. JMP$INITMOD:    JMP    MXINIT        ;go to user written routine    14DH
  141. JMP$SETUPR:    JMP    MXSETBAUD    ;                150H
  142. ;
  143. CLREOS:        CALL    JMP$ILPRT    ;                153H
  144.         DB    CLR1,CLR2,CLR3,CLR4,0
  145.         RET
  146. ;
  147. CLRSCRN:    CALL    JMP$ILPRT    ;                15CH
  148.         DB    SCLR1,SCLR2,SCLR3,SCLR4,0
  149.         RET
  150. ;
  151. JMP$ILPRT:    DS    3    ;                    165H
  152. JMP$ILCOMP:    DS    3    ;                    168H
  153. JMP$INBUFF:    DS    3    ;                    16BH
  154. JMP$SYSVER:    JMP    SYSVERMSG;                    16EH
  155. JMP$DIALPL:    DS    3    ;                    171H
  156. JMP$DISCONNT:    DS    3    ;                    174H
  157. ;
  158. SYSVERMSG:            ;                    16EH
  159.     CALL    JMP$ILPRT
  160.     DB    'Version for: OSBORNE O-1',CR,LF,0
  161.     RET
  162.  
  163. ;INSERT YOUR LOGON HERE, MUST END IN 0.
  164. LOGON:    DB    0
  165. ;
  166. MXIN:    CALL    $-$    ;patched to call input routine
  167.     RET
  168. ;
  169. MXOUT:    CALL    $-$    ;patched to call output routine
  170.     RET
  171. ;
  172. MXSTAT:
  173.     CALL    $-$    ;patched to call status routine
  174.     RET
  175. ;
  176. MXINIT:
  177.     LDA    FINITFLG
  178.     ORA    A
  179.     RZ
  180.     CMA
  181.     STA    FINITFLG
  182.     LHLD    6    ;find top of user RAM
  183.     LXI    D,-100H    ;step down a little
  184.     DAD    D
  185.     PUSH    H    ;save it
  186.     LXI    D,BDJ    ;point to source of code
  187.     LXI    B,CDLEN+2    ;set length of code
  188.     XCHG
  189.     DB    0EDH,0B0H ; Z80 LDIR
  190. ;
  191.     LHLD    6    ;get BDOS address back
  192.     POP    D
  193.     PUSH    D
  194.     INX    D    ;point to address position
  195.     XCHG
  196.     MOV    M,E    ;patch in address
  197.     INX    H
  198.     MOV    M,D
  199. ;
  200.     POP    H
  201.     SHLD    6    ;transfer BDOS jump
  202. ;
  203.     LXI    D,OSIN-BDJ
  204.     DAD    D    ;compute address of OSIN routine
  205.     SHLD    MXIN+1    ;patch call
  206.     LXI    D,OSOUT-OSIN
  207.     DAD    D
  208.     SHLD    MXOUT+1    ;patch call
  209.     LXI    D,OSTAT-OSOUT
  210.     DAD    D
  211.     SHLD    MXSTAT+1
  212. ;
  213.     MVI    A,1        ;MSPEED 300 baud value
  214.     STA    MSPEED
  215.     MVI    C,56H        ;for 300 baud
  216. STBAUD:    PUSH    H
  217.     CALL    OSET
  218.     POP    H
  219.     XRA    A    ;clear carry
  220.     RET
  221. ;
  222. OSET:    LHLD    1    ;get BIOS+3 address
  223.     MVI    L,3CH    ;special Osborne routine
  224.     PCHL        ;branch to it
  225. ;
  226. MXSETBAUD:
  227.     PUSH    H
  228. AGAIN:    LXI    D,BAUDBUF    ;point to input buffer for ILCOMP
  229.     CALL    JMP$ILPRT
  230.     DB    'Input Baud Rate (300, 1200): ',0
  231.     CALL    JMP$INBUFF
  232.     LXI    D,BAUDBUF+2
  233.     CALL    JMP$ILCOMP    ;compare BAUDBUF+2 with characters below
  234.     DB    '300',0
  235.     MVI    A,1        ;MSPEED 300 baud
  236.     MVI    C,56H        ;O-1 300 baud
  237.     JNC    OK        ;go if got match
  238.     CALL    JMP$ILCOMP
  239.     DB    '1200',0
  240.     MVI    A,5
  241.     MVI    C,55H
  242.     JNC    OK
  243.     CALL    JMP$ILPRT    ;all matches failed - tell operator
  244.     DB    '++ Incorrect entry ++',CR,LF,BELL,0
  245.     JMP    AGAIN        ;try again
  246. ;
  247. OK:    STA    MSPEED        ;set MSPEED
  248.     POP    H
  249.     JMP    STBAUD
  250. ;
  251. BAUDBUF:    DB    10,0
  252.         DS    10
  253. ;
  254. FINITFLG:    DB    TRUE
  255. ;
  256. ;
  257. ; --- ROUTINES THAT GET COPIED UP TO TOP OF MEMORY ---
  258. ;        JUST UNDER THE BDOS
  259. ;
  260. BDJ:    JMP    $-$    ;this gets patched to jump to BDOS entry
  261. ;
  262. OSIN:    DI        ;disable interrupts
  263.     OUT    0    ;switch to alternate page
  264.     LDA    MODDATP    ;get data byte
  265.     OUT    1    ;switch back pages
  266.     EI        ;re-enable interrupts
  267.     RET
  268. ;
  269. OSOUT:    DI        ;disable interrupts
  270.     OUT    0    ;switch to alternate page
  271.     STA    MODDATP    ;send data byte
  272.     OUT    1    ;switch back pages
  273.     EI        ;re-enable interrupts
  274.     RET
  275. ;
  276. OSTAT:    DI        ;disable interrupts
  277.     OUT    0    ;switch to alternate page
  278.     LDA    MODCTLP    ;get status byte
  279.     OUT    1    ;switch back pages
  280.     EI        ;re-enable interrupts
  281.     RET
  282. CDLEN:    EQU    $-BDJ    ;length of code to copy
  283. ;
  284. ;
  285.     END
  286. ;
  287.