Weird Behaviour From the ZX81 Core

RichardHallas
Posts: 4
Joined: Sun Mar 12, 2023 11:09 am
Has thanked: 5 times

Weird Behaviour From the ZX81 Core

Unread post by RichardHallas »

I'm a new/inexperienced MiSTer user, so I suppose I may be overlooking something obvious, but I've run into a brick wall with this, so I'm asking on here…

I'm keen to use the ZX81 core, and I've got a pretty large library of ZX81 software – but I can't seem to get the MiSTer core to load and successfully run any of it. The problem is not the loading of the software; it's what happens when it's loaded. I just get weird errors.

For example, if I load my .p file of 3D Monster Maze, then the game loads and I see the traditional "ANYONE THERE?" message on the screen. But then it stops immediately with a "C/0" error. If I load Mazogs, it stops immediately with a "C/8574" error.

Almost everything I've tried fails immediately in this way. Just about the only thing I've tried so far that appears to work is Campbell Systems' Gulpman, which loads, runs, and allows me to scroll back and forth as expected through its initial screen of instructions. But when I exit that screen to go to the main game menu, it then goes partially wrong: the menu area at the right is nearly blank, with just the first menu item (M=MAZE) listed. Even then, it's actually working: I can press M to cycle through the mazes (and the screen does update to show them), and if I press K to change the control key scheme, the 'moving cursor' animation happens on that menu line, even though the line itself remains blank (i.e. I see the animation effect, but there's no text there before, during or after the animation).

This is a real head-scratcher. Can anyone elighten me as to what might be going wrong, please?

Hackshed_Carl
Posts: 115
Joined: Mon May 25, 2020 3:22 pm
Has thanked: 31 times
Been thanked: 51 times
Contact:

Re: Weird Behaviour From the ZX81 Core

Unread post by Hackshed_Carl »

The ZX80/1 core isn't one I've used much but might have some time this evening to take a look.
The first thing I'll ask is if you've tried any different rom sets?

I know from experience with the Coco2 core in Dragon mode, I've had a similar thing.
My curated collection of roms refused to load on the core despite loading perfectly on emulators.
I found a new source for the roms and they all worked perfectly.

I never got round to examining the roms to work out why.

No idea if that'll help but it's all I've got :)

FPGA64
Top Contributor
Posts: 771
Joined: Mon Mar 01, 2021 3:10 pm
Has thanked: 45 times
Been thanked: 330 times

Re: Weird Behaviour From the ZX81 Core

Unread post by FPGA64 »

Just tested my 3d Monster maze works as expected

Select the p file in the core menu

then j and shift p twice to get the load ""

then run after and it works fine

Game is from a Tosec collection

Mazogs again works from a .p file

Although I did find out the keyboard seems to have space mapped to the break key. So dont press that !

Error C is
The text of the (string) argument of VAL does not form a valid numerical expression.

So no idea how thats being generated

RichardHallas
Posts: 4
Joined: Sun Mar 12, 2023 11:09 am
Has thanked: 5 times

Re: Weird Behaviour From the ZX81 Core

Unread post by RichardHallas »

Thanks for those two responses so far. Concerning trying different ROM sets… no, I've just used the ROMs that were installed with the core. I assumed that they were well established ROMs that are known to work. Besides, this core appears to work for other people, so I can't see why I'm especially unlucky! I'm aware that different versions of the ZX81 ROM do exist (later ones had bug-fixes), and if similar problems have been seen with other cores (Coco2 etc.) then I guess I'd better compare ROM versions and see what I can turn up.

The ZX81 was the first computer I owned, and I've still got a couple of them, so it's not an unfamiliar system to me, and I've never seen an issue like this before with either a real one or an emulator.

Also, yes, I'm aware that error C makes no real sense, which is another reason why this problem is weird! But it's consistent. If anyone else has seen this, or has further ideas, I'm all ears. In the meantime, I'll do some more investigating.

FPGA64
Top Contributor
Posts: 771
Joined: Mon Mar 01, 2021 3:10 pm
Has thanked: 45 times
Been thanked: 330 times

Re: Weird Behaviour From the ZX81 Core

Unread post by FPGA64 »

By default the ZX81 core would not contain any ZX81 software. When I did my testing I was using the stock settings on the Core.

My guess is the .p files that you are feeding the core. The Tosec sets although really badly named thansk 8.3 naming scheme are available on a certain archive site and I know they work.

ZX81 was my first computer. Christmas I got the machine and then on my birthday the 16k Ram Pack

User avatar
pgimeno
Top Contributor
Posts: 679
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 261 times
Been thanked: 210 times

Re: Weird Behaviour From the ZX81 Core

Unread post by pgimeno »

I also think that the files must be corrupt. My first guess is that they may be transferred to the MiSTer via FTP (Filezilla?) in non-binary mode, but it may be something else.

Error C is a plain syntax error. It would only make sense to get it for corrupt files, because the ZX81 doesn't let you enter lines with syntax errors in them. If you do for example 10 REM and then POKE 16513,38 then line 10 turns into 10 A which is a syntax error; if you try to run that you get C/10. You also get it for VAL because VAL uses the BASIC expression evaluator internally, which can produce syntax errors for free-form strings.

For me, ZX81 was not the first computer I owned (which was a Spectrum), but it was the first one I used, borrowing it from a friend for a long time, and the one with which I learned BASIC and Z80 machine code. A friend and I are working on an expansion interface; I'm working on the ROM part, which adds new commands (and uses error C in several places, but these are not usually visible to the user because they are converted to an inverted "?" sign while inputting a line). https://codeberg.org/Retrostuff/SD81-Booster

EeDee
Posts: 244
Joined: Thu Dec 24, 2020 12:33 pm
Has thanked: 10 times
Been thanked: 47 times

Re: Weird Behaviour From the ZX81 Core

Unread post by EeDee »

@pgimeno I looked up your SD81 project and makes me want a ZX81. So I have to ask the question, what would it take to add it to Mister? The ZX81 core lacks only due to the fact that it cannot Save programmes/data

User avatar
pgimeno
Top Contributor
Posts: 679
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 261 times
Been thanked: 210 times

Re: Weird Behaviour From the ZX81 Core

Unread post by pgimeno »

EeDee wrote: Wed Nov 08, 2023 9:16 pm

@pgimeno I looked up your SD81 project and makes me want a ZX81. So I have to ask the question, what would it take to add it to Mister? The ZX81 core lacks only due to the fact that it cannot Save programmes/data

I am not aware of any free ATmega 640/1280/2560 Verilog or VHDL modules. Anyway I don't have the expertise to port it. The CPLD firmware update capability would not be possible with MiSTer I gather, but that's not a biggie.

User avatar
Bristles
Posts: 72
Joined: Wed Aug 16, 2023 8:36 pm
Has thanked: 31 times
Been thanked: 10 times

Re: Weird Behaviour From the ZX81 Core

Unread post by Bristles »

The main problem with all the ZX81 collections out there is that, there isn't any standard naming scheme in any of the collections. They're all a complete mess, and mostly named, like FPGA64 said above, in limited 8.3 names.
Also, a lot of the .p files are not loader code, they are a combination of High-Res Display code, Graphics Data, Screen Layout data, or main game code, and the one we want is the loader code .p file.
Sometimes, I can get the real name by opening the .p file in a hex editor, then scrolling down looking for anything that might resemble a game name. If I find nothing, then I fire up the EightyOne ZX81 emulator on my PC, and see what happens.
Unless there is a collection out there that has proper named files, then it would take a community effort to try and get some proper naming in place.

Hackshed_Carl
Posts: 115
Joined: Mon May 25, 2020 3:22 pm
Has thanked: 31 times
Been thanked: 51 times
Contact:

Re: Weird Behaviour From the ZX81 Core

Unread post by Hackshed_Carl »

[/quote]
I am not aware of any free ATmega 640/1280/2560 Verilog or VHDL modules. Anyway I don't have the expertise to port it. The CPLD firmware update capability would not be possible with MiSTer I gather, but that's not a biggie.
[/quote]

https://github.com/MiSTer-devel/Arduboy_MiSTer Arduboy uses https://github.com/MorgothCreator/atmeg ... -soft-core

Only adding for the sake of it, not to suggest that anyone picks this up.
I know there are plenty of things I'd like to tweak in some cores but I'm nowhere near intelligent enough to do that.
I'll stick to sweeping up :)

EeDee
Posts: 244
Joined: Thu Dec 24, 2020 12:33 pm
Has thanked: 10 times
Been thanked: 47 times

Re: Weird Behaviour From the ZX81 Core

Unread post by EeDee »

Thanks for the replies. I think I'm getting the picture, after quite some Months of looking and hoping, that saving files on the Mister ZX81 core is something we may never see.
Ah well, at least it's a decent Core

User avatar
pgimeno
Top Contributor
Posts: 679
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 261 times
Been thanked: 210 times

Re: Weird Behaviour From the ZX81 Core

Unread post by pgimeno »

Bristles wrote: Thu Nov 09, 2023 2:20 pm

The main problem with all the ZX81 collections out there is that, there isn't any standard naming scheme in any of the collections. They're all a complete mess, and mostly named, like FPGA64 said above, in limited 8.3 names.
Also, a lot of the .p files are not loader code, they are a combination of High-Res Display code, Graphics Data, Screen Layout data, or main game code, and the one we want is the loader code .p file.
Sometimes, I can get the real name by opening the .p file in a hex editor, then scrolling down looking for anything that might resemble a game name. If I find nothing, then I fire up the EightyOne ZX81 emulator on my PC, and see what happens.
Unless there is a collection out there that has proper named files, then it would take a community effort to try and get some proper naming in place.

There are two different "raw" file formats: .P and .P81. The .P81 format closely follows the contents that the ROM normally saves to tape; that is, the program name (ended with a character with bit 7 set) followed by a memory dump of the whole program including most system variables, the BASIC program, BASIC variables, and the screen contents.

The .P format is the same MINUS the program name. The rationale for this was that when you type LOAD "MYPROG" in an emulator (or in our interface), then you need some way of finding the file where that program is stored, so it appends ".P" to the name of the program you specify in the LOAD command, and searches for a file called "MYPROG.P". The program name header would therefore be redundant in that case. It could just be ignored instead of omitted, but old emulators did not do that, and we're stuck with that now in the .P files we have.

(There's a third file format, T81, created by the EightyOne author, but that's useful for a collection of programs, not for a single program, and it uses ASCII instead of the ZX81 character set. That one is not under discussion here).

That goes for many emulators, therefore having "proper names" can be troublesome. Imagine a typical TOSEC entry with flags. These flags, according to the TOSEC naming convention, must be enclosed in [ ], and as it turns out, these square brackets don't exist in the ZX81 character set, therefore you can't load a file with that name in many emulators because you can't type the name in the LOAD command.

The MiSTer (as well as certain emulators) of course does not have this restriction, because you specify the program to load with the menu, and then no matter the name you enter in the LOAD command, the file gets loaded. But then you'd need a collection that is prepared to work like that (arbitrary names) instead of like some emulators do (using the program name as the file name). The emulator I use for Linux, z81, does the latter.

hitm4n
Posts: 107
Joined: Sat Jan 30, 2021 9:20 am
Has thanked: 2 times
Been thanked: 18 times

Re: Weird Behaviour From the ZX81 Core

Unread post by hitm4n »

No-one seems to have answered your question here. If you press F12 and check the options, for games like 3D Monster Maze and Mazogs, you're gonna need 16k ram. If its set to 1k, you'll have issues :) I've played with the ZX81 core quite a bit as it was my first machine back in 1982, Mazogs was one of my favourites. I don't recall what the initial default "Main RAM" is set to in the core, but set it to 16k and it may just fix it.

