sz81 emulator

Emulator and emulator development specific topics
Moggy
Posts: 3079
Joined: Wed Jun 18, 2008 2:00 pm

Re: sz81 emulator

Post by Moggy »

This new version of commanderdoesn't work for me sadly.

On my already established version of the emulator it just crashes so downloaded SZ-81 again and installed on a different computer so everything nice and fresh, and whilst it will run your test version of commander there is nothing inside the folders when you open them.

Only the root directory shows executable P files.

Personally this is no problem for me as I have little use for emulation but happy to test and find a solution for others that do.
Exile
Posts: 22
Joined: Tue Jan 03, 2023 9:50 pm

Re: sz81 emulator

Post by Exile »

I've noticed an interesting issue with the 16kB rezurrection demo on SZ81. On the final screen the text "Calodox - we own ZX81" becomes corrupted, as can be seen in the attached screen shot. This corruption does not occur on my "real" ZX81.

Looking through the rezurrection code, the issue seems to be that a VSYNC is generated shortly before an HSYNC. This results in the linecounter being incremented once too often, compared to a real ZX81, leading to the character corruption. I reassembled the final screen of rezurrection, changing the timing so that the VSYNC coincided with HYSNC, and the issue went away.

I "fixed" this in SZ81 (and my PicoZX81 derivative!) by adding a work around, and effectively skipping the first linecounter increment if VSYNC occurs just before HSYNC. This case was identified by checking the value of the hsync 207 tstate counter at the point VSYNC is triggered.

The question is, from a hardware perspective, does this workaround make physical sense? I did have a look at the latest EO code, and there are checks to merge HSYNC and VSYNC pulses if they occur close together, so hopefully there is a hardware explanation as to why this workaround is valid?

What do you think please?
Attachments
head.JPG
olofsen
Posts: 189
Joined: Wed Jan 08, 2014 12:29 pm

Re: sz81 emulator

Post by olofsen »

Thank you for writing about the issue with rezurrection. I seem to remember trying it some years ago and that it worked correctly, so possibly some later improvement introduced the issue. I think it is still unknown how the ULA works exactly, but if something works on a real ZX81 it should work on an emulator (or ULA replacement). But indeed without knowing how the ULA works exactly it cannot be known if an implementation is completely correct. Is your fix available online?
Moggy
Posts: 3079
Joined: Wed Jun 18, 2008 2:00 pm

Re: sz81 emulator

Post by Moggy »

Works ok for me on SZ-81 (file no 2.1.8.1) and only corrupts the lettering as the final screen is actually being drawn. once drawn it's ok.
Exile
Posts: 22
Joined: Tue Jan 03, 2023 9:50 pm

Re: sz81 emulator

Post by Exile »

@olofsen Thanks for getting back to me, and many thanks for all of your work on SZ81, it is a great emulator, and the code is really nice to work with.

The diff of the workaround can be found at: https://github.com/SegHaxx/sz81/compare ... diff=split

I've also attached the updated zx81.c here.

head.p is just the final screen from rezurrection.

@Moggy Yes the text corruption only occurs as the page is being scrolled up, not after it has stopped at its final position, so I think you are seeing the same thing that I am. There is no text corruption on a "real" ZX81 as it is being scrolled. Am I right in thinking 2.1.8.1 is a Windows build of sz81(aka. 2.3.10)?
Attachments
zx81.c
(60.29 KiB) Downloaded 23 times
head1.p
(1.81 KiB) Downloaded 23 times
Moggy
Posts: 3079
Joined: Wed Jun 18, 2008 2:00 pm

Re: sz81 emulator

Post by Moggy »

2.1.8.1 is the file version I get when I right click on the SZ-81 EXE and look at the details tab.
Post Reply