RE: [stella] a question...

Subject: RE: [stella] a question...
From: "Gonzalo" <gonzalorf@xxxxxxxxxxx>
Date: Sun, 4 Feb 2001 00:46:51 -0300
;> No, the two equates above just assign names to memory addresses.
;> If you store something to var, it will be stored in the RAM at address
;> $80. If you store something to var2, it will be stored in address $82.

;> Ciao, Eckhard Stolberg

;Thanks $Eckhard! That puts things easier to me... I was having 
;a nightmare thinking about it...

;Another question: this is my first attemp in stella programming...
;I want to learn to draw 2 players... but qhen they are in the same
;vertical position,
;something is wrong whit their size. I think that I must do something 
;whit the Vertical delay, isn't?
;But I don't have any idea about how to do it... I write the VDEL 
;rgisters and nothig happen
;Another thing: If I draw the PF0 and PF1, I have again troubles 
;whit the size of sprites:
;am I using more cycles than I can?
; Please, somebody help me... my algorithm really sucks, 
;which is the best way to draw 2 players?:

 processor 6502
 ORG $F000
 include VCS.H

VPOS0 = $81
GRAPH0 = $83
SCANL   = $82
INDE0 = $84
GRAPH1  = $85
SCANL1 = $86
INDE1 = $87
VPOS1 = $88
Start   SEI
 CLD
 LDX #$FF
 TXS
 LDA #$00

clrstk  STA $00,X
 DEX
 BNE clrstk
 LDA #$08
 STA INDE0
 LDA #100
 STA SCANL
 STA VPOS0
 LDA #90
 STA SCANL1
 STA VPOS1

 STA WSYNC
 LDX #$07
pos1    DEX
 BNE pos1
 STA VSYNC
 STA RESP0
 STA RESP1
 STA RESM0
 STA WSYNC
 LDX #$06

vblank  LDA #$02
 STA WSYNC
 STA WSYNC
 STA WSYNC
 STA VSYNC
 STA WSYNC
 STA WSYNC
 STA HMOVE
 LDA #$2C
 STA TIM64T
 LDA #$00
 STA WSYNC
 STA VSYNC
 STA GRP0
 STA GRP1
 LDY #192
 LDA #$01
 STA CTRLPF


draw    LDA INTIM
 BNE draw
 STA WSYNC
 STA VBLANK

frame  STA WSYNC
; STY PF0 ; if I do this, there's problems with the size of sprites
; STY PF1
 STY PF2
 STY COLUPF
 LDA GRAPH0
 STA GRP0
 LDA GRAPH1
 STA GRP1
 CPY SCANL
 BNE flA
 LDX INDE0
 BEQ flA
 DEC SCANL
 LDA sprdata,X
 STA GRAPH0
 LDA colors,X
 STA COLUP0
 DEC INDE0
 JMP flD
flA LDA #$00
 STA GRAPH0
flD     CPY SCANL1
 BNE flB
 LDX INDE1
 BEQ flB
 DEC SCANL1
 LDA sprdata,X
 STA GRAPH1
 LDA colors,X
 STA COLUP1
 DEC INDE1
 JMP flC
flB LDA #$00
 STA GRAPH1

flC DEY
 BNE frame

switch  LDA #$00
 STA HMP0
 STA HMP1
 LDA SWCHA
 CMP #$BF
 BEQ left
 CMP #$7F
 BEQ right
 CMP #$5F
 BEQ rido
 CMP #$6F
 BEQ riup
 CMP #$9F
 BEQ ledo
 LDA SWCHA
 CMP #$AF
 BEQ leup
 CMP #$EF
 BEQ up
 CMP #$DF
 BEQ down

 JMP over

up      LDA VPOS0
 CMP #191
 BEQ over
 INC VPOS0
 JMP over

down    LDA VPOS0
 CMP #0
 BEQ over
 DEC VPOS0
 JMP over

left    LDA #$20
 STA HMP0
 STA HMP1
 JMP over

right   LDA #$D0
 STA HMP0
 STA HMP1
 JMP over

rido LDA #$D0
 STA HMP0
 LDA VPOS0
 CMP #0
 BEQ over
 DEC VPOS0
 JMP over

riup LDA #$D0
 STA HMP0
 LDA VPOS0
 CMP #191
 BEQ over
 INC VPOS0
 JMP over

ledo LDA #$30
 STA HMP0
 LDA VPOS0
 CMP #0
 BEQ over
 DEC VPOS0
 JMP over

leup LDA #$30
 STA HMP0
 LDA VPOS0
 CMP #191
 BEQ over
 INC VPOS0
 JMP over


over    LDA     #35
        STA     TIM64T
 LDA VPOS0
 STA SCANL
 LDA #$08
 STA INDE0
 STA INDE1
 LDA VPOS1
 STA SCANL1

scan    LDA     INTIM
        BNE     scan
        JMP     vblank


sprdata .byte $00,$81,$18,$24,$42,$81,$81,$99,$66
colors  .byte $00,$71,$74,$74,$74,$76,$76,$78,$78

 org $F7FC
 .word Start
 .word Start

 org $FFFC
 .word Start
 .word Start











Attachment: 2 Players.bin
Description: Binary data

Current Thread