Skip to content

COM Port now working - int14 fix#71

Open
Martin1701 wants to merge 3 commits into640-KB:mainfrom
Martin1701:main
Open

COM Port now working - int14 fix#71
Martin1701 wants to merge 3 commits into640-KB:mainfrom
Martin1701:main

Conversation

@Martin1701
Copy link

About

Firstly, I want to preface this that I'm an total amateur when it comes to 8088 assembly and only recently I got my first XT-class machine (Compaq Portable).
I needed to get serial communication running to transfer files from my pc, that's when I noticed DOS giving me weird timeout and read errors or repeated character reads (depending on the DOS version).
As you can see in this example character 'a' was received even when no characters were being sent:
D83FF929-B040-432A-99A6-39B2187D2464_1_105_c
Issue here is BIOS failing to set the error bit indicating timeout, so DOS interprets the read as valid.

Solution

I dug into the code and found that timeout and error handling is wrong and/or missing. Again I have no idea how DOS expects these errors to look, but in couple cases the actual code doesn't implement what comments are saying.
There is slight increase in size, thus space needed to be made in the constrained memory area. These modifications were done on v0.4.1 and are currently running on my machine without issues.

Hardware

@640-KB
Copy link
Owner

640-KB commented Mar 19, 2026

Hi @Martin1701. Thanks so much for submitting this. Looking this over, I'm not really sure why there isn't a JNZ INT_14_RW_ERR in the INT_14_2 receive function as there is in the INT_14_1 send function. It very well could have been an oversight as you say!

One question though. Does adding only the JNZ INT_14_RW_ERR into INT_14_2 and the INC CX fix it? I'm not sure why the OR vs. MOV would make any difference here (they should both set the timeout bit).

Also, can you change the comment about the INC CX to be "Need to clear ZF to indicate timeout"? Technically ZF=1 means that it is zero, so we are setting ZF to 0 (clearing it) to indicate the result is not-zero (yes, I find this counterintuitive).

640KB

@640-KB
Copy link
Owner

640-KB commented Mar 19, 2026

Also, it might be better to instead do JNS INT_14_RW_ERR instead of JNZ as it will eliminate the need for the INC CX. It will mean the timeout will be increased by one loop, however since that duration is entirely based on CPU loops, increasing by 1 wouldn't be a bad thing since there are many Turbo XTs that are much faster than the 4.77 MHz this factor was likely intended for.

Copy link
Owner

@640-KB 640-KB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Martin1701 can you do the following:

  1. 6322: change JNZ INT_14_POLL_LOOP to JNS INT_14_POLL_LOOP, and remove the added INC CX
  2. 6250: Keep OR AH as it was instead of MOV AH. According to https://stanislavs.org/helppc/int_14.html, those send/recv calls are supposed to return the complete LSR status byte in AH in addition to the flag set if timeout.
  3. in INT_14_1 and INT_14_2 move the two INC DX's to the beginning of INT_14_POLL. This way the code byte space is saved and no need to move the VID_MODE_TBL. Also update the comment in INT_14_POLL for Input to read "DX = 3FC Modem Control Register"

If you could give that a test on your machine and verify the fix, I'll merge it.

Thanks!

640KB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants