Author Topic: .  (Read 143212 times)

0 Members and 1 Guest are viewing this topic.

Offline McKlain

  • 6128 Plus
  • ******
  • Posts: 867
  • Country: es
  • Programmable Sound Generator
    • www.mcklain.com
  • Liked: 339
  • Likes Given: 950
Re: CPCBox, your CPC emulator in Javascript
« Reply #250 on: 23:26, 27 June 11 »
I guess it's an improvement, I can't test the emu  :laugh:

Still there are a few thing that doesn't sound right, mainly the "hard" sounds and the noise generator. The noise sounds at a higher pitch than the real AY output, if you compare it with my recording. Another thing, can you make the output in stereo? That way you could check it side by side.


http://soundcloud.com/mcklain/take-off

And thank you  ;D

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #251 on: 00:27, 02 July 11 »
.
« Last Edit: 17:10, 30 June 21 by PhilZeVibe »

Offline McKlain

  • 6128 Plus
  • ******
  • Posts: 867
  • Country: es
  • Programmable Sound Generator
    • www.mcklain.com
  • Liked: 339
  • Likes Given: 950
Re: CPCBox, your CPC emulator in Javascript
« Reply #252 on: 12:26, 03 July 11 »
Wow, pretty good, sounds like the original one  :D

Now it just needs stereo  ;D

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #253 on: 12:43, 07 July 11 »
.
« Last Edit: 17:10, 30 June 21 by PhilZeVibe »

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2281
  • Likes Given: 3478
Re: CPCBox, your CPC emulator in Javascript
« Reply #254 on: 12:55, 07 July 11 »
To go further into emulation, what's now needed is mimicking the synchronisation lag between the CRTC and the Gate Array output.
As I implemented CPCBox, there is actually no delay between those 2 chips. It makes things simpler for a code point of view, and it enables nice optimizations.

But at the end of it, it's not how the real thing works.
I tried my best to hack around to mitigate the side effects. But some demos are impossible to fix due to this synchronisation issue, and so it claims for proper emulation!

