Last updated Aug 2 2010. Edited by Herb Johnson, (c) Herb Johnson, except for content written by Lee Hart or others.
These are notes in progress for supporting the Lee Hart 1802 Membership card with a program to download and upload software, via a Windows/Linux/PC parallel port. Work is in progress by Herb Johnson (me) to write an MS-DOS program. Windows OS's since NT will not run MS-DOS program calls to the parallel port I/O addresses, they will give a protection error.
There are ways around this "protection", by using DLL's which work with Windows. The lvr.com Web site discusses these I/O protection issues and provides a DLL from logix4u.net called Inpout32.dll.
Note: another hitch to my progress, is that the Windows/DOS-32 C compiler I'm using, LCC-32, is a 32-bit but pre-Win-NT compiler. It won't produce old-school "16-bit" MS-DOS application programs. So if you run a compiled program in a strictly "MS-DOS" system, it WON'T RUN, PERIOD. But, while LCC-32 has I/O calls, they just won't work in Win NT, Win 2000, or later Windows systems, even in a "MS-DOS window".
I'll have to find another compiler, such as a simpler MS-DOS 16-bit compiler, and a Win32 compiler with a library for NT I/O support. My friend who knows, tell me to use Watcom C, which has versions for either. Lee Hart is learning to use dev-c++, a 32-bit windows compiler.- Herb Johnson
Base I/O address for parallel ports
MDPA no MDPA
LPT1 0x3BC 0x378
LPT2 0x378 0x278
LPT3 0x278 n/a
MDPA means monochrome display and print adapter - the original video/print card on PC's.
Register addresses within the parallel printer port:
Port R/W IOAddr Bits Function
---------- ------ ----- ----------------
Data Out W Base+0 D0-D7 8 LS TTL outputs
Status In R Base+1 S3-S7 5 LS TTL inputs
Control Out W Base+2 C0-C3 4 TTL Open Collector outputs
" " " C4 internal, IRQ enable
" " " C5 internal, Tristate data [PS/2]
Data Feedback R Base+0 D0-D7 matches Data Out
Control Feedbk R Base+2 C0-C3 matches Control Out
" " " C4 internal, IRQ enable readback
Note: some parallel ports are bidirectional. I've not documented that here.
Control OUT Register: bits vs Pins vs 1802 pins:
"active LOW" means a 1 in the register is a LOW condition on the pin.
bit0 - strobe pin 1 (active LOW), to clock through the IN button the /DMA-IN flipflop on the RISING edge.
Also to steer pairs of input bits via U9.
bit1 - autofeed pin 14 (active LOW), to the OFF postion of "LOAD" switch to /WAIT and also gate data IN latch U6.
bit2 - init pin 16 (active HIGH), to the ON position of "RUN" switch to /CLEAR.
bit3 - selectin pin 17 (active LOW), to the R/O position of "R/W" switch, the /WE line of the RAM.
status IN Register: bits vs Pins vs 1802 lines: active HIGH unless noted.
bit3 - error pin 15, to Q and LED D8
bit4 - selectout pin 13, to D4 or D0 via U9
bit5 - paperout pin 12, to D5 or D1 via U9
bit6 - ack pin 10, to D6 or D2 via U9
bit7 - busy pin 11 active LOW?, to D7 or D3 via U9
Active LOW means a logic 1 produces or reads a ground voltage; active HIGH, a logic 1 is five volts or so.
Lee Hart wrote these instructions, on using the Membership Card's DB-25 with an Intel/Windows/Linux PC. I'm currently working on an MS-DOS program to support this procedure. - Herb Johnson
To load a program into the 1802's memory, and run it, [these PC parallel port lines must be operated as follows:]
- set INIT (pin 16) low (resets the 1802)
- set AUTOFEED (pin 14) low (puts the 1802 in LOAD mode)
- set SELECTIN (pin 17) high to enable writes into 1802 memory
- set D0-D7 (pins 2-9) to the byte to write into 1802 memory
- pulse STROBE (pin 1) low to write the byte and increment the address
- set AUTOFEED high to end load mode (INIT still low, so 1802 is reset)
- set INIT high, and the 1802 runs the program you loaded.
To read the contents of the 1802's memory [via the parallel port]:
- set INIT low (resets 1802)
- set AUTOFEED low (puts 1802 in load mode)
- set SELECTIN low to make 1802 memory read-only
- set STROBE low to read 1802 low nibble:
... Q0 is on SELECT (pin 13)
... Q1 is on PAPER (pin 12
... Q2 is on ACK (pin 10)
... Q4 is on BUSY (pin 11)
- set STROBE high to read 1802 high nibble:
... Q5 is on SELECT (pin 13)
... Q6 is on PAPER (pin 12
... Q7 is on ACK (pin 10)
... Q8 is on BUSY (pin 11)
- set STROBE low to increment to next address and read its contents
While the 1802 is in RUN mode:
- D0-D7 are inputs that get read by the 1802's IN5 or IN7 instruction
- Q0-Q7 are outputs written to by the 1802's OUT5 or OUT7 instruction
- the 1802 Q output can be read on ERROR (pin 15)
- the 1802 /EF4 flag input can be set by STROBE
- Lee Hart
To verify the operation of my program, I built this LED dongle to display the parallel port lines. It simply consists of LED's with 330 ohm resistors to ground. The LEDs are wired so that when an output is HIGH the LED is ON, so the low side of the LED is to ground. I used red LEDs for the data lines, orange for the control out lines. - Herb Johnson
In the "old days", MS-DOS based PC's included QBasic or "QuickBASIC". With a text-based IDE, and interpreted (not compiled) BASIC, it's easy to create little (and big) programs incrementally. My old 80486 system with Win 3.1 includes it, and I'm using it to mess with the parallel port with the "PC Port Dongle" attached. Here's a QBASIC program to send bits to the parallel port.
Note that of the four output control lines on the parallel port, one is active HIGH, the others are active LOW. So your program logic must be aware of that. - Herb Johnson
This page and edited content is copyright Herb Johnson (c) 2010. Contents written by Lee Hart, are copyright Lee Hart (c) 2010. Copyright of other contents beyond brief quotes, is held by those authors. Contact Herb at www.retrotechnology.com, an email address is available on that page..