Merge branch 'master' of ssh://shion.micecat.ath.cx/~ikari/public_html/git/sd2snes

This commit is contained in:
Maximilian Rehkopf 2009-10-14 13:32:13 +02:00
commit d47ddd3b4d
39 changed files with 4008 additions and 52 deletions

BIN
gfx/logo.chi Normal file

Binary file not shown.

BIN
gfx/sd2snes.pal Normal file

Binary file not shown.

BIN
gfx/sd2snes.psd Normal file

Binary file not shown.

BIN
gfx/sd2snes_logo_remap.bin Normal file

Binary file not shown.

BIN
pcb/cart/sd2snes18.brd Normal file

Binary file not shown.

BIN
pcb/cart/sd2snes18.sch Normal file

Binary file not shown.

17
snes/Makefile Normal file
View File

@ -0,0 +1,17 @@
OBJS = header.ips reset.o65 main.o65 font.o65 palette.o65 data.o65 const.o65 logo.o65 # gfx.o65 # vars.o65
all: menu.bin
menu.bin: $(OBJS)
sneslink -fsmc -o $@ $^
# Generic rule to create .o65 out from .a65
%.o65: %.a65
snescom -J -Wall -o $@ $<
# Generic rule to create .ips out from .a65
%.ips: %.a65
snescom -I -J -Wall -o $@ $<
clean:
rm -f *.ips *.o65 *~ menu.bin

3
snes/const.a65 Normal file
View File

@ -0,0 +1,3 @@
zero .word 0
hello .byt "Hello World!"
bg2tile .byt $20

3
snes/data.a65 Normal file
View File

@ -0,0 +1,3 @@
.data
testvar .byt 0
testvar2 .word 0

512
snes/font.a65 Normal file
View File

