First post, by superfury
Exactly what is the difference between accessing ports 3DB("Clear lightpen latch") and 3DC("Preset lightpen latch")?
https://www.seasip.info/VintagePC/cga.html just explains 3DB (for clearing it to latch the lightpen position at a later time).
https://pdos.csail.mit.edu/6.828/2008/reading … /vgadoc/CGA.TXT says that 3DC latches the lightpen address from the light pen position.
Reengine says that (https://www.reenigne.org/blog/cga-reading-the … lightpen-latch/) the reading from 3DB and 3DC then reading the lightpen registers gives the current beam position instead of from the light pen inputs?
So does 3DB cause the lightpen to latch into the registers without 3DC being accessed? And if 3DC is accessed after it, it will trigger immediately instead of during the light pen location(otherwise, wait for the light pen location to get a pulse from the light pen pin on the CGA lightpen port)? Or am I missing something here?
If I check Reenigne's own tested code, https://github.com/reenigne/reenigne/blob/mas … n/lightpen3.asm , it means that 3DB rearms the latch (and clears the bit in the input status register), while 3DC is only used to cause it to latch immediately instead of waiting for the light pen pulse (so it's in fact a preset pulse manual input from the light pen triggered from the CPU)?
Edit: So, 3DB clears the light pen latch and allows a hardware pen to trigger it's latching. 3DC causes a cleared light pen latch to immediately trigger as if the hardware pen was giving a pulse when the port is written (so in effect this port access itself directly causes the pulse to be registered)? So without 3DB accessed first it would have no effect (pulse registered while the light pen is set, or otherwise registering a 'pulse' at that very moment and cause a latch (if the latch wasn't set already))? And just 3DB without 3DC will cause documented light pen reading behaviour?
Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows, PSP, Vita and Switch on itch.io