forked from christopherpow/nes-test-roms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9772000
Showing
1,068 changed files
with
118,991 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Oops, something went wrong.