@ -0,0 +1,512 @@
font .byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $30, $00, $30, $08, $30, $08, $30, $08
.byt $20, $18, $00, $10, $30, $00, $00, $18
.byt $6c, $00, $6c, $12, $24, $12, $00, $12
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $6c, $00, $6c, $12, $fe, $00, $6c, $13
.byt $fe, $00, $6c, $13, $6c, $12, $00, $36
.byt $10, $00, $7c, $44, $c6, $38, $f0, $03
.byt $1e, $60, $c6, $09, $7c, $47, $10, $2e
.byt $42, $00, $a4, $01, $48, $12, $10, $24
.byt $24, $08, $4a, $10, $84, $21, $00, $42
.byt $70, $40, $c0, $38, $c4, $24, $6e, $4a
.byt $c4, $33, $c4, $22, $7c, $46, $00, $3e
.byt $18, $00, $18, $04, $10, $0c, $00, $08
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $18, $00, $30, $2c, $30, $08, $30, $08
.byt $30, $08, $30, $28, $18, $00, $00, $0c
.byt $30, $00, $18, $08, $18, $04, $18, $04
.byt $18, $04, $18, $0c, $30, $0c, $00, $18
.byt $00, $00, $6c, $00, $38, $06, $7c, $00
.byt $38, $06, $6c, $12, $00, $36, $00, $00
.byt $00, $00, $30, $00, $30, $08, $fc, $00
.byt $30, $4e, $30, $08, $00, $18, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $18, $00, $18, $04, $10, $08
.byt $00, $00, $00, $00, $00, $00, $fc, $00
.byt $00, $7e, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $18, $00, $18, $04, $00, $0c
.byt $18, $00, $18, $04, $30, $0c, $30, $08
.byt $30, $08, $60, $18, $60, $10, $00, $30
.byt $7c, $44, $e6, $38, $c6, $31, $c6, $21
.byt $c6, $21, $ce, $29, $7c, $47, $00, $3e
.byt $08, $00, $18, $04, $18, $04, $18, $04
.byt $18, $04, $18, $04, $18, $04, $00, $0c
.byt $fc, $00, $00, $7e, $06, $00, $7c, $07
.byt $c0, $be, $c0, $20, $fe, $00, $00, $7f
.byt $fc, $00, $00, $7e, $06, $00, $3c, $07
.byt $06, $18, $06, $01, $fc, $07, $00, $7e
.byt $c6, $00, $c6, $21, $c0, $23, $7e, $40
.byt $06, $39, $06, $01, $06, $01, $00, $03
.byt $fe, $00, $00, $7f, $c0, $00, $fc, $04
.byt $06, $78, $06, $01, $fc, $07, $00, $7e
.byt $7c, $00, $00, $3e, $c0, $00, $fc, $04
.byt $c6, $38, $c6, $a1, $7c, $07, $00, $3e
.byt $fe, $00, $00, $7f, $06, $00, $06, $01
.byt $06, $01, $06, $01, $06, $01, $00, $03
.byt $7c, $04, $06, $38, $c6, $01, $7c, $47
.byt $c6, $38, $c6, $21, $7c, $47, $00, $3e
.byt $7c, $04, $06, $38, $c6, $01, $7e, $41
.byt $06, $39, $06, $01, $7c, $07, $00, $3e
.byt $00, $00, $00, $00, $30, $00, $00, $18
.byt $00, $00, $30, $00, $00, $18, $00, $00
.byt $00, $00, $00, $00, $30, $00, $00, $18
.byt $00, $00, $30, $00, $20, $18, $00, $10
.byt $00, $00, $18, $00, $30, $0c, $60, $18
.byt $30, $00, $18, $00, $00, $0c, $00, $00
.byt $00, $00, $00, $00, $3c, $00, $00, $1e
.byt $00, $00, $3c, $00, $00, $1e, $00, $00
.byt $00, $00, $30, $00, $18, $00, $0c, $00
.byt $18, $06, $30, $0c, $00, $18, $00, $00
.byt $f8, $08, $0c, $70, $0c, $02, $18, $06
.byt $30, $0c, $00, $18, $30, $00, $00, $18
.byt $7c, $04, $06, $38, $c6, $01, $de, $21
.byt $de, $21, $c0, $2f, $7e, $40, $00, $3f
.byt $7c, $04, $06, $38, $c6, $01, $de, $21
.byt $c6, $29, $c6, $21, $c6, $21, $00, $63
.byt $fc, $04, $06, $78, $c6, $01, $dc, $27
.byt $c6, $28, $c6, $21, $fc, $07, $00, $7e
.byt $7e, $00, $00, $3f, $c0, $00, $c0, $20
.byt $c0, $20, $c0, $20, $7e, $40, $00, $3f
.byt $fc, $00, $06, $7a, $c6, $01, $c6, $21
.byt $c6, $21, $c6, $23, $fc, $03, $00, $7e
.byt $fe, $00, $00, $7f, $c0, $00, $f8, $00
.byt $c0, $3c, $c0, $20, $fe, $00, $00, $7f
.byt $fe, $00, $00, $7f, $c0, $00, $f8, $00
.byt $c0, $3c, $c0, $20, $c0, $20, $00, $60
.byt $7e, $00, $00, $3f, $c0, $00, $ce, $20
.byt $c6, $21, $c6, $21, $7c, $47, $00, $3e
.byt $c6, $00, $06, $61, $c6, $01, $de, $21
.byt $c6, $29, $c6, $21, $c6, $21, $00, $63
.byt $18, $00, $18, $04, $18, $04, $18, $04
.byt $18, $04, $18, $04, $18, $04, $00, $0c
.byt $0c, $00, $0c, $02, $0c, $02, $0c, $02
.byt $0c, $02, $0c, $06, $f8, $06, $00, $7c
.byt $c6, $00, $c6, $21, $c0, $23, $fc, $04
.byt $c6, $38, $c6, $21, $c6, $21, $00, $63
.byt $c0, $00, $00, $60, $c0, $00, $c0, $20
.byt $c0, $20, $c0, $20, $fc, $00, $00, $7e
.byt $fc, $04, $16, $68, $d6, $09, $d6, $29
.byt $c6, $29, $c6, $21, $c6, $21, $00, $63
.byt $fc, $04, $06, $78, $c6, $01, $c6, $21
.byt $c6, $21, $c6, $21, $c6, $21, $00, $63
.byt $7c, $04, $06, $38, $c6, $01, $c6, $21
.byt $c6, $21, $c6, $21, $7c, $47, $00, $3e
.byt $fc, $04, $06, $78, $c6, $01, $c6, $01
.byt $fc, $07, $c0, $3e, $c0, $20, $00, $60
.byt $7c, $00, $06, $3a, $c6, $01, $c6, $21
.byt $c6, $21, $ce, $21, $7e, $41, $00, $3f
.byt $fc, $04, $06, $78, $c6, $01, $fc, $06
.byt $c6, $39, $c6, $21, $c6, $21, $00, $63
.byt $7e, $00, $00, $3f, $c0, $00, $7c, $44
.byt $06, $38, $06, $01, $fc, $07, $00, $7e
.byt $fe, $00, $00, $7f, $18, $00, $18, $04
.byt $18, $04, $18, $04, $18, $04, $00, $0c
.byt $c6, $00, $06, $61, $c6, $01, $c6, $21
.byt $c6, $21, $c6, $21, $7c, $47, $00, $3e
.byt $c6, $00, $06, $61, $c6, $01, $c6, $21
.byt $66, $01, $36, $01, $1e, $01, $00, $0f
.byt $c6, $00, $06, $61, $c6, $01, $d6, $21
.byt $d6, $29, $d6, $29, $7e, $41, $00, $3f
.byt $c6, $00, $06, $61, $c6, $01, $7c, $47
.byt $c6, $38, $c6, $21, $c6, $21, $00, $63
.byt $c6, $00, $06, $61, $c6, $01, $7e, $41
.byt $06, $39, $06, $03, $fc, $03, $00, $7e
.byt $fe, $00, $00, $7f, $06, $00, $7c, $47
.byt $c0, $3e, $c0, $20, $fe, $00, $00, $7f
.byt $3c, $00, $30, $0e, $30, $08, $30, $08
.byt $30, $08, $30, $08, $3c, $00, $00, $1e
.byt $30, $00, $30, $08, $18, $00, $18, $04
.byt $18, $04, $0c, $00, $0c, $02, $00, $06
.byt $3c, $00, $0c, $12, $0c, $02, $0c, $02
.byt $0c, $02, $0c, $02, $3c, $02, $00, $1e
.byt $18, $00, $3c, $24, $66, $18, $00, $33
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $fe, $00, $00, $7f
.byt $30, $00, $18, $00, $18, $04, $00, $0c
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $7c, $04, $06, $38
.byt $7e, $41, $c6, $39, $7e, $41, $00, $3f
.byt $c0, $00, $c0, $20, $fc, $04, $c6, $38
.byt $c6, $21, $c6, $21, $fc, $07, $00, $7e
.byt $00, $00, $00, $00, $7e, $40, $c0, $3f
.byt $c0, $20, $c0, $20, $7e, $40, $00, $3f
.byt $06, $00, $06, $01, $7e, $41, $c6, $39
.byt $c6, $21, $c6, $21, $7e, $41, $00, $3f
.byt $00, $00, $00, $00, $7c, $44, $c6, $38
.byt $de, $21, $c0, $2f, $7e, $40, $00, $3f
.byt $1e, $00, $30, $2f, $30, $08, $3c, $00
.byt $30, $0e, $30, $08, $30, $08, $30, $08
.byt $00, $00, $00, $00, $7e, $40, $c6, $38
.byt $c6, $21, $7e, $41, $06, $39, $7c, $03
.byt $c0, $00, $c0, $20, $fc, $04, $c6, $38
.byt $c6, $21, $c6, $21, $c6, $21, $00, $63
.byt $00, $00, $18, $00, $00, $0c, $18, $00
.byt $18, $04, $18, $04, $18, $04, $00, $0c
.byt $00, $00, $18, $00, $00, $0c, $18, $00
.byt $18, $04, $18, $04, $18, $0c, $30, $0c
.byt $c0, $00, $c6, $20, $c6, $21, $fc, $07
.byt $c6, $38, $c6, $21, $c6, $21, $00, $63
.byt $30, $00, $30, $08, $30, $08, $30, $08
.byt $30, $08, $30, $28, $18, $00, $00, $0c
.byt $00, $00, $00, $00, $fc, $04, $d6, $28
.byt $d6, $29, $d6, $29, $c6, $29, $00, $63
.byt $00, $00, $00, $00, $fc, $04, $c6, $38
.byt $c6, $21, $c6, $21, $c6, $21, $00, $63
.byt $00, $00, $00, $00, $7c, $44, $c6, $38
.byt $c6, $21, $c6, $21, $7c, $47, $00, $3e
.byt $00, $00, $00, $00, $fc, $04, $c6, $38
.byt $c6, $21, $fc, $07, $c0, $3e, $c0, $20
.byt $00, $00, $00, $00, $7e, $40, $c6, $39
.byt $c6, $21, $7e, $41, $06, $39, $06, $01
.byt $00, $00, $00, $00, $7c, $40, $c0, $3e
.byt $c0, $20, $c0, $20, $c0, $20, $00, $60
.byt $00, $00, $00, $00, $7e, $40, $c0, $3f
.byt $7c, $44, $06, $38, $fc, $07, $00, $7e
.byt $30, $00, $30, $08, $3c, $00, $30, $0e
.byt $30, $08, $30, $08, $1e, $10, $00, $0f
.byt $00, $00, $00, $00, $c6, $00, $c6, $21
.byt $c6, $21, $c6, $21, $7c, $47, $00, $3e
.byt $00, $00, $00, $00, $c6, $00, $c6, $21
.byt $66, $01, $36, $01, $1e, $01, $00, $0f
.byt $00, $00, $00, $00, $c6, $00, $d6, $21
.byt $d6, $29, $d6, $29, $7e, $41, $00, $3f
.byt $00, $00, $00, $00, $c6, $00, $c6, $21
.byt $7c, $47, $c6, $38, $c6, $21, $00, $63
.byt $00, $00, $00, $00, $c6, $00, $c6, $21
.byt $7e, $41, $06, $39, $06, $01, $fc, $07
.byt $00, $00, $00, $00, $fe, $00, $06, $79
.byt $7c, $47, $c0, $3e, $fe, $00, $00, $7f
.byt $18, $00, $30, $0c, $30, $08, $70, $08
.byt $30, $08, $30, $08, $18, $00, $00, $0c
.byt $18, $00, $18, $04, $18, $04, $00, $0c
.byt $18, $00, $18, $04, $18, $04, $00, $0c
.byt $30, $00, $18, $00, $18, $04, $1c, $00
.byt $18, $06, $18, $04, $30, $0c, $00, $18
.byt $00, $00, $00, $00, $72, $10, $fe, $01
.byt $9c, $73, $00, $4e, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $30, $00
.byt $48, $10, $48, $24, $30, $04, $00, $18
.byt $3c, $00, $30, $0e, $30, $08, $30, $08
.byt $00, $18, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $0c, $00
.byt $0c, $02, $0c, $02, $3c, $02, $00, $1e
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $30, $00, $18, $00, $0c, $00
.byt $00, $00, $00, $00, $00, $00, $60, $00
.byt $00, $30, $00, $00, $00, $00, $00, $00
.byt $fe, $00, $02, $7d, $7e, $01, $02, $3d
.byt $02, $01, $04, $03, $78, $06, $00, $3c
.byt $00, $00, $00, $00, $7c, $00, $14, $2a
.byt $18, $02, $10, $0c, $20, $08, $00, $10
.byt $00, $00, $00, $00, $08, $00, $10, $04
.byt $70, $08, $10, $28, $10, $08, $00, $08
.byt $00, $00, $00, $00, $10, $00, $7c, $00
.byt $44, $3a, $08, $22, $30, $04, $00, $18
.byt $00, $00, $00, $00, $7c, $00, $10, $2e
.byt $10, $08, $10, $08, $7c, $00, $00, $3e
.byt $00, $00, $00, $00, $08, $00, $7c, $00
.byt $18, $26, $28, $04, $58, $04, $00, $2c
.byt $00, $00, $00, $00, $20, $00, $7c, $00
.byt $24, $1a, $28, $12, $20, $14, $00, $10
.byt $00, $00, $00, $00, $00, $00, $38, $00
.byt $08, $14, $08, $04, $7c, $00, $00, $3e
.byt $00, $00, $00, $00, $78, $00, $08, $34
.byt $38, $04, $08, $14, $7c, $00, $00, $3e
.byt $00, $00, $00, $00, $50, $00, $54, $28
.byt $04, $2a, $08, $02, $30, $04, $00, $18
.byt $00, $00, $00, $00, $00, $00, $1c, $00
.byt $e0, $0e, $00, $70, $00, $00, $00, $00
.byt $fe, $00, $02, $7d, $14, $01, $18, $02
.byt $10, $0c, $10, $08, $20, $08, $00, $10
.byt $04, $00, $08, $02, $30, $04, $d0, $08
.byt $10, $68, $10, $08, $10, $08, $00, $08
.byt $10, $00, $fe, $00, $82, $7d, $82, $41
.byt $02, $41, $04, $01, $38, $02, $00, $1c
.byt $00, $00, $7c, $00, $10, $2e, $10, $08
.byt $10, $08, $10, $08, $fe, $00, $00, $7f
.byt $04, $00, $7e, $00, $0c, $33, $14, $02
.byt $24, $0a, $44, $12, $0c, $22, $00, $06
.byt $20, $00, $20, $10, $fe, $00, $22, $5d
.byt $22, $11, $42, $11, $84, $21, $00, $42
.byt $10, $00, $1c, $00, $70, $0e, $1e, $20
.byt $78, $07, $08, $34, $08, $04, $00, $04
.byt $40, $00, $7e, $00, $42, $3d, $82, $21
.byt $04, $41, $08, $02, $10, $04, $00, $08
.byt $40, $00, $7e, $00, $48, $37, $88, $24
.byt $08, $44, $10, $04, $20, $08, $00, $10
.byt $00, $00, $fe, $00, $02, $7d, $02, $01
.byt $02, $01, $02, $01, $fe, $01, $00, $7f
.byt $44, $00, $fe, $00, $44, $3b, $44, $22
.byt $44, $22, $08, $22, $10, $04, $00, $08
.byt $e0, $00, $00, $70, $e2, $00, $04, $71
.byt $08, $02, $30, $04, $c0, $18, $00, $60
.byt $fc, $00, $04, $7a, $04, $02, $08, $02
.byt $18, $04, $24, $08, $c2, $10, $00, $61
.byt $20, $00, $20, $10, $fe, $00, $22, $5d
.byt $24, $11, $20, $12, $1c, $00, $00, $0e
.byt $84, $00, $84, $42, $84, $42, $04, $42
.byt $08, $02, $08, $04, $10, $04, $00, $08
.byt $40, $00, $7e, $00, $42, $3d, $9a, $21
.byt $04, $49, $08, $02, $30, $04, $00, $18
.byt $0c, $00, $70, $0e, $10, $28, $fe, $00
.byt $10, $6f, $10, $08, $20, $08, $00, $10
.byt $52, $00, $52, $29, $52, $29, $04, $29
.byt $04, $02, $08, $02, $10, $04, $00, $08
.byt $7c, $00, $00, $3e, $fe, $00, $10, $6f
.byt $10, $08, $10, $08, $20, $08, $00, $10
.byt $20, $00, $20, $10, $30, $00, $28, $10
.byt $20, $14, $20, $10, $20, $10, $00, $10
.byt $10, $00, $10, $08, $fe, $00, $10, $6f
.byt $10, $08, $10, $08, $20, $08, $00, $10
.byt $00, $00, $7c, $00, $00, $3e, $00, $00
.byt $00, $00, $fe, $00, $00, $7f, $00, $00
.byt $fc, $00, $04, $7a, $24, $02, $18, $02
.byt $0c, $00, $12, $04, $e0, $09, $00, $70
.byt $10, $00, $7c, $00, $04, $3a, $18, $02
.byt $f6, $08, $10, $6b, $10, $08, $00, $08
.byt $02, $00, $02, $01, $02, $01, $04, $01
.byt $04, $02, $08, $02, $10, $04, $00, $08
.byt $44, $00, $44, $20, $42, $20, $42, $21
.byt $42, $21, $82, $21, $82, $41, $00, $41
.byt $80, $00, $80, $40, $98, $40, $e0, $0c
.byt $80, $70, $80, $40, $7e, $00, $00, $3f
.byt $fe, $00, $02, $7d, $02, $01, $04, $01
.byt $04, $02, $18, $02, $e0, $0c, $00, $70
.byt $00, $00, $10, $00, $28, $00, $44, $10
.byt $02, $20, $00, $01, $00, $00, $00, $00
.byt $10, $00, $10, $08, $fe, $00, $10, $6f
.byt $54, $08, $92, $28, $10, $49, $00, $08
.byt $fe, $00, $02, $7d, $04, $01, $28, $02
.byt $10, $04, $08, $00, $00, $04, $00, $00
.byt $78, $00, $06, $38, $00, $03, $38, $00
.byt $04, $18, $78, $02, $06, $38, $00, $03
.byt $20, $00, $20, $10, $20, $10, $48, $10
.byt $44, $20, $8e, $20, $f2, $05, $00, $79
.byt $04, $00, $04, $02, $34, $02, $0c, $12
.byt $0a, $04, $10, $05, $60, $08, $00, $30
.byt $7c, $00, $20, $1e, $20, $10, $fe, $00
.byt $20, $5f, $20, $10, $1e, $00, $00, $0f
.byt $40, $00, $4e, $20, $f2, $05, $24, $59
.byt $20, $12, $10, $00, $10, $08, $00, $08
.byt $00, $00, $7c, $00, $04, $3a, $04, $02
.byt $04, $02, $fe, $00, $00, $7f, $00, $00
.byt $fe, $00, $02, $7d, $02, $01, $1e, $01
.byt $02, $0d, $02, $01, $7e, $01, $00, $3f
.byt $7c, $00, $00, $3e, $fe, $00, $02, $7d
.byt $02, $01, $04, $01, $38, $02, $00, $1c
.byt $44, $00, $44, $22, $44, $22, $44, $22
.byt $04, $22, $08, $02, $10, $04, $00, $08
.byt $28, $00, $28, $14, $28, $14, $28, $14
.byt $28, $14, $4a, $14, $8c, $21, $00, $46
.byt $80, $00, $80, $40, $80, $40, $84, $40
.byt $88, $42, $90, $44, $e0, $08, $00, $70
.byt $00, $00, $fe, $00, $82, $7d, $82, $41
.byt $82, $41, $82, $41, $fe, $01, $00, $7f
.byt $fe, $00, $82, $7d, $82, $41, $02, $41
.byt $04, $01, $08, $02, $30, $04, $00, $18
.byt $e0, $00, $02, $70, $02, $01, $02, $01
.byt $04, $01, $18, $02, $e0, $0c, $00, $70
.byt $20, $00, $90, $00, $40, $08, $00, $20
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $60, $00, $90, $20, $90, $48, $60, $08
.byt $00, $30, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00
.byt $00, $00, $00, $00, $00, $00, $00, $00

