tfv: some more multiplaction result arranging

This commit is contained in:
Vince Weaver 2017-11-30 01:02:45 -05:00
parent 91706259a7
commit e37caf6624
3 changed files with 39 additions and 37 deletions

View File

@ -783,12 +783,12 @@ static void draw_background_mode7(void) {
fixed_mul(CONST_LOWRES_HALF_I,CONST_LOWRES_HALF_F,
ram[DX_I],ram[DX_F],
&ram[TEMP_I],&ram[TEMP_F],0);
cycles.mode7+=40;
cycles.mode7+=38;
fixed_add(ram[SPACEX_I],ram[SPACEX_F],
ram[TEMP_I],ram[TEMP_F],
&ram[SPACEX_I],&ram[SPACEX_F]);
cycles.mode7+=20;
cycles.mode7+=16;
if (!displayed) {
printf("SPACEX! %x:%x\n",
ram[SPACEX_I],ram[SPACEX_F]);
@ -802,13 +802,14 @@ static void draw_background_mode7(void) {
fixed_add(ram[SPACEY_I],ram[SPACEY_F],
ram[TEMP_I],ram[TEMP_F],
&ram[SPACEY_I],&ram[SPACEY_F]);
cycles.mode7+=22;
cycles.mode7+=16;
if (!displayed) {
printf("SPACEY! %x:%x\n",ram[SPACEY_I],ram[SPACEY_F]);
}
// go through all points in this screen line
ram[SCREEN_X] = 0;
ram[SCREEN_X] = LOWRES_W;
cycles.mode7+=2;
while(1) {
// get a pixel from the tile and put it on the screen
@ -842,8 +843,8 @@ match:
ram[DY_I],ram[DY_F],
&ram[SPACEY_I],&ram[SPACEY_F]);
ram[SCREEN_X]++;
if (ram[SCREEN_X] >= LOWRES_W) break;
ram[SCREEN_X]--;
if (ram[SCREEN_X]== 0) break;
cycles.mode7+=41;

View File

@ -218,12 +218,13 @@ This looks like a pessimization, but it's because the cycle counting code
Cycles: getkey= 46
Cycles: page_flip= 26
Cycles: multiply= 40,680
Cycles: mode7= 115,470
Cycles: mode7= 115,150
Cycles: lookup_map= 22,747
Cycles: put_sprite= 2,561
================================
Total = 181,717
Frame Rate = 5.50 fps
Total = 181,397
Frame Rate = 5.51 fps
Each cycle removed from inner X loop saves

View File

@ -885,10 +885,10 @@ spacez_shifted:
;==========
; 16
; mul7
; fixed_mul(&temp,&dx,&temp);
lda #CONST_LOWRES_HALF_I ; 3
; fixed_mul(&lowres_half,&dx,&temp);
lda #CONST_LOWRES_HALF_I ; 2
sta NUM1H ; 3
lda #CONST_LOWRES_HALF_F ; 3
lda #CONST_LOWRES_HALF_F ; 2
sta NUM1L ; 3
lda DX_I ; 3
sta NUM2H ; 3
@ -896,26 +896,24 @@ spacez_shifted:
lda DX_F ; 3
sta dxf_label+1 ; for self modify ; 4
sta NUM2L ; 3
sec ; 2
sec ; don't reuse previous num1 ; 2
jsr multiply ; 6
; stx TEMP_I ;
; sta TEMP_F ;
; TEMP_I in X ;
; TEMP_F in A ;
;==========
; 40
; 38
clc ; fixed_add(&space_x,&temp,&space_x); ; 2
lda SPACEX_F ; 3
; adc TEMP_F ;
adc RESULT+1 ; 3
; fixed_add(&space_x,&temp,&space_x);
clc ; 2
; TEMP_F in A
adc SPACEX_F ; 3
sta SPACEX_F ; 3
lda SPACEX_I ; 3
; adc TEMP_I ;
adc RESULT+2 ; 3
txa ; TEMP_I in X ; 2
adc SPACEX_I ; 3
sta SPACEX_I ; 3
;==========
; 20
; 16
;mul8
; fixed_mul(&fixed_temp,&dy,&fixed_temp);
@ -925,28 +923,30 @@ spacez_shifted:
lda DY_F ; 3
sta NUM2L ; 3
sta dyf_label+1 ; for self modify ; 4
clc ; reuse LOWRES_HALF_I from last time ; 2
clc ; reuse CONST_LOWRES_HALF from last time ; 2
jsr multiply ; 6
; stx TEMP_I ;
; sta TEMP_F ;
; TEMP_I in X
; TEMP_F in A
;==========
; 28
clc ; fixed_add(&space_y,&temp,&space_y); ; 2
lda SPACEY_F ; 3
; adc TEMP_F ;
adc RESULT+1 ; 3
; fixed_add(&space_y,&temp,&space_y);
clc ; 2
; TEMP_F in A
adc SPACEY_F ; 3
sta SPACEY_F ; 3
lda SPACEY_I ; 3
; adc TEMP_I ;
adc RESULT+2 ; 3
txa ; TEMP_I in X ; 2
adc SPACEY_I ; 3
sta SPACEY_I ; 3
; brk ; space_y = f7:04
;==========
; 16
ldx #40 ; was SCREEN_X ; 2
;==========
; 22
; 2
screenx_loop: