|
Subject: Re: [stella] Gunfight 2600: The Good, The Bad, The Ugly From: Manuel Polik <manuel.polik@xxxxxxxxxxx> Date: Wed, 28 Feb 2001 13:50:43 +0100 |
Gonzalo wrote: > > Please comment on demo, how do you like what you see? Already any > > suggestions? > I think is great! But the previous demo show the hair of the cowboy when he > walk up... that was cool, I'd like to see it again... Done. I thought it was impossible to reinstall that with an elegant way within an 8-way moevent scheme, but at least I found one - at the cost of two RAM bytes. Check the 'hairBuffer' :-) > I'm following your code from the beginning, is a good way to learn... so I'm > waiting for the new code... Ok, here we go. Sorry for the almost complete lack of any comments. I'll comment/explain any part on request. As special feature, this version shows the second cowboy with the hat already shot of, so you see I wasn't just kidding on that feature :-) Greetings, Manuel
Attachment:
gunfight.bin
Description: Binary data
processor 6502
include vcs.h
SCREENSTART = $60
SEG.U vars
org $80
horPosP0 ds 1 ; Horizontal position player 0
horPosP1 ds 1 ; Horizontal position player 1
horPosM0 ds 1 ; Horizontal position missile 0
horPosM1 ds 1 ; Horizontal position missile 1
horPosBL ds 1 ; Horizontal position ball
verPosP0 ds 1 ; Vertical position player 0
verPosP1 ds 1 ; Vertical position player 1
verPosM0 ds 1 ; Vertical position missile 0
verPosM1 ds 1 ; Vertical position missile 1
verPosBL ds 1 ; Vertical position ball
colorBuffer ds 2 ; Buffer player colors temporary
hairBuffer ds 2 ; Buffer player haircolor permanent
playerShapePtr00 ds 2 ; Pointer to current player 0 shape in the ROM
playerShapePtr01 ds 2 ; Pointer to current player 1 shape in the ROM
animCounter ds 2 ; Simple frameCounters, one for each player
playerMovement ds 2 ; backup the Joystick readings for each player
playerShape00 ds 11 ; Player 0 shape complete in the RAM
playerShape01 ds 11 ; Player 1 shape complete in the RAM
colorShape00 ds 11 ; Player 0 colors complete in the RAM
colorShape01 ds 11 ; Player 1 colors complete in the RAM
SEG code
org $F000
start SEI
CLD
LDX #$FF
TXS
LDA #$00
zero STA $00,X ;zero out the machine
DEX
BNE zero
LDA #$30 ;set up the starting vertical position of sprite
STA verPosP0
STA verPosP1
LDA #$25
STA verPosM0
STA verPosM1
STA verPosBL
LDA #$18
STA horPosP0
LDA #$90
STA horPosP1
LDA #$1C
STA COLUBK
LDA #<cbup00
sta playerShapePtr00
sta playerShapePtr01
LDA #>cbup00
sta playerShapePtr00+1
sta playerShapePtr01+1
LDA #$3C
STA hairBuffer
STA hairBuffer+1
LDX #$0A
ResetPlayers LDA cbup00,X
STA playerShape00,X
STA playerShape01,X
LDA colordata,X
STA colorShape00,X
LDA colordata2,X
STA colorShape01,X
DEX
BPL ResetPlayers
LDA menwithouthats
STA playerShape01+9
LDA menwithouthats+1
STA playerShape01+10
LDA #$F4
STA colorShape01+9
MainLoop JSR VerticalSync ;
JSR VerticalBlank ;
JMP MainScreen ; MainScreen does Overscan
VerticalSync LDA #$02 ;
STA WSYNC ; Finish current line
STA VSYNC ; start vertical sync
LDA #$03 ;
STA TIM64T ;
JMP WaitIntimReady ; finish vertical sync
VerticalBlank STA WSYNC ; Finish current line
STA VSYNC ; Stop vertical sync
LDA #$2B ;
STA TIM64T ; Init timer
; Position all objects
LDY #$04
PosAnother ldx horPosP0,Y ;
JSR PosPlayer
DEY
BPL PosAnother
STA WSYNC ; Finish current line
STA HMOVE
LDY #SCREENSTART ; Init display Kernel
LDA #$02
LDA $F0
INC horPosBL
INC horPosM0
INC horPosM0
INC horPosM1
INC horPosM1
INC horPosM1
LDA #$01
STA VDELP0
WaitIntimReady LDA INTIM ; finish vertical blank
BNE WaitIntimReady ;
RTS
Waste STA WSYNC ; Waste a line
DEX ;
BNE Waste ; if X is not zero, do more lines
RTS
SkipDraw
NOP
SEC
LDA VSYNC
LDA #$00
BEQ Continue
SkipDraw2
NOP
SEC
LDA VSYNC
LDA #$00
BEQ Continue2
MainScreen STA WSYNC ; Finish current line
STA VBLANK ; Stop vertical blank
NextLine LDX #$1F
TXS
TYA
STA WSYNC
CPY verPosBL
PHP
CPY verPosM1
PHP
CPY verPosM0
PHP
SEC
SBC verPosP0 ;
ADC #$0B
BCC SkipDraw
TAX
LDA colorShape00,X
STA colorBuffer
LDA playerShape00,X ;
Continue
STA GRP0
TYA
SBC verPosP1 ;
ADC #$0B
BCC SkipDraw2
TAX
LDA colorShape01,X
STA colorBuffer+1
LDA playerShape01,X ;
Continue2
LDX colorBuffer
NOP
NOP
STA WSYNC
STA GRP1
STX COLUP0
LDA colorBuffer+1
STA COLUP1
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DEY
BNE NextLine
LDX #$FF
TXS
STA WSYNC
LDA #$02 ;
STA VBLANK ; Start vertical blank
JSR joy ; Read the joysticks.
LDX #$01
AnimPlayer LDA playerMovement,X
EOR #$FF
AND #$0F
BEQ NoAnim
LDY #$3C ; Assume No Hair
CMP #$01
BNE HairsOk
LDY haircolors,X ; Load Hair
HairsOk STY hairBuffer,X
ASL
ASL
STA playerMovement,X
INC animCounter,X
LDA animCounter,X
AND #$18
LSR
LSR
LSR
ADC playerMovement,X
TAY
TXA
ASL
TAX
LDA cowboyWalk,Y
STA playerShapePtr00,X
TXA
LSR
TAX
NoAnim DEX
BPL AnimPlayer
LDA hairBuffer
STA colorShape00+8
LDA hairBuffer+1
STA colorShape01+8
LDY #$06
AnimateCowboys LDA (playerShapePtr01),Y
STA playerShape01,Y
LDA (playerShapePtr00),Y
STA playerShape00,Y
DEY
BPL AnimateCowboys
LDX #$1E
JSR Waste
JMP MainLoop ; Repeat
joy LDA SWCHA
LDX #$01
JoyPlayer2
STA playerMovement,X
LSR
TAY
BCC up
UpDone TYA
LSR
TAY
BCC down
DownDone TYA
LSR
TAY
BCC left
LeftDone TYA
LSR
TAY
BCC right
RightDone TYA
DEX
BPL JoyPlayer2
RTS
right INC horPosP0,X
LDA horPosP0,X
CMP rightrestriction,X
BNE HorPosOK
DEC horPosP0,X
LDA playerMovement,X
ORA #$08
STA playerMovement,X
HorPosOK LDA #$00
STA REFP0,X
JMP RightDone
left DEC horPosP0,X
LDA horPosP0,X
CMP leftrestriction,X
BNE HorPosOK2
INC horPosP0,X
LDA playerMovement,X
ORA #$04
STA playerMovement,X
HorPosOK2 LDA #$08
STA REFP0,X
JMP LeftDone
up INC verPosP0,X
LDA verPosP0,X
CMP #SCREENSTART-1
BNE VerPosOk
DEC verPosP0,X
LDA playerMovement,X
ORA #$01
STA playerMovement,X
VerPosOk JMP UpDone
down DEC verPosP0,X
LDA verPosP0,X
CMP #$0D
BNE VerPosOk2
INC verPosP0,X
LDA playerMovement,X
ORA #$02
STA playerMovement,X
VerPosOk2 JMP DownDone
PosPlayer
sta WSYNC ;begin scanline
lda HorzTable,X ;+4 7
sta HMP0,Y ;+3 10
and #$0F ;+2 12
tax ;+2 14
P0 dex ;+2 16
bpl P0 ;
sta RESP0,Y ;
rts
cowboyWalk
.byte #<cbup01,#<cbup00,#<cbup01,#<cbup02 ; DummyLine
.byte #<cbup01,#<cbup00,#<cbup01,#<cbup02 ; Up
.byte #<cbup01,#<cbup00,#<cbup01,#<cbup02 ; Down
.byte #<cbup01,#<cbup00,#<cbup01,#<cbup02 ; DummyLine
.byte #<cblt01,#<cblt00,#<cblt01,#<cblt02 ; Left
.byte #<cblu01,#<cblu00,#<cblu01,#<cblu02 ; Left-Up
.byte #<cbld01,#<cbld00,#<cbld01,#<cbld02 ; Left-Down
.byte #<cbup01,#<cbup00,#<cbup01,#<cbup02 ; DummyLine
.byte #<cblt01,#<cblt00,#<cblt01,#<cblt02 ; Right
.byte #<cblu01,#<cblu00,#<cblu01,#<cblu02 ; Right-Up
.byte #<cbld01,#<cbld00,#<cbld01,#<cbld02 ; Right-Down
cbup00
.byte %00001100
.byte %01101100
.byte %01101100
.byte %00111000
.byte %00111010
.byte %10111010
.byte %01111100
.byte %00010000
.byte %00111000
.byte %01111100
.byte %00111000
menwithouthats
.byte %00111000
.byte %00000000
cbup01
.byte %01101100
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111010
.byte %10111010
.byte %01111100
cbup02
.byte %01100000
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111000
.byte %10111010
.byte %01111100
cbup03
.byte %01101100
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111001
.byte %10111010
.byte %01111100
cbup04
.byte %01101100
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111000
.byte %10111110
.byte %01111010
cblt00
.byte %11000011
.byte %11000110
.byte %01101100
.byte %00111000
.byte %10111000
.byte %10111110
.byte %01111000
cblt01
.byte %00111100
.byte %00111000
.byte %00111000
.byte %00111000
.byte %01111000
.byte %01111000
.byte %00111000
cblt02
.byte %11000011
.byte %11000110
.byte %01101100
.byte %00111000
.byte %01111000
.byte %00111100
.byte %00111000
cblt03
.byte %00111100
.byte %00111000
.byte %00111000
.byte %00111000
.byte %00111100
.byte %00111111
.byte %00111000
cbld00
.byte %11001100
.byte %11001110
.byte %01101100
.byte %00111000
.byte %01111000
.byte %11111000
.byte %01111000
cbld01
.byte %01111110
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111010
.byte %11111100
.byte %01111000
cbld02
.byte %11001100
.byte %11001110
.byte %01101100
.byte %00111000
.byte %10111100
.byte %10111111
.byte %01111100
cbld03
.byte %01111110
.byte %01101100
.byte %01101100
.byte %00111000
.byte %01111010
.byte %11111100
.byte %01111000
cblu00
.byte %11001100
.byte %11001110
.byte %01101100
.byte %00111000
.byte %00111000
.byte %01111100
.byte %01111100
cblu01
.byte %01111110
.byte %01101100
.byte %01101100
.byte %00111000
.byte %11111001
.byte %11111110
.byte %01111100
cblu02
.byte %11001100
.byte %11001110
.byte %01101100
.byte %00111000
.byte %10111000
.byte %11111110
.byte %01111100
cblu03
.byte %01111110
.byte %01101100
.byte %01101100
.byte %00111000
.byte %10111000
.byte %01111110
.byte %01111101
rightrestriction
.byte $99,$99
leftrestriction
.byte $FF,$FF
haircolors
.byte $00,$F4
colordata
.byte $F4
.byte $F2
.byte $F2
.byte $F0
.byte $00
.byte $00
.byte $00
.byte $3C
.byte $3C
.byte $15
.byte $17
colordata2
.byte $E4
.byte $E2
.byte $E2
.byte $E0
.byte $00
.byte $00
.byte $00
.byte $3C
.byte $3C
.byte $00
.byte $00
ORG $FF00
HorzTable ;this must not cross a page boundary
.byte $30,$20,$10,$00,$F0,$E0,$D0,$C0,$B0,$A0,$90
.byte $71,$61,$51,$41,$31,$21,$11,$01,$F1,$E1,$D1,$C1,$B1,$A1,$91
.byte $72,$62,$52,$42,$32,$22,$12,$02,$F2,$E2,$D2,$C2,$B2,$A2,$92
.byte $73,$63,$53,$43,$33,$23,$13,$03,$F3,$E3,$D3,$C3,$B3,$A3,$93
.byte $74,$64,$54,$44,$34,$24,$14,$04,$F4,$E4,$D4,$C4,$B4,$A4,$94
.byte $75,$65,$55,$45,$35,$25,$15,$05,$F5,$E5,$D5,$C5,$B5,$A5,$95
.byte $76,$66,$56,$46,$36,$26,$16,$06,$F6,$E6,$D6,$C6,$B6,$A6,$96
.byte $77,$67,$57,$47,$37,$27,$17,$07,$F7,$E7,$D7,$C7,$B7,$A7,$97
.byte $78,$68,$58,$48,$38,$28,$18,$08,$F8,$E8,$D8,$C8,$B8,$A8,$98
.byte $79,$69,$59,$49,$39,$29,$19,$09,$F9,$E9,$D9,$C9,$B9,$A9,$99
.byte $7A,$6A,$5A,$4A,$3A,$2A,$1A,$0A,$FA,$EA,$DA,$CA,$BA,$AA,$9A
org $FFFC
.word start
.word start
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [stella] Gunfight 2600: The Goo, Gonzalo | Thread | Re: [stella] Gunfight 2600: The Goo, Eckhard Stolberg |
| Re: [stella] Qb Instruciones & game, Andrew Davie | Date | Re: [stella] Qb Instruciones & game, Joe Grand |
| Month |