MiSTer-devel / VIC20_MiSTer

Commodore VIC-20 for MiSTer
17 stars 16 forks source link

Robotic Liberation Demo Fails to Run #6

Open dave18 opened 4 years ago

dave18 commented 4 years ago

Hi

Tried the Robotic Liberation demo by pwp. The first file "liberation.prg" loads and runs but then crashes back to the "READY." prompt without running any of the demo. I've tested the D64 on Vice and it works fine there.

I think the demo uses the 1541 in a custom mode as it doesn't work on SD2IEC interfaces either.

Dave

dave18 commented 3 years ago

I've done some investigation that one of the problems is that when reading the 4 bit colour RAM the core assumes the upper nibble is "0000". In reality this should be whatever is left on the bus from the last 8 bit transfer (although exactly how reliable this is is unclear). Robotic Liberation uses this expected behaviour in its vblank sync code and if the check fails it resets.

sorgelig commented 3 years ago

Which address you are talking about?

dave18 commented 3 years ago

The colour RAM is read from $9600 to $97FF on an unexpanded VIC or $9400 to $95FF if using a memory expansion. If in BASIC you peek these addresses in VICE you mostly get (although not consistently) ? PEEK (37888) = 144 (top nibble 0x9) ? PEEK (38400) = 150 (top nibble 0x9)

In MiSTER core you get the following ? PEEK (37888) = 0 (top nibble 0x0) ? PEEK (38400) = 6 (top nibble 0x0)

The cause of this is line 613 in vic20.vhd: v_data_read_mux <= "0000" & col_ram_dout;

This forces the high nibble to always to 0 on a read from colour RAM, however when looking at the VICE source it should return whatever was last on the bus.

I've played around with the core to try and reproduce the correct (ie VICE) behaviour and while it passes the check in the demo (however demo still hangs on a black screen further along) it doesn't seem to return the same values when peeking the colour RAM.

vic20 .txt

sorgelig commented 3 years ago

Try this build: VIC20.zip

dave18 commented 3 years ago

Thanks for the build

That is better and similar to to results I managed to get. It passes the initial check but hangs later so I expect it is not giving an expected value later in the code, I will keep examining the code to see if I can work out what other reads it does to those addresses (assuming the issue isn't something else entirely).

For info, peeking in BASIC now normally returns 32 and 38 (decimal) for 37888 and 38400 respectively.

I wrote a quick program that duplicates the initial test code with Robot Liberation to confirm that it passes, just load the PRG and then SYS4352 rl-test.zip

I also have real hardware here so can run any tests that might be useful (as I don't know how accurate VICE actually is - there are a few TODO markers in the code around the colour RAM).

dspiteri commented 2 years ago

RL single-file version runs but has some graphic glitches on the raster effects.