Skip to content

Commit

Permalink
Other: 10PRINT experiment.
Browse files Browse the repository at this point in the history
  • Loading branch information
deanthecoder committed Mar 1, 2024
1 parent 9c633d8 commit d683b63
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
Binary file added Experiments/10print/10print
Binary file not shown.
71 changes: 71 additions & 0 deletions Experiments/10print/10print.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// zcc +zx -lndos -create-app -o 10print 10print.c
#include <stdio.h>
#include <conio.h>
#include <input.h>
#include <graphics.h>
#include <arch/zx/spectrum.h>

static unsigned char *attrMem = 22528;
static unsigned int x, y, i;

void main()
{
zx_border(BLUE);
textbackground(CYAN);

// Prep.
in_GetKeyReset();
srand(0);

// Loop.
while (!in_GetKey())
{
clrscr();

// Draw.
for (y = 0; y < 192; y += 8)
{
for (x = 0; x < 256; x += 8)
{
switch (rand() % 2)
{
case 0:
plot(x + 1, y);
drawr(7, 7);
plot(x, y + 1);
drawr(7, 7);
break;
case 1:
plot(x + 7, y);
drawr(-7, 7);
plot(x + 8, y + 1);
drawr(-7, 7);
break;
}
}
}

// Footer.
clga(152, 184, 104, 8);
drawb(151, 183, 106, 10);

gotoxy(40, 23);
printf("10PRINT (@DeanTheCoder)");
for (x = 755; x < 768; ++x)
attrMem[x] = PAPER_BLUE + INK_WHITE + BRIGHT;

// Fill.
i = 0;
while (i < 8)
{
x = rand() % 256;
y = rand() % 192;

if (point(x, y) + point(x + 1, y) + point(x, y - 1) + point(x, y + 1))
continue;

fill(x, y);
i++;
}
}
}
Binary file added Experiments/10print/10print.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Experiments/10print/10print.tap
Binary file not shown.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ I first populate the entire screen with characters (black on black), then build
This array is then used to set the colors on the screen, and a `memmove` command is used to scroll the buffer by one byte. This keeps the framerate up as it's only the color attributes that change - Not the characters on the screen.
![](Experiments/TheMatrix/TheMatrix.png)

# Experiments - 10PRINT
C compiled into Z80 machine code ([here](Experiments/10print/10print.tap)).

The screen is filled with forward and backslashes (Drawn with a small gap in my case), then I randomly fill areas of the screen. Quite relaxing to watch!
![](Experiments/10print/10print.png)

## Contribution and Improvements
ZX Speculator is an ongoing project and contributions are welcome. Whether it's improving emulation accuracy, testing on different platforms, or enhancing existing features, your input is valuable (although I can't always promise a fast response, as this is a side project).

Expand Down

0 comments on commit d683b63

Please sign in to comment.