HOME


Commodore Tricks and Tips

KwikJump ®tm

Video and Graphics

Light Pens and Light Guns

Actually, a light pen is a digital signal. Inside a light pen (or a light gun for games) is a PIN photo-diode or photo transistor. If you point one of these at a CRT, you get a pretty gnarly signal right as the electron beam passes across the field of view of the photo-diode. This signal gets filtered and shaped to make it logic level compatible and into the computer it goes. (On the C64 it goes in on the joystick 1 fire button - the BTNA/LP line.)

The BTNA/LP line goes to CIA but it also goes to the LP input of the VIC chip. Because the VIC is generating the video signals, it knows approximately where the CRT electron beam is at any given time. So, when the VIC sees the trigger pulse from the light pen (or light gun) it transfers the contents of the X and Y beam counter into the light pen registers. (LPX and LPY)

Light Pen Links


Disk Drives

1581

1581 Easter Egg

Because of the RAM shortage in early PETS (8K!) Commodore disk drives were little computers in themselves with DOS in ROM and you would send commands to them and then read the error channel to see how the disk drive had carried out or failed to carry out the command. You could tell the disk drive to format a floppy, unplug it from the computer and it would continue the task. The 1581, a 3 1/2" MFM disk drive, made primarily for the C-128, had easter egg commands


100 input "Device number of 1581";dv 
110 rem first disk drive = 8, 1581 usually dv = 9 
120 open 1,dv,15: rem 15 = command channel 
130 for i=1 to 2 
140 read cm$ 
150 data uj,uk 
160 print#1,cm$: REM send the command to the drive 
170 input#1,a$,b$,c,d 
180 Rem get the error channel output 
190 Rem a$ = command error number but may be 7: here 
200 Rem b$ = descriptive error 
210 Rem c, d = track, sector #--0,0 here 
220 print a$,b$,c,d 
230 next 

Command: "UJ" or "U:" 
Error: 79,software david siracusa. hardware greg berlin,0,0 

Command; "UK" or "U;" 
Error: 7:,dedicated to my wife lisa,0,0 

Note--no, I didn't remember the strings since my 1581 went away MANY years ago
I got the ROM listings from ftp.funet.fi

HOME

This page was last updated April 20, 2003
© Dredd Productions, Ltd
Hosted by www.Geocities.ws

1