jok@minster.UUCP (03/27/86)
Can you help me please? I am a newcomer to MS-DOS and the IBM PC & compatible community and am about to try to write some software (in assembler) which initialises, and reads characters from, the COM1 RS232 port. Transmitting characters to the outside world will not be required. I had been intending to use ROM-BIOS interrupt RS232_IO (20 dec, 14 Hex) subservices INIT_COM (0), AWAIT_COMM_CHAR (2), and COMM_STATUS (3). It is important that I can use COMM_STATUS to determine whether or not a character is available for reading (using AWAIT_COMM_CHAR) without actually reading it - that is, I want to poll. A colleague has told me that the only way he has been able to get a valid result from COMM_STATUS is by transmitting a character immediately before reading the status. This seems very odd to me and only serves to convince me that he is doing something wrong. The only fault in that line of thought is that using these BIOS services seems to me so incredibly simple that there is very little to actually get wrong, unless there is a bug in the BIOS services themselves, which seems unlikely. I have looked in several books and manuals, and can find no detailed examples of how to use these services other than appendices which note their existence. Has anybody else experienced any problems with this? Specifically, as I do not yet have any equipment to connect to COM1 and am trying to work to a very tight deadline, does anybody know of any reason why the following pieces of code should not work ? (where COM1 is initialised to 9600 baud, 8-bit data with no parity, 1 start- and 2 stop-bits)? COM1 equ 0 RS232_IO equ 20 RxRDY equ 1 INIT_COM equ 0 PARAMS equ 0E7H AWAIT_COMM_CHAR equ 2 COMM_STATUS equ 3 ; initialise COM1 ; test for character available mov dx, COM1 mov dx, COM1 mov al, PARAMS mov ah, COMM_STATUS mov ah, INIT_COM int RS232_IO int RS232_IO test ah, RxRDY jz no_char ; jump if no chr jmp short rd_chr ; else read it ; read the character rd_chr: mov dx, COM1 mov ah, AWAIT_COMM_CHAR int RS232_IO ; character now in AL Sorry if this seems amazingly trivial, but I couldn't find any published information on the subject and am entering mild **PANIC** as a result of what my colleague told me. Please reply to the net, or by mail to me as jok@uk.ac.york.minster Thanks in advance.