Skip to content

Commit

Permalink
Adding test ROMs.
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherpow committed Aug 6, 2011
0 parents commit 9772000
Show file tree
Hide file tree
Showing 1,068 changed files with 118,991 additions and 0 deletions.
66 changes: 66 additions & 0 deletions MMC1_A12/MMC1.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
;MMC1 write handler
.define R0 $9fff
.define R1 $bfff
.define R2 $dfff
.define R3 $f000

.section "MMC1" FREE
WriteR0
sta R0
lsr A
sta R0
lsr A
sta R0
lsr A
sta R0
lsr A
sta R0
rts

WriteR1
sta R1
lsr A
sta R1
lsr A
sta R1
lsr A
sta R1
lsr A
sta R1
rts

WriteR2
sta R2
lsr A
sta R2
lsr A
sta R2
lsr A
sta R2
lsr A
sta R2
rts

ProgramSwitch1
sta BankLatch1
ProgramSwitch2
sta BankLatch2
WriteR3
tax
lda M2000
and #$7f
sta $2000
txa
sta R3
lsr A
sta R3
lsr A
sta R3
lsr A
sta R3
lsr A
sta R3
lda M2000
sta $2000
rts
.ends
Binary file added MMC1_A12/alphabet.chr
Binary file not shown.
68 changes: 68 additions & 0 deletions MMC1_A12/joypad.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
;Joypad handling

.section "ReadnLockPads" FREE
ReadLockJoypad
jsr ReadJoypad
ldx #$01
- lda Pad1,X
tay
eor Pad1Locked,X ;This detects the key who had a '0' to '1' transition
and Pad1,X
sta Pad1,X
sty Pad1Locked,X
dex
bpl -
rts
.ends

.section "ReadLockPadsDPCM" FREE ;To be used when the DPCM may occasionally glitch the reads
ReadLockJoypadDPCM
jsr ReadJoypad
- ldx Pad1
ldy Pad2 ;Read until 2 consecutive reads returns the same data
jsr ReadJoypad
cpx Pad1
bne -
cpy Pad2
bne -

ldx #$01
- lda Pad1,X
tay
eor Pad1Locked,X ;This detects the key who had a '0' to '1' transition
and Pad1,X
sta Pad1,X
sty Pad1Locked,X
dex
bpl -
rts
.ends

.section "ReadPad" FREE
;Do read the hardware joypads ports
;Exit with JoyData=Joypad value
;X and Y unchanged

ReadJoypad
lda #$01
sta $4016 ;Be sure to reset the shift counters
sta Pad1
sta Pad2
lsr A ;Simple trick to get a 0, heh
sta $4016

- lda $4016 ;Read the value of JoyPad 1
lsr A
bcs +
lsr A
+ rol Pad1
bcc - ;Carry will be set when all 8 keys are read

- lda $4017 ;Read the value of JoyPad 1
lsr A
bcs +
lsr A
+ rol Pad2
bcc - ;Carry will be set when all 8 keys are read
rts
.ends
Binary file added MMC1_A12/joypad.lib
Binary file not shown.
9 changes: 9 additions & 0 deletions MMC1_A12/linkfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[objects]
mmc1_a12.o

[libraries]
BANK 7 SLOT 3 mmc1.lib
BANK 7 SLOT 3 joypad.lib

[header]
snrom.bin
23 changes: 23 additions & 0 deletions MMC1_A12/maping.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
;Defines NES's RAM for any games witout SRAM
;Stack isn't defined, it's use is reserved
;Also $200-$2ff is reserved for SpriteRam and isn't defined here

.memorymap
defaultslot 0
slotsize $100
slot 0 $0 ;0 page RAM
slotsize $500
slot 1 $300 ;BSS RAM
slotsize $4000 ;PRG ROM slot (16kb)
slot 2 $8000
slotsize $4000
slot 3 $c000 ;Resitant PRG slot (16kb)
.endme

;Define a CNROM structure with 32kb PRG and 32kb CHR

.rombankmap
bankstotal 8
banksize $4000 ;4x 32kb PRG
banks 8
.endro
Binary file added MMC1_A12/mmc1.lib
Binary file not shown.
Loading

0 comments on commit 9772000

Please sign in to comment.