Jump to content
IGNORED

MAME: Aquarius


Pernod

Recommended Posts

Hi!

 

Yes, 0.227. Basically I miss the PAL version, seems that only NTSC model is emulated. Also, when "racing the beam" you can clearly see the differences, the vblank period seems to be correctly processed; but when the new frame retrace starts, looks like the frame is instantly generated. Probably I'm not explaining correctly...? 

Oh, I also miss the border color and I haven't found a switch to enable it. Does it works or hasn't been implemented yet?.

 

Screeen shot from Aqualite

 

Aqualite!, thanks!

 

As you're emulating a PAL machine (at least seems so), Aqualite renders the screen mostly fine, the row is partially visible; with a PAL Aquarius and a 43 value you won't see at all the yellow row, with a value of 42 you'll see about one quarter of the last scanline. Probably I would need to develop more accurate tests to fine tune this.

We still need the real numbers from a NTSC machine, I don't expect a big difference but the hblank must be taken into account.

Link to comment
Share on other sites

2 minutes ago, jltursan said:

Yes, 0.227. Basically I miss the PAL version, seems that only NTSC model is emulated. Also, when "racing the beam" you can clearly see the differences, the vblank period seems to be correctly processed; but when the new frame retrace starts, looks like the frame is instantly generated. Probably I'm not explaining correctly...? 

Oh, I also miss the border color and I haven't found a switch to enable it. Does it works or hasn't been implemented yet?.

The PAL version is aquariusp, whereas aquarius is NTSC. The refresh period should be correct but it's still using an old rendering method where the whole screen is drawn at once, it needs to be converted to be drawn by scanline. I'll take a look at updating this.

You'll have to give me a reference on the border colour, it's not implemented.

Link to comment
Share on other sites

Doh!, you're right, I just need to invoke aquariusp to get the PAL version. That was fast, thanks!

 

The refresh period should be correct but it's still using an old rendering method where the whole screen is drawn at once, it needs to be converted to be drawn by scanline

 

It matches what I'm seeing. I've used the MAME debugger to trace the display update and looks fine indeed, it was only the screen refresh what made me think that something was wrong there. It would be really cool if you can fix it.

 

Border colour is, AFAIK, extremely simple, the border is filled with the character and attribute color present at $3000. If you check the Aqualite snapshot you'll notice that upperleft green char, it's a space char with green background color, the border is generated using it.

I've not tested yet how the border interacts with the raster but I guess you can change $3000 at any time and the border will be updated but only will be visible from the beam position to the end of frame.

Link to comment
Share on other sites

2 hours ago, jltursan said:

 

 

Border colour is, AFAIK, extremely simple, the border is filled with the character and attribute color present at $3000. If you check the Aqualite snapshot you'll notice that upperleft green char, it's a space char with green background color, the border is generated using it.

I've not tested yet how the border interacts with the raster but I guess you can change $3000 at any time and the border will be updated but only will be visible from the beam position to the end of frame.

Check my recorded video from a real machine with some border effects in play.

Border colour is changed end of Vblank and again at start of vblank

Edited by MackJsy
  • Like 1
Link to comment
Share on other sites

Implemented the border, but looks like I'm a little out on the timing?

0000.png.0163a95892b73a1418001e81d629040d.png

 

0001.png.5619297ffc94553e2946064d79518064.png

 

The Xmas Demo is blanking the borders, but also looks like it's maybe out by a couple of scanlines blanking the bottom border.

0002.png.f5ff08d99e9a9cd0302aaeeb9d340d03.png

 

I need to double check everything and do some calculations, may have some questions to clarify things.

  • Like 1
Link to comment
Share on other sites

Amazing progress!

 

Yes, if the row is invisible in line 49 you're off by 6. I want to finish the border demo as it could be a better way to test all things together but the timing is giving me some headaches. Right now the number shows how many scanlines are being skipped before an action takes place; but the calculation is absolutely rough and with incremental error count, higher numbers means higher accumulated error.

 

The scroll demo shows a little better, there're not too much extra lines/pixels in the bottom.

Edited by jltursan
Link to comment
Share on other sites

