Personal challenge: Writing a text adventure in 1k for the zx80

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply

Forth or sinclair basic?

Forth
1
25%
Sinclair Basic
3
75%
 
Total votes: 4

Crayon21
Posts: 357
Joined: Sun Nov 04, 2018 2:33 am

Personal challenge: Writing a text adventure in 1k for the zx80

Post by Crayon21 »

I have decided to write a mini horror text adventure based off of Lovecraft's Shadow over Innsmouth. I saved the listing and it was a whopping 963 bytes when fully typed out (mostly, ran out of room after line 58)

anyway, seeing as I made myself a rather interesting challenge, how can I cram a text adventure into 1k? Tips anyone? I also want to include rudimentary graphics if possible. If push comes to shove, only then will I go up to 16k. But for now, 1k or 2k should suffice.

here is the program
Attachments
innsmouth.tzx
(2.11 KiB) Downloaded 54 times
In Heck, there are two options for perpetual torment:

Eat the Puckerberry and suffer for eternity:
drink nothing but a cocktail of The Last Dab and Mexican Cake blended and served with
habanero slices
:twisted:
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by dr beep »

Crayon21 wrote: Wed Feb 22, 2023 6:18 am how can I cram a text adventure into 1k? Tips anyone?
machinecode!
BASIC has too much overhead, linenumber, length, variable storage.
User avatar
bobs
Posts: 325
Joined: Thu Aug 27, 2009 10:49 pm
Location: UK
Contact:

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by bobs »

Machine code, and 16k. You can do a lot in 1k, but I don’t think an adventure would be right for it, especially as you want to include graphics.
User avatar
marste
Posts: 252
Joined: Sun Aug 10, 2014 9:58 pm
Location: Italy
Contact:

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by marste »

Really a short one and filled with a lot of imagination in between I think.

Anyway agree with machine code.

Using a set of 32 characters I think you can save text to print in 5 bits per character compacting all text together and call a routine with initial char and end char parameters for printing. In this way you can also reuse pieces of text in "longer" sentences in case.
In this way with 2 chunks of 256 bytes compacted (managed by a single routine with a two 8-bit register and carry as input) you might have a bit more of 800 characters of usable sentencies to be printed and "space" for the game input and logic...

For extreme cases like this (and for an evolution of my 1k real chess :D ) I was also thinking of using a loader to load the final program insted of relying to basic starting the machine code. In this way you gain more system variables space and remove the need of basic starting program. The loader can also have a "long" text to introduce the adventure, so to remove it from the final loaded 1k and have minimal descriptions based on introduction for the various interactions.
Last edited by marste on Sat Feb 25, 2023 11:27 am, edited 1 time in total.
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by dr beep »

marste wrote: Sat Feb 25, 2023 2:52 am I was also thinking of using a loader to load the final program insted of relying to basic starting the machine code. In this way you gain more system variables space and remove the need of basic starting program. The loader can also have a "long" text to introduce the adventure, so to remove it from the final loaded 1k and have minimal descriptions based on introduction for the various interactions.
On a ZX81 I have placed the basic over the sysvar, need to check how it can be done on the ZX80.
User avatar
marste
Posts: 252
Joined: Sun Aug 10, 2014 9:58 pm
Location: Italy
Contact:

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by marste »

dr beep wrote: Sat Feb 25, 2023 9:21 am On a ZX81 I have placed the basic over the sysvar, need to check how it can be done on the ZX80.
You can have a look at the 1K starter kit: viewtopic.php?f=6&t=2349

It contains example program (for both machines), assembler, instructions and possibilty to debug with Visual Studio Code
dr beep
Posts: 2080
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by dr beep »

marste wrote: Sat Feb 25, 2023 11:18 am
dr beep wrote: Sat Feb 25, 2023 9:21 am On a ZX81 I have placed the basic over the sysvar, need to check how it can be done on the ZX80.
You can have a look at the 1K starter kit: viewtopic.php?f=6&t=2349

I did some time ago and indeed, I tried moving BASIC over sysvar, but the ZX80 is not a ZX81.
User avatar
marste
Posts: 252
Joined: Sun Aug 10, 2014 9:58 pm
Location: Italy
Contact:

Re: Personal challenge: Writing a text adventure in 1k for the zx80

Post by marste »

The ZX80 vars are more compact and not very much free space to be used in basic start. Anyway in the kit there is the best solution I've found (if there are better I'm all ears :) ), surely more than enough for a loader program.

And to be clear: the basic is to start, the rest should be machine code to be able to use at best all the space!
Post Reply