I loaded Planet Builder on my Kroc Cart and the starfield does not have the smooth movement that I want. Not sure where the problem is. Here is my Main Screen kernal where I call the subroutine DrawStars. I use LDA StarTable,Y to turn off and on idividual stars. Any insight into this problem would be appreciated. I'm using FILL_NOPs at Line 777 to pad the code
And here is the Draws Stars Subroutine
New11_16_08a.zip (25.73K)
downloads: 130
MainScreen SUBROUTINE
JSR SixDigitDisplay
;Ship Movement
;--SwitchDraw
; TopLine == top line of sprite
; BottomLine == bottom line of sprite ORed with $80
; requires scanline counter < $80 (i.e., 128 lines, though you
; can get around this by interlacing your graphics)
LDY Mineral_Truck
; Calculate SwitchDraw Variables
SEC
LDA Ship_YPos
STA PSWITCH
SBC #C_SHIP_HEIGHT
STA PEND
; Subtract Height For SwitchDraw Routine
LDA #<Sprite_Data0
SBC PEND
STA Ship_Ptr
LDA Truck_Tab,Y
SBC PEND
STA Ship_Ptr+2
;Continue to Calculate SwitchDraw Variables
LDA PEND
ORA #%10000000
STA PEND
LDX #0
LDA Ship_XPos
JSR bzoneRepos
STX PF0 ;prevents artifact after (Restore black border..)
sleep 10
SEC
LDA Ship_ColorPtr
SBC Ship_YPos
CLC
ADC #C_SHIP_HEIGHT-#1
STA Ship_ColorPtr
STA WSYNC
STA HMCLR
LDX #1
SEC
LDA Ship_XPos
CMP #12
BCS NoAdjust
ADC #161
NoAdjust
SBC #8
JSR bzoneRepos
STA WSYNC
STA HMCLR
JSR DrawStars
LDA #QUAD_SIZE_MISSILE
STA NUSIZ0
LDA #SILVER ;Ball(meteor)is color of playfield
STA COLUPF
TSX ; Transfer stack pointer to X
STX SavedStackPointer ; Store it in RAM
LDX #ENABL
TXS
;---------------------------------------------------------------------------------------------------
;Top Kernal
;Begin Ship draw loop
;LDY #C_KERNAL_HEIGHT +#C_SHIP_HEIGHT - #1;
LDY #127 ;was 151 (Switchdraw maximum height is 127)
STA WSYNC ;0
;---------------------------------------------------------------------------------------------------
ShipLoop
; Draw Sprite (SwitchDraw)
CPY PSWITCH ; 3 = 3
BPL PSwitch ; 2/3 = 5
LDA (Ship_Ptr),Y ; 5 = 10
STA GRP0 ; 3 = 13
LDA (Ship_Ptr+2),Y ; 5 = 18
STA GRP1 ; 3 = 21 writes must be finished before cycle 22 to avoid tearing
PContinue
;Color for Ship loaded below
STY COLUP1 ; 3 = 24
;Color for Ship loaded below
STX COLUP0 ; 3 = 27
;Draw Truck = 27
;---------------------------------------------------------------------------------------------------
;DrawMissile
TYA ; 2 = 2 assuming y contains the scanline
SBC Missile_YPos ; 3 = 5 carry must be 1 (else use DCP)
ADC #C_MISSILE_LENGTH ; 2 = 7
LDA #2 ; 2 = 9
ADC #$FF ; 2 = 11 carry is always set!
STA ENAM0 ; 3 = 14 bit 1 depends on the carry after ADC
;EndMissileLoop
;Draw Stars
;Y Has Scanline 127
LDA StarTable,Y ;5 = 19
STA ENAM1 ;3 = 22 waste a cycle
;Drawing Missiles =22
;---------------------------------------------------------------------------------------------------
;DrawMeteor
CPY Meteor_YPos ;3 Assumes Y is your kernal line counter
PHP ;2
LDX #ENABL ;2
TXS ;2
;EndMeteorLoop
;Drawing Meteors =9
;---------------------------------------------------------------------------------------------------
;27+22+9=58
;Load Color for RCV
LDA (Ship_ColorPtr),Y ;5 = 63
TAX ;2 = 65
NOP ;2 = 67
NOP ;2 = 69
DEY ;2 = 71
CPY #48 ;2 = 73
BCS ShipLoop ;3 = 74
;---------------------------------------------------------------------------------------------------
; SwitchDraw Routines
PSwitch ; 6
bne PWait ; 2/3 = 8
LDA PEND ; 3 = 11
STA PSWITCH ; 3 = 14
SLEEP 4 ; 4 = 18
bcs PContinue ; 3 = 21
PWait ; 9
STA HMCLR ; 3 = 12
SLEEP 6 ; 6 = 18
BPL PContinue ; 3 = 21
EndShipLoop
if (>ShipLoop != >EndShipLoop)
echo "WARNING WARNING WARNING WARNING: ShipLoop Kernel crosses a page boundary!"
endif
;---------------------------------------------------------------------------------------------------
LDA THREE_MED_COPIES ;three buildings
STA NUSIZ1 ;place here to minimize vertical missile stretch
LDX SavedStackPointer
TXS
And here is the Draws Stars Subroutine
DrawStars SUBROUTINE LDA Star_XPos LDX #3 JSR bzoneRepos STA WSYNC STA HMCLR LDA #$70 ;this value is important for the effect STA HMM1 STA WSYNC STA HMOVE SLEEP 16 LDA #$60 STA HMM1 ;this is the tricky part RTS
New11_16_08a.zip (25.73K)
downloads: 130



Create a custom theme







