mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-04-18 03:37:41 +00:00
starpath: make basic version
This commit is contained in:
parent
b0c32e0349
commit
0d210d0804
6
demos/lovebyte2025/blackhole_64/monitor.txt
Normal file
6
demos/lovebyte2025/blackhole_64/monitor.txt
Normal file
@ -0,0 +1,6 @@
|
||||
CALL -151
|
||||
E7: 20 D8 F3 84 E4 20 57 F4 A9 06 A0 E2 A2 E3 20 5D
|
||||
F7: F6 E6 E9 A5 E9 C9 29 D0 EF E8 86 E7 A4 E7 C0 1C
|
||||
107: F0 E1 A8 A2 8C A9 60 20 11 F4 A2 E0 A0 E2 E6 E8
|
||||
117: A5 E8 29 3F D0 02 E6 E7 2C 30 C0 20 01 F6 F0 DC
|
||||
E7G
|
38
graphics/gr/starpath/Makefile
Normal file
38
graphics/gr/starpath/Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
PNG2GR = ../../../utils/gr-utils/png2gr
|
||||
PNG2RLE = ../../../utils/gr-utils/png2rle
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKERSCRIPTS = ../../../linker_scripts
|
||||
EMPTYDISK = ../../../empty_disk
|
||||
|
||||
all: starpath.dsk
|
||||
|
||||
$(DOS33):
|
||||
cd ../../utils/dos33fs-utils && make
|
||||
|
||||
starpath.dsk: $(DOS33) HELLO STARPATH.BAS
|
||||
cp $(EMPTYDISK)/empty.dsk starpath.dsk
|
||||
$(DOS33) -y starpath.dsk SAVE A HELLO
|
||||
$(DOS33) -y starpath.dsk SAVE A STARPATH.BAS
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
###
|
||||
|
||||
STARPATH.BAS: starpath.bas
|
||||
$(TOKENIZE) < starpath.bas > STARPATH.BAS
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o HELLO STARPATH.BAS *.lst
|
||||
|
2
graphics/gr/starpath/hello.bas
Normal file
2
graphics/gr/starpath/hello.bas
Normal file
@ -0,0 +1,2 @@
|
||||
5 HOME
|
||||
10 PRINT CHR$(4);"CATALOG"
|
15
graphics/gr/starpath/starpath.bas
Normal file
15
graphics/gr/starpath/starpath.bas
Normal file
@ -0,0 +1,15 @@
|
||||
0 GOTO 8:SPEED=$)%DEL$LRUSR:SPEED=$)%DEL$LRUSR
|
||||
8 POKE 2068,9:DIM CL(32):FOR I=0 TO 31:READ CL(I):NEXT:GR:POKE 49234,0
|
||||
30 FOR Y=0 TO 47:FOR X=0 TO 39:D=14
|
||||
40 YP=Y*4*D:T=(X*6)-D:IF T>=0 THEN 70
|
||||
50 C=11:A=(X*6)+YP
|
||||
55 IF A>256 THEN A=A-256:GOTO 55
|
||||
57 IF A<6 THEN 95
|
||||
60 C=(C*16)+((Y*4)/16):C=C-160:GOTO 95
|
||||
70 XP=T*D:POKE 2067,XP/256:POKE 2069,YP/256:CALL 2066:T=PEEK(36)
|
||||
75 POKE2057,T:POKE2059,D+F:CALL 2056:C=PEEK(36):D=D+1
|
||||
80 IF C<16 THEN 40
|
||||
90 C=C-16
|
||||
95 COLOR=CL(C):PLOT X,Y:NEXT X,Y:F=F+1:GOTO 30
|
||||
97 DATA 0,5,0,5,5,5,10,10,5,5,10,10,7,7,15,15,1,2,1,2,3,9,3,9,13,12,13,12,4,4,4,4
|
||||
100 REM APPLE II VERSION OF HELLMOOD'S 64B STARPATH
|
@ -5,7 +5,7 @@ SDL_LIBS= `sdl-config --libs`
|
||||
SDL_INCLUDE= `sdl-config --cflags`
|
||||
GR_SIM = ../gr-sim.a
|
||||
|
||||
all: starpath_gr starpath_hgr
|
||||
all: starpath_gr starpath_hgr starpath_basic
|
||||
|
||||
###
|
||||
|
||||
@ -17,6 +17,15 @@ starpath_gr.o: starpath_gr.c
|
||||
|
||||
###
|
||||
|
||||
starpath_basic: starpath_basic.o
|
||||
$(CC) $(LFLAGS) -o starpath_basic starpath_basic.o $(GR_SIM) $(SDL_LIBS)
|
||||
|
||||
starpath_basic.o: starpath_basic.c
|
||||
$(CC) $(CFLAGS) -c starpath_basic.c
|
||||
|
||||
|
||||
###
|
||||
|
||||
starpath_hgr: starpath_hgr.o
|
||||
$(CC) $(LFLAGS) -o starpath_hgr starpath_hgr.o $(GR_SIM) $(SDL_LIBS)
|
||||
|
||||
@ -27,4 +36,4 @@ starpath_hgr.o: starpath_hgr.c
|
||||
###
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o hellmood_memories starpath_gr hellmood_simple
|
||||
rm -f *~ *.o starpath_hgr starpath_gr starpath_basic
|
||||
|
127
utils/gr-sim/starpath/starpath_basic.c
Normal file
127
utils/gr-sim/starpath/starpath_basic.c
Normal file
@ -0,0 +1,127 @@
|
||||
/* An Apple II lores version of Hellmood's amazing 64B DOS Star Path Demo */
|
||||
|
||||
/* See https://hellmood.111mb.de//starpath_is_55_bytes.html */
|
||||
|
||||
/* deater -- Vince Weaver -- vince@deater.net -- 24 February 2025 */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gr-sim.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MAX_COLORS 32
|
||||
|
||||
/* The demo only actually generates these colors */
|
||||
// 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
|
||||
// black/white gradient, let's map from 0..15 instead
|
||||
// in decimal, so add 100/16 each time, or 6.25?
|
||||
|
||||
static int color_remap[32]={
|
||||
0, 5, 0, 5, 5, 5,10,10, 5, 5,10,10, 7, 7, 15, 15,
|
||||
1, 2, 1, 2, 3, 9, 3, 9,13,12,13,12, 4, 4, 4, 4,
|
||||
// 1, 1, 2, 2, 3, 3, 9, 9,13,13,12,12, 4, 4, 4, 4,
|
||||
};
|
||||
|
||||
static void framebuffer_putpixel(unsigned int x, unsigned int y,
|
||||
unsigned char color) {
|
||||
|
||||
color_equals(color_remap[color]);
|
||||
basic_plot(x,y);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
int frame,color,depth,x,y,yprime,xprime;
|
||||
int temp,ch;
|
||||
|
||||
// set_default_pal();
|
||||
|
||||
frame=0;
|
||||
|
||||
grsim_init();
|
||||
|
||||
gr();
|
||||
|
||||
clear_screens();
|
||||
|
||||
soft_switch(MIXCLR);
|
||||
|
||||
while(1) {
|
||||
|
||||
for(x=0;x<40;x++) {
|
||||
for(y=0;y<48;y++) {
|
||||
|
||||
depth=14; // start ray depth at 14
|
||||
L:
|
||||
yprime=(y*4)*depth; // Y'=Y * current depth
|
||||
|
||||
temp=(x*6)-depth; // curve X by the current depth
|
||||
|
||||
// if left of the curve, jump to "sky"
|
||||
if (temp&0x100) {
|
||||
|
||||
color=27-16; // is both the star color and
|
||||
// palette offset into sky
|
||||
|
||||
// pseudorandom multiplication leftover DL added to
|
||||
// truncated pixel count
|
||||
// 1 in 256 chance to be a star
|
||||
if ((((x*6)+yprime)&0xff)!=0) {
|
||||
// if not, shift the starcolor and add scaled pixel count
|
||||
color=(color<<4)|((y*4)>>4);
|
||||
color-=160;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
// multiply X by current depth (into AH)
|
||||
xprime=temp*depth;
|
||||
|
||||
// OR for geometry and texture pattern
|
||||
temp=((xprime)|(yprime))>>8;
|
||||
|
||||
// get (current depth) + (current frame)
|
||||
// mask geometry/texture by time shifted depth
|
||||
color=(temp&(depth+frame));
|
||||
|
||||
// (increment depth by one)
|
||||
depth++;
|
||||
|
||||
// ... to create "gaps"
|
||||
|
||||
if ((color&0x10)==0) goto L;
|
||||
|
||||
// if ray did not hit, repeat pixel loop
|
||||
|
||||
color-=16;
|
||||
}
|
||||
|
||||
framebuffer_putpixel(x,y,color);
|
||||
}
|
||||
}
|
||||
|
||||
frame++; // increment frame counter
|
||||
|
||||
// dump_framebuffer_gr();
|
||||
|
||||
grsim_update();
|
||||
|
||||
usleep(10000);
|
||||
|
||||
ch=grsim_input();
|
||||
if (ch=='q') return 0;
|
||||
if (ch==27) return 0;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user