home *** CD-ROM | disk | FTP | other *** search
- *.........................................................................
- * Program Name: FOXCOM01 Copyright: Magna Carta Software, Inc.
- * Date Created: 06-21-91 Language: FoxPro v2.0
- *.............................................................................
- * Description: FOXCOM00 plus...
- * Interrupt-driven reception
- *.............................................................................
-
- PUBLIC version, ret
- version = 1
-
- CLEAR
- SET TALK OFF
- SET ESCAPE OFF
-
- * Load the right library
- foxid = VERS()
- IF "2.0" $ foxid
- SET LIBR TO ctf && Identified FoxPro 2.0
- ELSE
- IF "2.5" $ VERS()
- IF "Windows" $ foxid && Identified FoxPro 2.5 for Windows
- SET LIBR TO ctfw
- ELSE
- SET LIBR TO ctf25 && Identified FoxPro 2.5 for DOS
- ENDIF
- ENDIF
- ENDIF
-
- DO ctfhdr
-
- ret = u8250_init(0, COM1, 2400, 8, PARITY_NONE, 1) && initialize COM1 (I/O address = 1016)
- IF ret < 0
- ? "Initialization return code=" + STR(ret)
- =INKEY(0)
- CANCEL
- ENDIF
- ret =install_ipr(0, RECEIVE, NULL, 2048) && initialize receive IPR, 2k buffer
- IF ret < 0
- ? "Interrupt processing install routine returned" + STR(ret)
- =INKEY(0)
- CANCEL
- ENDIF
- ret =install_isr(0, 4, NULL) && use IRQ4 (use 3 for COM2)
- IF ret < 0
- ? "Interrupt service install routine returned" + STR(ret)
- =INKEY(0)
- CANCEL
- ENDIF
-
- @ 00,00 SAY "CommTools Terminal Version " + LTRIM(STR(version)) + ": Press ESC to Exit"
- =c_term(0) && switch to dumb terminal mode
- =deinit_port(0) && deinitialize the port
- CLEAR
- @ 24,00 SAY "End of CommTools Terminal Version " + LTRIM(STR(version))
- RETURN
-
-
- *
- * C_TERM -- This is a dumb terminal loop in FoxPro.
- * Alternately poll the serial input buffer and the keyboard for data.
- *
- PROCEDURE c_term
- PARAMETERS portid
- PRIVATE c
-
- ?
- DO WHILE .T.
- * CHECK SERIAL PORT FOR BYTE *
- c = c_inchar(portid) && check the serial port for a byte
- IF c <> CT_EOF && if a valid character display it
- ?? CHR(c)
- ENDIF
- * CHECK KEYBOARD FOR A KEY PRESS *
- c = INKEY() && check keyboard for a key
- DO CASE && evaluate the received key
- CASE c == ESC && ESC was pressed
- RETURN
- CASE c <> 0
- =c_putc(portid, c)
- ENDCASE
- ENDDO && do while .t.
- @02,00 SAY "Exiting c_term()"
- RETURN
-