Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
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: 5027
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: 645
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: 5027
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: 645
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: 1724
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
redback
Frostbyte/Artline De..
Guests online: 109
Top Demos
1 Next Level  (9.8)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 No Bounds  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 Layers  (9.7)
2 It's More Fun to Com..  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Rainbow Connection  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Censor Design  (9.3)
4 Crest  (9.3)
5 Performers  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 MWS  (9.6)

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