[stella] Timing correction

Subject: [stella] Timing correction
From: Glenn Saunders <cybpunks2@xxxxxxxxxxxxx>
Date: Sat, 10 Nov 2001 15:34:35 -0800
Thomas,

According to my calculations, I'm getting a constant 30 cycle timing on your missile code. I had to remove a couple NOPs and add another one.

Does the timing look right on this?

; START MISSILE ROUTINE

; MISSILE LOGIC

; tya ; +2 2

;    you might be able
;    to avoid this
;    sec		; +2   	4

;    sbc M0_Y      	; +3	7
;    beq .enable    	; +2³	9/10


; adc #PedHeight ; +2 11 ; bcc .disable ; +2³ 13/14 ; /MISSILE LOGIC (13 CYCLES NO BRANCHING)


; STORE THE MISSILE


;  bytes stored
; as: mmmmww00 (m = motion, w = width)

;    lda (MissileCurrentFramePtr),y; +5	18
;    sta HMM0       	; +3	21
;    asl            	; +2	23
;    asl		; +2	25
;    sta NUSIZ0		; +3	28

; NEEDED FOR CONSTANT TIMING
;    NOP		' +2	30
; /STORE THE MISSILE (17 CYCLES)

;TAKES CONSTANT 30 CYCLES REGARDLESS OF BRANCHES TAKEN
;.continue:            ;


; this code should be positioned outside the main kernel



; STORE THE MISSILE2


;.enable:              ; 	14
;bytes stored
; as: mmmmss00
;    lda    (ptr),y    ; +5	19
;    sta    HMMx       ; +3	22
;    lda    #2         ; +2	24
;    sta    ENAMx      ; +3	27
;    bne    .continue  ; +3	30
; /STORE THE MISSILE2	;16 CYCLES TOTAL (30 for entire routine)

; CLEAR THE MISSILE

;.disable:             	;	18
;    lda    #0         	; +2	20
;    sta  ENAMx		; +3	23
;keep carry state
;constant
;    sec               	; +2   	25
;waste 2 cycles for
;constant timing
;    nop               	; +2   	27
;    bcs    .continue  	; +3	30
; /CLEAR THE MISSILE	;12 CYCLES TOTAL (30 for entire routine)




---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/


Current Thread