[comp.os.os2.programmer] COM3, COM4 support

gah@hood.hood.caltech.edu (Glen Herrmannsfeldt) (03/09/91)

After wondering for a while how to get COM3 and COM4 support,
I finally figured out how to patch COM01.SYS to make it support
COM3 COM4.   That is, a separate copy that only knows COM3, COM4,
and has a different name.  I don't know if my version is like 
everyone elses, so I will only give the general idea.  If they are,
I can give specific PATCH instructions.

The COM1, COM2 in the device header should be changed.
Another COM1, I don't know what it is for.

At offset 2276 and 2280, (use PATCH command to see it.)
are x'03f8' and x'02f8' which should be changed to respective addresses.

Offset 2273 and 227d are x'04' and x'03', which are interrupt vectors.
These should be changed.  Multiple devices on the same vector are NOT
supported.  Your card (I have Jameco 1062) must support more.

The instructions to load the port addresses from 400, 402 must be
changed to ones that set the address, unless your BIOS loads 404, 406.

From:
  MOV AX,40
  MOV ES,AX
  MOV BX,[0BD5]
  SHL BX,1
  MOV  DX,ES:[BX]

To:

  MOV DX,02E8
  TEST [0BD5],1
  JNZ .+5
  MOV DX,03E8
  NOP

The code which zeroes out the 400, 402 

  MOV [BX],0000

should be NOP'ed out.

I currently have COM3 on IRQ5 (turn off LPT2) working.
COM4 on IRQ2 --> interrupt vector 9, may not work.  Then again,
I may have a defective cable.  It is a 9 pin connector of this board.

The documentation for DevHlp SetIRQ seems to require vector 9 for IRQ2,
and it is supposed to be redirected.  Well, the IRQ2 bus line goes to
interrupt line 9.  This may not work for some other reason, I only
tested it once.  I am writing this while logged in on COM3.

Good Luck.

wbonner@eecs.wsu.edu (Wim Bonner) (03/10/91)

In article <gah.668509309@valine> gah@hood.hood.caltech.edu (Glen Herrmannsfeldt) writes:
>The documentation for DevHlp SetIRQ seems to require vector 9 for IRQ2,
>and it is supposed to be redirected.  Well, the IRQ2 bus line goes to
>interrupt line 9.  This may not work for some other reason, I only
>tested it once.  I am writing this while logged in on COM3.

Actually the way I understand it, you should never try to use interrupt 2 
directly.  The second interrupt controller in an AT is cascaded off this
interrupt from the main controller.

If you try to use IRQ2, you are in effect trying to use the same interrupt
as any device trying to use irq8-irq15.  This includes your hard drive
controller if your machine is standard in its use of interrupts.

Wim.
-- 
|  wbonner@yoda.eecs.wsu.edu  |
| 27313853@wsuvm1.csc.wsu.edu |
|  72561.3135@CompuServe.com  |

jack@cscdec.cs.com (Jack Hudler) (03/10/91)

In article <1991Mar09.202258.24347@eecs.wsu.edu> wbonner@yoda.UUCP (Wim Bonner) writes:
>In article <gah.668509309@valine> gah@hood.hood.caltech.edu (Glen Herrmannsfeldt) writes:
>>The documentation for DevHlp SetIRQ seems to require vector 9 for IRQ2,
>>and it is supposed to be redirected.  Well, the IRQ2 bus line goes to
>>interrupt line 9.  This may not work for some other reason, I only
>>tested it once.  I am writing this while logged in on COM3.
>
>Actually the way I understand it, you should never try to use interrupt 2 
>directly.  The second interrupt controller in an AT is cascaded off this
>interrupt from the main controller.
>
>If you try to use IRQ2, you are in effect trying to use the same interrupt
>as any device trying to use irq8-irq15.  This includes your hard drive
>controller if your machine is standard in its use of interrupts.

This is true IRQ2 is a cascade of the slave 8259A, however in an AT the IRQ2 
interrupt is NOT tied tied to the bus like the PC. In the AT bus IRQ2
becomes IRQ9 of the slave 8259A. So it is incorrect to say you should never
use IRQ2, all our network cards run on IRQ2.
-- 
Jack           Computer Support Corporation             Dallas,Texas
Hudler         Internet: jack@cscdec.cs.com

TURGUT@TREARN.BITNET (Turgut Kalfaoglu) (03/11/91)

Howdy. Where can I find some examples on how to write COM: support under
OS/2?  I did some odd things, and it seems to work, such as DosOpen("COM1:"),
and then writing to it, and then reading back character by character for
the user input (I want to write a BBS software, so all I need is writing,
reading,and checking for carrier). It seems to work, but especially reading
character by character is a lot of wasted overhead. Is there a better way?

Thanks, -turgut

gah@hood.hood.caltech.edu (Glen Herrmannsfeldt) (03/15/91)

Apparently the reason my COM4 didn't work is that it has
an 8250 and not a 16450.  I put COM3 on IRQ2 --> vector 9,
and it works.  Now I will have to find a 16450.

Someday I should figure out how to support a second disk controller.
It should be about as hard.