Page 2 of 4

Re: Can't make anything fit into 1K... or is it me?

Posted: Sun May 02, 2021 6:33 pm
by XavSnap

Code: Select all

IF X=Q THEN PRINT AT R,P+W;"O"
 IF X=W OR X=E THEN PRINT AT E,P+Q;"O";AT T,P+E;"O"
 IF X=E THEN PRINT AT R,P+W;"O"
 IF X=R OR X=T THEN PRINT AT E,P+Q;"O O";AT T,P+Q;"O O"
 IF X=T THEN PRINT AT R,P+W;"O"
 IF X=Y THEN PRINT AT E,P+Q;"OOO";AT T,P+Q;"OOO" 
equal

Code: Select all

PRINT AT R,P+W;"O" AND X=Q;AT E,P+Q;"O";AT T,P+E;"O" AND (X=W OR X=E);AT R,P+W;"O" AND X=E;AT E,P+Q;"O O";AT T,P+Q;"O O" AND (X=R OR X=T);AT R,P+W;"O" AND X=T;AT E,P+Q;"OOO";AT T,P+Q;"OOO" AND X=Y
another very good emulator
:shock:
:lol:

Re: Can't make anything fit into 1K... or is it me?

Posted: Sun May 02, 2021 6:59 pm
by 1024MAK
This program shows how small the program has to be if you use a large amount of the screen (and hence the display file becomes large):

Code: Select all

1 PRINT CHR$ (RND*25+38);
2 IF PEEK 16442=INT PI THEN GOSUB 9
3 GOTO SGN PI
9 SCROLL
10 SCROLL
11 PRINT AT 19,SGN PI;
12 RETURN
Mark

Re: Can't make anything fit into 1K... or is it me?

Posted: Sun May 02, 2021 7:49 pm
by LoadError
That part of the code scratches die #2 when not needed, so I kept it in.
The variables are used multiple times.
Thanks for all the hints! I was even able to put "FG SOFT" back in :D

Re: Can't make anything fit into 1K... or is it me?

Posted: Sun May 02, 2021 7:51 pm
by LoadError
XavSnap wrote: Sun May 02, 2021 6:33 pm

Code: Select all

IF X=Q THEN PRINT AT R,P+W;"O"
 IF X=W OR X=E THEN PRINT AT E,P+Q;"O";AT T,P+E;"O"
 IF X=E THEN PRINT AT R,P+W;"O"
 IF X=R OR X=T THEN PRINT AT E,P+Q;"O O";AT T,P+Q;"O O"
 IF X=T THEN PRINT AT R,P+W;"O"
 IF X=Y THEN PRINT AT E,P+Q;"OOO";AT T,P+Q;"OOO" 
equal

Code: Select all

PRINT AT R,P+W;"O" AND X=Q;AT E,P+Q;"O";AT T,P+E;"O" AND (X=W OR X=E);AT R,P+W;"O" AND X=E;AT E,P+Q;"O O";AT T,P+Q;"O O" AND (X=R OR X=T);AT R,P+W;"O" AND X=T;AT E,P+Q;"OOO";AT T,P+Q;"OOO" AND X=Y
This is neat! Very different from the Commodore dialect I'm used to.

Re: Can't make anything fit into 1K... or is it me?

Posted: Sun May 02, 2021 9:06 pm
by bola_dor
LoadError wrote: Sun May 02, 2021 7:49 pm That part of the code scratches die #2 when not needed, so I kept it in.
The variables are used multiple times.
Thanks for all the hints! I was even able to put "FG SOFT" back in :D
Yes I felt sorry for that..
Perhaps you can recover some animation in the larger version..

Re: Can't make anything fit into 1K... or is it me?

Posted: Mon May 03, 2021 9:37 pm
by LoadError
Yes, I was able to also add the animation back!
Maybe I'll post it in the "crap games" cathegory :lol:
By the way, I'm happy. Now if I only could make my real ZX81 display an image on a TV...

Re: Can't make anything fit into 1K... or is it me?

Posted: Mon May 03, 2021 9:49 pm
by bola_dor
Look at MAK1024 signature for his buffer composite mod.. it's really good and works. Unless you have an older non back porch ULA

Re: Can't make anything fit into 1K... or is it me?

Posted: Tue May 04, 2021 9:01 am
by LoadError
XavSnap wrote: Sun May 02, 2021 6:33 pm

Code: Select all

IF X=Q THEN PRINT AT R,P+W;"O"
 IF X=W OR X=E THEN PRINT AT E,P+Q;"O";AT T,P+E;"O"
 IF X=E THEN PRINT AT R,P+W;"O"
 IF X=R OR X=T THEN PRINT AT E,P+Q;"O O";AT T,P+Q;"O O"
 IF X=T THEN PRINT AT R,P+W;"O"
 IF X=Y THEN PRINT AT E,P+Q;"OOO";AT T,P+Q;"OOO" 
equal

Code: Select all

PRINT AT R,P+W;"O" AND X=Q;AT E,P+Q;"O";AT T,P+E;"O" AND (X=W OR X=E);AT R,P+W;"O" AND X=E;AT E,P+Q;"O O";AT T,P+Q;"O O" AND (X=R OR X=T);AT R,P+W;"O" AND X=T;AT E,P+Q;"OOO";AT T,P+Q;"OOO" AND X=Y
Actually, I've done some tests and the two codes do not appear to be equivalent.
See this example:

print at 1,1;"o" and x=1;at 0,0;"o";at 2,2;"o" and x=2

This results in "o" being printed at 1,1 if x=1 (correct); in "o" at 0,0 being *always* printed regardless of if x is 1 or 2 (unwanted); and in "o" at 2,2 being printed if x=2 (correct).
So the second AND boolean only validates the third "print at" (2,2) and not the second (0,0) which is always validated.
So it should be:

print at 1,1;"o" and x=1;at 0,0;"o" and x=2;at 2,2;"o" and x=2

and then it would be equivalent to

if x=1 then print at 1,1;"o"
if x=2 then print at 0,0;"o";at 2,2;"o"

Still, 7 bytes less so maybe worth it.

Re: Can't make anything fit into 1K... or is it me?

Posted: Wed May 05, 2021 4:00 pm
by XavSnap
:oops:

It's true, this boolean graphics conditions are use block by block.

IF X=Y THEN PRINT AT E,P+Q;"OOO";AT T,P+Q;"OOO"

IF X=Y THEN PRINT (AT E,P+Q;"OOO");(AT T,P+Q;"OOO")

…;AT E,P+Q;"OOO" AND X=Y ;AT T,P+Q;"OOO" AND X=Y;...

Somes conditions have been forgotten in the previous example !

Re: Can't make anything fit into 1K... or is it me?

Posted: Mon May 24, 2021 6:10 pm
by LoadError
I've just finished porting my dice program to the ZX80, or should I say "rewriting". The '81 version is centered around the PRINT AT instruction which is missing in the '80, so I had to rethink the whole thing. I'm happy with the result (I just stripped down the animations because they would not make sense on a ZX80 anyway). I guess the fact that the '80 BASIC is integer only did help though, because I had no problems making it fit in 1K without the tricks I had to use on the 81 (like replacing numbers with integer variables). The only problem now is: I WANT A ZX80! That's about as hardcore as it gets, this side of an Altair 8800! :lol: