From 1bb8491f687a9e52574c9e0804e40d828e7494c9 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 26 Nov 2017 18:27:58 -0500 Subject: [PATCH] tfv: make the speed handling more similar on the two versions --- gr-sim/tfv_flying_6502.c | 14 +++++++------- tfv/tfv_flying.s | 14 ++++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gr-sim/tfv_flying_6502.c b/gr-sim/tfv_flying_6502.c index b48e2ff2..1af5b2c8 100644 --- a/gr-sim/tfv_flying_6502.c +++ b/gr-sim/tfv_flying_6502.c @@ -132,8 +132,7 @@ static int lookup_map(int xx, int yy) { offset=yy<<3; offset+=xx; - - cycles.lookup_map+=34; + cycles.lookup_map+=37; if ((yy>7) || (xx>7)) { cycles.lookup_map+=14; @@ -938,7 +937,7 @@ int flying(void) { ram[TURNING]=0; } else { - ram[TURNING]=235; // -20 + ram[TURNING]=250; // -5 ram[ANGLE]-=1; if (ram[ANGLE]<0) ram[ANGLE]+=ANGLE_STEPS; @@ -950,7 +949,7 @@ int flying(void) { ram[TURNING]=0; } else { - ram[TURNING]=20; + ram[TURNING]=5; ram[ANGLE]+=1; if (ram[ANGLE]>=ANGLE_STEPS) ram[ANGLE]-=ANGLE_STEPS; } @@ -959,7 +958,7 @@ int flying(void) { cycles.flying+=5; /* Used to be able to go backwards */ if (ch=='z') { - if (ram[SPEED]<3) ram[SPEED]++; + if (ram[SPEED]<4) ram[SPEED]++; } cycles.flying+=5; if (ch=='x') { @@ -1099,7 +1098,7 @@ int flying(void) { cycles.flying+=9; iterations++; - if (iterations==100) { + if (iterations==20) { int total_cycles; total_cycles=cycles.flying+cycles.getkey+ cycles.page_flip+cycles.multiply+ @@ -1118,7 +1117,8 @@ int flying(void) { iterations=0; } - usleep(20000); + /* Limit to around 10 fps */ + usleep(100000); } return 0; diff --git a/tfv/tfv_flying.s b/tfv/tfv_flying.s index b6ac33be..e885fc5b 100644 --- a/tfv/tfv_flying.s +++ b/tfv/tfv_flying.s @@ -4,7 +4,8 @@ CONST_SHIPX EQU 15 CONST_TILE_W EQU 64 CONST_TILE_H EQU 64 -CONST_MAP_MASK EQU (CONST_TILE_W - 1) +CONST_MAP_MASK_X EQU (CONST_TILE_W - 1) +CONST_MAP_MASK_Y EQU (CONST_TILE_H - 1) CONST_LOWRES_W EQU 40 CONST_LOWRES_H EQU 40 CONST_BETA_I EQU $ff @@ -159,7 +160,7 @@ check_speedup: ;========= ; SPEED UP ;========= - lda #$3 + lda #$8 cmp SPEED beq check_speeddown inc SPEED @@ -1019,20 +1020,21 @@ lookup_map: lda SPACEX_I ; 3 ;nomatch2: sta LAST_SPACEX_I ; 3 - and #CONST_MAP_MASK ; 2 - sta TEMPY ; 3 + and #CONST_MAP_MASK_X ; 2 + sta SPACEX_I ; 3 tay ; 2 lda SPACEY_I ; 3 sta LAST_SPACEY_I ; 3 - and #CONST_MAP_MASK ; wrap to 64x64 grid ; 2 + and #CONST_MAP_MASK_Y ; wrap to 64x64 grid ; 2 + sta SPACEY_I asl ; 2 asl ; 2 asl ; multiply by 8 ; 2 clc ; 2 - adc TEMPY ; add in X value ; 3 + adc SPACEX_I ; add in X value ; 3 ; only valid if x<8 and y<8 ; SPACEX_I is in y