• Please review our updated Terms and Rules here

Tandy 1000 DIY Lightpen Shenannigans

creepingnet

Veteran Member
Joined
Feb 25, 2005
Messages
1,104
Location
Reno, NV
I'm kind of starting this thread in part to document my shennanigans in DIYing a working light pen using cast-off parts and some drivers from TVdog's archive. The light pen port has been a curiosity to me as a Tandy 1000 user since I got my first computer, a 1000 SX, back in 1997 (yes, it was 10 years old when I got it ;D ).

What motivated this endeavor is several things...

- Curiosity about that lightpen port, nobody used it, but it holds so much potential
- The desire for some kind of pointing device for the Tandy and not having a free serial port for a mouse (my current is a 1000A using all three ISA slots up with Memory Expansion, Ethernet, and XT-IDE)
- The scarcisty of light pen port and gameport pointing devices for the Tandy 1000 (yes I'm aware it uses TRS-80 controllers/mice)
- The fact I remember seeing a lightpen on a CGA PC in the 80's as a very small kid and being quite fasinated with it

How I started was with making a breadboard wire for the Tandy 1000 series light pen port, which I used the Tandy 1000 Hardware reference manual to get the pinout for... the port itself is D-sub male, and the connector is D-sub female - which I had from a pile of spares I got at Vetco a couple years ago for repairing the NEC MultiSync II monitor I use with my Tandy (cracked source selector board PCB and bad DB-9 port).

Pinout is as follows
1 - +5vdc
2 - Ground
3 - Light Pen In
4 - Switch/Button
5 - nc
6 - nc
7 - nc
8 - nc
9 - nc

The cable I made goes to a 4 pin molex female micro-connector that I can use to stick components into like a breadboard.

So came the research/Google-Fu part of this. I found an old Atari 8-bit archive article about lightpens here to get an idea on how I can "hack" something that may (or might not) works together. - https://www.atariarchives.org/creativeatari/Build_Your_Own_Light_Pen.php

Then there was reading up on some about the CGA graphics controller in the Tandy 1000, the MC6845 CRTC - which is the chipset used by the Tandy for CGA graphics (and the reason it has a Lightpen port). This included a blog article, and a thread from here on VCF

NERDLY PLEASURES -http://nerdlypleasures.blogspot.com/2016/05/ibms-cga-hardware-explained.html

VCFED - http://www.vcfed.org/forum/archive/index.php/t-18091.html

So what I deduced was this - most lightpens seems to consist of a phototransistor or a light detector cell of some sort, a resistor, and a push-button to turn the pen on when you want to use it. Going off the atariarchives article, this meant wiring a phototransistor to the LPIN (pin 3) and +5VDC (pin 1), and then wiring a switch between ground and the LPIN side (pin 2 to pin 3). But then that leaves me wondering what the LPSW (pin 4) is for.

For components I'm using....
- a photosensor from a dead ball mouse
- a 100K, later a 10K resistor
- momentary pushbutton switches swiped from a dead VCR (one for what the Atari aritcle calls a "loop" and the other for the regular switch, both connect to ground - switch one takes from the photosensor on the LPIN side, and the other from the LPSW.
- various wires I had laying around
- and of course, my home-made LP breadboard cable

For drivers/controllers for the pen, I'm using the PENMOUSE/LIGHTPEN driver, I can't remember where I found it but I'm putting it up for download on my own site eventually anyway. Basically it consists of four EXE files....

- LIGHTPEN.EXE - the control TSR for the lightpen itself
- PENMOUSE.EXE - I assume this makes it behave as a mouse
- INSTALL.EXE - which configures the TSR for the lightpen
- CONTROL.EXE - some kind of very old lightpen file manager program that crashes with a stack overflow, probably because its being run off an 8GB HDD.

Initial testing of this configuration started with me wiring up the "pen" a few different ways at first, eventually settling on the very basic 10K resistor on the +5VDC side of the opto-sensor, and putting a bare wire into the ground. That is what's making results, using the wire as a switch. I have something more complex now with the 2 switches going to ground from LPIN and LPSW...

Driver setup is done by first running "LIGHTPEN.EXE" to put the control module in memory, not doing this causes all other programs to immediatley terminate and drop you to the rood directory of the hard disk with the error message "controller or lightpen not availible".

Wired up and with LIGHTPEN in memory though - were ready to rock, running the install program shows that it IS picking up the light pen....but it seems up to random luck in timing though as it appears the photosensor just BARELY addresses at random intervals, and the rest of the time the click addresses on another part of the raster refresh - as indicated by a random asterik appearing when I click the button for LPIN.

I've tried it out in turbopaint, same deal.

So it seems I'm missing a few things, maybe someone can help me out on this....

Do mice use different devices than lightpens do for sensing the spot on screen? I think it may be possible I need to put down a buck or two on some phototransistors instead per the Atari article. Either that or use a transistor (have a ton of them for Guitar pedal builds) to make an amplifier and boost the input signal from the pen to LPIN so it can actually track more than once in a blue moon.

Are there any better schematics or photos from a compatible device out there than the Atari one. I know that one is pretty simple, maybe I need a few more capacitors to handle timing,. I know the NES Zapper is a similar device and uses more than just a resistor, photosensor, and a switch to do it;s job (I see 2 capacitors, an IC, and maybe a diode or two in there). Also, I'm aware an Atari 400/800 is not the same as a Tandy 1000 PC compatible - even if they use the same standards. I'm also curious how the "LPSW" pin is supposed to work, a lot of devices I know switches ground off a signal to make it go low/high to register, but maybe I'm missing something important.

Just some thoughts. Either way, my tinkering is proving rather successful after about 4 hours of total work over the course of a few afternoons at 1-2 hours a pop.
 
Here's a light pen schematic that does use a transistor, it might be worth a shot:

https://www.atarimagazines.com/compute/issue10/018_1_BASICS_OF_LIGHT_PEN_OPERATION.php

It does seem to be remarkably hard to find a light pen schematic specifically for PCs.

Also, regarding the photodetectors from mice, I believe most mice use infrared LEDs. (At least I don't actually recall seeing visible light coming from inside an old mouse.) Perhaps it's possible that the matching photodetectors are also tuned to be less sensitive to visible light
 
Could you use one of the Atari CX-75 light pens? They seem to be fairly cheap, and according to this website, should probably work if you rewire the connector.

Atari CX-75 Lightpen on Ebay: https://www.ebay.ca/itm/Atari-CX-75...977520?hash=item1ef015c570:g:XtsAAOSwa1ZcBgjD
DB9 lightpen schematic: http://wiki.icomp.de/wiki/DB9-Lightpen
A DB9 breakout adapter to wire it up: https://www.ebay.ca/itm/DB9-9-pin-M...var=584285217601&_trksid=p2060353.m2749.l2649

Or I could be wrong.. the cx-75 was used to register on the screen. Is that how the tandy one worked?
 
Here's a light pen schematic that does use a transistor, it might be worth a shot:

https://www.atarimagazines.com/compute/issue10/018_1_BASICS_OF_LIGHT_PEN_OPERATION.php

It does seem to be remarkably hard to find a light pen schematic specifically for PCs.

Also, regarding the photodetectors from mice, I believe most mice use infrared LEDs. (At least I don't actually recall seeing visible light coming from inside an old mouse.) Perhaps it's possible that the matching photodetectors are also tuned to be less sensitive to visible light

The IR thing might explain why it's not addressing where the sensor is on the screen. I kind of thought that might be the case, just not sure. Maybe I should put the NEC into Amber Mono emulation mode and see if it picks it up better. I remember now, I think that detector is from a VCR ND that would be infared because I never see a light source in a VCR when I repair them.
 
So what I deduced was this - most lightpens seems to consist of a phototransistor or a light detector cell of some sort, a resistor, and a push-button to turn the pen on when you want to use it. Going off the atariarchives article, this meant wiring a phototransistor to the LPIN (pin 3) and +5VDC (pin 1), and then wiring a switch between ground and the LPIN side (pin 2 to pin 3). But then that leaves me wondering what the LPSW (pin 4) is for.

The LPSW is just that, a switch that reads either pressed or not-pressed. It does not "turn the pen on when you want to use it". Most light pens were always on once connected; the atariarchives article was probably talking about a second switch just to turn off the pen. The typical use of the LPSW was a little button near the tip of the pen that, for all intents and purposes, was a mouse button. Pressing it could either flash the entire screen pure white for one frame (so that the pen location could be determined if it was resting in a black area), or it could indicate to the software you want to pick something up or select something.

Once you fix this and your pen is always on, your software might start working. Keep us posted (I've always wanted to program for one but lack the skill to assemble and troubleshoot the hardware).

It might be different on Tandy 1000 systems, but on IBM CGA systems, the resolution provided by a light pen is limited to the granularity of 6845 character generator, giving the light pen an effective 40x100 resolution in all graphics modes, and 80x25 in 80-column text mode. So while you might be tempted to draw with it, it won't be pretty unless the graphics program performs a lot of averaging or other smoothing tricks. It seems best suited for selecting things in 80x25 text mode.
 
Could you use one of the Atari CX-75 light pens? They seem to be fairly cheap, and according to this website, should probably work if you rewire the connector.

Atari CX-75 Lightpen on Ebay: https://www.ebay.ca/itm/Atari-CX-75...977520?hash=item1ef015c570:g:XtsAAOSwa1ZcBgjD
DB9 lightpen schematic: http://wiki.icomp.de/wiki/DB9-Lightpen
A DB9 breakout adapter to wire it up: https://www.ebay.ca/itm/DB9-9-pin-M...var=584285217601&_trksid=p2060353.m2749.l2649

Or I could be wrong.. the cx-75 was used to register on the screen. Is that how the tandy one worked?
Thx, that's some stuff I can look at.

From my googley-fu I think all light pens for computers worked much the same. Raster is detected by the light sensor, sent to a DAC then converted to on screen coordinates and appropriate action by the computer per horizontal refresh and software as to which scanline and where during that lines drawing cycle the sensor picked it up.

I think the Atari could work via a configuration change of the pins. The Tandy interface is much simpler than the regular CGA one that seems to use more pins for +12v and I think one other function.

If I can get this going...might be able to also create a light gun for the Tandy 1000 (maybe a good port/parody of Duck Hunt is in order, lol).
 
Back
Top