zx-fizzbuzz
2 years agoAdd GPL3 notices and a copy of the GPL3. master
Mark Wooding [Thu, 18 Nov 2021 19:53:09 +0000 (19:53 +0000)]
Add GPL3 notices and a copy of the GPL3.

2 years agoAdd a separate port for 1K ZX81.
Mark Wooding [Thu, 18 Nov 2021 19:47:32 +0000 (19:47 +0000)]
Add a separate port for 1K ZX81.

This puts each output on its own line rather than trying to fill the
screen -- because there isn't enough memory to do that.

Alternatively, we might try writing to just the top few lines of the
display file.  Maybe later.

2 years agozx81-loader.p: Improve the ZX81 loading program.
Mark Wooding [Thu, 18 Nov 2021 18:47:19 +0000 (18:47 +0000)]
zx81-loader.p: Improve the ZX81 loading program.

Two important changes (sorry):

  * Automatically run the program when it's loaded.  I've just
    (re?)discovered that if you `save' within a program then it
    continues where it left off, so use this mechanism.

  * Set `ramtop' below where the program lives before running it,
    because the ZX81 snapshots don't include `ramtop' in the memory
    image.

2 years agofizzbuzz.s: Increment `len' in place rather than via register.
Mark Wooding [Sun, 14 Nov 2021 15:46:11 +0000 (15:46 +0000)]
fizzbuzz.s: Increment `len' in place rather than via register.

The Z80 isn't a load/store architecture, even though my RISC-programming
habits lead me to treat it like one.

2 years agofizzbuzz.s: Delete pointless calculation of new high digit position.
Mark Wooding [Sun, 14 Nov 2021 15:44:10 +0000 (15:44 +0000)]
fizzbuzz.s: Delete pointless calculation of new high digit position.

HL is already in the right place.  We only end up here if `djnz' fails,
which means we've stepped len bytes through buf, and therefore HL now
holds buf + len -- which is what we try to calculate.

2 years agofizzbuzz.s: Add a dummy high length byte.
Mark Wooding [Sun, 14 Nov 2021 15:03:23 +0000 (15:03 +0000)]
fizzbuzz.s: Add a dummy high length byte.

The length is still only one byte, but the extra zero means we can load
the BC in a single instruction rather than having to prat about with
setting up the two halves separately -- and loading C via A because of
instruction-set limitations.

2 years agoAdd a ZX81 port.
Mark Wooding [Sun, 14 Nov 2021 13:56:59 +0000 (13:56 +0000)]
Add a ZX81 port.

It seems that ZX81 emulators are awful.  This hack is the best I could
come up with.

Since I wrote the thing in ZX BASIC in an emulator, I guess
`zx81-loader.p' file is the preferred form for modification.

2 years agofizzbuzz.s: Abstract out a number of system dependencies.
Mark Wooding [Sun, 14 Nov 2021 13:55:21 +0000 (13:55 +0000)]
fizzbuzz.s: Abstract out a number of system dependencies.

Maybe you can see where this is going.

2 years agoAdd machinery for building a working `.tap' file.
Mark Wooding [Sun, 14 Nov 2021 13:53:38 +0000 (13:53 +0000)]
Add machinery for building a working `.tap' file.

I maintain the ZX BASIC loader program using FUSE, so, alas, the
`spectrum-loader.tap' file is the `preferred' form for modification.
I'd like something less awful.

2 years agoMakefile: Add a cheesy makefile.
Mark Wooding [Sun, 14 Nov 2021 13:48:11 +0000 (13:48 +0000)]
Makefile: Add a cheesy makefile.

2 years agoImport yesterday's source.
Mark Wooding [Sun, 14 Nov 2021 10:28:22 +0000 (10:28 +0000)]
Import yesterday's source.