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 / M7MFIO-2.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  13KB  |  386 lines

  1. ; M7MFIO-2.ASM  For Electralogics Inc. MFIO.  04/30/84
  2. ; You will want to look this file over carefully. There are a number of
  3. ; options that you can use to configure the program to suit your taste.
  4. ; This file places particular emphasis on using the Electralogics MFIO
  5. ; board with 8250 serial I/O.  Much of the information contained here is
  6. ; not in the main file.  
  7. ;
  8. ; Set serial port desired at 'sio' equate
  9. ;
  10. ; Use the "SET" command to change baudrate when desired.
  11. ;
  12. ; Edit this file for your preferences then follow the "TO USE:" example
  13. ; shown below.
  14. ;
  15. ;
  16. ;    TO USE: First edit this file filling in answers for your own
  17. ;        equipment.  Then assemble with ASM.COM or equivalent
  18. ;        assembler.  Then use DDT to overlay the the results
  19. ;        of this program to the original .COM file:
  20. ;
  21. ;        A>DDT MDM7xx.COM
  22. ;        DDT VERS 2.2
  23. ;        NEXT  PC
  24. ;        4x00 0100
  25. ;        -IM7MFIO-2.HEX        (note the "I" command)
  26. ;        -R            ("R" loads in the .HEX file)
  27. ;        NEXT  PC
  28. ;        4x00 0000
  29. ;        -G0            (return to CP/M)
  30. ;        A>SAVE 73 MDM7xx.COM    (now have a modified .COM file)
  31. ;               ^
  32. ;                       May vary depending upon version of MDM7xx
  33. ;
  34. ;----------------------------------------------------------------------------
  35. ; NOTE:
  36. ; The MFIO is a very complex I/O board containing 8 serial ports, 2 parallel
  37. ; ports, a real time clock, and vectored interrupt controller. All of the
  38. ; above facilities can be accessed by the use of only 9 I/O port addresses.
  39. ; This requires that the active I/O block number be stored somewhere in memory
  40. ; so that when the current I/O operation is completed, the MFIO can be
  41. ; restored to its previous I/O block (normally the system console). I have
  42. ; selected location 0000FH for the purpose and called it 'BLKSTAT'.
  43. ; Any other unused memory location is equally suitable.
  44. ;
  45. ; If this procedure is adopted in all BIOS I/O routines, all that needs
  46. ; to be done in any other I/O routine is to select the current I/O block,
  47. ; set up the MFIO command port for that block and store that value at
  48. ; location 'BLKSTAT'. Following is my CONIN routine as an example:
  49. ;
  50. ;    CONIN:    mvi    a,sio0        ; set sio0 for console I/O
  51. ;        out    cmdport        ;  and tell MFIO
  52. ;        in    linstat        ; read the line status register
  53. ;        ani    ckrb        ;  & mask console kb rdy bit
  54. ;        jz    conin        ;   loop till ready
  55. ;        in    keydat        ; read sio0 data register
  56. ;        ani    7fh        ;  strip the parity bit
  57. ;        push    psw        ;   save the byte
  58. ;        lda    blkstat        ;    & get the previous I/O block
  59. ;        out    cmdport        ;   restore MFIO to prev block
  60. ;        pop    psw        ;  get the keyboard data byte
  61. ;        ret            ; and bail out
  62. ;
  63. ; The routine "mxdin" located near the end of this program is called from
  64. ; all routines which use BIOS I/O calls that utilize MFIO resources (in my
  65. ; system, ALL I/O except the disks is MFIO-oriented). Its only purpose is
  66. ; to ensure that the system keep track of the MFIO resource blocks. If you
  67. ; get really complicated (interrupts, for example) you may need to push 
  68. ; and pop them using a 'stack'.
  69. ; 'nuff said. Luck!!
  70. ;                    - Bill Harnell
  71. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  72. ;
  73. ; 04/30/84 - Renamed and Revised for MDM7xx     - Dennis Recla
  74. ;
  75. ; 08/14/83 - Revised to work with MFIO.         - Vic Kass
  76. ;            CONIN and CONOUT routines
  77. ;            in your BIOS must reset
  78. ;            modem port after any access!
  79. ;
  80. ;
  81. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  82. ;
  83. BELL:        EQU    07H        ;bell
  84. CR:        EQU    0DH        ;carriage return
  85. ESC:        EQU    1BH        ;escape
  86. LF:        EQU    0AH        ;linefeed
  87. ;
  88. YES:        EQU    0FFH
  89. NO:        EQU    0
  90. ;
  91. ;
  92. ; Change the value at MODDATP if it does not match what you are using.
  93. ;
  94. sio:        equ    02H
  95. blkstat:    equ    0000fh        ;location to store current I/O block
  96. cmdport:    equ    48H
  97. ;
  98. MODDATP:    EQU    40H        ;data port for MFIO
  99. MODCTL1:    EQU    MODDATP+5    ;status port for MFIO
  100. MODRCVB:    EQU    1        ;bit to test for received data
  101. MODRCVR:    EQU    1        ;modem receive ready
  102. MODSNDB:    EQU    20H        ;bit to test for ready to send
  103. MODSNDR:    EQU    20H        ;modem send ready bit
  104. ;
  105. ;
  106.         ORG    100H
  107. ;
  108. ; Change the clock speed if needed, to match your system
  109. ;
  110.         DS    3    ;(for  "JMP   START" instruction)
  111. ;
  112. PMMIMODEM:    DB    NO    ;yes=PMMI S-100 Modem            103H
  113. SMARTMODEM:    DB    NO    ;yes=Smartmodem
  114. TOUCHPULSE:    DB    'T'    ;T=touch, P=pulse (Smartmodem-only)    105H
  115. CLOCK:        DB    40    ;clock speed in MHz x10, 25.5 MHz max.    106H
  116.                 ;20=2 MHh, 37=3.68 MHz, 40=4 MHz, etc.
  117. MSPEED:        DB    1    ;0=110 1=300 2=450 3=600 4=710 5=1200   107H
  118.                 ;6=2400 7=4800 8=9600 9=19200 default
  119. BYTDLY:        DB    5    ;0=0 delay  1=10ms  5=50 ms - 9=90 ms   108H
  120.                 ;default time to send character in ter-
  121.                 ;minal mode file transfer for slow BBS.
  122. CRDLY:        DB    5    ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H
  123.                 ;default time for extra wait after CRLF
  124.                 ;in terminal mode file transfer
  125. NOOFCOL:    DB    5    ;number of DIR columns shown        10AH
  126. SETUPTST:    DB    YES    ;yes=user-added Setup routine        10BH
  127. SCRNTEST:    DB    YES    ;Cursor control routine         10CH
  128. ACKNAK:        DB    YES    ;yes=resend a record after any non-ACK    10DH
  129.                 ;no=resend a record after a valid NAK
  130. BAKUPBYTE:    DB    NO    ;yes=change any file same name to .BAK    10EH
  131. CRCDFLT:    DB    YES    ;yes=default to CRC checking        10FH
  132. TOGGLECRC:    DB    YES    ;yes=allow toggling of CRC to Checksum    110H
  133. CONVBKSP:    DB    NO    ;yes=convert backspace to rub        111H
  134. TOGGLEBK:    DB    NO    ;yes=allow toggling of bksp to rub    112H
  135. ADDLF:        DB    NO    ;no=no LF after CR to send file in    113H
  136.                 ;terminal mode (added by remote echo)
  137. TOGGLELF:    DB    YES    ;yes=allow toggling of LF after CR    114H
  138. TRANLOGON:    DB    YES    ;yes=allow transmission of logon    115H
  139.                 ;write logon sequence at location LOGON
  140. SAVCCP:        DB    YES    ;yes=do not overwrite CCP        116H
  141. LOCONEXTCHR:    DB    NO    ;yes=local command if EXTCHR precedes    117H
  142.                 ;no=external command if EXTCHR precedes
  143. TOGGLELOC:    DB    YES    ;yes=allow toggling of LOCONEXTCHR    118H
  144. LSTTST:        DB    YES    ;yes=printer available on printer port    119H
  145. XOFFTST:    DB    NO    ;yes=checks for XOFF from remote while    11AH
  146.                 ;sending a file in terminal mode
  147. XONWAIT:    DB    NO    ;yes=wait for XON after CR while    11BH
  148.                 ;sending a file in terminal mode
  149. TOGXOFF:    DB    YES    ;yes=allow toggling of XOFF checking    11CH
  150. IGNORCTL:    DB    YES    ;yes=CTL-chars above ^M not displayed    11DH
  151. EXTRA1:        DB    0    ;for future expansion            11EH
  152. EXTRA2:        DB    0    ;for future expansion            11FH
  153. BRKCHR:        DB    '@'-40H    ;^@ = Send a 300 ms. break tone        120H
  154. NOCONNCT:    DB    'N'-40H    ;^N = Disconnect from the phone line    121H
  155. LOGCHR:        DB    'O'-40H    ;^O = Send logon            122H
  156. LSTCHR:        DB    'P'-40H    ;^P = Toggle printer            123H
  157. UNSAVE:        DB    'R'-40H    ;^R = Close input text buffer        124H
  158. TRANCHR:    DB    'T'-40H ;^T = Transmit file to remote        125H
  159. SAVECHR:    DB    'Y'-40H    ;^Y = Open input text buffer        126H
  160. EXTCHR:        DB    '^'-40H    ;^^ = Send next character        127H
  161. ;
  162. ;
  163.         DS    2        ;                128H
  164. ;
  165. IN$MODCTL1:    call    mxdin        ;set & store current I/O block
  166.         IN    MODCTL1 ! RET    ;in modem control port             12AH
  167.         DS    4
  168. OUT$MODDATP:    call    mxdin
  169.         OUT    MODDATP ! RET    ;out modem data port        134H
  170.         DS    4
  171. IN$MODDATP:    call    mxdin
  172.         IN    MODDATP ! RET    ;in modem data port        13EH
  173.         DS    4
  174. ANI$MODRCVB:    ANI    MODRCVB ! RET    ;bit to test for receive ready    148H
  175. CPI$MODRCVR:    CPI    MODRCVR ! RET    ;value of rcv. bit when ready    14BH
  176. ANI$MODSNDB:    ANI    MODSNDB ! RET    ;bit to test for send ready    14EH
  177. CPI$MODSNDR:    CPI    MODSNDR ! RET    ;value of send bit when ready    151H
  178.         DS    12        ;PMMI only calls        154H
  179. ;
  180. ;
  181. LOGONPTR:    DW    LOGON        ;for user message.        160H
  182.         DS    6        ;                162H
  183. JMP$GOODBYE:    JMP    GOODBYE        ;                168H
  184. JMP$INITMOD:    JMP    INITMOD        ;go to user written routine    16BH
  185.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    16EH
  186.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    171H
  187.         RET  !  NOP  !  NOP    ;(by-passes PMMI routine)    174H
  188. JMP$SETUPR:    JMP    SETUPR        ;                177H
  189. JMP$SPCLMENU:    JMP    SPCLMENU    ;                17AH
  190. JMP$SYSVER:    JMP    SYSVER        ;                17DH
  191. JMP$BREAK:    JMP    SENDBRK        ;                180H
  192. ;
  193. ;
  194. ; Do not change the following six lines.
  195. ;
  196. JMP$ILPRT:    DS    3        ;                183H
  197. JMP$INBUF    DS    3        ;                186H
  198. JMP$INLNCOMP:    DS    3        ;                189H
  199. JMP$INMODEM    DS    3        ;                18CH
  200. JMP$NXTSCRN:    DS    3        ;                18FH
  201. JMP$TIMER    DS    3        ;                192H
  202. ;
  203. ;
  204. ; Set the following clear screen codes for your terminal type
  205. ;
  206. CLREOS:        CALL    JMP$ILPRT    ;                195H
  207.         DB    ESC,'Y',0,0,0    ;                198H
  208.         RET            ;                19DH
  209. ;
  210. CLRSCRN:    CALL    JMP$ILPRT    ;                19EH
  211.         DB    ESC,'+',0,0,0    ;                1A1H
  212.         RET            ;                1A6H
  213. ;
  214. ;
  215. SYSVER:        CALL    JMP$ILPRT    ;                1A7H
  216.         DB    'Version for Electralogics Incorporated MFIO'
  217.         DB    CR,LF,0
  218.         RET
  219. ;.....
  220. ;
  221. ;
  222. ;-----------------------------------------------------------------------
  223. ;
  224. ; NOTE:  You can change the SYSVER message to be longer or shorter.  The
  225. ;     end of your last routine should terminate by 0400H (601 bytes
  226. ;     available after start of SYSVER) if using the Hayes Smartmodem
  227. ;     or by address 0C00H (2659 bytes) otherwise.
  228. ;
  229. ;-----------------------------------------------------------------------
  230. ;
  231. ; You can put in a message at this location which can be called up with
  232. ; CTL-O if TRANLOGON has been set TRUE.  You can put in several lines if
  233. ; desired.  End with a 0.
  234. ;
  235. LOGON:      DB    'Hello...... >> Bill Harnell<< here....',CR,LF,0
  236. ;.....
  237. ;
  238. ;
  239. ; This routine sends a 300 ms. break tone to reset some time-share
  240. ; computers.
  241. ;
  242. SENDBRK:  call    mxdin        ;set & store current I/O block
  243.       MVI    A,40H        ;SET BREAK TONE
  244.       OUT    MODDATP+3
  245.       JMP    GOODBYE1    ;SEND A 300 MS. BREAK TONE
  246. ;.....
  247. ;
  248. ;
  249. ; This routine sends a 300 ms. break tgone and set DTR low for the same
  250. ; length of time to disconnect some modems such as the Bell 212A, etc.
  251. ;
  252. GOODBYE:  call    mxdin
  253.       XRA    A
  254.       OUT    MODDATP+4    ;SET DTR AND RTS LOW
  255.       MVI    A,40H        ;SET BREAK TONE
  256.       OUT    MODDATP+3
  257. ;
  258. GOODBYE1: MVI    B,3        ;WAIT 300 MS.
  259.       CALL    JMP$TIMER
  260.       MVI    A,03H        ;RESET TO NORMAL 8 BITS
  261.       OUT    MODDATP+3
  262.       MVI    A,01H
  263.       OUT    MODDATP+4    ;RESET DTR HIGH
  264.       RET
  265. ;.....
  266. ;
  267. ;
  268. ; The following is used to initialize the MFIO 8250 I/O port 'SIO'
  269. ;
  270. INITMOD:  MVI    A,1        ;default transfer speed to 300 baud
  271.       call    mxdin
  272.       STA    MSPEED
  273.       DI            ;turn off interrupts for init.
  274.       XRA    A
  275.       OUT    MODDATP+1    ;interrupt enable register
  276.       MVI    A,80H        ;insure out of mode to set baud rate
  277.       OUT    MODDATP+3    ;line control register
  278.       OUT    MODDATP+3
  279. ;
  280. LSPSPD:      MVI    A,80H        ;default 'LSP' speed for 300 baud
  281.       OUT    MODDATP        ;register for 'LSP' speed if enabled
  282. ;
  283. MSPSPD:      MVI    A,01H        ;default 'MSP' speed for 300 baud
  284.       OUT    MODDATP+1    ;register for 'MSP' speed if enabled
  285. ;
  286.       MVI    A,03H        ;8-level, 1 stop bit, no parity
  287.       OUT    MODDATP+3    ;line control register
  288.       MVI    A,01H        ;set 'DTR' for proper modem output level
  289.       OUT    MODDATP+4    ;modem control register
  290.       EI            ;restore interrupts to normal
  291.       RET
  292. ;.....
  293. ;
  294. ;
  295. ; The following routine changes the baud rate for the MFIO with the SET
  296. ; command.
  297. ;
  298. SETUPR:      call    mxdin
  299.       LXI    D,BAUDBUF    ;point to input buffer for INLNCOMP
  300.       CALL    JMP$ILPRT
  301.       DB    'Input Baud Rate (300, 1200, etc.): ',0
  302.       CALL    JMP$INBUF
  303.       LXI    D,BAUDBUF+2
  304.       CALL    JMP$INLNCOMP    ;compare BAUDBUF+2 with characters below
  305.       DB    '300',0
  306.       JNC    OK300        ;go if got match
  307.       CALL    JMP$INLNCOMP
  308.       DB    '450',0
  309.       JNC    OK450
  310.       CALL    JMP$INLNCOMP
  311.       DB    '600',0
  312.       JNC    OK600
  313.       CALL    JMP$INLNCOMP
  314.       DB    '1200',0
  315.       JNC    OK1200
  316.       CALL    JMP$INLNCOMP
  317.       DB    '9600',0
  318.       JNC    OK9600
  319.       CALL    JMP$ILPRT    ;all matches failed - tell operator
  320.       DB    '++ Incorrect entry ++',CR,LF,BELL,0
  321.       JMP    SETUPR        ;try again
  322. ;
  323. OK300:      MVI    A,1        ;MSPEED 300 baud value
  324.       LHLD    BD300        ;get 300 baud parameters in HL
  325.       JMP    LOADBD        ;go load them
  326. ;
  327. OK450:      MVI    A,2
  328.       LHLD    BD450
  329.       JMP    LOADBD
  330.  
  331. OK600:      MVI    A,3
  332.       LHLD    BD600
  333.       JMP    LOADBD
  334. ;
  335. OK1200:      MVI    A,5
  336.       LHLD    BD1200
  337.       JMP    LOADBD
  338. ;
  339. OK9600:      MVI    A,8
  340.       LHLD    BD9600
  341. ;
  342. LOADBD:      STA    INITMOD+1    ;store speed to show transfer time 
  343.       MOV    A,L        ;get least significant baud rate byte
  344.       STA    LSPSPD+1    ;store in INITMOD
  345.       MOV    A,H        ;get most signifcant baud rate byte
  346.       STA    MSPSPD+1    ;store in INITMOD
  347.       JMP    INITMOD        ;reset MFIO 8250
  348. ;
  349. ;
  350. ; Table of baud rate parameters
  351. ;
  352. BD300:      DW    0180H
  353. BD450:      DW    0100H
  354. BD600:      DW    00C0H
  355. BD1200:      DW    0060H
  356. BD9600:      DW    000CH
  357. ;
  358. BAUDBUF:  DB    10,0
  359.       DS    10
  360. ;
  361. ;-----------------------------------------------------------------------
  362. ;
  363. ; This routine can be used for your equipment, be sure to end with RET
  364. ; If using the Hayes Smartmodem this is unavailable without a special
  365. ; change.
  366. ;
  367. SPCLMENU: RET
  368. ;
  369. ;-----------------------------------------------------------------------
  370. ;
  371. mxdin:    push    psw
  372.     mvi    a,sio
  373.     out    cmdport
  374.     sta    blkstat        ;store current I/O block
  375.     pop    psw
  376.     ret
  377. ;
  378. ; NOTE:  MUST TERMINATE PRIOR TO 0400H (with Smartmodem)
  379. ;                 0C00H (without Smartmodem)
  380. ;
  381.       END
  382. ;
  383.