This is the border demo I've been working on. It mostly works but it has some flaws as the yellow bar first scanline is off by about 30tstates (you can clearly see this in the first line of 191 pic) and I've just noticed that the line counter is wrong, showing the value minus 1 ? . As in this demo I'm always leaving free the first scanline, you can't never reach a 0 counter, 1 must be the lowest valid value.

 

I hope that even with these bugs it could be of some help, I'll try to generate a new version with more exact routines. Btw, use "Q" & "A" as before.

 

Aquarius_5.thumb.png.4fa627a43af6365d0954fd606c6061c0.png  Aquarius_82.thumb.png.2155c322b72d51a317f9af8477ec5675.png

 

Aquarius_191.thumb.png.b31e35b910318c5c3cf872f958fe002a.png

 

Suposedly, in all pics I've tried to align the first visible yellow scanline with the start of a 4x4 box but in fact, due the 30 cycles offset, it's the second scanline of the yellow bar.

bordertest.bin

Link to comment
Share on other sites

10 hours ago, jltursan said:

This is the border demo I've been working on. It mostly works but it has some flaws as the yellow bar first scanline is off by about 30tstates (you can clearly see this in the first line of 191 pic) and I've just noticed that the line counter is wrong, showing the value minus 1 ? . As in this demo I'm always leaving free the first scanline, you can't never reach a 0 counter, 1 must be the lowest valid value.

The demo works well, but the counter and bar get further out of sync as I move down the screen. What are your timings actually based on? I'm still not convinced on the detail in the Video Timing thread, and find it hard to totally disregard the timings giving in the technical manual as not being relevant.

 

We know the pixel clock is 7.15909MHz, so the question is how many dots per line at this rate? The Video Timing thread suggests 456 but I think this is slightly off.

 

As far as I know the only timing info you have access to is the VSYNC bit on port $FD, correct? Is VSYNC low for the borders too, your demo suggests yes but the Video Timing thread says not. Assuming a 312 PAL screen, which lines are you expecting VSYNC to be low on?

Edited by Pernod
Link to comment
Share on other sites

43 minutes ago, Pernod said:

The demo works well, but the counter and bar get further out of sync as I move down the screen. What are your timings actually based on? I'm still not convinced on the detail in the Video Timing thread, and find it hard to totally disregard the timings giving in the technical manual as not being relevant.

 

We know the pixel clock is 7.15909MHz, so the question is how many dots per line at this rate? The Video Timing thread suggests 456 but I think this is slightly off.

 

As far as I know the only timing info you have access to is the VSYNC bit on port $FD, correct? Is VSYNC low for the borders too, your demo suggests yes but the Video Timing thread says not. Assuming a 312 PAL screen, which lines are you expecting VSYNC to be low on?

I'm going to get the logic analyser on the RA0->RA2 and Vblank lines on the PAL (all I have) version - just to see if RA0->RA2 are reset to zero on VBLANK end (which I suspect is the case)
but logic says the following 625 lines in 1/25s (2 interlaced frames) - Dot clock would produce 458.
((1/25)/(1/CLK))/625 = 458 so 456 is off by 2 a line, or 50 a full frame
note - VBLANK is only low from bottom of the displayed area round to top of the displayed area - it is not low during the side borders, only the top (above active screen area) and below (under active screen area)

Edited by MackJsy
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, MackJsy said:

I'm going to get the logic analyser on the RA0->RA2 and Vblank lines on the PAL (all I have) version - just to see if RA0->RA2 are reset to zero on VBLANK end (which I suspect is the case)

Sounds good, the actual VSYNC time should give us more to work with.

 

Whilst I'm very close to actual behaviour on all three test cases I feel there may be something more that we're missing. Could there be any RAM contention coming into play during the active display?

Edited by Pernod
Link to comment
Share on other sites

40 minutes ago, Pernod said:

Sounds good, the actual VSYNC time should give us more to work with.

 

Whilst I'm very close to actual behaviour on all three test cases I feel there may be something more that we're missing. Could there be any RAM contention coming into play during the active display?

Well - Ram contention is interesting , as the Z80's Wait line is fed the CLK/4, so some instructions  will wait, some won't - depend on the point of the M1 /access cycle of the CPU at that point

However, it's a CPU wide thing - not ram location.  - so it's consistent

 

 

Link to comment
Share on other sites

