Maker Pro
Maker Pro

Printer Port

B

budgie

Jan 1, 1970
0
Actually, they don't - that code clears them all!

It doesn't actually. Try it some time.
You want this:

TEMP = INP(37A)
TEMP = TEMP AND FB
TEMP = TEMP OR (MYDATA AND 04)
OUT 37A, TEMP

No, I like mine beacuse it fits on one line without being cryptic, and it works.
It could all be written in one line, but that's too cryptic - when I
go back and look at code a year later, I like to be able to read it. ;-)

I do too. At least we agree on one thing :)
 
B

Bob Masta

Jan 1, 1970
0
Hi,
Address of 378 is normally define for printer port, LPT.
Then what is the purpose to use the address of 379, 37A ?
I am confuse and hope someone can shed me a light. Thanks.

To enlarge on what others have posted, note that you need Win9x
or earlier to access the printer port without a special driver. For
NT, 2K, or XP you need a kernel driver. See Jan Axelson's site
at <www.lvr.com> for more info.

Also note that it's good programming practice in DOS to never
assume the port address is 378h or anything else. Instead,
you should read it from the BIOS. The word at 0:408h is the
base address of LPT1, 40Ah is the address of LPT2, 40C is
LPT3, and 40E is LPT4. Of course, most systems never had
more than one LPT anyway, but it's location wasn't always a
sure thing. In the early days it was a separate card, and could
be jumpered to various addresses. You might have had an
LPT on a graphics adapter as well.

Hope this helps!


Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
 
R

Rich Grise

Jan 1, 1970
0
budgie said:
It doesn't actually. Try it some time.

OK, it clears them all except the 04 bit, which it sets.
Unless your BASIC interpreter does it different - for example,
FF AND 04 yields 04 on every system I've ever used, and every
book about it that I've read.

Or maybe 37A is open-collector (I'd have to look it up), in
which case if there are pullups, those bits will go high -
but not because of what's been output. (outputted? :) )

And some of the bits are inverted, I also would have to look
up which bits - but the value of the data is as I said.

Thanks,
Rich
 
J

Jan Panteltje

Jan 1, 1970
0
Actually, they don't - that code clears them all! You want this:

TEMP = INP(37A)
TEMP = TEMP AND FB
TEMP = TEMP OR (MYDATA AND 04)
OUT 37A, TEMP

It could all be written in one line, but that's too cryptic - when I
go back and look at code a year later, I like to be able to read it. ;-)

Cheers!
Rich

