|
Subject: Re: [stella] My very first From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx> Date: Wed, 1 Jan 2003 23:56:54 -0800 (PST) |
On Thu, 2 Jan 2003, Christopher Tumber wrote: > Chris' advice to split up the table into 6 parts is a good one and will > give you a good result immediately. Lots of good advice. Also, I was doing a lot of this ldx tmp dex stx tmp When I count be doing this dec tmp Also, I suppose the code could be commented better. Maze0 contains the maze raw data, 1 bit per block Tedious unpacks it into PF format, 2 bits per block in PF bit order and stores it in RAM The kernel gets the PF data out of ram Attached is a new spin, with most of the changes you've mentioned (thanks again). Any clue why the player gets a little jaggy around the 13th column? -- Will code for food. http://cuddlepuddle.org/~adam/resume.html adam@xxxxxxxxxxxxxxxx http://cuddlepuddle.org/~adam/pgp.html
; Sokoban for the Atari 2600
; Adam Wozniak
; demo 0
; 2-Jan-2003
processor 6502
include vcs.h
manY equ $80
manX equ $81
myrow equ $82
tmp equ $83
tmp2 equ $84
tmp3 equ $85
tmp4 equ $86
tmp5 equ $87
tmp6 equ $88
tmp7 equ $89
toptr equ $8A
fromptr equ $8B
swchao equ $8C
Maze equ $90 ; 2*3*16 == $60 bytes! (egad)
MazePF0 equ $90 ; alias for Maze, Left half, PF0
MazePF1 equ $91 ; alias for Maze, Left half, PF1
MazePF2 equ $92 ; alias for Maze, Left half, PF2
MazePF3 equ $93 ; alias for Maze, Right half, PF0
MazePF4 equ $94 ; alias for Maze, Right half, PF1
MazePF5 equ $95 ; alias for Maze, Right half, PF2
org $F000
Start
sei ; disable interrupts
cld ; hex math, not BCD
ldx #$FF ; set the stack pointer to $FF
txs
lda #0 ; clear the entire stack
clear
sta 0,x
dex
bne clear
jsr Tedious ; initialize the first maze
ldx #$30 ; and position variables
stx manY
ldx #$0B
stx manX
Silence
ldx #$00 ; blessed silence
stx AUDV0
stx AUDV1
Colors
; already done... ldx #$00 ; background color
stx COLUBK
ldx #$24 ; player 1 color
stx COLUP0
ldx #$00 ; player 1 size and number
stx NUSIZ0
ldx #$8C ; playfield color
stx COLUPF
MainLoop
lda VSYNC ; start the vertical sync
ora #$02
sta VSYNC
ldy #$3
jsr SkipLines
lda VSYNC ; end the vertical sync
and #$FD
sta VSYNC
VerticalBlank
lda #$42
sta VBLANK
; sync player 0 to left edge
stx WSYNC
stx RESP0
ldx #$30
stx HMP0
stx WSYNC
stx HMOVE
ldy #$23
sty tmp
ldx #$80
stx HMP0
again
stx WSYNC
lda tmp
clc
sbc manX
bcs skippit
stx HMOVE
skippit
dec tmp
bne again
lda #$40 ; end the vertical blank
sta VBLANK
Visible
ldx #$00
stx myrow
ldx #$10
stx tmp6
MazeRow
ldx #$00
stx GRP0
stx tmp7 ; flag player off
lda myrow
eor manY
bne label1
ldx #$FF ; flag player on
stx tmp7
label1
ldx #$0C ; cycles 2
MazeRowLoop
ldy myrow ; cycles 3
stx WSYNC ; cycles 3
lda MazePF0,Y ; cycles 4
sta PF0 ; cycles 3
lda MazePF1,Y ; cycles 4
sta PF1 ; cycles 3
lda MazePF2,Y ; cycles 4
sta PF2 ; cycles 3
nop ; cycles 2
nop ; cycles 2
nop ; cycles 2
lda MazePF3,Y ; cycles 4
sta PF0 ; cycles 3
lda MazePF4,Y ; cycles 4
sta PF1 ; cycles 3
lda MazePF5,Y ; cycles 4
sta PF2 ; cycles 3
; draw player
lda Man,X
and tmp7
sta GRP0
dex
bne MazeRowLoop
lda myrow
adc #$06
sta myrow
ldx #$00
stx PF0
stx PF1
stx PF2
dec tmp6
bne MazeRow
Overscan
lda SWCHA
sta tmp
eor swchao
beq nochange
lda tmp
and #$80 ; right
bne overscan1
inc manX
overscan1
lda tmp
and #$40 ; left
bne overscan2
dec manX
overscan2
lda tmp
and #$20 ; down
bne overscan3
lda manY
clc
adc #$06
sta manY
overscan3
lda tmp
and #$10 ; up
bne overscan4
lda manY
sec
sbc #$06
sta manY
overscan4
nochange
ldx tmp
stx swchao
; TODO check for proper motion
ldy #$1E
jsr SkipLines
jmp MainLoop
SkipLines
stx WSYNC
dey
bne SkipLines
rts
Tedious
ldx #$10
stx tmp5
ldx #$00
stx toptr
stx fromptr
TediousLoop2
jsr TediousInner
lda toptr
clc
adc #$06
sta toptr
lda fromptr
clc
adc #$03
sta fromptr
dec tmp5
bne TediousLoop2
rts
TediousInner
ldx #$14
stx tmp2
TediousLoop
lda tmp2
clc
adc #$FF
asl
asl
sta tmp
ldy tmp
lda TediousTable,Y
iny
ldx TediousTable,Y
clc
adc fromptr
sta tmp3
stx tmp4
lda tmp4
ldy tmp3
and Maze0,Y
beq NotTonightDear
ldy tmp
iny
iny
lda TediousTable,Y
iny
ldx TediousTable,Y
clc
adc toptr
sta tmp3
stx tmp4
lda tmp4
ldy tmp3
ora Maze,Y
sta Maze,Y
NotTonightDear
dec tmp2
bne TediousLoop
rts
Halt
jmp Halt
TediousTable
dc.b #$00, #$08, #$00, #$30
dc.b #$00, #$04, #$00, #$C0
dc.b #$00, #$02, #$01, #$C0
dc.b #$00, #$01, #$01, #$30
dc.b #$01, #$80, #$01, #$0C
dc.b #$01, #$40, #$01, #$03
dc.b #$01, #$20, #$02, #$03
dc.b #$01, #$10, #$02, #$0C
dc.b #$01, #$08, #$02, #$30
dc.b #$01, #$04, #$02, #$C0
dc.b #$01, #$02, #$03, #$30
dc.b #$01, #$01, #$03, #$C0
dc.b #$02, #$80, #$04, #$C0
dc.b #$02, #$40, #$04, #$30
dc.b #$02, #$20, #$04, #$0C
dc.b #$02, #$10, #$04, #$03
dc.b #$02, #$08, #$05, #$03
dc.b #$02, #$04, #$05, #$0C
dc.b #$02, #$02, #$05, #$30
dc.b #$02, #$01, #$05, #$C0
Man
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$3C ; ..****..
dc.b #$66 ; .**..**.
dc.b #$C3 ; **....**
dc.b #$99 ; *..**..*
dc.b #$A5 ; *.*..*.*
dc.b #$81 ; *......*
dc.b #$A5 ; *.*..*.*
dc.b #$C3 ; **....**
dc.b #$66 ; .**..**.
dc.b #$3C ; ..****..
Spot
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$18 ; ...**...
dc.b #$24 ; ..*..*..
dc.b #$24 ; ..*..*..
dc.b #$18 ; ...**...
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$00 ; ........
dc.b #$00 ; ........
Gold
dc.b #$00 ; ........
dc.b #$3C ; ..****..
dc.b #$66 ; .**..**.
dc.b #$C3 ; **....**
dc.b #$81 ; *......*
dc.b #$81 ; *......*
dc.b #$81 ; *......*
dc.b #$81 ; *......*
dc.b #$C3 ; **....**
dc.b #$66 ; .**..**.
dc.b #$3C ; ..****..
dc.b #$00 ; ........
Gspot
dc.b #$00 ; ........
dc.b #$3C ; ..****..
dc.b #$66 ; .**..**.
dc.b #$C3 ; **....**
dc.b #$99 ; *..**..*
dc.b #$A5 ; *.*..*.*
dc.b #$A5 ; *.*..*.*
dc.b #$99 ; *..**..*
dc.b #$C3 ; **....**
dc.b #$66 ; .**..**.
dc.b #$3C ; ..****..
dc.b #$00 ; ........
Maze0
dc.b #$08, #$F8, #$01
dc.b #$00, #$88, #$00
dc.b #$00, #$88, #$00
dc.b #$03, #$8C, #$00
dc.b #$02, #$04, #$00
dc.b #$0E, #$B4, #$7E
dc.b #$08, #$B7, #$C2
dc.b #$08, #$00, #$02
dc.b #$0F, #$BA, #$C2
dc.b #$00, #$83, #$FE
dc.b #$00, #$FE, #$00
dc.b #$00, #$00, #$00
dc.b #$00, #$00, #$00
dc.b #$00, #$00, #$00
dc.b #$00, #$00, #$00
dc.b #$08, #$00, #$01
org $FFFC
dc.w Start
dc.w Start
Attachment:
soko.bin
Description: soko.bin
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] My very first, Christopher Tumber | Thread | Re: [stella] My very first, Fabrizio Zavagli |
| Re: [stella] My very first, Christopher Tumber | Date | Re: [stella] Space Treat with score, Fabrizio Zavagli |
| Month |