73
snes/header.a65 Normal file
View File

@ -0,0 +1,73 @@
; This file is part of the snescom-asm demo - a demo of how to build a SNES program.
; See http://bisqwit.iki.fi/source/snescom.html for details.
; Begin assembling to this address.
*= $C0FF00
RESET:
sei: clc: xce
jmp @GAME_MAIN
NMI_16bit:
php
rep #$30
pha: phx: phy: phd: phb
jsl @NMI_ROUTINE
rep #$30
int_exit:
plb: pld: ply: plx: pla
plp
rti
IRQ_16bit:
php
rep #$30
pha: phx: phy: phd: phb
jsl @IRQ_ROUTINE
bra int_exit
;error vectors
ABT_8bit: ABT_16bit:
BRK_8bit: BRK_16bit:
COP_8bit: COP_16bit:
IRQ_8bit:
NMI_8bit:
- lda $ABCDEF : bra -
*= $C0FFB0
; Zero the area from $FFB0 - $FFFF
; to ensure that the linker won't get clever
; and fill it with small pieces of code.
.word 0,0,0,0, 0,0,0,0
.word 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
.word 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0
*= $C0FFB0
.byt "01" ;2 bytes - company id
.byt "SNSD" ;4 bytes - rom id
*= $C0FFC0
.byt "SD2SNES MAIN MENU "
;123456789012345678901; - max 21 chars
*= $C0FFD5 .byt $31 ;rom speed
*= $C0FFD6 .byt $02 ;rom type
*= $C0FFD7 .byt $06 ;rom size 64 kByte
*= $C0FFD8 .byt $03 ;sram size 8 kBit
*= $C0FFD9 .byt $09 ;rom region 4 = Finland
*= $C0FFDA .byt $33 ;company id flag
*= $C0FFDC .word 0,0 ;checksums
*= $C0FFE4 .word COP_16bit
*= $C0FFE6 .word BRK_16bit
*= $C0FFE8 .word ABT_16bit
*= $C0FFEA .word NMI_16bit
*= $C0FFEE .word IRQ_16bit
*= $C0FFF4 .word COP_8bit
*= $C0FFF8 .word ABT_8bit
*= $C0FFFA .word NMI_8bit
*= $C0FFFC .word RESET
*= $C0FFFE .word BRK_8bit
*= $C0FFFE .word IRQ_8bit

2496
snes/logo.a65 Normal file

File diff suppressed because it is too large Load Diff

249
snes/main.a65 Normal file
View File

