Subject: Re: [stella] My code is broked! From: Christopher Tumber <christophertumber@xxxxxxxxxx> Date: Thu, 09 Oct 2003 15:42:22 -0400 |
At 04:13 PM 08/10/2003 -0700, you wrote: >There are four players in the game. So in order for a trade hands >subroutine to work the current player's hand RAM location, and the chosen >players hand RAM location should be stored into pointers. Ah, okay gotcha. You're prolly already way past this, but this is how I'd implement (untested code, may be buggy, yada, yada, yada) org $80 Player0Buffer .byte .byte .byte .byte .byte .byte .byte .byte Player1Buffer .byte .byte .byte .byte .byte .byte .byte .byte Player2Buffer .byte .byte .byte .byte .byte .byte .byte .byte Player3Buffer .byte .byte .byte .byte .byte .byte .byte .byte TempPointer1 .word TempPointer2 .word Temp .byte <...> ;Routine to switch two buffers ;Where X and Y registers contain the buffer numbers to switch ;Optionally A could be used to pass the size of the buffer if you wanted a more general purpose routine ;Buffers are in fixed, predetermined locations ; ;Registers are not preserved ; SwitchBuffers: ; pha ;Include this line to enable variable buffer size where size=A lda PlayerBufferTableLow,y sta TempPointer1 lda #0 ;High byte is always known as $00 ; lda PlayerBufferTableHigh,y ;Use this instead for more general purpose buffer swapping sta TempPointer1+1 lda PlayerBufferTableLow,x sta TempPointer2 lda #0 ;High byte is always known as $00 ; lda PlayerBufferTableHigh,x ;Use this instead for more general purpose buffer swapping sta TempPointer2+1 ; pla ;Include this line to enable variable buffer size where size=A ; tay ;Include this line to enable variable buffer size where size=A ldy #7 ;Remove this line to enable variable buffer size where size=A next_switch: lda (TempPointer1),y sta Temp lda (TempPointer2),y sta (TempPointer1),y lda Temp sta (TempPointer2),y dey bpl next_switch rts PlayerBufferTableLow: .byte #<Player0Buffer,#<Player1Buffer,#<Player2Buffer,#<Player3Buffer ;PlayerBufferTableHigh: .byte #>Player0Buffer,#>Player1Buffer,#>Player2Buffer,#>Player3Buffer ;Use for more general purpose buffer switching ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] My code is broked!, Chris Larkin | Thread | [stella] z-Axis Movement Programmin, J Parlee |
Re: [stella] My code is broked!, Fabrizio Zavagli | Date | [stella] z-Axis Movement Programmin, J Parlee |
Month |