mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-11 09:29:51 +00:00
tfv: switch over to 40x40 mode
framerate is back to 4fps
This commit is contained in:
parent
03e7afe1ce
commit
b6335d4419
@ -193,7 +193,7 @@ int main(int argc, char **argv) {
|
||||
double coach_z;
|
||||
double horizon=-2.0;
|
||||
|
||||
printf("horizontal_scale_lookup:\n");
|
||||
printf("horizontal_scale_lookup_20:\n");
|
||||
for(space_z=0.5;space_z<7.5;space_z+=1.0) {
|
||||
printf("{");
|
||||
for(i=8;i<40;i+=2) {
|
||||
@ -208,6 +208,21 @@ int main(int argc, char **argv) {
|
||||
printf("},\n");
|
||||
}
|
||||
|
||||
printf("horizontal_scale_lookup_40:\n");
|
||||
for(space_z=0.5;space_z<7.5;space_z+=1.0) {
|
||||
printf("{");
|
||||
for(i=8;i<40;i+=1) {
|
||||
coach_z=space_z/((double)i-horizon);
|
||||
double_to_fixed(coach_z,&fa);
|
||||
if (fa.i!=0) {
|
||||
printf("CRITICAL ERROR TOP NOT 0\n");
|
||||
}
|
||||
printf("0x%02X,",fa.f);
|
||||
|
||||
}
|
||||
printf("},\n");
|
||||
}
|
||||
|
||||
for(coach_z=-1.0;coach_z<1.0;coach_z+=0.1) {
|
||||
double_to_fixed(coach_z,&fa);
|
||||
printf("%lf\t%02X,%02X\n",coach_z,fa.i,fa.f);
|
||||
|
@ -221,7 +221,7 @@ static int gbascalc(unsigned char a) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short y_indirect(unsigned char base, unsigned char y) {
|
||||
short y_indirect(unsigned char base, unsigned char y) {
|
||||
|
||||
unsigned short addr;
|
||||
|
||||
|
@ -42,6 +42,7 @@ void print(char *string);
|
||||
void print_both_pages(char *string);
|
||||
void print_inverse(char *string);
|
||||
int plot(unsigned char xcoord, unsigned char ycoord);
|
||||
short y_indirect(unsigned char base, unsigned char y);
|
||||
|
||||
#define APPLE_UP 11
|
||||
#define APPLE_DOWN 10
|
||||
|
@ -218,20 +218,50 @@ static struct fixed_type fixed_sin_scale[ANGLE_STEPS]={
|
||||
{0xff,0xf4},
|
||||
};
|
||||
|
||||
static unsigned char horizontal_lookup[7][16] = {
|
||||
{0x0C,0x0A,0x09,0x08,0x07,0x06,0x05,0x05,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,},
|
||||
{0x26,0x20,0x1B,0x18,0x15,0x13,0x11,0x10,0x0E,0x0D,0x0C,0x0C,0x0B,0x0A,0x0A,0x09,},
|
||||
{0x40,0x35,0x2D,0x28,0x23,0x20,0x1D,0x1A,0x18,0x16,0x15,0x14,0x12,0x11,0x10,0x10,},
|
||||
{0x59,0x4A,0x40,0x38,0x31,0x2C,0x28,0x25,0x22,0x20,0x1D,0x1C,0x1A,0x18,0x17,0x16,},
|
||||
{0x73,0x60,0x52,0x48,0x40,0x39,0x34,0x30,0x2C,0x29,0x26,0x24,0x21,0x20,0x1E,0x1C,},
|
||||
{0x8C,0x75,0x64,0x58,0x4E,0x46,0x40,0x3A,0x36,0x32,0x2E,0x2C,0x29,0x27,0x25,0x23,},
|
||||
{0xA6,0x8A,0x76,0x68,0x5C,0x53,0x4B,0x45,0x40,0x3B,0x37,0x34,0x30,0x2E,0x2B,0x29,},
|
||||
//static unsigned char horizontal_lookup[7][16] = {
|
||||
// {0x0C,0x0A,0x09,0x08,0x07,0x06,0x05,0x05,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,},
|
||||
// {0x26,0x20,0x1B,0x18,0x15,0x13,0x11,0x10,0x0E,0x0D,0x0C,0x0C,0x0B,0x0A,0x0A,0x09,},
|
||||
// {0x40,0x35,0x2D,0x28,0x23,0x20,0x1D,0x1A,0x18,0x16,0x15,0x14,0x12,0x11,0x10,0x10,},
|
||||
// {0x59,0x4A,0x40,0x38,0x31,0x2C,0x28,0x25,0x22,0x20,0x1D,0x1C,0x1A,0x18,0x17,0x16,},
|
||||
// {0x73,0x60,0x52,0x48,0x40,0x39,0x34,0x30,0x2C,0x29,0x26,0x24,0x21,0x20,0x1E,0x1C,},
|
||||
// {0x8C,0x75,0x64,0x58,0x4E,0x46,0x40,0x3A,0x36,0x32,0x2E,0x2C,0x29,0x27,0x25,0x23,},
|
||||
// {0xA6,0x8A,0x76,0x68,0x5C,0x53,0x4B,0x45,0x40,0x3B,0x37,0x34,0x30,0x2E,0x2B,0x29,},
|
||||
//};
|
||||
|
||||
//static unsigned char horizontal_lookup[7][32] = {
|
||||
static unsigned char horizontal_lookup[7*32] = {
|
||||
0x0C,0x0B,0x0A,0x09,0x09,0x08,0x08,0x07,
|
||||
0x07,0x06,0x06,0x06,0x05,0x05,0x05,0x05,
|
||||
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x03,
|
||||
0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
|
||||
0x26,0x22,0x20,0x1D,0x1B,0x19,0x18,0x16,
|
||||
0x15,0x14,0x13,0x12,0x11,0x10,0x10,0x0F,
|
||||
0x0E,0x0E,0x0D,0x0D,0x0C,0x0C,0x0C,0x0B,
|
||||
0x0B,0x0A,0x0A,0x0A,0x0A,0x09,0x09,0x09,
|
||||
0x40,0x3A,0x35,0x31,0x2D,0x2A,0x28,0x25,
|
||||
0x23,0x21,0x20,0x1E,0x1D,0x1B,0x1A,0x19,
|
||||
0x18,0x17,0x16,0x16,0x15,0x14,0x14,0x13,
|
||||
0x12,0x12,0x11,0x11,0x10,0x10,0x10,0x0F,
|
||||
0x59,0x51,0x4A,0x44,0x40,0x3B,0x38,0x34,
|
||||
0x31,0x2F,0x2C,0x2A,0x28,0x26,0x25,0x23,
|
||||
0x22,0x21,0x20,0x1E,0x1D,0x1C,0x1C,0x1B,
|
||||
0x1A,0x19,0x18,0x18,0x17,0x16,0x16,0x15,
|
||||
0x73,0x68,0x60,0x58,0x52,0x4C,0x48,0x43,
|
||||
0x40,0x3C,0x39,0x36,0x34,0x32,0x30,0x2E,
|
||||
0x2C,0x2A,0x29,0x27,0x26,0x25,0x24,0x22,
|
||||
0x21,0x20,0x20,0x1F,0x1E,0x1D,0x1C,0x1C,
|
||||
0x8C,0x80,0x75,0x6C,0x64,0x5D,0x58,0x52,
|
||||
0x4E,0x4A,0x46,0x43,0x40,0x3D,0x3A,0x38,
|
||||
0x36,0x34,0x32,0x30,0x2E,0x2D,0x2C,0x2A,
|
||||
0x29,0x28,0x27,0x26,0x25,0x24,0x23,0x22,
|
||||
0xA6,0x97,0x8A,0x80,0x76,0x6E,0x68,0x61,
|
||||
0x5C,0x57,0x53,0x4F,0x4B,0x48,0x45,0x42,
|
||||
0x40,0x3D,0x3B,0x39,0x37,0x35,0x34,0x32,
|
||||
0x30,0x2F,0x2E,0x2C,0x2B,0x2A,0x29,0x28,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void fixed_add(unsigned char x_i,unsigned char x_f,
|
||||
unsigned char y_i, unsigned char y_f,
|
||||
unsigned char *z_i, unsigned char *z_f) {
|
||||
@ -642,21 +672,27 @@ static void draw_background_mode7(void) {
|
||||
ram[FACTOR_I],ram[FACTOR_F]);
|
||||
}
|
||||
|
||||
cycles.mode7+=12;
|
||||
cycles.mode7+=11;
|
||||
|
||||
for (ram[SCREEN_Y] = 8; ram[SCREEN_Y] < LOWRES_H; ram[SCREEN_Y]+=2) {
|
||||
ram[SCREEN_Y]=8;
|
||||
|
||||
do {
|
||||
|
||||
y=0;
|
||||
hlin_setup(ram[DRAW_PAGE],y,0,ram[SCREEN_Y]);
|
||||
cycles.mode7+=43;
|
||||
cycles.mode7+=39;
|
||||
|
||||
// then calculate the horizontal scale, or the distance between
|
||||
// space points on this horizontal line
|
||||
ram[HORIZ_SCALE_I]=0;
|
||||
|
||||
ram[HORIZ_SCALE_F]=
|
||||
horizontal_lookup[ram[SPACEZ_I]&0xf]
|
||||
[(ram[SCREEN_Y]-8)/2];
|
||||
cycles.mode7+=44;
|
||||
//horizontal_lookup[ram[SPACEZ_I]&0xf]
|
||||
// [(ram[SCREEN_Y]-8)];
|
||||
horizontal_lookup[((ram[SPACEZ_I]&0xf)<<5)+
|
||||
(ram[SCREEN_Y]-8)];
|
||||
|
||||
cycles.mode7+=39;
|
||||
|
||||
if (!displayed) {
|
||||
printf("HORIZ_SCALE %x %x\n",
|
||||
@ -766,20 +802,29 @@ static void draw_background_mode7(void) {
|
||||
}
|
||||
|
||||
// go through all points in this screen line
|
||||
for (ram[SCREEN_X] = 0; ram[SCREEN_X] < LOWRES_W; ram[SCREEN_X]++) {
|
||||
for (ram[SCREEN_X] = 0;
|
||||
ram[SCREEN_X] < LOWRES_W;
|
||||
ram[SCREEN_X]++) {
|
||||
|
||||
// get a pixel from the tile and put it on the screen
|
||||
|
||||
map_color=lookup_map(ram[SPACEX_I],ram[SPACEY_I]);
|
||||
|
||||
ram[COLOR]=map_color;
|
||||
ram[COLOR]|=map_color<<4;
|
||||
ram[COLOR]=(map_color&0xf);
|
||||
// ram[COLOR]|=map_color<<4;
|
||||
|
||||
// if ((ram[SCREEN_X]==20) && (ram[SCREEN_Y]==38)) {
|
||||
// if (map_color==COLOR_DARKBLUE) ram[OVER_WATER]=1;
|
||||
// }
|
||||
y=0;
|
||||
if ((ram[SCREEN_Y]&1)==0) {
|
||||
ram[y_indirect(GBASL,y)]=ram[COLOR];
|
||||
}
|
||||
else {
|
||||
a=ram[COLOR];
|
||||
ram[y_indirect(GBASL,y)]|=(a<<4);
|
||||
|
||||
hlin_double_continue(1);
|
||||
cycles.mode7+=19;
|
||||
}
|
||||
|
||||
ram[GBASL]++;
|
||||
cycles.mode7+=31;
|
||||
|
||||
// advance to the next position in space
|
||||
fixed_add(ram[SPACEX_I],ram[SPACEX_F],
|
||||
@ -790,8 +835,11 @@ static void draw_background_mode7(void) {
|
||||
&ram[SPACEY_I],&ram[SPACEY_F]);
|
||||
cycles.mode7+=53;
|
||||
}
|
||||
cycles.mode7+=17;
|
||||
}
|
||||
|
||||
ram[SCREEN_Y]+=1;
|
||||
cycles.mode7+=15;
|
||||
} while(ram[SCREEN_Y] < LOWRES_H);
|
||||
|
||||
displayed=1;
|
||||
cycles.mode7+=6;
|
||||
}
|
||||
|
@ -97,3 +97,16 @@ Move checking if over water out of critical section
|
||||
Total = 106,841
|
||||
Frame Rate = 9.36 fps
|
||||
|
||||
Move to 40x40 mode
|
||||
|
||||
Cycles: flying= 187
|
||||
Cycles: getkey= 46
|
||||
Cycles: page_flip= 26
|
||||
Cycles: multiply= 49,613
|
||||
Cycles: mode7= 123,701
|
||||
Cycles: lookup_map= 48,847
|
||||
Cycles: put_sprite= 2,561
|
||||
=================================
|
||||
Total = 224,981
|
||||
Frame Rate = 4.44 fps
|
||||
|
||||
|
112
tfv/tfv_flying.s
112
tfv/tfv_flying.s
@ -564,7 +564,7 @@ draw_background_mode7:
|
||||
; 11
|
||||
|
||||
sky_loop: ; draw line across screen
|
||||
ldy #40 ; from y=0 to y=6 ; 2
|
||||
ldy #39 ; from y=0 to y=6 ; 2
|
||||
sty V2 ; 3
|
||||
ldy #0 ; 2
|
||||
pha ; 3
|
||||
@ -581,7 +581,7 @@ sky_loop: ; draw line across screen
|
||||
lda #COLOR_BOTH_GREY ; Horizon is Grey ; 2
|
||||
sta COLOR ; 3
|
||||
lda #6 ; draw single line at 6/7 ; 2
|
||||
ldy #40 ; 2
|
||||
ldy #39 ; 2
|
||||
sty V2 ; hlin Y,V2 at A ; 3
|
||||
ldy #0 ; 2
|
||||
jsr hlin_double ; hlin 0,40 at 6 ; 63+(X*16)
|
||||
@ -621,21 +621,42 @@ no_draw_sky:
|
||||
;; BAD 4 80 * ffffffff 80 = 42 40
|
||||
|
||||
lda #8 ; 2
|
||||
sta SCREEN_Y ; 4
|
||||
sta SCREEN_Y ; 3
|
||||
;=============
|
||||
; 12
|
||||
; 11
|
||||
screeny_loop:
|
||||
ldy #0 ; 2
|
||||
jsr hlin_setup ; y-coord in a, x-coord in y ; 41
|
||||
; sets up GBASL/GBASH
|
||||
tay ; y=A ; 2
|
||||
and #$1 ; 2
|
||||
bne screeny_odd ; 2nt/3
|
||||
screeny_even:
|
||||
lda #$0f ; 2
|
||||
bne screeny_continue ; 3
|
||||
screeny_odd:
|
||||
tya ; 2
|
||||
and #$fe ; 2
|
||||
tay ; 2
|
||||
lda #$f0 ; 2
|
||||
screeny_continue:
|
||||
sta COLOR_MASK ; 3
|
||||
|
||||
lda gr_offsets,Y ; lookup low-res memory address ; 4
|
||||
sta GBASL ; 3
|
||||
iny ; 2
|
||||
|
||||
lda gr_offsets,Y ; 4
|
||||
clc ; 2
|
||||
adc DRAW_PAGE ; add in draw page offset ; 3
|
||||
sta GBASH ; 3
|
||||
|
||||
;=============
|
||||
; 43
|
||||
; 39/35
|
||||
|
||||
lda #0 ; horizontal_scale.i = 0 ; 2
|
||||
sta HORIZ_SCALE_I ; 3
|
||||
|
||||
; unsigned char horizontal_lookup[7][32];
|
||||
;horizontal_scale.f=
|
||||
; horizontal_lookup[space_z.i&0xf][(screen_y-8)/2];
|
||||
; horizontal_lookup[(space_z<<5)+(screen_y-8)]
|
||||
|
||||
lda SPACEZ_I ; 3
|
||||
and #$f ; 2
|
||||
@ -643,19 +664,19 @@ screeny_loop:
|
||||
asl ; 2
|
||||
asl ; 2
|
||||
asl ; 2
|
||||
asl ; 2
|
||||
sta TEMP_I ; 3
|
||||
|
||||
sec ; 2
|
||||
lda SCREEN_Y ; 3
|
||||
sbc #8 ; 2
|
||||
lsr ; 2
|
||||
clc ; 2
|
||||
adc TEMP_I ; 3
|
||||
tay ; 2
|
||||
lda horizontal_lookup,Y ; 4
|
||||
sta HORIZ_SCALE_F ; 3
|
||||
;============
|
||||
; 44
|
||||
; 39
|
||||
;; brk ASM, horiz_scale = 00:73
|
||||
; mul2
|
||||
; calculate the distance of the line we are drawing
|
||||
@ -919,26 +940,21 @@ screenx_loop:
|
||||
jsr lookup_map ; get color in A ; 6
|
||||
|
||||
ldy #0 ; 2
|
||||
|
||||
and COLOR_MASK ; 3
|
||||
ldx COLOR_MASK ; 3
|
||||
bpl big_bottom ; 2nt/3
|
||||
|
||||
ora (GBASL),Y ; 4
|
||||
big_bottom:
|
||||
|
||||
sta (GBASL),Y ; plot double height ; 6
|
||||
inc GBASL ; point to next pixel ; 5
|
||||
|
||||
; Check if over water
|
||||
; cmp #$22 ; see if dark blue ; 2
|
||||
; bne not_watery ; 2nt/3
|
||||
|
||||
; lda SCREEN_Y ; only check pixel in middle of screen ; 3
|
||||
; cmp #38 ; 2
|
||||
; bne not_watery ; 2nt/3
|
||||
|
||||
; lda SCREEN_X ; only check pixel in middle of screen ; 3
|
||||
; cmp #20 ; 2
|
||||
; bne not_watery ; 2nt/3
|
||||
|
||||
; lda #$1 ; set over water ; 2
|
||||
; sta OVER_WATER ; 3
|
||||
;============
|
||||
; 19
|
||||
;not_watery:
|
||||
; 31
|
||||
|
||||
|
||||
|
||||
; advance to the next position in space
|
||||
|
||||
clc ; fixed_add(&space_x,&dx,&space_x); ; 2
|
||||
@ -964,15 +980,13 @@ screenx_loop:
|
||||
;=============
|
||||
; 53
|
||||
|
||||
inc SCREEN_Y ; 5
|
||||
lda SCREEN_Y ; 3
|
||||
clc ; 2
|
||||
adc #2 ; 2
|
||||
sta SCREEN_Y ; 3
|
||||
cmp #40 ; LOWRES height ; 2
|
||||
beq done_screeny ; 2nt/3
|
||||
jmp screeny_loop ; 3
|
||||
;=============
|
||||
; 17
|
||||
; 15
|
||||
done_screeny:
|
||||
rts ; 6
|
||||
|
||||
@ -1097,14 +1111,34 @@ fixed_sin_scale:
|
||||
.byte $ff,$ea
|
||||
.byte $ff,$f4
|
||||
|
||||
;horizontal_lookup_20:
|
||||
; .byte $0C,$0A,$09,$08,$07,$06,$05,$05,$04,$04,$04,$04,$03,$03,$03,$03
|
||||
; .byte $26,$20,$1B,$18,$15,$13,$11,$10,$0E,$0D,$0C,$0C,$0B,$0A,$0A,$09
|
||||
; .byte $40,$35,$2D,$28,$23,$20,$1D,$1A,$18,$16,$15,$14,$12,$11,$10,$10
|
||||
; .byte $59,$4A,$40,$38,$31,$2C,$28,$25,$22,$20,$1D,$1C,$1A,$18,$17,$16
|
||||
; .byte $73,$60,$52,$48,$40,$39,$34,$30,$2C,$29,$26,$24,$21,$20,$1E,$1C
|
||||
; .byte $8C,$75,$64,$58,$4E,$46,$40,$3A,$36,$32,$2E,$2C,$29,$27,$25,$23
|
||||
; .byte $A6,$8A,$76,$68,$5C,$53,$4B,$45,$40,$3B,$37,$34,$30,$2E,$2B,$29
|
||||
|
||||
; FIXME: we can guarantee faster indexed reads if we page-aligned this
|
||||
.align 256
|
||||
horizontal_lookup:
|
||||
.byte $0C,$0A,$09,$08,$07,$06,$05,$05,$04,$04,$04,$04,$03,$03,$03,$03
|
||||
.byte $26,$20,$1B,$18,$15,$13,$11,$10,$0E,$0D,$0C,$0C,$0B,$0A,$0A,$09
|
||||
.byte $40,$35,$2D,$28,$23,$20,$1D,$1A,$18,$16,$15,$14,$12,$11,$10,$10
|
||||
.byte $59,$4A,$40,$38,$31,$2C,$28,$25,$22,$20,$1D,$1C,$1A,$18,$17,$16
|
||||
.byte $73,$60,$52,$48,$40,$39,$34,$30,$2C,$29,$26,$24,$21,$20,$1E,$1C
|
||||
.byte $8C,$75,$64,$58,$4E,$46,$40,$3A,$36,$32,$2E,$2C,$29,$27,$25,$23
|
||||
.byte $A6,$8A,$76,$68,$5C,$53,$4B,$45,$40,$3B,$37,$34,$30,$2E,$2B,$29
|
||||
.byte $0C,$0B,$0A,$09,$09,$08,$08,$07,$07,$06,$06,$06,$05,$05,$05,$05
|
||||
.byte $04,$04,$04,$04,$04,$04,$04,$03,$03,$03,$03,$03,$03,$03,$03,$03
|
||||
.byte $26,$22,$20,$1D,$1B,$19,$18,$16,$15,$14,$13,$12,$11,$10,$10,$0F
|
||||
.byte $0E,$0E,$0D,$0D,$0C,$0C,$0C,$0B,$0B,$0A,$0A,$0A,$0A,$09,$09,$09
|
||||
.byte $40,$3A,$35,$31,$2D,$2A,$28,$25,$23,$21,$20,$1E,$1D,$1B,$1A,$19
|
||||
.byte $18,$17,$16,$16,$15,$14,$14,$13,$12,$12,$11,$11,$10,$10,$10,$0F
|
||||
.byte $59,$51,$4A,$44,$40,$3B,$38,$34,$31,$2F,$2C,$2A,$28,$26,$25,$23
|
||||
.byte $22,$21,$20,$1E,$1D,$1C,$1C,$1B,$1A,$19,$18,$18,$17,$16,$16,$15
|
||||
.byte $73,$68,$60,$58,$52,$4C,$48,$43,$40,$3C,$39,$36,$34,$32,$30,$2E
|
||||
.byte $2C,$2A,$29,$27,$26,$25,$24,$22,$21,$20,$20,$1F,$1E,$1D,$1C,$1C
|
||||
.byte $8C,$80,$75,$6C,$64,$5D,$58,$52,$4E,$4A,$46,$43,$40,$3D,$3A,$38
|
||||
.byte $36,$34,$32,$30,$2E,$2D,$2C,$2A,$29,$28,$27,$26,$25,$24,$23,$22
|
||||
.byte $A6,$97,$8A,$80,$76,$6E,$68,$61,$5C,$57,$53,$4F,$4B,$48,$45,$42
|
||||
.byte $40,$3D,$3B,$39,$37,$35,$34,$32,$30,$2F,$2E,$2C,$2B,$2A,$29,$28
|
||||
|
||||
|
||||
|
||||
grass_string:
|
||||
.asciiz "NEED TO LAND ON GRASS!"
|
||||
|
@ -94,6 +94,7 @@ LAST_SPACEX_I EQU $87
|
||||
LAST_SPACEY_I EQU $88
|
||||
LAST_MAP_COLOR EQU $89
|
||||
DRAW_SKY EQU $8A
|
||||
COLOR_MASK EQU $8B
|
||||
|
||||
SHIPY EQU $E4
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user