1Kb programs???

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

1Kb programs???

Post by yerzmyey »

OK then - my friend has bought a ZX81.
He asked me about soft for 1K and I gave it to him.
He was also really interested in writting programs (rather small demos) for the 1K config.
I gave him some small tips but while the conversation I stated I want to check it out too.

How much effects can be fit in 1K (not assembler but pure BASIC).
I do it on emulators and only watch on real hardware.

I was very surprised when I found that even only 5 lines of pretty simple code take more that 1024 bytes. (!!)

I felt it's kinda impossible so I made the same simple effect on ZX Spectrum. I saved it and...
It took 190 bytes!!

My question is: how is it possible?
How to make 1K progs then?

Is that fault of *.p format??
Or differences between both machines are SO big?

I would be really grateful for Your suggestions.
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
gus
Posts: 177
Joined: Fri May 16, 2008 10:18 pm
Location: Buenos Aires. Argentina
Contact:

Re: 1Kb programs???

Post by gus »

HI,
please upload your BASIC code so we can take a look and try to find a explanation and if its posible a solution :)

have fun,
Gus
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: 1Kb programs???

Post by XavSnap »

Hi,

If you had to make room in your zx81's memory.
Type-in your basic programme in Vb81 Xur, go to basic tools, and optimize it !
Try to use an alf screen, and avoid to store variables in memory... as is.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: 1Kb programs???

Post by yerzmyey »

Sure guys, here it is
http://yerzmyey.republika.pl/1k.tap
(is Spectrum version, I deleted the previous one).
Of course Spectrum has much worse gfx signs, so it looked a bit better.
This prog took on ZX81 1059 bytes which is impossible in my opinion.

I suspect there is some bug in the *.p format. I had an impression that TZX for ZX81 was smaller (with its real size).
But I wanted to avoid TZX because I wanted later to convert the P file into WAV, for ZX81.

Now - I don't know. :(
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: 1Kb programs???

Post by yerzmyey »

OK, more:

this is a single test:
http://yerzmyey.republika.pl/test.tzx
TZX file for ZX81 (EightyOne Emulator).

The classic program

1 PRINT "HUJ"
2 GOTO 1

Takes here 935 bytes.
Something's highly WRONG here....
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
gus
Posts: 177
Joined: Fri May 16, 2008 10:18 pm
Location: Buenos Aires. Argentina
Contact:

Re: 1Kb programs???

Post by gus »

I think that your problem is the memory configuration, because the video memory is saved with the BASIC listing when you use the SAVE command.
So if you have 16 KBytes of RAM the video memory is always expanded and takes 793 bytes of RAM. But if you has less that 4 Kbytes the video memory is collapsed and takes in case of a clear screen only 25 bytes.
So you can try to configure the EO with 1 Kbyte and saw what you get :)
It's a common technique in 1K programs use as little screen space as possible and in the upper left corner :)

Have fun,
Gus
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: 1Kb programs???

Post by yerzmyey »

Gus, many thanx, man!
I saved the "classic prog" on 1K config and it took only 168 bytes! :)

Well, that's kinda solution, although might cause trouble while making any serious prog.

But still - many thanx.
Mayb it will be useful in future. I was thinking about making a small "Internet party" with compo with a demo for ZX81 1K. ;)
Heh, we will see.

Greetz!
Y
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: 1Kb programs???

Post by yerzmyey »

OK, I tested the idea.

I worked - to the moment.

Finally I had to finish the prog on ZX81 2Kb (editing was impossible) but still I made it small 776 bytes.

The problem is - 776 bytes prog loads into ZX81 1K, starts automatically and work - to the moment, like I said.

It should work "forever" but it does only on 2K machine. Somehow it stops on 1K machine.

Anybody can check out why is that? http://yerzmyey.republika.pl/1k.tzx

All my progs for now were 16K or 2K, so I don't know what to do now.
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
yerzmyey
Posts: 1240
Joined: Thu May 15, 2008 10:11 am
Location: Rubber Planet
Contact:

Re: 1Kb programs???

Post by yerzmyey »

Ah, well.

I made the effect's screen smaller.
The prog became smaller too: 768 bytes.

Now it works on ZX81 1K.

I think I didn't realize how difficult is coding for the pure setup.

Well, anyway now I have my 1K small demo. If the friend I mentioned (and it's Factor6) manages to make his small demo too, we will be able to make some compo for 1K basic demos. ;)

If anybody's interested in joining the idea, then I would be very happy. :) I think it's really good time with ZX81 - not too much of work, much fun 'though. ;)

I will keep You informed. However if You have anything already, feel free to send Your demos to
yerzmyey AT interia.pl

After sometime (in December?) we could organize Internet voting and so on, heh.
It was really nice to clean my ZX81 from dust. :)

Btw - WHAT CAN CONVERT TZX into WAVs????
IN NIHILUM REVERTERIS - a big text-adventure game for ZX81: http://tiny.pl/g2m6m
"MONOCHROME" issue 5 - (Spring 2014) free paper/PDF magazine about ZX81: http://tiny.pl/q2m44
ZX81 COMPETITIONS 2007/2009: http://zx81.republika.pl/
User avatar
gus
Posts: 177
Joined: Fri May 16, 2008 10:18 pm
Location: Buenos Aires. Argentina
Contact:

Re: 1Kb programs???

Post by gus »

Hi Yerymyey !

Well I'm happy helping on that :) Now I tried to download the demo but I received the "Przykro nam, strona o podanym adresie nie istnieje." message :)

Gus
Post Reply