@ -0,0 +1,249 @@
GAME_MAIN:
jsr snes_init
jsr font_dma
jsr tests
- wai
bra -
font_dma:
sep #$20 : .as
rep #$10 : .xl
stz $420b
stz $420c
lda #$01 ;A to B; (direct); non-fixed, inc, two reg
sta $4300 ;to DMA ch.0 ctrl
lda #^font ;font source bank
ldy #!font ;font source address
sty $4302 ;address -> 4302,4303
sta $4304 ;bank -> 4304
ldx #$1000 ;transfer size
stx $4305 ;to reg
stz $2116 ;VRAM address 0
stz $2117 ;
lda #$18 ;VRAM data port
sta $4301 ;to channel 0 tgt address
lda #$01 ;ch 0 enable
sta $420b ;GPDMA GO!
lda #$09 ;A to B; fixed, two reg
sta $4300
lda #^zero
ldy #!zero
sty $4302
sta $4304
ldx #$1000
stx $4305 ;zero 4096b of VRAM
ldx #$3000
stx $2116 ;from 0x6000-0x6fff
lda #$18 ;VRAM data port
sta $4301 ;to channel 0 tgt address
lda #$01
sta $420b
; copy logo
lda #$01 ;A to B; (direct); non-fixed, inc, two reg
sta $4300 ;to DMA ch.0 ctrl
lda #^logo ;font source bank
ldy #!logo ;font source address
sty $4302 ;address -> 4302,4303
sta $4304 ;bank -> 4304
ldx #$4b00 ;transfer size
stx $4305 ;to reg
ldx #$800 ;after font
stx $2116 ;VRAM address 0x1000
lda #$18 ;VRAM data port
sta $4301 ;to channel 0 tgt address
lda #$01 ;ch 0 enable
sta $420b ;GPDMA GO!
; copy logo tilemap
lda #$01 ;A to B; (direct); non-fixed, inc, two reg
sta $4300 ;to DMA ch.0 ctrl
lda #^logomap ;font source bank
ldy #!logomap ;font source address
sty $4302 ;address -> 4302,4303
sta $4304 ;bank -> 4304
ldx #$300 ;transfer size
stx $4305 ;to reg
ldx #$3400 ;BG1 tilemap
stx $2116 ;VRAM address 0x6800
lda #$18 ;VRAM data port
sta $4301 ;to channel 0 tgt address
lda #$01 ;ch 0 enable
sta $420b ;GPDMA GO!
;copy test text
lda #$00 ;A->B, inc, 1 reg
sta $4300
lda #^hello
ldy #!hello
sty $4302
sta $4304
ldx #$c ;24 bytes
stx $4305
ldx #$3020
stx $2116
lda #$18
sta $4301
stz $2115 ;increment after LOW byte (write to 2118)
lda #$01
sta $420b
lda #$08 ;A->B, fixed, 1 reg
sta $4300
lda #^bg2tile
ldy #!bg2tile
sty $4302
sta $4304
ldx #$c ;24 bytes
stx $4305
ldx #$3020
stx $2116
lda #$19
sta $4301
lda #$80
sta $2115 ;increment after HIGH byte (write to 2119)
lda #$01
sta $420b
stz $2121 ;palette index 0
lda #$00
sta $4300
lda #^palette
ldy #!palette
sty $4302
sta $4304
ldx #$200
stx $4305
lda #$22 ;CG RAM port
sta $4301
lda #$01
sta $420b
rts
tests:
sep #$30 : .as : .xs ;8-bit accumulator and index
lda #$0f
sta $2100 ;screen on, full brightness
lda #$04 ;mode 4, mode 5 is a bitch :(
sta $2105
lda #$34 ;Tilemap addr 0x6800
sta $2107 ;for BG1
lda #$30 ;Tilemap addr 0x6000
sta $2108 ;for BG2
lda #$03 ;enable BG1+BG2
sta $212c ;BG Main
sta $212d ;BG Sub
lda #$00 ;224
sta $2133 ;
lda #$00
sta $2130
stz $2121
lda #$0
ldx #$0
ldy #$0
- bra -
-
inx
bne +
iny
+
stz $2121
stx $2122
sty $2122
bra -
rts
snes_init:
sep #$20 : .as ;8-bit accumulator
lda #$01
sta $420d ; FAAAAAST
lda #$8f
sta $2100 ;INIDISP: force blank
stz $2101 ;
stz $2102 ;
stz $2103 ;
stz $2104 ; (OAM Data?!)
stz $2104 ; (OAM Data?!)
stz $2105 ;
stz $2106 ;
stz $2107 ;
stz $2108 ;
stz $2109 ;
stz $210a ;
stz $210b ;
stz $210c ;
stz $210d ;
stz $210d ;
stz $210e ;
stz $210e ;
stz $210f ;
stz $210f ;
lda #$00
sta $2110 ;
stz $2110 ;
stz $2111 ;
stz $2111 ;
stz $2112 ;
stz $2112 ;
stz $2113 ;
stz $2113 ;
stz $2114 ;
stz $2114 ;
lda #$80
sta $2115 ;
stz $2116 ;
stz $2117 ;
stz $2118 ;(VRAM Data?!)
stz $2119 ;(VRAM Data?!)
stz $211a ;
stz $211b ;
lda #$01
sta $211b ;
stz $211c ;
stz $211c ;
stz $211d ;
stz $211d ;
stz $211e ;
sta $211e ;
stz $211f ;
stz $211f ;
stz $2120 ;
stz $2120 ;
stz $2121 ;
stz $2122 ; (CG Data?!)
stz $2123 ;
stz $2124 ;
stz $2125 ;
stz $2126 ;
stz $2127 ;
stz $2128 ;
stz $2129 ;
stz $212a ;
stz $212b ;
stz $212c ;
stz $212d ;
stz $212e ;
lda #$30
sta $2130 ;
stz $2131 ;
lda #$e0
sta $2132 ;
stz $2133 ;
stz $4200 ;
lda #$ff
sta $4201 ;
stz $4202 ;
stz $4203 ;
stz $4204 ;
stz $4205 ;
stz $4206 ;
stz $4207 ;
stz $4208 ;
stz $4209 ;
stz $420a ;
stz $420b ;
stz $420c ;
rts

64
snes/palette.a65 Normal file
View File

@ -0,0 +1,64 @@
palette .byt $00, $00, $ff, $7f, $00, $00, $18, $63
.byt $60, $2d, $df, $6b, $70, $05, $7f, $4f
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $10, $42, $10, $42, $10, $42, $10, $42
.byt $83, $52, $ae, $77, $8e, $73, $c5, $5a
.byt $ce, $7b, $81, $10, $a1, $14, $c1, $18
.byt $61, $0c, $41, $08, $23, $25, $6b, $6f
.byt $ad, $77, $63, $2d, $66, $4e, $27, $46
.byt $49, $6b, $e6, $3d, $e3, $41, $c6, $72
.byt $04, $4e, $05, $7f, $a6, $66, $e5, $7a
.byt $86, $62, $05, $46, $26, $52, $e6, $76
.byt $26, $4e, $87, $5e, $65, $5a, $06, $7f
.byt $67, $5a, $a7, $6a, $c2, $41, $a2, $2d
.byt $c4, $41, $24, $5a, $05, $52, $26, $56
.byt $a2, $3d, $4a, $2d, $6c, $31, $dc, $1c
.byt $bf, $14, $35, $29, $9f, $14, $37, $29
.byt $7f, $10, $31, $29, $6a, $2d, $17, $25
.byt $67, $2d, $2f, $25, $11, $21, $11, $25
.byt $4a, $29, $bc, $18, $31, $25, $bf, $18
.byt $65, $31, $6c, $2d, $6d, $2d, $8b, $31
.byt $51, $29, $fb, $20, $c4, $39, $68, $2e
.byt $e4, $2d, $a1, $31, $81, $2d, $0d, $2b
.byt $2e, $27, $eb, $26, $67, $2a, $c4, $29
.byt $61, $29, $ec, $2a, $6f, $23, $6f, $27
.byt $4e, $27, $0c, $27, $a9, $26, $06, $2a
.byt $cb, $2e, $69, $2e, $e5, $2d, $06, $32
.byt $28, $36, $ac, $26, $c4, $31, $28, $32
.byt $67, $19, $c6, $6e, $c3, $3d, $4f, $29
.byt $f4, $20, $f8, $20, $45, $29, $53, $29
.byt $bd, $18, $88, $31, $18, $21, $9f, $10
.byt $73, $2d, $d1, $18, $d9, $1c, $fa, $1c
.byt $a3, $29, $82, $29, $41, $25, $89, $26
.byt $23, $1d, $0e, $27, $6b, $22, $87, $19
.byt $2e, $23, $c9, $1d, $cd, $21, $f6, $1e
.byt $ac, $22, $30, $22, $ff, $17, $8a, $15
.byt $ff, $1b, $5a, $1f, $ac, $19, $b4, $1e
.byt $7b, $1f, $28, $15, $cd, $19, $71, $1e
.byt $b5, $1e, $d5, $1a, $73, $1e, $ee, $1d
.byt $8b, $19, $e6, $10, $39, $1f, $31, $22
.byt $28, $19, $df, $1b, $93, $1a, $9c, $1f
.byt $ca, $18, $d7, $1c, $ce, $18, $aa, $14
.byt $88, $10, $b8, $18, $cc, $18, $9b, $14
.byt $c8, $18, $a6, $14, $81, $14, $01, $1d
.byt $f7, $1e, $0f, $1e, $18, $23, $ff, $13
.byt $48, $15, $8a, $1d, $9c, $1b, $bd, $1b
.byt $30, $1e, $48, $19, $a1, $18, $a1, $10
.byt $61, $10, $c3, $39, $c8, $5a, $2a, $67
.byt $6c, $6f, $c6, $5a, $4b, $6b, $29, $67
.byt $e7, $5e, $a5, $56, $e1, $3d, $64, $4e
.byt $c1, $39, $a6, $56, $a1, $35, $65, $4e
.byt $61, $2d, $81, $31, $01, $42, $e3, $3d
.byt $85, $52, $08, $63, $e8, $5e, $25, $46
.byt $8d, $73, $09, $63, $84, $52, $03, $42
.byt $63, $4e, $23, $46, $62, $4e, $22, $46
.byt $41, $29, $21, $25, $04, $42, $a8, $56
.byt $87, $52, $e4, $3d, $0a, $63, $21, $46
.byt $a4, $56, $01, $21, $e1, $1c, $a3, $35

