Skip to content

Commit

Permalink
Merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Oct 30, 2024
2 parents e52c6d1 + 55811f5 commit 210b99f
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ to the 6502. So far it runs on:

- KIM-1 with K-1013 FDC, directly connected SD card module or 1541 drive.

- Ohio Scientific series with 16kB RAM or more, and a floppy drive. TPA up to 39kB.

Unlike the original, it supports relocatable binaries, so allowing unmodified
binaries to run on any system: this is necessary as 6502 systems tend to be
much less standardised than 8080 and Z80 systems. (The systems above all load
Expand Down Expand Up @@ -421,7 +423,7 @@ the same time.
- Supported systems are:
- 400 series, with Model 440 32x32 video, Model 470 disk controller (5.25" or 8"), and an ASCII keyboard.
- 500 series, with Model 540 64x32 video, Model 505 disk controller (5.25" or 8"), and 542 polled keyboard.
- 600 series, with 64x16 video, on-board disk controller (5.25" or 8"), and polled keyboard.
- 600 series, with on board 64x16 video, Model 610 disk controller (5.25" or 8"), and polled keyboard.
- serial system, without video, Model 470 or 505 disk controller (8" only), and serial ACIA at $fc00.
- All systems need at least 16kB of RAM, but detect up to 40kB with BASIC present, and 48kB if BASIC is replaced by RAM.
Expand Down
1 change: 1 addition & 0 deletions apps/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def asm(self, name, src: Target = None, deps: Targets = []):
"attr",
"copy",
"life",
"mbrot",
"mkfs",
"objdump",
"qe",
Expand Down
84 changes: 84 additions & 0 deletions apps/mbrot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Mandelbrot for CP/M-65
*
* Adapted from https://github.com/Johnlon/mandelbrot/blob/main/integer.c
* by Henrik Löfgren 2024.
*
*/

#include <stdio.h>
#include <cpm.h>
#include "lib/screen.h"

int main()
{
int width, height;
int X1, X2, Y1, Y2, LIMIT;
int px, py;
int x0, y0;
int x,y,i;
int xSqr, ySqr;
int sum;
int xt;

char * chr = ".,_-*\\/!$&IO ";

int maxIters = 13;

if(!screen_init()) {
cpm_printstring("Error: No SCREEN driver, exiting\r\n");
cpm_warmboot();
}
screen_getsize(&width, &height);

screen_clear();
screen_setcursor(0,0);

// 6 bit precision fixed point
X1 = 224;
X2 = 160;
Y1 = 128;
Y2 = 64;
LIMIT = 512;
px=0;
py=0;

while (py < height) {
while (px < width) {

x0 = ((px*X1) / width) - X2;
y0 = ((py*Y1) / height) - Y2;

x=0;
y=0;

i=0;

while (i < maxIters) {
xSqr = (x * x) >> 6;
ySqr = (y * y) >> 6;

sum =(xSqr + ySqr);
if (sum > LIMIT) {
break;
}

xt = xSqr - ySqr + x0;

y = (((x * y) >> 6) << 1) + y0;
x=xt;

i = i + 1;
}
i = i - 1;
screen_putchar(chr[i]);
px = px + 1;
}

cpm_printstring("\r\n");
py = py + 1;
px = 0;
}

return 0;
}
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"0:vt52drv.com": "apps+vt52drv",
"0:vt52test.com": "apps+vt52test",
"0:kbdtest.com": "apps+kbdtest",
"0:mbrot.com": "apps+mbrot",
}

BIG_SCREEN_APPS = {
Expand Down

0 comments on commit 210b99f

Please sign in to comment.