|
Subject: [stella] Gunfight 2600: Westward Ho! From: Manuel Polik <manuel.polik@xxxxxxxxxxx> Date: Mon, 19 Feb 2001 19:20:48 +0100 |
Hi again!
I spent some time transferring my Gunfight kernel from 1LK to a real 2LK
now. Looks promising I think.
Additionally I added the *shot* & gave the guns at least some shape.
Think I understood now, how VDEL works :-)
I've some cycles left in the second scannline, so now the crashcourse
'Drawing with missiles in 18 cycles' would come in handy :-)
Is there any working example source of drawing with missiles out
anywhere? I didn't find one in the archive.
Some theories from me about that subject:
Any HMOV during the kernel would mess up the left side with black lines,
so I'd have to do it the Activision way & do a 'STA HMOV' every single
line, I fear. Right?
First (clever I thought :-)) idea I had, was to have a fixed size of the
missile and move it one/two pixels every line. So, it could draw
something like this for example:
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
**
It'd paint that on the whole screen, but I'd only display 4 lines on the
vertical height of the cowboy. So a structure lokking like this:
**
**
**
**
Would be displayed on the right height and I'd only need to shift it
horizontally to the right cowboy for a gun looking up (or two the left
for a gun looking down)
It didn't work out, for too possible reasons:
- Either I was too stupid...
- ...positioning wouldn't work with values > 160 & subsequently shifting
it left/right from there wouldn't work, too.
I hopefully assume it's the second reason :-)
Ok, now I'd need other ideas, sources, snippets, anything that uses
missiles to draw something.
I attached the current version of Gunfight, plus source. It's an even
bigger mess now, don't bother looking at anything except the 'nextline
loop', if you're interested in the display kernel. First goal is getting
it going, then I clean it up.Attachment:
gunfight.bin
Description: Binary data
processor 6502
include vcs.h
SCREENSTART = $60
SEG.U vars
org $80
horPosP0 ds 1 ; Horizontal position
horPosP1 ds 1 ; Horizontal position
horPosM0 ds 1 ; Horizontal position
horPosM1 ds 1 ; Horizontal position
horPosBL ds 1 ; Horizontal position
verPosP0 ds 1 ; Vertical position
verPosP1 ds 1 ; Vertical position
verPosM0 ds 1 ; Vertical position
verPosM1 ds 1 ; Vertical position
verPosBL ds 1 ; Vertical position
colorpointer ds 4 ; pointer to color tables
playerpointer ds 4 ; pointer to shape tables
sizepointer ds 4 ; pointer to size tables
color ds 2 ; cowboy colors
gunSize ds 2 ; cowboy colors
SEG code
org $F000
start SEI
CLD
LDX #$FF
TXS
LDA #$00
zero STA $00,X ;zero out the machine
DEX
BNE zero
LDA #$32 ;set up some of the variables.
STA COLUP0 ;set up sprite colour
LDA #$30 ;set up the starting vertical position of sprite
STA verPosP0
STA verPosP1
LDA #$25
STA verPosM0
STA verPosM1
STA verPosBL
LDX #$03
SetUpHorizontal LDA horpostab,X
STA horPosP0,X
DEX
BPL SetUpHorizontal
LDA #$1C
STA COLUBK
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 ; Wait until vertical sync finished
VerticalBlank STA WSYNC ; Finish current line
STA VSYNC ; Stop vertical sync
LDA #$02 ;
STA VBLANK ; Start vertical blank
LDA #$2B ;
STA TIM64T ; Init timer
; Position all objects
LDY #$04
PosAnother ldx horPosP0,Y ;+3 3
JSR PosPlayer
DEY
BPL PosAnother
STA WSYNC ; Finish current line
sta HMOVE
LDY #SCREENSTART ; Init display Kernel
LDA #$08
STA REFP1 ; Reflect Player 1
LDA #$02
LDA $F0
; Init pointers (yes, a very quick hack :-))
CLC
LDA #<p0data ; Init Pointers
SBC verPosP0
ADC #$13
STA playerpointer ;
LDA #>p0data ; Init Pointers
STA playerpointer+1 ;
CLC
LDA #<p0data ; Init Pointers
SBC verPosP1
ADC #$13
STA playerpointer+2 ;
LDA #>p0data ; Init Pointers
STA playerpointer+3 ;
LDA #$01
sta VDELP0
sta VDELBL
LDA #$30
sta NUSIZ0
sta NUSIZ1
; STA HMCLR ; must be enough space from WSYNC!
; LDA #$F0
; sta HMM0 ;+3 10
; LDA #$10
; sta HMM1 ;+3 10
inc horPosBL
CLC
LDA #<colordata ; Init Pointers
SBC verPosP0
ADC #$13
STA colorpointer ;
LDA #>colordata ; Init Pointers
STA colorpointer+1 ;
CLC
LDA #<colordata2 ; Init Pointers
SBC verPosP1
ADC #$13
STA colorpointer+2 ;
LDA #>colordata2 ; Init Pointers
STA colorpointer+3 ;
WaitIntimReady LDA INTIM ; Wait until vertical blank finished
BNE WaitIntimReady ;
RTS
Waste STA WSYNC ; Waste a line
DEX ;
BNE Waste ; if X is not zero, do more lines
RTS
SkipDraw NOP
NOP
NOP
NOP
NOP
NOP
NOP
SEC
LDA #$00
BEQ Continue
SkipDraw2 NOP
NOP
NOP
NOP
NOP
NOP
SEC
LDA #$00
BEQ Continue2
MainScreen STA WSYNC ; Finish current line
STA VBLANK ; Stop vertical blank
NextLine LDX #$1F
TXS
LDX #$00
TYA
SBC verPosP0 ;
STA WSYNC
ADC #$13
BCC SkipDraw
lda color
STA COLUP0
LDA (colorpointer),Y
sta color
LDA (playerpointer),Y ;
STX COLUP1
Continue
STA GRP0
TYA
SBC verPosP1 ;
ADC #$13
BCC SkipDraw2
lda color+1
STA COLUP1
LDA (colorpointer+2),Y
sta color+1
STX COLUP0
LDA (playerpointer+2),Y ;
Continue2
CPY verPosBL
PHP
NOP
NOP
NOP
NOP
STX COLUP1
STA GRP1
lda color
STA COLUP0
TYA
CLC
SBC verPosM1
AND #$FE
PHP
TYA
CLC
SBC verPosM0
AND #$FE
PHP
SEC
NOP
NOP
NOP
NOP
NOP
lda color+1
STA COLUP1
STX COLUP0
DEY
BNE NextLine
LDX #$FF
TXS
oscan2 JSR joy ;overscan. Time to read the joysticks.
LDX #$1E
JSR Waste
JMP MainLoop ; Repeat
joy LDY #$00
LDA SWCHA
ASL
BCC right
ASL
BCC left
ASL
BCC down
ASL
BCC up
ASL
BCC right2
ASL
BCC left2
ASL
BCC down2
ASL
BCC up2
RTS
right INC horPosM1
INC horPosP0
LDA horPosP0
CMP #$31
BNE HorPosOK
DEC horPosP0
DEC horPosM1
HorPosOK rts
left DEC horPosM1
DEC horPosP0 ;set horizontal motion register to one pixel left
LDA horPosP0
CMP #$07
BNE HorPosOK2
INC horPosM1
INC horPosP0
HorPosOK2 rts
up LDA verPosP0 ;make sure we haven't gone over the top of the screen
CMP #SCREENSTART-1
BEQ NoClimb
INC verPosP0 ;if not then increase the vertical position
INC verPosM1 ;if not then increase the vertical position
NoClimb RTS
down LDA verPosP0
CMP #$15
BEQ NoSink
DEC verPosP0 ;decrease the vertical position
DEC verPosM1 ;decrease the vertical position
NoSink RTS
right2 INC horPosM0
INC horPosP1 ;set horizontal motion register to one pixel right
LDA horPosP1
CMP #$99
BNE HorPosOK3
DEC horPosM0
DEC horPosP1
HorPosOK3 rts
left2 DEC horPosP1 ;set horizontal motion register to one pixel left
DEC horPosM0
LDA horPosP1
CMP #$68
BNE HorPosOK4
INC horPosP1
INC horPosM0
HorPosOK4 rts
up2 LDA verPosP1 ;make sure we haven't gone over the top of the screen
CMP #SCREENSTART-1
BEQ NoClimb2
INC verPosP1 ;if not then increase the vertical position
INC verPosM0 ;if not then increase the vertical position
NoClimb2 RTS
down2 LDA verPosP1
CMP #$15
BEQ NoSink2
DEC verPosP1 ;decrease the vertical position
DEC verPosM0 ;decrease the vertical position
NoSink2 RTS
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 ;when branch not taken: +2 (18 + x*5)
sta RESP0,Y ;(21 + x*5)
sta WSYNC
rts
ORG $FE00
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
horpostab
.byte $18,$90,$89,$21
ORG $FF80
p0data
.byte %11101110
.byte %10001000
.byte %01001100
.byte %00100110
.byte %01111110
.byte %10111100
.byte %10111100
.byte %10111100
.byte %11111100
.byte %01111111
.byte %00111111
.byte %00011000
.byte %00111100
.byte %00111110
.byte %00110100
.byte %11111111
.byte %00111100
.byte %00101100
.byte %00101000
colordata
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $88
.byte $86
.byte $84
.byte $82
.byte $82
.byte $82
.byte $3C
.byte $3C
.byte $3C
.byte $3C
.byte $13
.byte $15
.byte $15
.byte $17
colordata2
.byte $00
.byte $00
.byte $00
.byte $00
.byte $00
.byte $F8
.byte $F6
.byte $F4
.byte $F2
.byte $F2
.byte $F2
.byte $3E
.byte $3E
.byte $3E
.byte $00
.byte $11
.byte $12
.byte $13
.byte $14
org $FFFC
.word start
.word start
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [stella] Qb: v0.11, Andrew Davie | Thread | Re: [stella] Gunfight 2600: Westwar, Thomas Jentzsch |
| Re: [stella] Jammed v0.2, Andrew Davie | Date | Re: [stella] Qb: v0.05, Eckhard Stolberg |
| Month |