gasman / jsspeccy2

Ground-up rewrite of the Javascript Spectrum emulator
http://jsspeccy.zxdemo.org/
GNU General Public License v3.0
165 stars 43 forks source link

Implements the floating bus effect #15

Open rastersoft opened 3 years ago

rastersoft commented 3 years ago

When reading an inexistent I/O port in the Sinclair Spectrum, the value read not always is 255. That only happens when the ULA is painting the BORDER. When painting the PAPER, the bus presents the current value being read by the ULA from the video memory.

This effect is used by some games to synchronize with the beam. They can use a naive way, by just waiting for a non-255 value to appear in the bus, thus knowing that now the beam has started painting the PAPER, or checking that value and waiting for an specific one (usually a color attribute value), thus being able to detect when an specific line is being painted.

This patch emulates this behavior, thus allowing these games to run in the emulator.

Tested with Escape from M.O.N.J.A.S. (https://www.rastersoft.com/programas/monjas.html )

Fixes https://github.com/gasman/jsspeccy2/issues/14