|
Subject: [stella] My very first From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx> Date: Wed, 1 Jan 2003 19:11:08 -0800 (PST) |
My very first attempt at a 2600 game. It's Sokoban, a classic "push blocks around a maze" puzzle game. Nothing really there yet to speak of, but it does run. Can anybody spot any cheap ways to gain some cycles? I'm using an asymmetric playfield, and I'm afraid my kernel doesn't have enough time left to draw sprites! -- Will code for food. http://cuddlepuddle.org/~adam/resume.html adam@xxxxxxxxxxxxxxxx http://cuddlepuddle.org/~adam/pgp.html
Attachment:
soko.bin
Description: soko.bin
; Sokoban for the Atari 2600
; Adam Wozniak
; demo 0
; 1-Jan-2003
processor 6502
include vcs.h
man equ $80
myrow equ $81
tmp equ $82
tmp2 equ $83
tmp3 equ $84
tmp4 equ $85
tmp5 equ $86
toptr equ $87
fromptr equ $88
Maze equ $90 ; 2*3*16 == $60 bytes!
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
stx man
Silence
ldx #$00 ; blessed silence
stx AUDV0
stx AUDV1
Colors
ldx #$24 ; player 1 color
stx COLUP0
ldx #$00 ; player 1 size and number
stx NUSIZ0
ldx #$8C ; playfield color
stx COLUPF
ldx #$00 ; background color
stx COLUBK
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 VBLANK ; start the vertical blank
ora #$02
sta VBLANK
ldy #$25
jsr SkipLines
lda VBLANK ; end the vertical blank
and #$FD
sta VBLANK
Visible
ldx #$00
stx myrow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
jsr MazeRow
Overscan
ldy #$1E
jsr SkipLines
jmp MainLoop
MazeRow
ldx #$0C ; cycles 2
stx tmp2 ; cycles 3 == 5
ldx #$00
stx GRP0
; draw player
lda myrow
eor man
bne label1
ldx #$FF
stx GRP0
label1
MazeRowLoop
ldy myrow ; cycles 3
stx WSYNC ; cycles 3
lda Maze,Y ; cycles 4
sta PF0 ; cycles 3
iny ; cycles 2
lda Maze,Y ; cycles 4
sta PF1 ; cycles 3
iny ; cycles 2
lda Maze,Y ; cycles 4
sta PF2 ; cycles 3 == 25
iny ; cycles 2
ldx Maze,Y ; cycles 4
stx PF0 ; cycles 3
iny ; cycles 2
ldx Maze,Y ; cycles 4
stx PF1 ; cycles 3
iny ; cycles 2
ldx Maze,Y ; cycles 4
stx PF2 ; cycles 3 == 27
ldx tmp2
dex
stx tmp2
bne MazeRowLoop
lda myrow
adc #$06
sta myrow
ldx #$00
stx PF0
stx PF1
stx PF2
rts
SkipLines
ldx #$01
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
ldx tmp5
dex
stx 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
ldx tmp2
dex
stx tmp2
bne TediousLoop
rts
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 #$3C ; ..****..
dc.b #$66 ; .**..**.
dc.b #$C3 ; **....**
dc.b #$A5 ; *.*..*.*
dc.b #$81 ; *......*
dc.b #$A5 ; *.*..*.*
dc.b #$99 ; *..**..*
dc.b #$C3 ; **....**
dc.b #$66 ; .**..**.
dc.b #$3C ; ..****..
dc.b #$00 ; ........
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 ; ........
Halt
jmp Halt
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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [stella] Space Treat with score, Fabrizio Zavagli | Thread | Re: [stella] My very first, Chris Larkin |
| Re: [stella] Space Treat with score, Glenn Saunders | Date | Re: [stella] My very first, Chris Larkin |
| Month |