Skip to content

Instantly share code, notes, and snippets.

@fu-sen
Last active September 4, 2022 11:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fu-sen/4e079229d43a0aa6c9d40734c35fb2ab to your computer and use it in GitHub Desktop.
Save fu-sen/4e079229d43a0aa6c9d40734c35fb2ab to your computer and use it in GitHub Desktop.
Sine curve | z88dk mono graphics
/*
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){}
}
@fu-sen
Copy link
Author

fu-sen commented Jul 6, 2019

MSX (MSXPLAYer):
msxplayer

PC-6001mkII (PC6001VW+互換BASIC(ごかんBASIC, Gokan BASIC=Compatible BASIC):
Note: The PC-6001 has a green background
スクリーンショット 2019-07-09 18 45 35

PC-G850 (g800):
g800

ZX81 (EightyOne):
eightyone

ZX Spectrum (Speccy):
スクリーンショット 2019-07-07 15 03 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment