Discussion:
C to QuickBasic 4.0B
(too old to reply)
Not Sue What Is Meant By Display Names
2010-04-16 19:31:01 UTC
Permalink
I need to read the IQR assigned to a PCI add-on COM Port. MOSChip has
supplied the following code which appears to be "C". Can anyone help me
convert this to QuickBasic 4.0 B running under DOS 6.22 ?

Logic to scan the pci bus.



for(pci_bus=0; pci_bus<255; pci_bus++)

{

for(pci_slot=0; pci_slot<32; pci_slot++)

{

for(pci_function=0; pci_function<8; pci_function++)

{

PCIGetBusDataByOffset(pci_bus, pci_slot, pci_function, &Buff, 0,
0x40);

// Buff hold the PCI configuration data; Buff[0] holds the VID
and Buff[2] holds the PID

// Read the location 0x3c in Buff for IRQ assgined by the BIOS
if Buff[0] is 0x9710 and Buff[2] is 0x9865

// Location 0x10 holds the serial port base address.

}





}



}
Ethan Winer
2010-04-20 16:45:53 UTC
Permalink
I hope someone can help my friend with this.
I told him to post for the experts here! :->)

--Ethan
Auric__
2010-04-20 18:34:50 UTC
Permalink
On Fri, 16 Apr 2010 19:31:01 GMT,
Post by Not Sue What Is Meant By Display Names
I need to read the IQR assigned to a PCI add-on COM Port. MOSChip has
supplied the following code which appears to be "C". Can anyone help me
convert this to QuickBasic 4.0 B running under DOS 6.22 ?
Logic to scan the pci bus.
I actually wrote this last week, but I was waiting to see if anyone else
would reply first.
Post by Not Sue What Is Meant By Display Names
for(pci_bus=0; pci_bus<255; pci_bus++)
FOR pci_bus = 0 TO 254
Post by Not Sue What Is Meant By Display Names
for(pci_slot=0; pci_slot<32; pci_slot++)
FOR pci_slot = 0 TO 31
Post by Not Sue What Is Meant By Display Names
for(pci_function=0; pci_function<8; pci_function++)
FOR pci_function = 0 TO 7
Post by Not Sue What Is Meant By Display Names
PCIGetBusDataByOffset(pci_bus, pci_slot, pci_function,
&Buff, 0, 0x40);
This is a function, possibly (probably?) stored in a library.

Based on the comments below, Buff is either a byte array or a string. (In
C, there's no real difference between the two.) Buff should probably be a
fixed-length string of whatever size it's declared as in the C code -- it
probably looks something like this:
char *Buff[n];

Tansmogrify it to this (or something like it):
DIM Buff AS STRING * n

If this doesn't work exactly right, try removing VARPTR.

PCIGetBusDataByOffset pci_bus, pci_slot, pci_function, _
VARPTR(Buff), 0, &h40
Post by Not Sue What Is Meant By Display Names
// Buff hold the PCI configuration data; Buff[0] holds the
VID and Buff[2] holds the PID
// Read the location 0x3c in Buff for IRQ assgined by the
BIOS if Buff[0] is 0x9710 and Buff[2] is 0x9865
// Location 0x10 holds the serial port base address.
These are comments. Replace all occurences of "//" with "'" (apostrophe).
Post by Not Sue What Is Meant By Display Names
}
NEXT
Post by Not Sue What Is Meant By Display Names
}
NEXT
Post by Not Sue What Is Meant By Display Names
}
NEXT

So, the whole thing:
-----begin-----
FOR pci_bus = 0 TO 254
FOR pci_slot = 0 TO 31
FOR pci_function = 0 TO 7
PCIGetBusDataByOffset pci_bus, pci_slot, pci_function, _
VARPTR(Buff), 0, &h40
' Buff hold the PCI configuration data; Buff[0] holds the VID and
' Buff[2] holds the PID
' Read the location 0x3c in Buff for IRQ assgined by the BIOS if
' Buff[0] is 0x9710 and Buff[2] is 0x9865
' Location 0x10 holds the serial port base address.
-----in here goes your code to examine the buffer-----
NEXT
NEXT
NEXT
-----end-----

No guarantees it'll work as-is, but at the very least, it's a starting
point.
--
I saw a man with a wooden leg, and a real foot.
-- Steven Wright
A***@NOT.AT.Arargh.com
2010-04-21 07:20:42 UTC
Permalink
On Tue, 20 Apr 2010 18:34:50 GMT, "Auric__"
<***@email.address> wrote:

<snip>
Post by Auric__
Post by Not Sue What Is Meant By Display Names
PCIGetBusDataByOffset(pci_bus, pci_slot, pci_function,
&Buff, 0, 0x40);
This is a function, possibly (probably?) stored in a library.
Yes, but whose? Apparently private, because web searches get nowhere.

<snip>
Post by Auric__
If this doesn't work exactly right, try removing VARPTR.
PCIGetBusDataByOffset pci_bus, pci_slot, pci_function, _
VARPTR(Buff), 0, &h40
My guess is that that routine is 32-bit code, which can't be called
from QuickBasic.

My second guess is that accessing the PCI configuration space requires
INs and OUTs using LONGs, which can't be done directly in QuickBasic.

<snip>
--
ArarghMail004 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
Ethan Winer
2010-05-05 16:14:38 UTC
Permalink
Post by Not Sue What Is Meant By Display Names
I need to read the IQR assigned to a PCI add-on COM Port.
Are any of you guys up for a paid consulting gig? My friend (Not Sue, above)
needs some of the ASM code from Crescent's old PDQComm for DOS converted to
work with his COM card. His card does appear to require 32-bit IN and OUT
commands, or at least 32-bit addresses. But I didn't write the original code
and I'm not up on COM port stuff. Anyone interested can email me directly,
and I'll put you in touch with my friend. Email me from my web site:

www.ethanwiner.com

Thanks!

Loading...