RichardHallas
Posts: 4
Joined: Sun Mar 12, 2023 11:09 am
Has thanked: 5 times

Re: Weird Behaviour From the ZX81 Core

Unread post by RichardHallas »

hitm4n wrote: Fri Nov 10, 2023 6:54 pm

No-one seems to have answered your question here. If you press F12 and check the options, for games like 3D Monster Maze and Mazogs, you're gonna need 16k ram. If its set to 1k, you'll have issues :) I've played with the ZX81 core quite a bit as it was my first machine back in 1982, Mazogs was one of my favourites. I don't recall what the initial default "Main RAM" is set to in the core, but set it to 16k and it may just fix it.

I wish it were as simple as that, but unfortunately I'm not quite such a noob! ;-) Like you, my first computer was a ZX81 back in 1981/2, and I'm reasoanbly familiar with them. Certainly I understand that I can't load a 16K game into a 1K machine! Basically, I've tried twiddling all the options available on the F12 menu – at least, the ones that make sense – and I continue to get these errors regardless of how things are set.

The files I'm trying to load on the MiSTer core all work fine on (a) emulators and (b) a real ZX81 with ZXpand attached – so it's hard to see why they produce such weird errors on the MiSTer core, especially when the software apparently works for other people. And once something like 3D Monster Maze has loaded and failed with the strange C error code, I can still list it and see the uncorrupted BASIC portion. It's quite perplexing.

