Sine curve | z88dk mono graphics https://balloon.asia/categories/z88dk/
/* | |
Sine curve | z88dk mono graphics | |
Copyright (c) 2019 Keiichi Shiga (BALLOON | FU-SEN) | |
The MIT License (MIT) - https://mit.balloon.net.eu.org/#2019 | |
MSX (MSX turbo R has the tape feature removed!): | |
zcc +msx -lm -lmsxbios -create-app -bn sin sin.c (Cassette tape image, generate sin.cas) | |
--> BLOAD"CAS:",R | |
zcc +msx -lm -lmsxbios -create-app -subtype=disk -bn sin sin.c (BASIC BLOAD file, generate sin.msx) | |
--> BLOAD"SIN.MSX",R | |
zcc +msx -lm -lmsxbios -create-app -subtype=wav -bn sin sin.c (Cassette tape audio WAV format, generate sin.wav) | |
zcc +msx -lm -lmsxbios -create-app -subtype=msxdos -bn sin sin.c (MSX-DOS .com executable file, generate sin.com) | |
zcc +msx -lm -lmsxbios -create-app -subtype=rom -bn sin sin.c (ROM cartridge image, generate sin.rom) | |
PC-6001: | |
If you have a problem with the line drawing, try on Night Build 20190708 or later | |
zcc +pc6001 -lm -create-app -bn sin sin.c (16k, generate sin.cas) | |
zcc +pc6001 -lm -subtype=32k -create-app -bn sin sin.c (32k, generate sin.cas) | |
--> CLOAD | |
RUN | |
PC-8801: | |
zcc +pc88 -lm -lgfxpc88 -create-app -Cz--audio -bn sin sin.c (160x100, generate sin.t88) | |
zcc +pc88 -lm -lgfxpc88hr200 -create-app -Cz--audio -bn sin sin.c (640x200, generate sin.t88) | |
--> MON | |
R | |
G8A00 | |
PC-G850: | |
zcc +g800 -lm -create-app -clib=g850b -bn sin sin.c (generate sin.ihx) | |
--> g800 sin.ihx 100 (g800) | |
TI-83: | |
zcc +ti83 -lm -create-app -bn sin sin.c (shell=Ion or Ti-Explorer, generate sin.83p) | |
TI-86: | |
zcc +ti83 -lm -create-app -startup=2 -bn sin sin.c (shell=ASE, Rascal or emanon, generate sin.86p) | |
ZX81: | |
zcc +zx81 -lm -create-app -bn sin sin.c (generate sin.P) | |
ZX Spectrum: | |
zcc +zx -lp3 -lm -create-app -bn sin sin.c (generate sin.tap) | |
It can be built on various other Z80 platforms! | |
*/ | |
#include <graphics.h> | |
#include <math.h> | |
#include <stdio.h> | |
void main() { | |
int x, y; | |
clg(); | |
for (x=0; x<=getmaxx(); x+=2) { | |
plot(x, getmaxy() / 2); | |
} | |
for (x=0; x<=getmaxx(); x++) { | |
y = (int)((getmaxy() / 2) * (1.0 - sin(M_PI * 2.0 * x / getmaxx()))); | |
if (x==0){ | |
plot(x, y); | |
} else { | |
drawto(x, y); | |
} | |
} | |
while (getk() < 1){} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
MSX (MSXPLAYer):

PC-6001mkII (PC6001VW+互換BASIC(ごかんBASIC, Gokan BASIC=Compatible BASIC):

Note: The PC-6001 has a green background
PC-G850 (g800):

ZX81 (EightyOne):

ZX Spectrum (Speccy):
