Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Reading spacebar via lightpen registers
2022-03-18 07:58
Oswald

Registered: Apr 2002
Posts: 5017
Reading spacebar via lightpen registers

Google doesnt help me with this topic, how is this done, and what is the explanation please?
2022-03-18 09:20
Martin Piper

Registered: Nov 2007
Posts: 631
The light pen generates a signal when it detects the TV raster passing in front of it. This signal is passed through control port 1 pin 6 which is labelled BTNA/LP and PB4 going into CIA1 @ $dc0x: http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/c64..

This signal comes into pin 9 for VIC: http://www.zimmers.net/anonftp/pub/cbm/schematics/computers/c64..

This causes the VIC to latch into LPX LPY registers the current raster position that is being drawn by the TV.


Now, since BTNA/LP also goes into CIA1 and since CIA1 is for keyboard rows, don't forget the problem with the port 1 joystick fire button being seen as a keyboard space bar (seen in the schematic), I suppose if someone presses the spacebar or the joystick button it can be treated as a light pen signal. This will probably cause the light pen LPX and LPY registers to get latched with whatever raster position is being drawn by the VIC.
2022-03-18 09:24
Oswald

Registered: Apr 2002
Posts: 5017
thanks Martin, this brings up the question why is the LightPen trigger signal wired into the CIA ?
2022-03-18 09:49
Martin Piper

Registered: Nov 2007
Posts: 631
Because it shares a signal with the joystick button. Which also shares a signal with the keyboard row. All going into the CIA.

I suppose they didn't want to have too many discrete signals for the control ports.
2022-03-20 11:57
tlr

Registered: Sep 2003
Posts: 1702
Reading is fine, but more importantly you can get and IRQ on pressing space bar using this feature.

The reverse of this is also sometimes used for stable rasters, see: https://codebase64.org/doku.php?id=base:stable_raster_with_ligh..
2022-05-03 12:36
YTM

Registered: Apr 2021
Posts: 3
It also works in the opposite way: you can configure that line to be an output and a high to low transition with latch current beam location into lightpen registers.

Maybe it's not so useful with VIC, but it's a neat trick for VDC to get curent raster line estimation.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
megatonn/Bronx
Ghost/Quantum
GI-Joe/MYD!
iAN CooG/HVSC
Mike
t0m3000/ibex-crew
cba
Andy/AEG
Guests online: 70
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.9)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.032 sec.