Hi again!

Here is my third attempt (And probably the last as I think everything is finished):
diff 3rd attempt

In this version:
  • Implemented 2 contended memory script tables to support all major ZX Spectrum models (The 'Sinclair' script table for 48K/128K/+2. The 'Amstrad' script table for +2A/+3).
  • Each contended memory script is run during the opcode's execution, rather than after the opcode has finished.
  • Added a macro (MCFG_Z80_CFG_CONTENDED_MEMORY) allowing you to configure how the z80 device should contend memory. If you don't call this macro, then the z80 will not contended memory and will rely on the cc_op[]/cc_ed[] etc.. tables for eating cycles (Thus, will work the old way).
  • The ZX spectrum clones (Timex, ATM, Scorpion, Pentagon - and anything else that inherits the ZX Spectrum machine configuration) all work as they did before (I.e. without contended memory and without using the raster callback).
  • Floating bus support now working.
  • Reduced the amount of times the screen/border bitmaps are updated. Rather than render to the new raster beam position every time tstates are eaten. I realised that it was only necessary to render to the new raster beam position:
    • Just before memory is written to that could effect screen colour attributes
    • Just before memory is written to that could effect border color
    • Always at the end of each scanline (To fix flickering/missing graphics issues that the SCANLINE timer previously fixed (Discussed in the 'firefly' thread)).
  • Tidy up of all my code.


Regarding CPU usage. According to top, without my contented memory changes Amaurote runs at 22% CPU. With my contented memory changes it runs at 26%.

In terms of games/demos, this now means the following:
  • Nirvana (SnakeEscape/DreamWalker/Elstompo/MultiDude/Stormfinch/Sunbucket) MultiColour games look perfect on 48K and 128K Spectrums.
  • Shock Megademo looks perfect on 48K and 128K Spectrums. Note - You must use the '.TAP' file from WOS, don't use (like I did) the '.Z80' dump floating around on the net as it does not display correctly on 48K or 128K spectrums (The dodgy Z80 dump doesn't look right on Emuzwin or Fuse either).
  • Aquaplane - Horizon/Border position is correct (Contended Memory)
  • Darkstar - Hi-Score table border pattern position is correct (Contended Memory)
  • Sidewize - Now fully playable at the correct speed. It used to freeze just as you started the game (Floating Bus).
  • Zynaps - MultiColour text is correct. Speed is now perfect. Previously game play would speed up and slow down (Floating Bus).
  • Arkanoid - Original release, now fully playable. It used to freeze just as you started the game (Floating Bus).
  • Cobra - Original release, now fully playable at the correct speed (Floating Bus).
  • Short Circuit - Original release, Number 5 no longer flickers (Floating Bus).
  • Uridium - MultiColour text is correct.


Here is a selection of screen shots of the games/demos that I've tested:
screenshots

Thinking about whether or not I'd like to see this committed to mame and I'm really not sure. I've tried hard not to break anything and make modifications that fit in with mame 'as is'. I've done this but at the expense of making the Z80 CPU code more complex which has had a slight detrimental effect on MAME's CPU performance. Can the cost of my modifications be forgiven given based on the titles that now work? - In the end its all down to you mamedev experts to decide. Either way, I totally understand if don't decide to go with it, so no pressure smile

As I said in an earlier post, making/seeing this stuff work is what it has been about for me, take from it what you will and hope it helps smile