ZX81 target broken?

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
User avatar
RobertK
Well known member
Posts: 406
Joined: Mon Feb 26, 2018 12:58 pm

ZX81 target broken?

Post by RobertK »

Something seems to be wrong with the generic console output on the ZX81.
I'm using the lastest version 1.40 of the EightyOne emulator.

Here is a simple test:

Code: Select all

// zcc +zx81 -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o Hello3_ZX81 hello3.c
// zcc +pv2000 -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o Hello3_PV2000 hello3.c

#include <stdio.h>
#include <conio.h>

void main()
{
  int i, j;
	
  // Clear screen
  printf("%c",12);
  printf("\x0c");
  
  for (i=0;i<10;i++)
	printf("hello world\n");
  
  printf("\n\nany key to quit...");
  while (!kbhit()); // wait for keypress
  
  // Clear screen
  printf("%c",12);
  printf("\x0c");
}
And the result looks like this:
hello3.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 2291
Joined: Sun Jul 15, 2007 10:01 pm

Re: ZX81 target broken?

Post by dom »

Wow. The machine is really sensitive.

When the far format specifiers got added to printf we had to save the alt registers. Which means that at one point in time af' is not what it should be. And so af gets modified and we end up with curious characters.

I'm now skipping over the far code for ixiy machines - will need to figure out a better way should one of those machines get far support (realistically it's probably a custom zx81 build to be honest).
User avatar
RobertK
Well known member
Posts: 406
Joined: Mon Feb 26, 2018 12:58 pm

Re: ZX81 target broken?

Post by RobertK »

Now it's fine again, thank you!
The ZX81 is sensitive indeed. I just noticed that in my new program I was accessing an unsigned int variable that I had forgotten to initialize, and that made the program crash on the ZX81, while it was no problem on all other targets.
stefano
Well known member
Posts: 2323
Joined: Mon Jul 16, 2007 7:39 pm

Re: ZX81 target broken?

Post by stefano »

We got a little bit of regression here, I've solved it again recently.
Post Reply