mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-12 00:30:31 +00:00
ksp: some more work on this project
This commit is contained in:
parent
0805a7c3ee
commit
9b332497fd
1
TODO
1
TODO
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
pcx2hgr:
|
pcx2hgr:
|
||||||
error checking
|
error checking
|
||||||
complain if not 140x160 or 140x192
|
complain if not 140x160 or 140x192
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
PCX2HGR = ../hgr-utils/pcx2hgr
|
PCX2HGR = ../hgr-utils/pcx2hgr
|
||||||
DOS33 = ../dos33fs-utils/dos33
|
DOS33 = ../dos33fs-utils/dos33
|
||||||
|
TXT2BAS = ../asoft_basic-utils/tokenize_asoft
|
||||||
|
|
||||||
all: ksp.dsk
|
all: ksp.dsk
|
||||||
|
|
||||||
ksp.dsk: LOADING.HGR SQUAD.HGR TITLE.HGR
|
basic: VAB.BAS
|
||||||
|
|
||||||
|
VAB.BAS: vab.bas
|
||||||
|
$(TXT2BAS) < vab.bas > VAB.BAS
|
||||||
|
|
||||||
|
ksp.dsk: LOADING.HGR SQUAD.HGR TITLE.HGR VAB.BAS
|
||||||
$(DOS33) -y ksp.dsk SAVE B LOADING.HGR
|
$(DOS33) -y ksp.dsk SAVE B LOADING.HGR
|
||||||
$(DOS33) -y ksp.dsk SAVE B SQUAD.HGR
|
$(DOS33) -y ksp.dsk SAVE B SQUAD.HGR
|
||||||
$(DOS33) -y ksp.dsk SAVE B TITLE.HGR
|
$(DOS33) -y ksp.dsk SAVE B TITLE.HGR
|
||||||
|
$(DOS33) -y ksp.dsk SAVE A VAB.BAS
|
||||||
|
|
||||||
|
|
||||||
LOADING.HGR: loading.pcx
|
LOADING.HGR: loading.pcx
|
||||||
|
@ -2,7 +2,13 @@ CC = gcc
|
|||||||
CFLAGS = -Wall -O2
|
CFLAGS = -Wall -O2
|
||||||
LFLAGS =
|
LFLAGS =
|
||||||
|
|
||||||
all: ksp_loading ksp_vab
|
all: ksp_launch ksp_loading ksp_vab
|
||||||
|
|
||||||
|
ksp_launch: ksp_launch.o
|
||||||
|
$(CC) $(LFLAGS) -o ksp_launch ksp_launch.o
|
||||||
|
|
||||||
|
ksp_launch.o: ksp_launch.c
|
||||||
|
$(CC) $(CFLAGS) -c ksp_launch.c
|
||||||
|
|
||||||
ksp_loading: ksp_loading.o
|
ksp_loading: ksp_loading.o
|
||||||
$(CC) $(LFLAGS) -o ksp_loading ksp_loading.o
|
$(CC) $(LFLAGS) -o ksp_loading ksp_loading.o
|
||||||
@ -18,5 +24,5 @@ ksp_vab.o: ksp_vab.c
|
|||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o ksp_loading ksp_vab
|
rm -f *~ *.o ksp_launch ksp_loading ksp_vab
|
||||||
|
|
||||||
|
86
ksp/c/ksp_launch.c
Normal file
86
ksp/c/ksp_launch.c
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/* http://wiki.kerbalspaceprogram.com/wiki/Tutorial:Advanced_Rocket_Design */
|
||||||
|
|
||||||
|
/* Also, high school physics (thanks Mr. Brennen) */
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO: want 2d-vectors at least */
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
double capsule_mass=1.0;
|
||||||
|
|
||||||
|
double engine_isp=270.0; /* s */
|
||||||
|
double engine_mass=1.5; /* tons */
|
||||||
|
double engine_thrust=168.0; /* kN */
|
||||||
|
double fuel_flow_rate;
|
||||||
|
|
||||||
|
double tank_mass=0.5; /* tons */
|
||||||
|
double fuel_mass=4.0; /* tons */
|
||||||
|
|
||||||
|
double gravity=9.8; /* m/s^2 */
|
||||||
|
|
||||||
|
double rocket_velocity=0.0; /* m/s */
|
||||||
|
double rocket_acceleration=0.0; /* m/s^2 */
|
||||||
|
double rocket_altitude=0.0; /* m */
|
||||||
|
|
||||||
|
double deltav,twr;
|
||||||
|
double total_mass,empty_mass;
|
||||||
|
|
||||||
|
double time=0.0; /* s */
|
||||||
|
|
||||||
|
total_mass=engine_mass+tank_mass+fuel_mass+capsule_mass;
|
||||||
|
empty_mass=total_mass-fuel_mass;
|
||||||
|
|
||||||
|
deltav=engine_isp*gravity*log(total_mass/empty_mass);
|
||||||
|
|
||||||
|
twr=engine_thrust/(total_mass*gravity);
|
||||||
|
|
||||||
|
fuel_flow_rate=(engine_thrust)/(engine_isp*gravity);
|
||||||
|
|
||||||
|
printf("DeltaV=%lf m/s\n",deltav);
|
||||||
|
printf("Thrust/weight=%lf\n",twr);
|
||||||
|
printf("Fuel flow rate=%lf, time=%lfs\n",
|
||||||
|
fuel_flow_rate,fuel_mass/fuel_flow_rate);
|
||||||
|
|
||||||
|
for(time=0.0;time<500.0;time++) {
|
||||||
|
printf("Time: %lf\n",time);
|
||||||
|
printf("\tFuel left: %lf\n",fuel_mass);
|
||||||
|
if (fuel_mass<0.1) {
|
||||||
|
fuel_mass=0.0;
|
||||||
|
rocket_acceleration=-gravity;
|
||||||
|
rocket_velocity=rocket_velocity+rocket_acceleration*1.0;
|
||||||
|
rocket_altitude=rocket_altitude+
|
||||||
|
(rocket_velocity*1.0)+
|
||||||
|
0.5*rocket_acceleration+1.0*1.0;
|
||||||
|
if (rocket_altitude<0.0) {
|
||||||
|
printf("CRASH!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rocket_acceleration=(engine_thrust/total_mass)-gravity;
|
||||||
|
rocket_velocity=rocket_velocity+rocket_acceleration*1.0;
|
||||||
|
rocket_altitude=rocket_altitude+
|
||||||
|
(rocket_velocity*1.0)+
|
||||||
|
0.5*rocket_acceleration+1.0*1.0;
|
||||||
|
fuel_mass=fuel_mass-fuel_flow_rate;
|
||||||
|
total_mass=engine_mass+tank_mass+fuel_mass+capsule_mass;
|
||||||
|
}
|
||||||
|
printf("\tRocket acceleration: %lf g\n",rocket_acceleration/gravity);
|
||||||
|
printf("\tRocket velocity: %lf m/s\n",rocket_velocity);
|
||||||
|
printf("\tRocket altitude: %lf m\n",rocket_altitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Notes */
|
||||||
|
|
||||||
|
/* Once altitude above 100m stop drawing ground */
|
||||||
|
/* Once above 20k no more drag? */
|
||||||
|
/* Once above 2100m/s sideways, orbit? */
|
||||||
|
/* Once above 40k draw stars? */
|
||||||
|
/* Kerbal neutral 0-1G, smiles 1-2G, frowns > 2G or -velocity? */
|
@ -53,11 +53,11 @@ int main(int argc, char **argv) {
|
|||||||
printf("Available:\n");
|
printf("Available:\n");
|
||||||
printf("1. Jebediah\tPilot\tS ***\tC ***\n");
|
printf("1. Jebediah\tPilot\tS ***\tC ***\n");
|
||||||
printf("2. Valentina\tPilot\tS ***\tC ***\n");
|
printf("2. Valentina\tPilot\tS ***\tC ***\n");
|
||||||
printf("3. Kai\tEngineer\s ***\tC ***\n");
|
printf("3. Kai\tEngineer\t ***\tC ***\n");
|
||||||
printf("4. Kuroshin\tEngineer\s ***\tC ***\n");
|
printf("4. Kuroshin\tEngineer\t ***\tC ***\n");
|
||||||
printf("5. Desktop\tScientist\s ***\tC ***\n");
|
printf("5. Desktop\tScientist\t ***\tC ***\n");
|
||||||
printf("6. Slashdot\tPilot\s ***\tC ***\n");
|
printf("6. Slashdot\tPilot\t ***\tC ***\n");
|
||||||
printf("7. Zurgtroyd\tPilot\s ***\tC ***\n");
|
printf("7. Zurgtroyd\tPilot\t ***\tC ***\n");
|
||||||
|
|
||||||
printf("Select three astronauts\n"); // highlight and say correct?
|
printf("Select three astronauts\n"); // highlight and say correct?
|
||||||
|
|
||||||
|
BIN
ksp/ksp.dsk
BIN
ksp/ksp.dsk
Binary file not shown.
70
ksp/ship.table
Normal file
70
ksp/ship.table
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Number of shapes
|
||||||
|
3
|
||||||
|
# "Engine"
|
||||||
|
START
|
||||||
|
RT
|
||||||
|
DN
|
||||||
|
RT
|
||||||
|
DN
|
||||||
|
RT
|
||||||
|
DN
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
UP
|
||||||
|
RT
|
||||||
|
UP
|
||||||
|
RT
|
||||||
|
UP
|
||||||
|
RT
|
||||||
|
STOP
|
||||||
|
# "Fuel Tank"
|
||||||
|
START
|
||||||
|
NUP
|
||||||
|
NUP
|
||||||
|
NUP
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
DN
|
||||||
|
DN
|
||||||
|
DN
|
||||||
|
DN
|
||||||
|
DN
|
||||||
|
DN
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
UP
|
||||||
|
UP
|
||||||
|
UP
|
||||||
|
UP
|
||||||
|
UP
|
||||||
|
UP
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
STOP
|
||||||
|
# "Flame"
|
||||||
|
START
|
||||||
|
NUP
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
DN
|
||||||
|
LT
|
||||||
|
DN
|
||||||
|
LT
|
||||||
|
LT
|
||||||
|
UP
|
||||||
|
LT
|
||||||
|
UP
|
||||||
|
RT
|
||||||
|
RT
|
||||||
|
STOP
|
||||||
|
|
34
ksp/ship_test.bas
Normal file
34
ksp/ship_test.bas
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
5 EO = 0
|
||||||
|
10 HIMEM: 8135
|
||||||
|
20 POKE 232,199: POKE 233,31
|
||||||
|
30 FOR L = 8135 TO 8175: READ B: POKE L,B: NEXT L
|
||||||
|
35 HGR : ROT= 0: SCALE= 2
|
||||||
|
40 GOTO 150
|
||||||
|
90 END
|
||||||
|
100 DATA 3,0,8,0,18,0,33,0,53,53
|
||||||
|
101 DATA 53,63,63,63,44,44,44,0,0,40
|
||||||
|
102 DATA 45,54,54,54,63,63,63,36,36,36
|
||||||
|
103 DATA 45,5,0,40,53,55,63,60,44,5
|
||||||
|
104 DATA 0
|
||||||
|
150 GOSUB 2000
|
||||||
|
200 REM
|
||||||
|
300 GET A$
|
||||||
|
305 IF A$ = "Q" THEN GOTO 1000
|
||||||
|
310 IF A$ = " " THEN EO = 1
|
||||||
|
320 IF A$ = "A" THEN R = R - 8
|
||||||
|
325 IF A$ = "D" THEN R = R + 8
|
||||||
|
330 IF R < 0 THEN R = 56
|
||||||
|
335 IF R > 63 THEN R = 0
|
||||||
|
337 GOSUB 2000
|
||||||
|
340 ROT= R
|
||||||
|
800 GOSUB 2000
|
||||||
|
900 GOTO 200
|
||||||
|
1000 END
|
||||||
|
2000 REM DRAW SHIP
|
||||||
|
2010 XDRAW 1 AT 140,50
|
||||||
|
2020 XDRAW 2 AT 140,62
|
||||||
|
2030 XDRAW 2 AT 140,74
|
||||||
|
2040 XDRAW 1 AT 140,86
|
||||||
|
2050 HCOLOR= 5
|
||||||
|
2060 IF EO = 1 THEN DRAW 3 AT 140,92
|
||||||
|
2070 RETURN
|
42
ksp/vab.bas
Normal file
42
ksp/vab.bas
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
10 HIMEM: 8135
|
||||||
|
20 POKE 232,199: POKE 233,31
|
||||||
|
30 FOR L = 8135 TO 8175: READ B: POKE L,B: NEXT L
|
||||||
|
35 HGR : ROT= 0: SCALE= 2
|
||||||
|
40 GOTO 150
|
||||||
|
90 END
|
||||||
|
100 DATA 3,0,8,0,18,0,33,0,53,53
|
||||||
|
101 DATA 53,63,63,63,44,44,44,0,0,40
|
||||||
|
102 DATA 45,54,54,54,63,63,63,36,36,36
|
||||||
|
103 DATA 45,5,0,40,53,55,63,60,44,5
|
||||||
|
104 DATA 0
|
||||||
|
150 XDRAW 1 AT 140,20
|
||||||
|
155 Y=18
|
||||||
|
200 HOME
|
||||||
|
205 INVERSE : VTAB 21: HTAB 8
|
||||||
|
207 PRINT "VEHICLE ASSEMBLY BUILDING"
|
||||||
|
208 NORMAL
|
||||||
|
220 PRINT "HOW MANY STAGES? (1-3)";
|
||||||
|
225 INPUT S
|
||||||
|
230 FOR I = 1 TO S
|
||||||
|
240 PRINT "HOW MANY STACKS, STAGE ";I;" (1-3)";
|
||||||
|
245 INPUT T
|
||||||
|
247 ST(I) = T
|
||||||
|
260 PRINT "HOW MANY FUEL TANKS PER STACK, STAGE ";I;" (1-2)";
|
||||||
|
265 INPUT F
|
||||||
|
267 FT(I) = F
|
||||||
|
268 FOR J = 1 TO F
|
||||||
|
270 XDRAW 2 AT 140, Y+13*J
|
||||||
|
272 IF T >1 THEN XDRAW 2 AT 126, Y+13*J
|
||||||
|
274 IF T >2 THEN XDRAW 2 AT 154, Y+13*J
|
||||||
|
278 NEXT J
|
||||||
|
279 Y=Y+13*F
|
||||||
|
280 PRINT "HOW MANY ENGINES, STAGE ";I;" (1-";T;")";
|
||||||
|
285 INPUT E
|
||||||
|
287 EN(I) = E
|
||||||
|
290 XDRAW 1 AT 140, Y+8
|
||||||
|
292 IF E >1 THEN XDRAW 1 AT 126, Y+8
|
||||||
|
294 IF E >2 THEN XDRAW 1 AT 154, Y+8
|
||||||
|
297 Y=Y+6
|
||||||
|
300 NEXT I
|
||||||
|
510 PRINT "HOW MANY STRUTS? (1-20000)";
|
||||||
|
520 INPUT ST
|
Loading…
x
Reference in New Issue
Block a user