I'm not a hardware guy but this remembers me how the Amstrad CPC, sharing its RAM with the CRTC, does inserts extra wait cycles every four CPU cycles to give time to the CRTC to read pixels for video generation. I think that it also works consistently along all the RAM.

Link to comment
Share on other sites

11 hours ago, jltursan said:

I'm trying to generate a delay of 228T for every scanline based on the timings here. Looking at the real thing, it's close but I need to tighten a bit the code, I'm losing cycles here and there...

There is Ram contention sadly, - the Z80 Wait line is on a 1/4 CPU clock, so randomly (pretty much) some instructions will be one T state longer, I believe you lose on average 8 Tstates per scan line

Link to comment
Share on other sites

4 hours ago, jltursan said:

I'm not a hardware guy but this remembers me how the Amstrad CPC, sharing its RAM with the CRTC, does inserts extra wait cycles every four CPU cycles to give time to the CRTC to read pixels for video generation. I think that it also works consistently along all the RAM.

I'm not a hardware guy either, I just emulate machines based on available schematics and technical manuals. I'm only familiar with RAM contention as it's also an issue with the Acorn Electron.

Link to comment
Share on other sites

Yep, there're a lot of possible contention types, the more complex variant I know is the one in the CPC. It must be hard to emulate!. Let's see what can be done with the Aquarius...

 

the Z80 Wait line is on a 1/4 CPU clock, so randomly (pretty much) some instructions will be one T state longer, I believe you lose on average 8 Tstates per scan line

 

Thanks!; so, maybe we're talking of 228T+8T=236T per scanline?. I can make it work this way and compare the results.

I'm afraid that this will turn into a trial and error affair; but right now it's the best I can think of.

 

 

Link to comment
Share on other sites

  • 3 months later...
21 hours ago, Pernod said:

I relented on waiting for some better video timings, so the border effects and scanline rendering are now in today's MAME 0.232 release.

Not been able to get the aquarius to run since you started making changes tbh - so gave up

 

Link to comment
Share on other sites

5 minutes ago, MackJsy said:

Not been able to get the aquarius to run since you started making changes tbh - so gave up

 

Rather than just giving up with no explanation it would help if you actually mentioned this when you had problems, and provide some details as to what happens when you try to run it.

 

Chances are that you need to update your aquarius.zip romset, by adding the aquarius_s1 ROM that was posted earlier in this thread.

  • Like 2
Link to comment
Share on other sites

1 hour ago, Pernod said:

Rather than just giving up with no explanation it would help if you actually mentioned this when you had problems, and provide some details as to what happens when you try to run it.

 

Chances are that you need to update your aquarius.zip romset, by adding the aquarius_s1 ROM that was posted earlier in this thread.

Sorry -- been busy on lots of other things - think I tried it one "How many Scotch can I drink this evening" evening, and well forgot!

Is there a link to the romset, as what I have fro S1/S2 doesn't work !!

 

  • Haha 1
Link to comment
Share on other sites

5 hours ago, MackJsy said:

Sorry -- been busy on lots of other things - think I tried it one "How many Scotch can I drink this evening" evening, and well forgot!

Is there a link to the romset, as what I have fro S1/S2 doesn't work !!

Glad to see you back, Mack!  (I've been busier with other things than I would like, too, so I know what you mean.)

aquarius.zip

 

I've attached an Aquarius ROM set which you might find helpful.  It includes the "S2" OS ROM set for both the Aquarius and Aquarius II, along with my dumps of the "S1" OS ROM and the character generator ROM.  I just tested this set with the latest MAME 0.232 release, so all you should need to do is drop this into the "roms\" subdirectory.  You can switch from "S2" (the default) to "S1" using the "BIOS Selection" option in the MAME UI.

 

(Thanks again to Pernod for your work on the Aquarius/Aquarius II emulation!  I'm still stoked to finally see bankswitched cartridges working in MAME!  I hope to make use of it soon for some new projects.)

  • Thanks 1
Link to comment
Share on other sites

On 5/27/2021 at 8:34 PM, Pernod said:

I relented on waiting for some better video timings, so the border effects and scanline rendering are now in today's MAME 0.232 release.

That's really cool, thanks!. I'm working in a "big" Aquarius project and this would prove to be handy for sure, I need to update my MAME (I'm using it as my main development tool thanks to its debugger) right now!

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...