132
snes/reset.a65 Normal file
View File

@ -0,0 +1,132 @@
; This file is part of the snescom-asm demo - a demo of how to build a SNES program.
; See http://bisqwit.iki.fi/source/snescom.html for details.
#include "memmap.i65"
#define TILE_ADDR_REG_VAL(addr, scsize) \
(((addr & $FC00) >> 8) + scsize)
#define BMAP_ADDR_REG_VAL(addr, addr2) \
(((addr & $F000) >> 12) | (((addr2 & $F000) >> 12) << 4))
; NMI - called once per screen refresh (or something like that)
NMI_ROUTINE:
sep #$20 : .as
lda $4210
rtl
; IRQ - called when triggered (which is..?)
IRQ_ROUTINE:
sep #$20 : .as
lda $4211 ;Acknowledge irq
rtl
; To be called regularly - updated screen contents
; Sends the palette structure to PPU
PaletteDMA:
.xl : .as
lda #$00 : sta $4300 ;dma type
lda #$22 : sta $4301 ;address $2122
lda #^(PALETTE_ADDRESS) : sta $4304
ldx #!(PALETTE_ADDRESS) : stx $4302
ldx #512 : stx $4305 ; size: 16*2*16 bytes.
lda #$00 : sta $2121 ;Write CGRAM address (0)
lda #$01 : sta $420B ;Activate dma 0
rts
; Sends the video buffer contents to PPU
VRAMdma:
sty $2116 ;Write VRAM address
sty $4302 : sta $4304 ;Write DMA address
stx $4305 ;Write size
lda #$80 : sta $2115 ;PPU programming
lda #$01 : sta $4300 ;dma type
lda #$18 : sta $4301 ;address $2118
lda #$01 : sta $420B ;Activate DMA 0
rts
; Jumped to from snesheader.a65 - when the game is reseted.
RESET_GAME:
rep #$30 : .al : .xl
lda #$0400 : tcd
ldx #$03FE : txs
sep #$20 : .as
pha
plb
lda #$01
sta $420D ; set "fast" mode
; Next initialize screen
jsr InitializeScreen
jsr InitializeIRQ
sep #$20 : .as
;lda #$17
lda #$03
sta $212C ; put screens on
sta $212D ; put screens on
lda #$00: sta $2121
lda #$E0: sta $2122
lda #$7C: sta $2122
jmp @GAME_MAIN
InitializeIRQ:
sep #$20 : .as
lda #$B1 : sta $4200
ldx #0 : stx $4207
ldx #211 : stx $4209
sei
lda $4211
- lda $4210 ;: bpl -
rts
InitializeScreen:
rep #$10 : .xl
sep #$20 : .as
lda #$00 : sta $2101
ldx #$0000 : stx $2102
lda #$09 : sta $2105 ; select screen mode 1.
lda #$00 : sta $2106
lda #TILE_ADDR_REG_VAL(BG1_TILE_ADDR, 0) : sta $2107
lda #TILE_ADDR_REG_VAL(BG2_TILE_ADDR, 0) : sta $2108
lda #TILE_ADDR_REG_VAL(BG3_TILE_ADDR, 0) : sta $2109
lda #TILE_ADDR_REG_VAL(BG4_TILE_ADDR, 0) : sta $210A
lda #BMAP_ADDR_REG_VAL(BG1_BMAP_ADDR, BG2_BMAP_ADDR) : sta $210B
lda #BMAP_ADDR_REG_VAL(BG3_BMAP_ADDR, BG4_BMAP_ADDR) : sta $210C
; Set scrolling to 0,0 to all bgs
lda #$00 : sta $210D : sta $210D
lda #$00 : sta $210E : sta $210E
lda #$00 : sta $210F : sta $210F
lda #$00 : sta $2110 : sta $2110
lda #$00 : sta $2111 : sta $2111
lda #$00 : sta $2112 : sta $2112
lda #$00 : sta $2113 : sta $2113
lda #$00 : sta $2114 : sta $2114
rts

View File

@ -308,10 +308,10 @@ endif
# Type: avrdude -c ?
# to get a full listing.
#
AVRDUDE_PROGRAMMER = stk200
AVRDUDE_PROGRAMMER = dragon_isp
# com1 = serial port. Use lpt1 to connect to parallel port.
AVRDUDE_PORT = /dev/parport0 # programmer connected to serial device
AVRDUDE_PORT = usb # programmer connected to serial device
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
# AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep

View File

@ -35,7 +35,7 @@ CONFIG_UART_BAUDRATE=38400
CONFIG_UART_BUF_SHIFT=7
CONFIG_HARDWARE_NAME=sd2snes
CONFIG_SD_AUTO_RETRIES=10
CONFIG_SD_DATACRC=y
#CONFIG_SD_DATACRC=y
CONFIG_EEPROM_SIZE=512
CONFIG_EEPROM_OFFSET=512
CONFIG_MAX_PARTITIONS=1

View File

@ -1488,7 +1488,6 @@ FRESULT f_open (
dir[DIR_Attr] = 0; /* Reset attribute */
ps = get_fattime();
ST_DWORD(&dir[DIR_CrtTime], ps); /* Created time */
sync(fs); /* not sure if this is needed in all cases, but kept */
mode |= FA__WRITTEN; /* Set file changed flag */
}
}
@ -1504,6 +1503,8 @@ FRESULT f_open (
}
fp->dir_sect = FSBUF.sect; /* Pointer to the directory entry */
/* Moved sync from mode & FA_CREATE_ALWAYS because it can reset FSBUF.sect */
sync(fs); /* not sure if this is needed in all cases, but kept */
fp->dir_ptr = dir;
#endif
fp->flag = mode; /* File access mode */
@ -1533,6 +1534,26 @@ FRESULT l_opencluster (
return FR_OK;
}
FRESULT l_openfilebycluster (
FATFS *fs, /* Pointer to file system object */
FIL *fp, /* Pointer to the blank file object */
const UCHAR *path,
DWORD clust, /* Cluster number to be opened */
DWORD fsize /* File size to be assumed */
)
{
auto_mount(&path, &fs, 0);
fp->flag = FA_READ;
fp->org_clust = clust;
fp->fsize = fsize;
fp->fptr = 0;
fp->csect = 1;
fp->fs = fs;
return FR_OK;
}
/*-----------------------------------------------------------------------*/

View File

@ -315,6 +315,7 @@ FRESULT f_chdir (const UCHAR*); /* Change current di
/* Low Level functions */
FRESULT l_opendir(FATFS* fs, DWORD cluster, DIR *dirobj); /* Open an existing directory by its start cluster */
FRESULT l_opencluster(FATFS *fs, FIL *fp, DWORD clust); /* Open a cluster by number as a read-only file */
FRESULT l_openfilebycluster(FATFS *fs, FIL *fp, const UCHAR *path, DWORD clust, DWORD fsize); /* Open a file by its start cluster using supplied file size */
FRESULT l_getfree (FATFS*, const UCHAR*, DWORD*, DWORD); /* Get number of free clusters on the drive, limited */
#if _USE_STRFUNC

