Re: [stella] Bounce! demo

Subject: Re: [stella] Bounce! demo
From: Dennis Debro <ddebro@xxxxxxxxxxxxx>
Date: Mon, 28 Jul 2003 12:47:51 -0400
Hi Fab,

> So, as usual, I'd really love comments on all aspects of the game..
> playability, optimizations, improvements, etc.! :)

I took this opportunity to practice my "Kung Fu". Here are a few areas that would save a couple of bytes...

- You can remove the SEI instruction. It's not needed (saves 1 byte)
- Using Andrew Davie's clear routine will save you 2 bytes
- You can remove the JMP routines in your MainLoop and just place those routines in the main loop. It may not flow the best as far as readability but will save you ~15 bytes.
- In WaitINTIM if you do...
.waitTimer
  ldx INTIM
  bne .waitTimer
  rts
then x will be 0 when you do VerticalBlank so there would be no need to load it and that would save you 2 bytes

If you do this this you would also have to change...
DrawScreen  subroutine
;  LDA INTIM
;  BNE DrawScreen ; Whew!
   JSR WaitINTIM
   STX WSYNC
   STX VBLANK

- I'd change the VerticalBlank routine to...
;    ldx #0    not needed if you do the above suggestion
    lda #2
    sta WSYNC
    sta VSYNC
    sta WSYNC
    sta WSYNC
    IF PAL_60hz
    ldy #52
    ELSE
    ldy #44
    ENDIF
    lsr               ; a = 1
    sta WSYNC
    sta VSYNC
    sty TIM64T        ; this may need to be adjusted since it's not being set during VSYNC
    sty CXCLR
;    RTS

;CheckSwitches subroutine
;    LDA #0
    stx COLUBK    ; since x was 0 from above (saves 2 bytes)

I also looked at .CheckBlocks and that seems busy. I'll come back to it later when I have more time. At the surface if you change it to...
.CheckBlocks
   lda BallX
   cmp #110
   bcs .death
   cmp #63
   bcc .death

   lda BallY
   cmp #187
   bcs .death
   cmp #130
   bcc .death
   
   lda #0
   sta BigJump
   ldx BallPos
   lda LevelRam,x
   cmp #BLOCK_BLANK
   beq .death
   
   cmp #BLOCK_NORMAL
   bne .ContBlock2
   
   ; Put here action
   lda #BLOCK_BLANK
   sta LevelRam,X
;  SEC   ; Carry must be set here!
   sed
   lda TilesLeft
   sbc #1
   sta TilesLeft
   ;DEC TilesLeft
   cld
   bne .EndBlockCheck
   
   jsr InitRandomLevel
.death
   jsr InitGame
   jmp .EndMove
   
.ContBlock2
   cmp #BLOCK_IRON
   beq .EndBlockCheck

.ContBlock3
   CMP #BLOCK_RIGHT
   BNE .ContBlock4
   ; Put here action
   LDA #%01111111    ; Force movement
   STA OldJoystick0
   LDA #BLOCK_BLANK
   STA LevelRam,X
   beq .EndBlockCheck
.ContBlock4
   CMP #BLOCK_LEFT
   BNE .ContBlock5
   ; Put here action
   LDA #%10111111    ; Force movement
   STA OldJoystick0
   LDA #BLOCK_BLANK
   STA LevelRam,X
   beq .EndBlockCheck
.ContBlock5
   CMP #BLOCK_DOWN
   BNE .ContBlock6
   ; Put here action
   LDA #%11011111    ; Force movement
   STA OldJoystick0
   LDA #BLOCK_BLANK
   STA LevelRam,X
   beq .EndBlockCheck
.ContBlock6
   CMP #BLOCK_UP
   BNE .ContBlock7
   ; Put here action
   LDA #%11101111    ; Force movement
   STA OldJoystick0
   LDA #BLOCK_BLANK
   STA LevelRam,X
   beq .EndBlockCheck
.ContBlock7
   CMP #BLOCK_JUMP
   BNE .ContBlock8
   ; Put here action
   ;LDA #BLOCK_JUMP
   LDA #1
   STA BigJump
   LDA #BLOCK_BLANK
   STA LevelRam,X
   beq .EndBlockCheck
.ContBlock8

you could save 42 bytes.

This is all I see so far. I'll keep looking as time permits.

Take care,
Dennis

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


Current Thread