tfv: was forgetting to multiply angle by 2 before using sin table

This commit is contained in:
Vince Weaver 2017-09-10 16:52:56 -04:00
parent 6f2fe7e194
commit 65a5ac8aa9

View File

@ -233,17 +233,6 @@ sky_loop: ; draw line across screen
;; SPACEZ=78 * ff80 = FACTOR=66 ;; SPACEZ=78 * ff80 = FACTOR=66
;; 4 80 * ff 80 = 83 81
;; 4 80 * 00 00 = fc 83 81 40
;; 4 80 * ffffffff 80 = fffffffd c0
;; spacez*beta=factor
;; 00 40 02 00
;; 00000000 01000000 00000010 00000000
;; 11111111 10111111 11111110 00000000
;; ff Bf fe 00
;; C ;; C
;; GOOD 4 80 * ffffffff 80 = fffffffd c0 ;; GOOD 4 80 * ffffffff 80 = fffffffd c0
;; BAD 4 80 * ffffffff 80 = 42 40 ;; BAD 4 80 * ffffffff 80 = 42 40
@ -279,6 +268,7 @@ screeny_loop:
lda horizontal_lookup,Y lda horizontal_lookup,Y
sta HORIZ_SCALE_F sta HORIZ_SCALE_F
;; brk ASM, horiz_scale = 00:73
; calculate the distance of the line we are drawing ; calculate the distance of the line we are drawing
; fixed_mul(&horizontal_scale,&scale,&distance); ; fixed_mul(&horizontal_scale,&scale,&distance);
@ -296,6 +286,8 @@ screeny_loop:
lda RESULT+1 lda RESULT+1
sta DISTANCE_F sta DISTANCE_F
;; brk ASM, distance = 08:fc
; calculate the dx and dy of points in space when we step ; calculate the dx and dy of points in space when we step
; through all points on this line ; through all points on this line
@ -303,6 +295,7 @@ screeny_loop:
clc clc
adc #8 adc #8
and #$f and #$f
asl
tay tay
lda fixed_sin,Y lda fixed_sin,Y
sta DX_I sta DX_I
@ -310,6 +303,9 @@ screeny_loop:
lda fixed_sin,Y lda fixed_sin,Y
sta DX_F sta DX_F
;; ANGLE
;; brk ASM, dx = 00:00
; fixed_mul(&dx,&horizontal_scale,&dx); ; fixed_mul(&dx,&horizontal_scale,&dx);
lda HORIZ_SCALE_I lda HORIZ_SCALE_I
sta NUM1H sta NUM1H
@ -330,6 +326,7 @@ screeny_loop:
clc clc
adc #4 adc #4
and #$f and #$f
asl
tay tay
lda fixed_sin,Y lda fixed_sin,Y
sta DY_I sta DY_I
@ -369,6 +366,7 @@ screeny_loop:
clc clc
adc #4 adc #4
and #$f and #$f
asl
tay tay
lda fixed_sin,Y lda fixed_sin,Y
sta TEMP_I sta TEMP_I
@ -431,6 +429,7 @@ screeny_loop:
lda ANGLE ; fixed_temp.i=fixed_sin[angle&0xf].i; lda ANGLE ; fixed_temp.i=fixed_sin[angle&0xf].i;
and #$f and #$f
asl
tay tay
lda fixed_sin,Y lda fixed_sin,Y
sta TEMP_I sta TEMP_I