I've thought a little about it. Implications are enormous from a code point of view. Making proper emulation of this synchronization delay will be CPU intensive, and I'll have to ditch the optimization tricks I used that won't fit anymore. :(
Is it worth it, just to be able to fix a handful of demos? Given how slow CPCBox currently is, I'm not sure. But it's bothering the heck out of me. >:(

?? There are some delays.

it is known the the hsync is delayed by 2 crtc clocks before it leaves the gate-array, and is cut by the gate-array to a maximum of 6us.
this partly explains how the image is centralised in the display, and also why some values of hsync do not trigger interrupts.

I believe the same may be true of vsync, but I've not checked it.

do not forget the gate-array reads 2 bytes of memory for each crtc clock, it buffers these, then clocks them out to the display.

there is probably a delay in here, which explains why colours etc are delayed.

is it worth doing it for a few demos? depends on how far you want to go.

for me, I would do this.

I am currently investigating the dk'tronics ram expansion and how it's operation differs on a 464 compared to a 6128.
so I can emulate this in arnold correctly.

how far do you go with the timing of the instructions? do you do "inter instruction timings" where you consider that the i/o operations occur within the timing of the instruction? (e.g. outi, outd, the time for i/o happens before the instruction has finished executing), *this* will also explain why you have to work around the timings?
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #255 on: 13:00, 07 July 11 »
.
« Last Edit: 17:10, 30 June 21 by PhilZeVibe »

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #256 on: 15:19, 07 July 11 »
.
« Last Edit: 17:10, 30 June 21 by PhilZeVibe »

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: CPCBox, your CPC emulator in Javascript
« Reply #257 on: 02:26, 08 July 11 »
That's another synchronisation issue: synchronisation between Z80 and GA. There is a 0.5µs lag between these 2 chips. Palette is modified right in the middle of a Z80 "µs cyle".
It's really the worst of those synchronization issues. And it's interesting to note that no emulator emulates this. I don't plan to do it either!

The display output shows the palette change 14 (MODE 2) pixels into the 16 pixels read in one go. I think this may be slightly different on the Plus also. So the actual change happens 14/16 * 4 T-States in, ie. It's aligned to 3.5 T-States. This could be emulated by getting the renderer to render the first 14 pixels, then do and internal palette update if necessary, but it would involve a lot of overhead just to get the emulation 2 MODE 2 pixels correct (only 1 pixel in MODE 1, and no difference in MODE 0).

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #258 on: 17:38, 08 July 11 »
.
« Last Edit: 17:37, 30 June 21 by PhilZeVibe »

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #259 on: 17:46, 08 July 11 »
Well, I avoid that with a little, dirty trick :P
(Deinterlaced screenshot, so if you miss some pixels, go and search'em ;) )
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #260 on: 18:10, 08 July 11 »
.
« Last Edit: 17:11, 30 June 21 by PhilZeVibe »

Offline McKlain

  • 6128 Plus
  • ******
  • Posts: 867
  • Country: es
  • Programmable Sound Generator
    • www.mcklain.com
  • Liked: 339
  • Likes Given: 950
Re: CPCBox, your CPC emulator in Javascript
« Reply #261 on: 18:33, 08 July 11 »
Java CPC is the sleeping beast.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #262 on: 19:34, 08 July 11 »
I am still curious, why no emulator shows these effects properly, too:
First is completely missing in all emulators I tested,
and 2nd looks very worse...
(Still deinterlaced screenshots)

Accurate images:
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #263 on: 19:42, 08 July 11 »
.
« Last Edit: 17:11, 30 June 21 by PhilZeVibe »

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #264 on: 19:42, 08 July 11 »
I tried to get it working but with no luck at the moment. I can make those effects work but then there are glitches that appear in other demos, so i've not enabled it :(

It's easier as it seems ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #265 on: 19:45, 08 July 11 »
Try a thing like this in your CRTC emulation:
(I only emulate CRTC 1 or 0 so you will understand what I do here)
Code: [Select]
// Some scrollers use register 8 (CRTC 0)
// and register 6 (CRTC 1). This routine makes them visible
// JavaCPC is the only known emulator which emulates booth correct!
    public void checkHDisp() {
        if (hDisp) {
            if (CRTCType == 0) {
                if ((reg[8] & 0x030) == 0x30) {
                    listener.hDispEnd();
                } else if ((reg[8] & 0x030) == 0x00) {
                    listener.hDispStart();
                }

            } else {
                if (reg[6] != 0) {
                    listener.hDispStart();
                } else {
                    listener.hDispEnd();
                }

            }
        }
    }

and call it every GateArray cycle...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #266 on: 20:10, 08 July 11 »
.
« Last Edit: 17:11, 30 June 21 by PhilZeVibe »

Offline McKlain

  • 6128 Plus
  • ******
  • Posts: 867
  • Country: es
  • Programmable Sound Generator
    • www.mcklain.com
  • Liked: 339
  • Likes Given: 950
Re: CPCBox, your CPC emulator in Javascript
« Reply #267 on: 20:15, 08 July 11 »
It seems that everybody thinks that they get things right  :P

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #268 on: 21:45, 08 July 11 »
.
« Last Edit: 17:11, 30 June 21 by PhilZeVibe »

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #269 on: 22:05, 08 July 11 »
Nice...
Now just fix Reg 6 / 8 registers ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 785
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 394
  • Likes Given: 60
Re: CPCBox, your CPC emulator in Javascript
« Reply #270 on: 02:44, 09 July 11 »
Oops, my post earlier was completely wrong. I was thinking of the HSYNC blanking timing on the standard CPC I think. The Grim documentation is accurate for palette changes.

@Markus, it appears JavaCPC most likely delays the palette change one whole extra microsecond for you to get the correct screen output on Vanity.

WinAPE also has a slight interrupt timing issue which I never tracked down. I'm not sure if it's common to all emulators, but I dicussed it with someone back on CPC Zone. About the only things I'd really like to get back from Malc are those posts.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1018
  • Likes Given: 926
Re: CPCBox, your CPC emulator in Javascript
« Reply #271 on: 11:39, 09 July 11 »
@Markus, it appears JavaCPC most likely delays the palette change one whole extra microsecond for you to get the correct screen output on Vanity.

Its just done with a very dirty trick ;)
All other rasters behave like other emulators do, too...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #272 on: 14:54, 28 August 11 »
.
« Last Edit: 17:11, 30 June 21 by PhilZeVibe »

Offline PhilZeVibe

  • 464 Plus
  • *****
  • Posts: 471
  • Country: 00
  • Liked: 165
  • Likes Given: 187
Re: CPCBox, your CPC emulator in Javascript
« Reply #273 on: 15:42, 28 August 11 »
.
« Last Edit: 17:37, 30 June 21 by PhilZeVibe »

Offline SyX

  • 6128 Plus
  • ******
  • Posts: 1.137
  • Country: br
  • Liked: 1143
  • Likes Given: 1877
Re: CPCBox, your CPC emulator in Javascript
« Reply #274 on: 17:34, 28 August 11 »
Thanks phix2!!!  :D

Wonderful Job!!!  ;D ;D ;D

I get a solid 30 fps, i think that it's great with so good emulation :)

Is there any way to load my own DSKs???

We are using in http://amstradcpc.es/ the javascript emulator of Antonio Villena, and i don't know if i told before in the CPCWiki, but thanks to Antonio, we made the database freely avalaible here for all the community, surely you can find useful for CPCBox, too.