Here is the C version (I use 2 strings off i2c chips on the parport (6 pins in use plus ground):

sdal()
{
register a;
a = inb(par_port_address);
a = a & 0xbf; /* reset bit 6 (d6 on pin 8) */
outb(a, par_port_address);
busdly(IIC_BUS_DELAY);
}


sdah()
{
register char a;
a = inb(par_port_address);
a = a | 0x40; /* set bit 6 (d6 on pin 8) */
outb(a, par_port_address);
busdly(IIC_BUS_DELAY);
}
 
J

Jan Panteltje

Jan 1, 1970
0
----------------
Actually, the original LPT1 port base address on the PC was 3BC Hex,
but it is only assigned LPT1 status in DOS/Win if it is found active,
using a loopback data test, since it was only implemented on the early
mono-text-only-printer cards, and mono-graphic-printer cards and
Hercules cards and a few of the earliest higher level graphic cards.

The second LPT2 was originally the 378 Hex addrsss, and the 278 Hex
was the LPT3, but only if 3BC Hex was found and assigned to LPT1,
and without 3BC Hex being found, then 378 Hex defaults to LPT1 and
278 Hex defaults to LPT 2.

-Steve
It is for this reason and things that one should ask the BIOS what the address is.
JP
 
R

R. Steve Walz

Jan 1, 1970
0
Bob said:
To enlarge on what others have posted, note that you need Win9x
or earlier to access the printer port without a special driver. For
NT, 2K, or XP you need a kernel driver. See Jan Axelson's site
at <www.lvr.com> for more info.

Also note that it's good programming practice in DOS to never
assume the port address is 378h or anything else. Instead,
you should read it from the BIOS. The word at 0:408h is the
base address of LPT1, 40Ah is the address of LPT2, 40C is
LPT3, and 40E is LPT4. Of course, most systems never had
more than one LPT anyway, but it's location wasn't always a
sure thing. In the early days it was a separate card, and could
be jumpered to various addresses. You might have had an
LPT on a graphics adapter as well.

Hope this helps!

Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
 
R

R. Steve Walz

Jan 1, 1970
0
Rich said:
OK, it clears them all except the 04 bit, which it sets.
Unless your BASIC interpreter does it different - for example,
FF AND 04 yields 04 on every system I've ever used, and every
book about it that I've read.

Or maybe 37A is open-collector (I'd have to look it up), in
which case if there are pullups, those bits will go high -
but not because of what's been output. (outputted? :) )

And some of the bits are inverted, I also would have to look
up which bits - but the value of the data is as I said.

Thanks,
Rich
-----------
All pins serviced by 37A ( ar any LPT base + 2 control address) are
open-collector outputs, and bits -C0, -C1, -C3 are inverted, while
C2, the "4's" bit in binary, is not.

-Steve
 
R

Rich Grise

Jan 1, 1970
0
Rich Grise said:
OK, it clears them all except the 04 bit, which it sets.
Unless your BASIC interpreter does it different - for example,
FF AND 04 yields 04 on every system I've ever used, and every
book about it that I've read.

Or maybe 37A is open-collector (I'd have to look it up), in
which case if there are pullups, those bits will go high -
but not because of what's been output. (outputted? :) )

NO, Dangit! That's wrong! An open collector is a current
sink when it's set to 0. Duh! And I was sober when I posted
that! I'm ashamed of myself.

I might have been thinking of the inverted bits, see next
sentence. Just now I thought of using thinking of tri-state
as an excuse, but that's even lamer.
And some of the bits are inverted, I also would have to look
up which bits - but the value of the data is as I said.

Thanks,
Rich
A thousand pardons, sirs and mesdames.

Rich
 
B

budgie

Jan 1, 1970
0
OK, it clears them all except the 04 bit, which it sets.
Unless your BASIC interpreter does it different - for example,
FF AND 04 yields 04 on every system I've ever used, and every
book about it that I've read.


Whoops - red face time :-((

Should have been OR not AND.

OUT 37A, (INP(37A) OR 04)
 
R

R. Steve Walz

Jan 1, 1970
0
Jan said:
It is for this reason and things that one should ask the BIOS what the address is.
JP
-----------
Yes, agreed, unless you happen to know already.
Any generalized software should do this by looking at RAM address
408 Hex :
-d 0040:0008 L8
0040:0008 78 03 78 02 00 00 00 00

Note, the address is listed LO byte then HI byte
"78 03" instead of 0378 Hex, as Intel is Little Endian first.

Or in BASIC:

10 For i = 8 to 15
20 Print Peek(1024 + i)" ";
30 Next i
40 Print

-Steve
 
R

R. Steve Walz

Jan 1, 1970
0
Florian said:
s/sets/leaves untouched/
------------------------
Since it is the only one not inverted, a 1 in the "4's" but
SETS its output HI.

fecit quoque Dominus Deus Adam et uxori eius tunicas pellicias et
induit eos
----------------------
God didn't make anybody any clothing. Don't be stupid. Has God
ever made you a suit?

Did you know that "Genesis" was not original, that it was actually a
child's tale from Balylonian scrolls much older than Judaism?? The
Jews just picked it up during their slavery in Iraq! It's not some
"holy" book, it was meant to make kids keep their clothes on, because
the rich kids who were told it could only be identified and protected
if they wore clothes, which ONLY the rich of the king's court could
afford!!

-Steve
 
F

Florian

Jan 1, 1970
0
I'm not following you. Nothing's being inverted anywhere, and nothing's
being set high. It's a simple AND. Are you saying a PC parallel port will
perform some unexpected transformation on the values read and written?
That's contrary to my experience. I'm confused.

Heck, how would you know? Were you there?
Has God ever made you a suit?

Not personally, no. You?

(snip rest)
 
R

Rich Grise

Jan 1, 1970
0
God didn't make anybody any clothing. Don't be stupid. Has God
ever made you a suit?

Of course. He's also built me five computers, a Winnebago LeSharo, MAME,
TV, he grows me food and Marijuana, he brings me the words of all these
fine people on electrical telephone lines that he had built for me, ...
It's so fucking obvious that that's probably why it escapes you.

The part that hasn't been obvious, and has been made unobvious for very
many years for reasons that are just as unobvious, is the part that Will
plays in all this.

I have been given that answer, ergo, I am categorically insane. :)

Cheers!
Rich
 
R

R. Steve Walz

Jan 1, 1970
0
Rich said:
Of course. He's also built me five computers, a Winnebago LeSharo, MAME,
TV, he grows me food and Marijuana,
 
R

R. Steve Walz

Jan 1, 1970
0
Jan said:
In the old day par port was a 8255 PPI IIRC.
---------------
Nope, never ever was on any computer from the AT, XT, and PC, back
through all the CP/M machines.

You're guessing, and that's silly.

-Steve
 
J

Jan Panteltje

Jan 1, 1970
0
---------------
Nope, never ever was on any computer from the AT, XT, and PC, back
through all the CP/M machines.

You're guessing, and that's silly.
Nope, not guessin, in the 80ties I had the IBM BIOS listing.
And full diagrams of cause (company workled with IBM).
The Keyboard was one half of the 8255 PPI, 8 bit parallel in,
and that was fed from some shift registers, serial clock to the keyboard,
data from / to the keyboard.
Some other bits were control I think. But was not the other half of
that 8255 used for the printer port?
Or was the printer port just a latch?

OK, I just googled a bit I see you already knew this:
http://www.xs4all.nl/~ganswijk/chipdir/abc/keyboard/keyboard.faq
Version 0.9a IBM Keyboard/Scancode FAQ File Richard STEVEn Walz
rel 10 June 1994 *please retain this banner* [email protected]

Oh well ;-)
JP
 
R

Rich Grise

Jan 1, 1970
0
Nope, not guessin, in the 80ties I had the IBM BIOS listing.
And full diagrams of cause (company workled with IBM).
The Keyboard was one half of the 8255 PPI, 8 bit parallel in,
and that was fed from some shift registers, serial clock to the keyboard,
data from / to the keyboard.
Some other bits were control I think. But was not the other half of
that 8255 used for the printer port?
Or was the printer port just a latch?

OK, I just googled a bit I see you already knew this:
http://www.xs4all.nl/~ganswijk/chipdir/abc/keyboard/keyboard.faq
Version 0.9a IBM Keyboard/Scancode FAQ File Richard STEVEn Walz
rel 10 June 1994 *please retain this banner* [email protected]

I used to have "The IBM Personal Computer Technical Reference," which
was pretty cool - the whole BIOS listing, and the whole schematic.
I didn't do much with the keyboard, but ISTR seeing an 8048 or so -
and the LPT port was straight TTL. When third parties came up with
Chinese COM/LPT ports, they used some custom chip that blew out if
you looked at it wrong - I finally got tired of replacing them, and
built a little daughterboard where I exactly duplicated IBM's LPT
port. Then, realizing that the chip I'd supplanted had the clocks for
the UARTs, I built a little Pierce xtal oscillator with the collector
choke made of about 150 turns of magnet wire on a toothpick, with
pieces of resistor lead glued into tiny holes on the ends, so it
looked like it had leads like any other part.

But I've never seen or heard of an 8255 used for LPT.

Cheers!
Rich
 
J

Jan Panteltje

Jan 1, 1970
0
I used to have "The IBM Personal Computer Technical Reference," which
was pretty cool - the whole BIOS listing, and the whole schematic.
I didn't do much with the keyboard, but ISTR seeing an 8048 or so -
and the LPT port was straight TTL. When third parties came up with
Chinese COM/LPT ports, they used some custom chip that blew out if
you looked at it wrong - I finally got tired of replacing them, and
built a little daughterboard where I exactly duplicated IBM's LPT
port. Then, realizing that the chip I'd supplanted had the clocks for
the UARTs, I built a little Pierce xtal oscillator with the collector
choke made of about 150 turns of magnet wire on a toothpick, with
pieces of resistor lead glued into tiny holes on the ends, so it
looked like it had leads like any other part.

But I've never seen or heard of an 8255 used for LPT.

Cheers!
Rich
Yea, it seems it was a normal TTl latch (Sam will have to help us here).
I actually designed cards for in the PC in that company.
I made a soundcard, and it was used, and told the boss: 'Why don't you
patent this?' (It had wavetable too), but he did not want to do that.
He REALLY should have :)
JP
 
R

R. Steve Walz

Jan 1, 1970
0
Jan said:
Nope, not guessin, in the 80ties I had the IBM BIOS listing.
And full diagrams of cause (company workled with IBM).
The Keyboard was one half of the 8255 PPI, 8 bit parallel in,
and that was fed from some shift registers, serial clock to the keyboard,
data from / to the keyboard.
Some other bits were control I think. But was not the other half of
that 8255 used for the printer port?
--------------------------
Nope, the keyboard only. I have all the early PC schematics.

Or was the printer port just a latch?
--------------------------
The original PC-LPT was the circuit I presented years ago,
it was taken from a MGP video card 3BC Hex port LPT, and
it is representative of the original PC LPT card.

http://www.armory.com/~rstevew/Public/LPT/LPTskmtc_wid.html
 
Top