nocrew / ostis

Atari ST Emulator
GNU Lesser General Public License v2.1
19 stars 4 forks source link

Phalanx Demo issues #77

Open larsbrinkhoff opened 8 years ago

larsbrinkhoff commented 8 years ago

The Phalanx Demo F1 screen doesn't work.

A short while after it switches to medium resolution, it tries to execute a 000F instruction. Which is illegal, so the CPU stops.

I tried a version 100 commits older than the current master, and the exact same thing happened.

stefanberndtsson commented 8 years ago

ea79d10 works for me. All screens including menu has worked in this demo, apart from a slightly dodgy lower border on F3.

larsbrinkhoff commented 8 years ago

Apparently, it doesn't work with TOS 1.04.

However, the video output is still shakey in most of the screens.

larsbrinkhoff commented 8 years ago

I made the menu and the F1 screen happy by adjusting the timing of the Timer B interrupt.

These two screens use one Timer B interrupt to switch the video frequency back and forth, with a busy wait in between the switches.

However, the F3 screen uses two Timer B interrupts. The first goes to 60 Hz, and the second back to 50 Hz. Unfortunately, the second event happens too soon, so 50 Hz is in effect when the GLUE decides whether to switch DE off.

So far, I have been unable to adjust the Timer B timing to make both techniques work.

stefanberndtsson commented 8 years ago

Since mfp interrupts trigger between instructions only, and glue really should respond to clock regardless of instruction execution, that the trigger and the glue get out of sync briefly? Or something around that concept at least. I can't really see how right now, but maybe...

larsbrinkhoff commented 8 years ago

I have the GLUE call the MFP to set the Timer B interrupt pending. Then, later, the CPU calls the MFP to trigger pending interrupts.

For the HBL and VBL interrupts, I added flags in the CPU which is checked between instructions.

larsbrinkhoff commented 8 years ago

F5 with -K runs for a few seconds, then craches with lots of address errors.

larsbrinkhoff commented 8 years ago

F1 became unstable after #123.

Log output shows that sometimes the lower border switch to low resolution comes too late. Previously, the switch was done at cycle 28-44. Now, it sometimes comes at cycle 111-139.

The odd cycle number is a hint that this may be related to an exception.