View File

@ -1,6 +1,7 @@
// insert cool lengthy disclaimer here
// fileops.c: convenience
#include <util/delay.h>
#include "config.h"
#include "uart.h"
#include "ff.h"
@ -14,6 +15,9 @@ void file_init() {
f_mount(0, &fatfs);
}
void file_open_by_filinfo(FILINFO* fno) {
file_res = l_openfilebycluster(&fatfs, &file_handle, (UCHAR*)"", fno->clust, fno->fsize);
}
void file_open(char* filename, BYTE flags) {
file_res = f_open(&file_handle, (unsigned char*)filename, flags);
}
@ -37,8 +41,12 @@ UINT file_write() {
UINT file_readblock(void* buf, uint32_t addr, uint16_t size) {
UINT bytes_read;
file_res = f_lseek(&file_handle, addr);
if(file_res) return 0;
if(file_handle.fptr != addr) {
return 0;
}
if(file_res) { dprintf("no lseek %d\n", file_res); _delay_ms(30); return 0;}
file_res = f_read(&file_handle, buf, size, &bytes_read);
if(file_res) { dprintf("no read %d\n", file_res); _delay_ms(30); }
return bytes_read;
}

View File

@ -12,6 +12,7 @@ FRESULT file_res;
void file_init(void);
void file_open(char* filename, BYTE flags);
void file_open_by_filinfo(FILINFO* fno);
void file_close(void);
UINT file_read(void);
UINT file_write(void);

127
src/filetypes.c Normal file
View File

@ -0,0 +1,127 @@
// insert cool lengthy disclaimer here
#include <stdio.h>
#include <string.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
#include "config.h"
#include "uart.h"
#include "filetypes.h"
#include "ff.h"
#include "smc.h"
#include "fileops.h"
#include "crc16.h"
#include "memory.h"
uint16_t scan_dir(char* path, char mkdb) {
DIR dir;
FILINFO fno;
FRESULT res;
int len;
unsigned char* fn;
static unsigned char lfn[256];
static unsigned char depth = 0;
static uint16_t crc;
static uint32_t db_tgt;
if(depth==0) {
crc = 0;
db_tgt = SRAM_WORK_ADDR+0x10;
}
// dprintf("path=%s depth=%d ptr=%lx\n", path, depth, db_tgt);
// _delay_ms(50);
fno.lfn = lfn;
res = f_opendir(&dir, (unsigned char*)path);
if (res == FR_OK) {
len = strlen((char*)path);
for (;;) {
res = f_readdir(&dir, &fno);
if (res != FR_OK || fno.fname[0] == 0) break;
fn = *fno.lfn ? fno.lfn : fno.fname;
// dprintf("%s\n", fn);
// _delay_ms(100);
if (*fn == '.') continue;
if (fno.fattrib & AM_DIR) {
path[len]='/';
strncpy(path+len+1, (char*)fn, sizeof(fs_path)-len);
depth++;
scan_dir(path, mkdb);
depth--;
path[len]=0;
// if (res != FR_OK) {
// break;
// }
} else {
SNES_FTYPE type = determine_filetype((char*)fn);
if(type != TYPE_UNKNOWN) {
if(mkdb) {
snes_romprops_t romprops;
path[len]='/';
strncpy(path+len+1, (char*)fn, sizeof(fs_path)-len);
switch(type) {
case TYPE_SMC:
file_open_by_filinfo(&fno);
if(file_res){
dprintf("ZOMG NOOOO %d\n", file_res);
_delay_ms(30);
}
smc_id(&romprops);
file_close();
dprintf("%lx\n", db_tgt);
// _delay_ms(30);
sram_writeblock((uint8_t*)&romprops, db_tgt, sizeof(romprops));
sram_writeblock(path, db_tgt + sizeof(romprops), 256);
db_tgt += 0x140;
break;
case TYPE_UNKNOWN:
default:
break;
}
path[len]=0;
// dprintf("%s ", path);
// _delay_ms(30);
}
unsigned char* sfn = fno.fname;
while(*sfn != 0) {
crc += crc16_update(crc, sfn++, 1);
}
}
// dprintf("%s/%s\n", path, fn);
// _delay_ms(50);
// _delay_ms(10);
}
}
} else uart_putc(0x30+res);
// dprintf("%x\n", crc);
// _delay_ms(50);
sram_writeblock(&db_tgt, SRAM_WORK_ADDR+4, sizeof(db_tgt));
return crc;
}
SNES_FTYPE determine_filetype(char* filename) {
char* ext = strrchr(filename, '.');
if(ext == NULL)
return TYPE_UNKNOWN;
if(!strcasecmp_P(ext+1, PSTR("SMC"))) {
return TYPE_SMC;
}/* later
if(!strcasecmp_P(ext+1, PSTR("SRM"))) {
return TYPE_SRM;
}
if(!strcasecmp_P(ext+1, PSTR("SPC"))) {
return TYPE_SPC;
}*/
return TYPE_UNKNOWN;
}
FRESULT get_db_id(uint16_t* id) {
file_open("/sd2snes/sd2snes.db", FA_READ);
if(file_res == FR_OK) {
file_readblock(id, 0, 2);
/* XXX */// *id=0xdead;
file_close();
} else {
*id=0xdead;
}
return file_res;
}

22
src/filetypes.h Normal file
View File

@ -0,0 +1,22 @@
// insert cool lengthy disclaimer here
// filetypes.h: fs scanning and file identification
#ifndef FILETYPES_H
#define FILETYPES_H
#include "ff.h"
typedef enum {
TYPE_UNKNOWN = 0, /* 0 */
TYPE_SMC, /* 1 */
TYPE_SRM, /* 2 */
TYPE_SPC /* 3 */
} SNES_FTYPE;
char fs_path[256];
SNES_FTYPE determine_filetype(char* filename);
//uint32_t scan_fs();
uint16_t scan_dir(char* path, char mkdb);
FRESULT get_db_id(uint16_t*);
#endif

View File

@ -37,6 +37,11 @@ void spi_sd(void) {
SPI_SS_LOW();
}
void spi_none(void) {
FPGA_SS_HIGH();
SPI_SS_HIGH();
}
void fpga_spi_init(void) {
DDRC = _BV(PC7);
FPGA_SS_HIGH();
@ -48,7 +53,7 @@ void set_avr_addr(uint32_t address) {
spiTransferByte((address>>16)&0xff);
spiTransferByte((address>>8)&0xff);
spiTransferByte((address)&0xff);
spi_sd();
spi_none();
}
void set_saveram_mask(uint32_t mask) {
@ -57,7 +62,7 @@ void set_saveram_mask(uint32_t mask) {
spiTransferByte((mask>>16)&0xff);
spiTransferByte((mask>>8)&0xff);
spiTransferByte((mask)&0xff);
spi_sd();
spi_none();
}
void set_rom_mask(uint32_t mask) {
@ -66,5 +71,5 @@ void set_rom_mask(uint32_t mask) {
spiTransferByte((mask>>16)&0xff);
spiTransferByte((mask>>8)&0xff);
spiTransferByte((mask)&0xff);
spi_sd();
spi_none();
}

View File

@ -7,6 +7,7 @@ void fpga_spi_init(void);
void fpga_spi_test(void);
void spi_fpga(void);
void spi_sd(void);
void spi_none(void);
void set_avr_addr(uint32_t);
void set_saveram_mask(uint32_t);
void set_rom_mask(uint32_t);

View File

@ -127,7 +127,7 @@ int main(void) {
#ifdef CLOCK_PRESCALE
clock_prescale_set(CLOCK_PRESCALE);
#endif
spi_none();
snes_reset(1);
uart_init();
sei(); // suspected to reset the AVR when inserting an SD card
@ -145,20 +145,14 @@ int main(void) {
uart_putc('W');
fpga_init();
fpga_pgm("/sd2snes/main.bit");
_delay_ms(100);
fpga_spi_init();
uart_putc('!');
_delay_ms(100);
set_avr_ena(0);
snes_reset(1);
uart_putc('(');
load_rom("/test.smc");
uart_putc(')');
uart_putc('[');
load_sram("/test.srm");
uart_putc(']');
*fs_path=0;
*fs_path=0;
uint16_t curr_dir_id = scan_dir(fs_path, 0); // generate files footprint
dprintf("curr dir id = %x\n", curr_dir_id);
uint16_t saved_dir_id;
@ -169,10 +163,21 @@ int main(void) {
dprintf("rebuilding database...");
_delay_ms(50);
curr_dir_id = scan_dir(fs_path, 1); // then rebuild database
sram_writeblock(&curr_dir_id, 0x600000, 2);
save_sram("/sd2snes/sd2snes.db", 0x10000, 0x600000);
sram_writeblock(&curr_dir_id, SRAM_WORK_ADDR, 2);
uint32_t endaddr;
sram_readblock(&endaddr, SRAM_WORK_ADDR+4, 4);
dprintf("%lx\n", endaddr);
save_sram("/sd2snes/sd2snes.db", endaddr-SRAM_WORK_ADDR, SRAM_WORK_ADDR);
dprintf("done\n");
}
uart_putc('[');
load_sram("/test.srm");
uart_putc(']');
uart_putc('(');
load_rom("/test.smc");
uart_putc(')');
set_busy_led(0);
set_avr_ena(1);
@ -211,7 +216,7 @@ while(1) {
}
// set_avr_bank(3);
}
spi_sd();
spi_none();
}
while(1);
}

View File

@ -29,20 +29,22 @@ void sram_readblock(void* buf, uint32_t addr, uint16_t size) {
while(count--) {
*(tgt++) = spiTransferByte(0x00);
}
spi_sd();
spi_none();
}
void sram_writeblock(void* buf, uint32_t addr, uint16_t size) {
uint16_t count=size;
uint8_t* src = buf;
uint16_t count=size>>1;
uint16_t* src = buf;
set_avr_addr(addr);
spi_fpga();
spiTransferByte(0x91); // WRITE
while(count--) {
spiTransferByte(*src++);
spiTransferByte((*src)>>8);
spiTransferByte((*src)&0xff);
src++;
}
spiTransferByte(0x00); // dummy
spi_sd();
spi_none();
}
uint32_t load_rom(char* filename) {
@ -79,13 +81,14 @@ uint32_t load_rom(char* filename) {
FPGA_SS_HIGH();
}
file_close();
spi_none();
set_avr_mapper(romprops.mapper_id);
uart_puthex(romprops.header.map);
uart_putc(0x30+romprops.mapper_id);
uint32_t rammask;
uint32_t rommask;
if(filesize > (romprops.romsize_bytes + romprops.offset)) {
romprops.romsize_bytes <<= 1;
}
@ -141,7 +144,7 @@ void save_sram(char* filename, uint32_t sram_size, uint32_t base_addr) {
uint32_t count = 0;
uint32_t num = 0;
spi_sd();
spi_none();
file_open(filename, FA_CREATE_ALWAYS | FA_WRITE);
if(file_res) {
uart_putc(0x30+file_res);
@ -155,7 +158,7 @@ void save_sram(char* filename, uint32_t sram_size, uint32_t base_addr) {
file_buf[j] = spiTransferByte(0x00);
count++;
}
spi_sd();
spi_none();
num = file_write();
if(file_res) {
uart_putc(0x30+file_res);
@ -171,15 +174,13 @@ uint32_t calc_sram_crc(uint32_t base_addr, uint32_t size) {
uint16_t crc;
crc=0;
set_avr_addr(base_addr);
SPI_SS_HIGH();
FPGA_SS_HIGH();
FPGA_SS_LOW();
spi_fpga();
spiTransferByte(0x81);
spiTransferByte(0x00);
for(count=0; count<size; count++) {
data = spiTransferByte(0);
crc += crc16_update(crc, &data, 1);
}
FPGA_SS_HIGH();
spi_none();
return crc;
}

View File

@ -3,6 +3,9 @@
#ifndef MEMORY_H
#define MEMORY_H
#define SRAM_WORK_ADDR (0x100000L)
uint32_t load_rom(char* filename);
uint32_t load_sram(char* filename);
void sram_readblock(void* buf, uint32_t addr, uint16_t size);

View File

@ -58,12 +58,16 @@ void smc_id(snes_romprops_t* props) {
snes_header_t* header = &(props->header);
for(uint8_t num = 0; num < 6; num++) {
file_readblock(header, hdr_addr[num], sizeof(snes_header_t));
if(file_res) {
if(!file_readblock(header, hdr_addr[num], sizeof(snes_header_t))
|| file_res) {
// dprintf("uh oh... %d\n", file_res);
// _delay_ms(30);
score = 0;
} else {
score = smc_headerscore(header);
}
// dprintf("%d: offset = %lX; score = %d\n", num, hdr_addr[num], score);
// _delay_ms(100);
if(score>=maxscore) {
score_idx=num;
maxscore=score;
@ -77,6 +81,8 @@ void smc_id(snes_romprops_t* props) {
}
// restore the chosen one
// dprintf("winner is %d\n", score_idx);
// _delay_ms(30);
file_readblock(header, hdr_addr[score_idx], sizeof(snes_header_t));
switch(header->map & 0xef) {
case 0x20:

View File

@ -29,6 +29,7 @@ typedef struct _snes_header {
typedef struct _snes_romprops {
uint16_t offset; // start of actual ROM image
uint8_t mapper_id; // FPGA mapper
uint8_t pad1; // for alignment
uint32_t expramsize_bytes; // ExpRAM size in bytes
uint32_t ramsize_bytes; // CartRAM size in bytes
uint32_t romsize_bytes; // ROM size in bytes (rounded up)

View File

@ -47,7 +47,7 @@ void snes_reset(int state) {
void snes_main_loop() {
if(initloop) {
saveram_crc_old = calc_sram_crc(saveram_base_addr, saveram_size);
save_sram("/quite a long test filename.srm", saveram_size, saveram_base_addr);
save_sram("/test.srm", saveram_size, saveram_base_addr);
initloop=0;
}
saveram_crc = calc_sram_crc(saveram_base_addr, saveram_size);
@ -56,7 +56,7 @@ void snes_main_loop() {
uart_puthexshort(saveram_crc);
uart_putcrlf();
set_busy_led(1);
save_sram("/quite a long test filename.srm", saveram_size, saveram_base_addr);
save_sram("/test.srm", saveram_size, saveram_base_addr);
set_busy_led(0);
}
saveram_crc_old = saveram_crc;

32
utils/bin2asm.c Normal file
View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdint.h>
int main(int argc, char **argv) {
size_t count;
if(argc<1) {
fprintf(stderr, "Usage: %s <infile> \n", argv[0]);
return 1;
}
FILE* in;
if((in=fopen(argv[1], "rb"))==NULL) {
perror("could not open input file");
return 1;
}
printf("chgme ");
count=0;
while(1) {
uint8_t c = fgetc(in);
if(feof(in)) break;
if(!(count%8)) {
if(count) printf("\n ");
printf(".byt $%02x", c);
} else {
printf(", $%02x", c);
}
count++;
}
fclose(in);
return 0;
}

78
utils/chili2chr.c Normal file
View File

@ -0,0 +1,78 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv) {
if(argc<2) {
printf("Usage: %s <input> <output>\nCurrently only 4-to-2-bit supported\n", argv[0]);
}
FILE *in, *out;
size_t in_off = 0, out_off = 0;
uint8_t pixperbyte, mask_shift, mask, depth, planeidx;
uint8_t current_pixel, current_in_tile;
int i,j;
if((in=fopen(argv[1], "rb"))==NULL) {
perror("Could not open input file");
return 1;
}
if((out=fopen(argv[2], "wb"))==NULL) {
perror("Could not open output file");
return 1;
}
size_t fsize, dsize;
fseek(in, 0, SEEK_END);
fsize = ftell(in);
fseek(in, 0, SEEK_SET);
// pixperbyte = 2;
// mask_shift = 4;
// mask = 0x03;
// depth = 2;
// 4->2
pixperbyte = 1;
mask_shift = 0;
mask = 0xff;
depth = 8;
// 8->8
dsize = fsize / pixperbyte;
uint16_t *obuf;
if((obuf=malloc(dsize))==NULL) {
perror("Could not reserve memory");
fclose(out);
fclose(in);
return 1;
}
memset(obuf, 0, dsize);
while (!feof(in)) {
uint8_t chunk = fgetc(in);
printf("%lX\n", out_off);
for(i=0; i<pixperbyte; i++) {
current_pixel = (in_off*pixperbyte+i)%8;
current_in_tile = (in_off*pixperbyte+i)%64;
if(!current_pixel && in_off) { // after 8 pixels:
out_off++;
}
if(!current_in_tile && in_off) { // after 64 pixels:
out_off += (depth/2-1) * 8;
}
uint8_t bits = (chunk&mask);
chunk >>= mask_shift;
for(planeidx=0; planeidx < depth/2; planeidx++) {
for(j=0; j<2; j++) {
obuf[out_off+planeidx*8] |= ((bits & (1<<(j+2*planeidx))) >> (j+2*planeidx) << ((8*j+7)-current_pixel));
}
}
}
in_off++;
}
free(obuf);
fwrite(obuf, dsize, 1, out);
fclose(out);
fclose(in);
}

23
utils/gentilemap.c Normal file
View File

@ -0,0 +1,23 @@
#include <stdio.h>
#include <stdint.h>
int main(void) {
uint16_t tile=64;
uint16_t pad=0xa+64;
int i,j;
FILE *out;
if((out=fopen("tilemap", "wb"))==NULL) {
perror("Could not open output file 'tilemap'");
return 1;
}
for(i=0; i<12; i++) {
for(j=0; j<25; j++) {
fwrite(&tile, 2, 1, out);
tile++;
}
for(j=25; j<32; j++) {
fwrite(&pad, 2, 1, out);
}
}
fclose(out);
}

29
utils/palremap.c Normal file
View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdint.h>
int main(int argc, char **argv) {
if(argc<3) {
fprintf(stderr, "Usage: %s <infile> <outfile>\n", argv[0]);
return 1;
}
FILE *in, *out;
if((in=fopen(argv[1], "rb"))==NULL) {
perror("Could not open input file");
return 1;
}
if((out=fopen(argv[2], "wb"))==NULL) {
perror("Could not open output file");
return 1;
}
while(1) {
uint8_t c=fgetc(in);
if(feof(in))break;
if(c>=1 && c<=43) {
c+=212;
}
fputc(c, out);
}
fclose(out);
fclose(in);
return 0;
}

View File

@ -20,12 +20,10 @@
//////////////////////////////////////////////////////////////////////////////////
module my_dcm (
input CLKIN,
input CLKFB,
output CLK2X,
output CLKFX,
output CLK0,
output LOCKED,
input RST
input RST,
output[7:0] STATUS
);
// DCM: Digital Clock Manager Circuit
@ -39,10 +37,10 @@ module my_dcm (
.CLKFX_DIVIDE(1), // Can be any integer from 1 to 32
.CLKFX_MULTIPLY(4), // Can be any integer from 2 to 32
.CLKIN_DIVIDE_BY_2("FALSE"), // TRUE/FALSE to enable CLKIN divide by two feature
.CLKIN_PERIOD(46.561), // Specify period of input clock
.CLKIN_PERIOD(47.000), // Specify period of input clock
.CLKOUT_PHASE_SHIFT("NONE"), // Specify phase shift of NONE, FIXED or VARIABLE
.CLK_FEEDBACK("NONE"), // Specify clock feedback of NONE, 1X or 2X
.DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or
.DESKEW_ADJUST("SOURCE_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or
// an integer from 0 to 15
.DFS_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for frequency synthesis
.DLL_FREQUENCY_MODE("LOW"), // HIGH or LOW frequency mode for DLL
@ -50,7 +48,7 @@ module my_dcm (
.FACTORY_JF(16'hC080), // FACTORY JF values
// .LOC("DCM_X0Y0"),
.PHASE_SHIFT(0), // Amount of fixed phase shift from -255 to 255
.STARTUP_WAIT("FALSE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE
.STARTUP_WAIT("TRUE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE
) DCM_inst (
.CLK0(CLK0), // 0 degree DCM CLK output
.CLK180(CLK180), // 180 degree DCM CLK output

View File

@ -74,7 +74,6 @@ NET "SNES_REFRESH" IOSTANDARD = LVCMOS33;
NET "SPI_MISO" IOSTANDARD = LVCMOS33;
NET "SPI_MOSI" IOSTANDARD = LVCMOS33;
NET "SPI_SCK" IOSTANDARD = LVCMOS33;
NET "SPI_SS" IOSTANDARD = LVCMOS33;
NET "SRAM_DATA[10]" IOSTANDARD = LVCMOS33;
NET "SRAM_DATA[11]" IOSTANDARD = LVCMOS33;
NET "SRAM_DATA[12]" IOSTANDARD = LVCMOS33;
@ -181,8 +180,7 @@ NET "SRAM_DATA[7]" LOC = P116;
NET "SRAM_DATA[8]" LOC = P96;
NET "SRAM_DATA[9]" LOC = P98;
NET "SRAM_OE" LOC = P93;
NET "CLKIN" IOSTANDARD = LVCMOS33;
TIMESPEC TS_test = FROM "FFS" TO "FFS" 10 ns;
TIMESPEC TS_test = FROM FFS TO FFS 10 ns;
NET "SNES_ADDR<0>" MAXDELAY = 10 ns;
NET "SNES_ADDR<0>" MAXSKEW = 5 ns;
NET "SNES_ADDR<1>" MAXDELAY = 10 ns;
@ -231,3 +229,13 @@ NET "SNES_ADDR<22>" MAXDELAY = 10 ns;
NET "SNES_ADDR<22>" MAXSKEW = 5 ns;
NET "SNES_ADDR<23>" MAXDELAY = 10 ns;
NET "SNES_ADDR<23>" MAXSKEW = 5 ns;
NET "CLKIN" IOSTANDARD = LVCMOS33;
NET "CLKIN" PULLUP;
NET "SPI_SS" IOSTANDARD = LVCMOS33;
NET "SPI_SS" PULLUP;
NET "DCM_FX_STOPPED" LOC = P44;
NET "DCM_FX_STOPPED" IOSTANDARD = LVCMOS33;
NET "DCM_IN_STOPPED" LOC = P41;
NET "DCM_IN_STOPPED" IOSTANDARD = LVCMOS33;
//NET "DCM_RST" LOC = P46;
//NET "DCM_RST" IOSTANDARD = LVCMOS33;

View File

@ -49,10 +49,12 @@ module main(
output SPI_MISO,
input SPI_SS,
input SPI_SCK,
input AVR_ENA
input AVR_ENA,
/* debug */
output DCM_IN_STOPPED,
output DCM_FX_STOPPED
//input DCM_RST
);
wire [7:0] spi_cmd_data;
wire [7:0] spi_param_data;
@ -107,15 +109,49 @@ avr_cmd snes_avr_cmd(
.rom_mask_out(ROM_MASK)
);
wire [7:0] DCM_STATUS;
assign DCM_FX_STOPPED = DCM_STATUS[2];
assign DCM_IN_STOPPED = DCM_STATUS[1];
my_dcm snes_dcm(.CLKIN(CLKIN),
.CLK2X(CLK),
.CLKFB(CLKFB),
.CLKFX(CLK2),
.CLK0(CLK0),
.LOCKED(DCM_LOCKED),
.RST(DCM_RST)
.RST(DCM_RST),
.STATUS(DCM_STATUS)
);
assign DCM_RST = 1'b0;
/*always @(posedge CLKIN) begin
if(DCM_FX_STOPPED)
DCM_RST <= 1'b1;
else
DCM_RST <= 1'b0;
end
*/
/*reg DO_DCM_RESET, DCM_RESETTING;
reg DCM_RSTr;
assign DCM_RST = DCM_RSTr;
reg [2:0] DCM_RESET_CNT;
initial DO_DCM_RESET = 1'b0;
initial DCM_RESETTING = 1'b0;
always @(posedge CLKIN) begin
if(!DCM_LOCKED && !DCM_RESETTING) begin
DCM_RSTr <= 1'b1;
DO_DCM_RESET <= 1'b1;
DCM_RESET_CNT <= 3'b0;
end else if (DO_DCM_RESET) begin
DCM_RSTr <= 1'b0;
DCM_RESET_CNT <= DCM_RESET_CNT + 1;
end
end
always @(posedge CLKIN) begin
if (DO_DCM_RESET)
DCM_RESETTING <= 1'b1;
else if (DCM_RESET_CNT == 3'b110)
DCM_RESETTING <= 1'b0;
end
*/
wire SNES_RW;
reg [1:0] SNES_READr;
reg [1:0] SNES_WRITEr;

View File

@ -101,6 +101,7 @@
<property xil_pn:name="Speed Grade" xil_pn:value="-4"/>
<property xil_pn:name="Synthesis Tool" xil_pn:value="XST (VHDL/Verilog)"/>
<property xil_pn:name="Top-Level Source Type" xil_pn:value="HDL"/>
<property xil_pn:name="Unused IOB Pins" xil_pn:value="Float"/>
<property xil_pn:name="Verbose Property Persistence" xil_pn:value="false"/>
</properties>