Unfortunately my free time is extremely limited at the moment, so I can't investigate as thoroughly as I'd like to at present, but if I get to the bottom of the problem I'll post about it here.

hitm4n
Posts: 107
Joined: Sat Jan 30, 2021 9:20 am
Has thanked: 2 times
Been thanked: 18 times

Re: Weird Behaviour From the ZX81 Core

Unread post by hitm4n »

Hi Richard. I knew my post was a long shot. Sometimes its the easiest thing though so had to throw it out there even though i knew it sounded condescending. There are plenty of people who hang around these parts (or jump on other emulators) who never experienced these systems/consoles first time round and can be quite clueless when it comes to operating them. Hell, i'm still learning systems like Atari 800XL and Commodore PET having never owned them bitd.

OK, another idea for you. Sometimes the "downloader" or "update all" doesn't quite do whats expected. Sometimes folders are moved or renamed, maybe your core is an old version, or the bios files are old or being loaded from an old location. Hows about just deleting the core and/or any bios/roms files and refreshing those downloads. Downloader may be telling you you are fine and up to date, but it could be lying to you... I've seen it many times on this forum where people have said "oh, i deleted the file and now it works".

User avatar
pgimeno
Top Contributor
Posts: 679
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 261 times
Been thanked: 210 times

Re: Weird Behaviour From the ZX81 Core

Unread post by pgimeno »

RichardHallas wrote: Wed Nov 15, 2023 4:42 pm

The files I'm trying to load on the MiSTer core all work fine on (a) emulators and (b) a real ZX81 with ZXpand attached – so it's hard to see why they produce such weird errors on the MiSTer core, especially when the software apparently works for other people.

I'd propose this experiment: take one of these files from the MiSTer, and try it in an emulator. If it doesn't work, you'll know that the MiSTer image is corrupted.

FPGA64
Top Contributor
Posts: 771
Joined: Mon Mar 01, 2021 3:10 pm
Has thanked: 45 times
Been thanked: 330 times

Re: Weird Behaviour From the ZX81 Core

Unread post by FPGA64 »

I would also say if you are on PC and used Filezilla, Boo Hiss. then you may have sent it in Non Binary mode and so got a corrupt p file. I would use WinScp

Post Reply