Re: [stella] An exercise in minimalism...

Subject: Re: [stella] An exercise in minimalism...
From: Erik Mooney <emooney@xxxxxxxxxxxxxxxx>
Date: Wed, 01 Sep 1999 23:58:11 -0400
>Anyone have ideas for making it smaller?

>;Initialise
>
>	SEI  		;1 ; Disable interrupts.  This may be removeable.
>	CLD  		;1 ; Clear BCD math bit.  Removeable?  depends if
>			;inc&dec are affected.

INC and DEC are not affected by BCD (if I'm wrong I'll get corrected I'm
sure), so you can remove the CLD.  The SEI should be removable too... even
if interrupts aren't disabled, there's no mechanism to generate an
interrupt on the 2600 anyway.

>;need to clear out the player and playfield graphics regs as well as 
>;turn off the missles and ball.  I think this loop is smaller than 
>;doing each of those individually.
>
>	LDY #$FF	;2
>	LDX #0		;2
>B1      STX 0,Y		;2
>	DEY		;1
>	BNE B1		;2

You could change the first two lines of this to LDX #0 and TXY to save one
byte.  It'll still work.

>I also couldn't come up with a way to use the timer to save more bytes(it
>isn't used at all right now.), but there has to be a way to use it
>efficiently...

Not really...

>	LDY #34		;2
>	STY VBLANK	;2
>			;yes, I loose a scan line(it is blanked), but
>			;by doing this trick, I've removed 3 bytes!!!!
>	DEY		;1
>KillLines
>	STY WSYNC	;2
>	DEY		;1
>	BNE KillLines	;2

LDA #37 ;2
STA VBLANK  ;2
STA TIM64T   ;2
KillTime: LDA TIM64T  ;2
BNE KillTime  ;2

Hmm, that didn't actually save any bytes...

You could remove that first DEY actually.. it'll still display a coherent
picture, just one scanline further down on the TV.

>VerticalBlank
>	LDY #38		;2 ;Y now is %00100110(1 in bit1)
>	STY  WSYNC	;2
>vsync
>	STY VSYNC	;2
>	STY  WSYNC 	;2
>	STY  WSYNC 	;2
>	DEY		;1 ;Y now is %00100101 (37)
>	STY  WSYNC 	;2
>	STY VSYNC	;2 ;0 in bit 1, turns off VSYNC
>	INY		;1 ;Y is now 38

Instead of doing all these DEY/INY gymnastics, why not just keep the
accumulator loaded with 0 (or 2, whatever you need to be the opposite of
Y) and store it when necessary?

>vbloop	
>	STY WSYNC	;2
>	DEY		;1
>	BNE vbloop	;2 ;Y is now 0
>	STY VBLANK	;2  ; 0 turns off VBLANK
>
>	LDY #191 	;2
>	LDX backcolor	;2
>	INC backcolor	;2
>
>ScanLoop
>	STX WSYNC	;2
>	INX		;1
>	STX COLUBK	;2
>	DEY		;1
>	BNE ScanLoop	;2
>
>	BEQ top		;2
>
>	org $FFFC	;4k
>	.word Start	;2


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

Current Thread