mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-07-05 00:23:55 +00:00
tfv: update to make C code more 6502 like
This commit is contained in:
@ -739,7 +739,7 @@ int basic_vlin(int y1, int y2, int at) {
|
|||||||
else { ram[H2]=y2; ram[V2]=y2; ram[FIRST]=y1; }
|
else { ram[H2]=y2; ram[V2]=y2; ram[FIRST]=y1; }
|
||||||
x=at;
|
x=at;
|
||||||
|
|
||||||
if (x>48) {
|
if (x>40) {
|
||||||
fprintf(stderr,"Error! AT too large %d!\n",x);
|
fprintf(stderr,"Error! AT too large %d!\n",x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
extern unsigned char ram[128*1024];
|
extern unsigned char ram[128*1024];
|
||||||
|
extern unsigned char a,y,x;
|
||||||
|
|
||||||
int grsim_input(void);
|
int grsim_input(void);
|
||||||
int grsim_update(void);
|
int grsim_update(void);
|
||||||
int grsim_init(void);
|
int grsim_init(void);
|
||||||
|
80
gr-sim/tfv.c
80
gr-sim/tfv.c
@ -61,22 +61,47 @@ static unsigned char ship_left[]={
|
|||||||
0x15,0x00,0x07,0x77,0x00,
|
0x15,0x00,0x07,0x77,0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int xx,yy,yadd,match;
|
#define COLOR1 0x00
|
||||||
|
#define COLOR2 0x01
|
||||||
|
#define MATCH 0x02
|
||||||
|
#define XX 0x03
|
||||||
|
#define YY 0x04
|
||||||
|
#define YADD 0x05
|
||||||
|
#define LOOP 0x06
|
||||||
|
|
||||||
void draw_segment(int color1, int color2) {
|
static void draw_segment(void) {
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<4;i++) {
|
for(ram[LOOP]=0;ram[LOOP]<4;ram[LOOP]++) {
|
||||||
yy+=yadd;
|
ram[YY]=ram[YY]+ram[YADD];
|
||||||
if (xx==match) color_equals(color1*3);
|
if (ram[XX]==ram[MATCH]) color_equals(ram[COLOR1]*3);
|
||||||
else color_equals(color1);
|
else color_equals(ram[COLOR1]);
|
||||||
basic_vlin(10,yy,9+xx);
|
basic_vlin(10,ram[YY],9+ram[XX]);
|
||||||
if (xx==match) color_equals(color2*3);
|
if (ram[XX]==ram[MATCH]) color_equals(ram[COLOR2]*3);
|
||||||
else color_equals(color2);
|
else color_equals(ram[COLOR2]);
|
||||||
if (yy!=34) basic_vlin(yy,34,9+xx);
|
if (ram[YY]!=34) basic_vlin(ram[YY],34,9+ram[XX]);
|
||||||
xx++;
|
ram[XX]++;
|
||||||
}
|
}
|
||||||
yadd=-yadd;
|
ram[YADD]=-ram[YADD];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw_logo(void) {
|
||||||
|
|
||||||
|
ram[XX]=0;
|
||||||
|
ram[YY]=10;
|
||||||
|
ram[YADD]=6;
|
||||||
|
ram[COLOR1]=1;
|
||||||
|
ram[COLOR2]=0;
|
||||||
|
draw_segment();
|
||||||
|
ram[COLOR2]=4;
|
||||||
|
draw_segment();
|
||||||
|
ram[COLOR1]=2;
|
||||||
|
draw_segment();
|
||||||
|
draw_segment();
|
||||||
|
draw_segment();
|
||||||
|
ram[COLOR2]=0;
|
||||||
|
draw_segment();
|
||||||
|
|
||||||
|
grsim_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@ -97,34 +122,13 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
/* VMW splash */
|
/* VMW splash */
|
||||||
|
|
||||||
yy=10;
|
ram[MATCH]=100;
|
||||||
xx=0;
|
draw_logo();
|
||||||
|
|
||||||
yadd=6;
|
|
||||||
match=100;
|
|
||||||
draw_segment(1,0);
|
|
||||||
draw_segment(1,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,0);
|
|
||||||
|
|
||||||
grsim_update();
|
|
||||||
|
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
|
|
||||||
for(match=0;match<30;match++) {
|
for(ram[MATCH]=0;ram[MATCH]<30;ram[MATCH]++) {
|
||||||
yy=10;
|
draw_logo();
|
||||||
xx=0;
|
|
||||||
|
|
||||||
yadd=6;
|
|
||||||
draw_segment(1,0);
|
|
||||||
draw_segment(1,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,4);
|
|
||||||
draw_segment(2,0);
|
|
||||||
|
|
||||||
grsim_update();
|
grsim_update();
|
||||||
|
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
|
Reference in New Issue
Block a user