[stella] Problems with PCAE?

Subject: [stella] Problems with PCAE?
From: KirkIsrael@xxxxxxxxxxxxx
Date: 6 Jul 2002 00:44:30 -0000
Couple of things...
First off, I've given JoustPong its own webpage,
http://alienbill.com/joustpong/ ...hopefully it will be
a boon to getting my butt in gear and staying on target.
Thanks to Joe Grand for the general appearance idea,
though I can't decide if I should do a typical reverse-date
blog format or keep it in chronological order.

Here's my latest code...a happy face that flaps around 
a bit in a joustlike manner...seems to be very badly
broken under PCAE...am I doing something weird to make
PCAEWin all cranky?
--snip--
; yet another moving dot by Kirk Israel
	
	processor 6502
	include vcs.h
	org $F000



YPosFromBot = $80;
VisiblePlayerLine = $81;
PlayerBuffer = $82;
PlayerVertSpeed = $83;
ButtonOnLast = $84
Temp = $85

GravTimer = $86;



;CONSTANTS
FlapStrength = #5;
GravDelay = #5	;How often does gravity pull 'em down?
MaximumSpeed = #6 

;generic start up stuff...
Start
	SEI	
	CLD  	
	TXS	
	LDX #$FF	
	LDA #0		
ClearMem 
	STA 0,X		
	DEX		
	BNE ClearMem	
	LDA #$00		
	STA COLUBK	
	LDA #33
	STA COLUP0




;Some other initialization
	LDA #80
	STA YPosFromBot	;Initial Y Position
	LDA #0
	STA PlayerVertSpeed
	LDA GravDelay
	STA GravTimer


;VSYNC time
MainLoop
	LDA  #2
	STA  VSYNC	
	STA  WSYNC	
	STA  WSYNC 	
	STA  WSYNC	
	LDA  #43	
	STA  TIM64T	
	LDA #0		
	STA  VSYNC 	



CheckButton
	LDA INPT4
	BMI NoButton

	;Check to see if the button was already down
	LDA ButtonOnLast
	BNE ButtonWasAlreadyDown

	;New Button Pressed Time to Flap!
	LDA PlayerVertSpeed
	SEC
	SBC FlapStrength
	STA PlayerVertSpeed
	
	LDA #1
	STA ButtonOnLast
ButtonWasAlreadyDown
	JMP EndButton
NoButton	;button wasn't pressed, remember that
	LDA #0
	STA ButtonOnLast
EndButton



;Time to Add Gravity to Speed?

	DEC GravTimer
	BNE DoneWithGravity

	INC PlayerVertSpeed
	LDA GravDelay
	STA GravTimer
DoneWithGravity

;See if we're going too darn fast
	LDA PlayerVertSpeed
	SEC
	SBC MaximumSpeed ; Maximum Speed

	BMI SpeedNotMaxxed ;if speed - maxspeed is positive, we need to slow down
	LDA MaximumSpeed
	STA PlayerVertSpeed

SpeedNotMaxxed







;Subtract the Player's Speed from the Position
;Add the negative of the Player Vert Speed to 0 in A
	LDA #0
	SEC
	SBC PlayerVertSpeed
;Then add the current position
	CLC
	ADC YPosFromBot
	STA YPosFromBot


FinishPositioning






;check if player hit floor
	LDA #10
	CLC
	CMP YPosFromBot
	BCC DoneCheckingHitFloor
;we need a better bounce routine, like reducing the speed?
	LDA #-4; 
	STA PlayerVertSpeed
	LDA #10
	STA YPosFromBot



DoneCheckingHitFloor



;check if player hit ceiling
	LDA #180
	CMP YPosFromBot
	BCS DoneCheckingHitCeiling

;we need a better bounce routine, like reducing the speed?
	LDA #2; 
	STA PlayerVertSpeed

	LDA #180
	STA YPosFromBot





DoneCheckingHitCeiling




;assum horiz movement will be zero
	LDX #$00	
	LDA #$40	;Left?
	BIT SWCHA 
	BNE SkipMoveLeft
	LDX #$10	
	LDA %00001000
	STA REFP0
SkipMoveLeft

	LDA #$80	;Right?
	BIT SWCHA 
	BNE SkipMoveRight
	LDX #$F0	
	LDA %00000000
	STA REFP0
SkipMoveRight

	STX HMP0	;set horiz movement for player 0

WaitForVblankEnd
	LDA INTIM	
	BNE WaitForVblankEnd	
	LDY #191 	

	STA VBLANK  	

	STA WSYNC	
	STA HMOVE 	

;main scanline loop...
ScanLoop 
	STA WSYNC 	

; here the idea is that VisiblePlayerLine
; is zero if the line isn't being drawn now,
; otherwise it's however many lines we have to go
	LDA PlayerBuffer
	STA GRP0

CheckActivatePlayer
	CPY YPosFromBot
	BNE SkipActivatePlayer
	LDA #8
	STA VisiblePlayerLine 

SkipActivatePlayer

;turn player off then see if it should be on
	LDA #00		

;
;if the VisiblePlayerLine is non zero,
;we're drawing it
;
	LDX VisiblePlayerLine 
	BEQ FinishPlayer
IsPlayerOn	
	LDA BigHeadGraphic-1,X
	DEC VisiblePlayerLine 
FinishPlayer
	STA PlayerBuffer

	DEY		
	BNE ScanLoop	

	LDA #2		
	STA WSYNC  	
	STA VBLANK 	
	LDX #30		
OverScanWait
	STA WSYNC
	DEX
	BNE OverScanWait
	JMP MainLoop      
 
	org $FF00
BigHeadGraphic
	.byte %00111100
	.byte %01111110
	.byte %11000001
	.byte %10111111
	.byte %11111111
	.byte %11101011
	.byte %01111110
	.byte %00111100

	org $FFFC
	.word Start
	.word Start


--snip--


-- 
KirkIsrael@xxxxxxxxxxxxx    http://kisrael.com
"If you feel it, but it isn't right, don't do it and don't 
 believe it. We can be better than natural -- we're human."--Penn Jillette

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


Current Thread