Jump to content

TROGBlog

  • entries
    47
  • comments
    219
  • views
    125,202

Stellar Fortress v0.10


Guest

1,308 views

Hi all,I haven't posted in a while, but I've been busy coding. I spent about 12 hours over the past week tweaking the hell out of the kernel. Version .09 was a sanity revision that still needed cleanup. Version .10 is a cleaned up demo of the new kernel.sf101wm.pnglynxflyer199112html.zipNew Features:- The kernel is now 2-scanlines per pass. But it can still do high-resolution (single scanline) graphics for both player sprites, plus it handles both player missles, the asymetric playfield shield, and a variable height and width ball.Here's the kernel. Comments and suggestions are welcome.

TheKernel	TSX  ;Careful!  Need to initialize stack hack here.	STX Temp3;Preserve the stack.	LDX #ENAM1;ENABL is set manually.	TXS	LDX #95	LDA #0	STA Temp1	STA Temp2	JMP KernelLoop	align 256SkipShipDraw	LDA Temp1;3 (+1 from previous branch.)	STA Temp4;3	BEQ ContinueKernel;3 Block = 10 cycles.ClearBall	LDA Temp1;3 (+1 for branch) Careful!  Temp1 = 0.	BEQ ContinueBall;3 Block = 7 cycles.KernelLoop	STA WSYNC;3 This can be removed if more time is needed.	STA GRP0;3; Draw the first missile	CPX MissleY;3	PHP  ;3 sets ENAM1, Block = 6 cycles. <9th cycle>; Draw the left side of the shield.	LDY ShieldIndex,X;4	LDA LShield,Y;4	STA PF2  ;3	STA Temp5;3 Save for next scanline.  Block = 14 cycles.; Draw the cannon.	LDY CannonIndex,X;4	LDA (CannonGfxLoa),Y;5	STA GRP1;3 Block = 12 cycles. <35th cycle>; Draw the right side of the shield.	LDY ShieldIndex,X;4	LDA RShield,Y;4	SEC  ;2 <45th cycle>  Refresh PF2 now.	STA PF2  ;3	STA Temp6;3 Save for next scanline. <51st cycle>; Determine player graphics for next line.;	SEC  ;2 Careful!  Already did this above.	TXA  ;2 A now holds scanline.	SBC ShipPosYHi;3	ADC #ShipHeight;2	BCC SkipShipDraw;2 or 3 <60th cycle>	TAY  ;2	LDA (ShipGfxLoa),Y;5	STY Temp4;3 This holds the player graphics Y index for the next line.  ;  <70th cycle>ContinueKernel; Get ready to draw the FBomb.	CPX.w FBombY;4	NOP  ;2 <76th cycle>; Next scanline starts here.	PHP  ;3 sets ENAM0.	STA GRP0;3; Draw the variable-height Ball.	CPX BallEnd;3	BCS ClearBall;2 or 3	CPX BallStart;3	ROL  ;2	ROL  ;2ContinueBall	STA ENABL;3 Block = 15 cycles.  <21st cycle>; Draw the left side of the shield.	LDA Temp5;3	STA PF2  ;3 Block = 6 cycles. <27th cycle>; Draw the cannon.	LDY CannonIndex,X;4	LDA (CannonGfxLob),Y;5	STA GRP1;3 Block = 12 cycles. <39th cycle>; Draw the right side of the shield.	LDA.w Temp6;4 <43rd cycle>	NOP  ;2 <45th cycle>	STA PF2  ;3; Reset the stack	TXA  ;2	LDX #ENAM1;2	TXS  ;2	TAX  ;2 Block = 11 cycles. <56th cycle>; Prepare the next player graphics	LDY Temp4;3 Load in the stored GRP0 graphics.	LDA (ShipGfxLob),Y;5	DEX  ;2 <66th cycle>	BPL KernelLoop;2 or 3 <72 cycles including the WSYNC at the top.>

5 Comments


Recommended Comments

For a variable-height ball (or missile), maybe use this code:

   lda BallHeight
  dcp BallTemp
  sbc BallAdjuster
  sta ENABL          ;+14

Where:

BallTemp = Height of screen - Top line of ball

BallAdjuster = BallTemp - 2

 

There are a lot of possible variations there...

if BallHeight is fixed:

   lda #BALLHEIGHT
  dcp BallTemp
  sbc #BALLHEIGHT-2
  sta ENABL       ;+12

If BallHeight is variable, but you can restrict it to...umm, let's see if I can remember how this works...if you can restrict it to the form C + 4x, where C is a constant, then you can use this code:

   lda BallHeight
  dcp BallTemp
  sbc #BALLADJUSTER
  sta ENABL     ;+13

Where BALLADJUSTER = the constant C plus 2.

That gives you 4 options:

Ball height could be 1, 5, 9, 13, etc. BALLADJUSTER would be 3.

Ball height could be 2, 6, 10, 14, etc. BALLADJUSTER would be 4 (or zero).

Ball height could be 3, 7, 11, 15, etc. BALLADJUSTER would be 1.

Ball height could be 4, 8, 12, 16, etc. BALLADJUSTER would be 2.

 

If I remember correctly, though, the actual displayed height of the ball will be BallHeight - 1. So for a ball a single scanline high, use a height of zero.

Link to comment

This is coming along very nicely!

 

A suggestion - would it make the game look more "Star Castley" to color cycle the shields between yellow and red?

 

Like so:

 

stellarfort.gif

 

Although I suppose to really mimic the original... space would need that "blue overlay" look:

 

stellarfort_b.gif

 

Hmmm. Nah. Black looks better.

Link to comment
Next time use
...

please. ;)

 

Thomas, I'm still kinda noobish with the forum interface, so I'm not sure what you mean here. I used the code tags. Is there a way to make the code section collapsable/expandable?

 

vdbu_bobby, thanks for the suggestions. I tend to avoid illegal opcodes unless I really need the cycles. Currently the kernel does everything I need it to, so I don't plan to cram anything more in unless there's a way I can shave off a ton of cycles (a ton being 5 or more.)

 

Nathan, nice suggestion. I may take you up on that. Keep in mind that I'm not trying to do an exact port of the game, for copyright reasons. This literally is "an artistic reinterpretation." I already have some plans to deviate from the original game. Specifically, a slight retooling of the kernel will allow me to add enemy attack ships in the upper and lower empty space of the screen. These ships will show up occasionally on harder levels, similar to the random ships in asteroids.

 

I may also make a "classic" option in the game, which will match the original game as closely as possible, and then all the other options will have my own added features like the enemy ships, variations in the number of interceptor missles, different shield ring configurations, etc. Also, on harder levels, the rings will slowly regenerate, differing from the full regeneration if a ring is totally destroyed.

Link to comment
Thomas, I'm still kinda noobish with the forum interface, so I'm not sure what you mean here.  I used the code tags.

My problem is, that the formatting got completely lost, making it hard to read the code. AFAIK you need to replace any tabs with spaces before posting and you have to add an extra space when indenting.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...