sz81 emulator

Emulator and emulator development specific topics
Moggy
Posts: 3407
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: 58
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: 3407
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: 58
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 238 times
head1.p
(1.81 KiB) Downloaded 240 times
Moggy
Posts: 3407
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.
zx4ever
Posts: 18
Joined: Wed Jun 27, 2018 10:58 pm

Re: sz81 emulator

Post by zx4ever »

Hi and happy new year everyone. :)
These days I'm trying to test sz81 on a Raspberry Pi RiscOS and the emulator works just fine, except for one important part.
For some reason, every attempt to load any .p file ends up with a "Load failed" message.
Does anyone have an idea, what could be the cause and how to solve this issue ?
I use sz81 in both windows and raspbian linux environment, but I have never experienced anything like this.
Is it perhaps necessary to specify the file type in risc os for .p image or is it something else ?
Exile
Posts: 58
Joined: Tue Jan 03, 2023 9:50 pm

Re: sz81 emulator

Post by Exile »

Well, I'd never used RiscOS before today, so I thought I'd put it on an SDCard and give it a go on a Pi4.

It installed ok, but the GUI is very different to what I'm used to :-)

When I tried to run a pre-built version of sz81 from https://riscosports.co.uk/sz81.zip it seg faulted. Where did you get your executable version of sz81? Did you compile it yourself?

One thought: RiscOS uses . as its directory separator, so will any file name including a .p extension be confusing in RiscOS?
zx4ever
Posts: 18
Joined: Wed Jun 27, 2018 10:58 pm

Re: sz81 emulator

Post by zx4ever »

Exile wrote: Sun Jan 07, 2024 10:31 pm Well, I'd never used RiscOS before today, so I thought I'd put it on an SDCard and give it a go on a Pi4.

It installed ok, but the GUI is very different to what I'm used to :-)

When I tried to run a pre-built version of sz81 from https://riscosports.co.uk/sz81.zip it seg faulted. Where did you get your executable version of sz81? Did you compile it yourself?

One thought: RiscOS uses . as its directory separator, so will any file name including a .p extension be confusing in RiscOS?
No, I didn't compile it myself, I used this prebuilt version with the latest stable RiscOS 5.28 on a Pi 2B and it worked normally, but it keeps rejecting .p image files with "Failed" message.
Pi4 can be very sensitive with some older emulators, maybe you should try pi2/3.
btw, thanks for the tip, I'll try to remove the .p extension from ZX81 image files and try to load them that way.
Also, maybe its necessary to set a specific file type just for this type of emulator images.
This is how I did it for BBC B images, which requires BBC to be entered in the file type section and then I have a file association of these files with BBC emulators.
Exile
Posts: 58
Joined: Tue Jan 03, 2023 9:50 pm

Re: sz81 emulator

Post by Exile »

Thanks for the tip - I tried again using a Pi2 and sz81 started ok. I then got ZX Galaxians running by doing the following:

1. Downloaded sz81, unzipped and copied using InfoZip
2. Ran up sz81, wrote and saved a 1 line program "fred" using SAVE "FRED" from the emulator.
3. Checked that I could load the file back in the emulator using the menu (accessed by pressing F3).
4. Looked in the RiscOS file manager - a new directory p had been created created, containing the file fred
5. Downloaded the zip of galaxians.p
6. Unzipped it using InfoZip into the p directory that sz81 had created earlier
7. Renamed the p file from galaxians/p to galaxians
8. Pressed F3 in sz81 and now both hello and galaxians were visible to load
9. Loaded galaxians

So the key thing seems to be to find the p directory that sz81 creates and put renamed p files within it. Here's a quick screenshot showing some of the files...
sz81.jpg
This is quite an old version of sz81, so it will have issues with hi-res programs.
Post Reply