-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
59 changed files
with
15,299 additions
and
5 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,3 @@ | ||
[submodule "tools/bass-src"] | ||
path = tools/bass-src | ||
url = https://github.com/ARM9/bass |
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,13 @@ | ||
Copyright 2020 Adam Gashlin (hcs) | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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,45 @@ | ||
.PHONY: all ntsc ntsc_sym pal pkg clean clean-tools clean-all | ||
|
||
TOOLS=tools/chksum64 tools/bass | ||
|
||
# Path relative to src/ | ||
BASS=../tools/bass | ||
CHKSUM64=./tools/chksum64 | ||
|
||
ERR_EMBED=-d 'ERR_EMBED1=../pkg/roms/nestify7.nes' -d 'ERR_EMBED2=../pkg/roms/efp6.nes' | ||
NTSC_BASS_CMD=$(BASS) neon64.asm -d 'NTSC_NES=1' $(ERR_EMBED) -d 'OUTPUT_FILE=../neon64bu.rom' | ||
|
||
ntsc: $(TOOLS) | ||
cd src ; $(NTSC_BASS_CMD) | ||
$(CHKSUM64) neon64bu.rom | ||
|
||
ntsc_sym: | ||
cd src ; $(NTSC_BASS_CMD) -sym neon64.sym | ||
sort src/neon64.sym > src/neon64.sym.sorted | ||
mv src/neon64.sym.sorted src/neon64.sym | ||
|
||
all: ntsc pal | ||
|
||
clean-all: clean clean-tools | ||
|
||
pal: $(TOOLS) | ||
cd src ; $(BASS) neon64.asm -d 'PAL_NES=1' -d 'OUTPUT_FILE=../neon64bu_pal.rom' | ||
$(CHKSUM64) neon64bu_pal.rom | ||
|
||
pkg: ntsc pal | ||
zip --junk-paths neon64v2XXXX.zip pkg/README.txt LICENSE.txt neon64bu.rom neon64bu_pal.rom | ||
|
||
clean: | ||
rm -f neon64bu.rom neon64bu_pal.rom src/neon64.sym neon64v2XXXX.zip | ||
|
||
tools/chksum64: tools/chksum64.c | ||
|
||
tools/bass: | ||
git submodule init | ||
git submodule update | ||
$(MAKE) -C tools/bass-src/bass/ | ||
cp tools/bass-src/bass/bass tools/bass | ||
|
||
clean-tools: | ||
rm -f tools/chksum64 tools/bass | ||
$(MAKE) -C tools/bass-src/bass/ clean |
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,137 @@ | ||
Neon64 2.0 beta 2 | ||
================= | ||
|
||
NES Emulation, On the N64, in the distant future... | ||
|
||
Features | ||
-------- | ||
|
||
- NTSC NES on NTSC N64 | ||
- CPU (official opcodes) | ||
- PPU | ||
- APU channels (2 square, triangle, noise, DMC) | ||
- Battery backed RAM save to SRAM | ||
- iNES mappers #s 0,1,2,3,4,7,30,31,71 | ||
- Controller 1 (D-pad + analog) | ||
|
||
There's a lot missing, but it's already worlds better than 1.2. | ||
|
||
Running | ||
------- | ||
|
||
The easiest way is to use a dev cart that supports using an NES emulator for | ||
.nes files: | ||
|
||
- 64drive: Drop neon64bu.rom into the root directory. | ||
- EverDrive-64: Rename neon64bu.rom to emu.nes and put it in the ED64 directory. | ||
|
||
Anything that loads the NES ROM at the "emulation standard" (0x200000) will work. | ||
|
||
The Neon64 ROM is only as long as it needs to be to be checksummed consistently, | ||
so it will also look for a NES ROM at 0x101000 so it can be directly appended. | ||
From a Windows command line: | ||
|
||
copy /b neon64bu.rom + game.nes game.n64 | ||
|
||
on Linux, macOS, etc: | ||
|
||
cat neon64bu.rom game.nes > game.n64 | ||
|
||
I've included a separate version with PAL NES timing, this is usable but janky. | ||
|
||
Controls | ||
-------- | ||
|
||
A, B, Start and the D-pad on controller 1 are mapped in the obvious way. Select | ||
is the Z button. The analog stick is roughly like the D-pad, it may be easier to | ||
use with games allowing diagonal movement. | ||
|
||
To access the menu, hold the L and R shoulder buttons. Navigate with the D-pad | ||
or Z, select an option with A or Start. Hold L and R again to dismiss the menu. | ||
|
||
Saving | ||
------ | ||
|
||
For games with battery-backed RAM, you can save from the menu. | ||
|
||
Saving uses dedicated 768Kbit SRAM. This is supported by newer 64drive firmware, | ||
tested with 1.14e. | ||
|
||
Saves should be compatible with Visor's "Neon64 with Savestates" 0.3c, though | ||
savestates are not yet supported. | ||
|
||
Architecture | ||
------------ | ||
|
||
I split up the 6502 CPU ops to reduce code size; all N64 CPU code fits in ICache | ||
(1.5K to spare). All ucode fits in IMEM together (200 bytes to spare). | ||
|
||
The CPU runs the main PPU loop. It passes the bytes read to the RSP, which | ||
converts the background to a 4bpp texture and arranges sprites in an 8bpp | ||
texture. | ||
|
||
The RDP renders each frame, layering sprites and background, with tricky | ||
palettes to use the same texture for BG and FG sprites. | ||
|
||
The RSP synthesizes audio, driven by alists from the CPU. When the PCM buffer | ||
runs low, the AI interrupt can request an immediate flush to stretch the alist. | ||
|
||
The CPU has a cooperative scheduler, using an emulated cycle timer to trade off | ||
between the CPU and PPU. This works mainly with daddi+bgezl. | ||
|
||
The RSP has a separate coop scheduler. When a task yields it can run code on the | ||
CPU via the RSP break interrupt. | ||
|
||
I use the TLB to swap and mirror banks (PC is a native pointer), write protect | ||
CHR ROM, place data at addresses below 32K (for free indexing), and mirror all | ||
RDRAM (so bit 31 can be used as a flag). | ||
|
||
On most games only around 50% of frame time is used. | ||
|
||
Version history | ||
--------------- | ||
|
||
2020-07-07 - beta 2 | ||
- Add mappers 30, 31, 71 | ||
- Source release | ||
|
||
2020-07-04 - beta 1 | ||
- Initial beta release | ||
|
||
Everybody | ||
--------- | ||
|
||
Thanks to: | ||
* blargg for many docs and tests | ||
* Marat Fayzullin for teaching a generation about emulation | ||
* krom for great source and discussion | ||
* MarathonMan et al for cen64 (very helpful for debugging!) | ||
* marshallh for 64drive (the best N64 dev tool!) | ||
* Near, ARM9, et al for bass | ||
* Visor for a lot of good patches to 1.2 | ||
* Eisi for adding MMC4 support in 1.2 | ||
* bootgod et al for NesCartDB | ||
|
||
Many thanks to contributors to the NesDev wiki and ultra64.ca. | ||
|
||
Greets to the #n64dev and N64brew sceners, LaC, Pinchy, Zoinkity, jrra, | ||
mikeryan, ppcasm, arbin, DragonMinded, level42, fraser, fin, CrashOverride, | ||
et al! | ||
|
||
Hello to my HCS Forum friends, bxaimc, knurek, FastElbja, manakoAT, kode54, | ||
bnnm, Josh W, Mouser_X, and unknownfile if you're still out there! | ||
|
||
Black Lives Matter. | ||
|
||
Colophon | ||
-------- | ||
|
||
A Halley's Comet Software production. | ||
|
||
Bug reports welcome! | ||
|
||
Git: https://github.com/hcs64/neon64v2 | ||
Forum: https://hcs64.com/mboard/forum.php | ||
Email: [email protected] | ||
|
||
-hcs 2020-07-07 |
Binary file not shown.
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,81 @@ | ||
Architecture ideas: | ||
- Data layout should be more intentional, to understand how things | ||
are colliding, e.g.: | ||
* Jump tables shouldn't be embedded in code, or should be organized | ||
as jumps instead of addresses (as in the opcode table). | ||
* The most important things could be in memory that never gets evicted | ||
(besides the register file). The biggest issue is dealing with the | ||
random access pattern of the NES ROM. It might be possible to spread | ||
that out to leave gaps in physical address space. | ||
- Rework the scheduler so the CPU can run more than 1 instruction ahead, | ||
without having to yield constantly to allow other tasks to set interrupts. | ||
- dlists should be generated on the RSP to send to the RDP. This will | ||
make some mid-frame effects easier. | ||
- If I want expansion audio, the RSP scheduler needs to swap ucode, and/or | ||
I have to optimize for space. | ||
- Text rendering should use the RSP+RDP rather than uncached writes | ||
on the CPU. | ||
|
||
Missing features needed for better accuracy: | ||
- Mid-frame palette changes | ||
- Mid-scanline BG changes (MMC2, fine X scroll change, etc) | ||
- BG-accurate SP0 hit | ||
- Bug-accurate Sprite overflow | ||
- Read of PPU activity | ||
- Audio IRQs (frame counter, DMC) | ||
- Palette deemphasis, greyscale | ||
- Proper screen size for PAL | ||
- Video signal parameters (slightly too narrow? starts too late?) | ||
|
||
Desired features: | ||
- Gameshark version | ||
- Controller 2 | ||
- 4 player via Four Score | ||
- PAL NES mode switch at runtime | ||
- Proper text and profiling in PAL mode | ||
- Remember PAL setting per-game | ||
- Control remapping | ||
- Arkanoid paddle | ||
- Zapper | ||
- Reset, power cycle | ||
- PAL N64 mode | ||
- Unofficial CPU opcodes | ||
- Screenshots | ||
- Famicom Disk System | ||
- More mappers | ||
- NSF player (with mapper 31 this is pretty close) | ||
- Save to Controller Pak | ||
- Savestate (Expansion Pak, persistent) | ||
- Unlock framerate, fast-forward | ||
- Some NES 2.0 support? | ||
|
||
Desired mappers: | ||
Easy | ||
- 34 (Deadly Towers) | ||
- 11 (Color Dreams) | ||
- 66 (SMB+Duck Hunt) | ||
|
||
- 111 (homebrew, memblers) | ||
|
||
- 5 (MMC5, Castlevania 3, etc) | ||
- 9 (MMC2, Punch-Out!!) | ||
- 10 (MMC4, Fire Emblem, etc) | ||
- 19 (Namco 129/163, Pac-Man Championship Edition, etc) | ||
- 24 (VRC6a, Akumajou Densetsu) | ||
- 25 (VRC6b, Madara etc) | ||
- 64 (Tengen Rambo-1) | ||
- 68 (After Burner) | ||
- 69 (Sunsoft FME-7, Gimmick!, etc) | ||
|
||
Known bugs: | ||
- Streemerz uses a bad opcode (by design) after Faux logo | ||
- Bill & Ted palette messes up when dialog boxes come up. - Needs mid-frame palette change (also Wizards & Warriors) | ||
- Battletoads intro: a line of bad scroll (?) under the logo, during the quick | ||
pan the planet sometimes flashes into the upper screen (check hw?) | ||
- Rad Racer - single lines out of place (check hw?) | ||
- Jurassic Park - Ocean logo on the title screen seems to have a few lines out of place (check hw?) | ||
- Pop when shooting sword in Zelda is irritatingly loud | ||
- Some audio glitching in Mega Man 2 intro (check hw?) | ||
- Black line over Kirby in pause screen - This is going to require better IRQ timing and maybe mid-scanline scroll | ||
- Marble Madness garbled text - Needs mid-scanline pattern addr switch. | ||
- Big Nose Freaks Out doesn't get in-game. Needs IRQ? |
Oops, something went wrong.