Re: [stella] M-4 port

Subject: Re: [stella] M-4 port
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Wed, 4 May 2005 17:19:00 -0400
Bob Montgomery wrote:
> Any suggestions/comments are welcome.  I hope to cram this down
> into 1K eventually, so optimization tips are extra-appreciated!

old:
  lda Counter
  and #1
  bne NoMissileLMove
  
new:
  lda Counter
  lsr
  bcs NoMissileLMove
-------------------------------------------
old:
  lda SWCHB
  and #%00001000
  bne ColorObjects
;--else black and white objects and background
  sta GroundColor         ;black
  lda #WHITE
  sta CarAirplaneColor
  sta COLUPF
  sta TankColor
  jmp DoneSettingColors
ColorObjects
  lda #CACOLOR            ;--set car/airplane color
  sta CarAirplaneColor
  lda #TANKCOLOR          ;--set tank colors
  sta TankColor
  lda #FIELDCOLOR         ;--set ground color
  sta GroundColor
  lda #WALLCOLOR          ;--set wall color
  sta COLUPF
DoneSettingColors

new:
  lda SWCHB
  and #%00001000
  bne ColorObjects
;--else black and white objects and background
  sta GroundColor         ;black
  lda #WHITE
  tax
  tay
  bne DoneSettingColors
ColorObjects
  lda #FIELDCOLOR         ;--set ground color
  sta GroundColor
  ldx #CACOLOR            ;--set car/airplane color
  ldy #TANKCOLOR          ;--set tank colors
  lda #WALLCOLOR          ;--set wall color
DoneSettingColors
  stx CarAirplaneColor
  sty TankColor
  sta COLUPF
-------------------------------------------
old:
  lda #<TankLDataa
  sec
  sbc TankLY
  clc
  adc #TANKHEIGHT
  sta TankLPtra

new:
  lda #<TankLDataa
  clc
  adc #TANKHEIGHT+1
  sbc TankLY        ; carry is always clear!
  sta TankLPtra

But since you use this code so much, how about a subroutine?
-------------------------------------------
old:
  ldx #0
  lda #44
  jsr PositionASpriteSubroutine
  ldx #1

old:
  ldx #0
  lda #44
  jsr PositionASpriteSubroutine
  inx

Or you could just use a table and then loop.
-------------------------------------------

More if wanted.

Have fun!
Thomas                            
_______________________________________________________
Thomas Jentzsch         | *** Every bit is sacred ! ***
tjentzsch at web dot de |

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

Current Thread