<div align="center">
<img src="document/nes4j.png" alt="Nes4j logo" width="200" height="auto" />
<h1>Nes4j</h1>
<p>Nintendo red and white simulator</p>
</div>
<div align="center">
<h3>
<a href="README_zh.md">ä¸æææ¡£</a>
</h3>
<h3>
<a href="https://gitee.com/navigatorcode/nes4j">gitee repository</a>
</h3>
<img src="https://github.com/GZYangKui/nes4j/actions/workflows/maven.yml/badge.svg" alt="Build status"/>
<img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="Apache 2.0"/>
<img src="https://img.shields.io/badge/I18n-Support-orange.svg" alt="I18n support"/>
<img src="https://badgen.net/github/stars/GZYangKui/nes4j?icon=github&color=4ab8a1" alt="stars">
<img src="https://badgen.net/github/forks/GZYangKui/nes4j?icon=github&color=4ab8a1" alt="forks">
<br/>
</div>
![nes4j](SNAPSHOTS/Main.png)
![DuckTables](SNAPSHOTS/DuckTables.png)
![Super Mario](SNAPSHOTS/Super%20Mario.png)
## Project introduction
**nes4j**The Nintendo Red and White Machine Simulator is implemented in Java language, mainly
including [CPU](https://www.nesdev.org/wiki/CPU)ã
[PPU](https://www.nesdev.org/wiki/PPU_programmer_reference) and [APU](https://www.nesdev.org/wiki/APU) Three parts.PPU
is a red and white machine
It is difficult to understand the most difficult module.
## Project Structure
```
nes4j
âââ app UI module(javafx)
âââ bin Simulator core module (CPU/PPU/APU)
âââ document Development Documentation
```
## Quick start
### Download project
``` shell
git clone https://gitee.com/navigatorCode/nes4j.git
```
### Start project
```shell
mvn run
```
## Support cartridge mapper
+ [NROM](https://www.nesdev.org/wiki/NROM)
+ [MMC1](https://www.nesdev.org/wiki/MMC1)
+ [UxROM](https://www.nesdev.org/wiki/UxROM)
+ [CNROM](https://www.nesdev.org/wiki/INES_Mapper_003)
+ [KonamiVRC24](https://www.nesdev.org/wiki/VRC2_and_VRC4)
> More cartridge mapper are being implemented, please wait.
## The core module is introduced separately
> If you feel that the current game output program cannot meet your needs, you can provide PR to us, and we will try
> our best to meet your needs. Another way is to introduce nes4j bin module yourself to achieve video and audio output
> of
> the game.
### First introduce dependency
+ Apache Maven
```xml
<dependency>
<groupId>cn.navclub</groupId>
<artifactId>nes4j-bin</artifactId>
<version>1.0.5</version>
</dependency>
```
+ Gradle(groovy)
```groovy
implementation group: 'cn.navclub', name: 'nes4j-bin', version: '1.0.5'
```
or
```groovy
implementation 'cn.navclub:nes4j-bin:1.0.5'
```
+ Gradle(Kotlin)
```kotlin
implementation("cn.navclub:nes4j-bin:1.0.5")
```
### Then create an NES instance and initialize
+ GameWorld.java
```java
import cn.navclub.nes4j.bin.NesConsole;
import cn.navclub.nes4j.bin.io.JoyPad;
import cn.navclub.nes4j.bin.ppu.Frame;
public class GameWorld {
public NES create() {
NesConsole console = NesConsole.Builder
.newBuilder()
//nes game rom
.file(file)
//Audio Handler
.player(JavaXAudio.class)
//Game loop callback
.gameLoopCallback(GameWorld.this::gameLoopCallback)
.build();
try {
//Current method was called current will block current thread until game stop or exception occurred
console.execute();
} catch (Exception e) {
//todo An error occurred during the game.Once error occurred game immediate stop
}
}
//This function was callback when a game frame generate
private void gameLoopCallback(Frame frame, JoyPad joyPad, JoyPad joyPad1) {
}
}
```
+ JavaXAudio.java
```java
@SuppressWarnings("all")
public class JavaXAudio implements Player {
private final byte[] sample;
private final byte[] buffer;
private final Line.Info info;
private final AudioFormat format;
private final SourceDataLine line;
private int ldx;
//Current fill index
private int index;
private final Thread thread;
private volatile boolean stop;
private final static int SAMPLE_SIZE = 55;
private static final LoggerDelegate log = LoggerFactory.logger(JavaXAudio.class);
public JavaXAudio(Integer sampleRate) throws LineUnavailableException {
this.sample = new byte[SAMPLE_SIZE];
this.buffer = new byte[SAMPLE_SIZE];
this.thread = new Thread(this::exec);
this.format = new AudioFormat(sampleRate, 8, 1, false, false);
this.info = new DataLine.Info(SourceDataLine.class, format);
this.line = (SourceDataLine) AudioSystem.getLine(info);
line.open(format);
line.start();
this.thread.start();
}
@Override
public void output(byte sample) {
this.buffer[this.index] = sample;
this.index++;
if (this.index == SAMPLE_SIZE) {
this.index = 0;
System.arraycopy(this.buffer, 0, this.sample, 0, SAMPLE_SIZE);
LockSupport.unpark(this.thread);
}
this.index %= SAMPLE_SIZE;
}
private void exec() {
while (!this.stop) {
LockSupport.park();
this.line.write(this.sample, 0, SAMPLE_SIZE);
}
}
@Override
public void stop() {
this.stop = true;
LockSupport.unpark(this.thread);
this.line.close();
}
@Override
public void reset() {
this.index = 0;
}
}
```
## Participatory contributions
We strongly welcome interested developers to participate in the project construction, and welcome everyone to put
forward valuable suggestions and functional requirements for the project. The project is being actively developed, and
welcome PR ðã
## Copyright Description
At present, most of the game copyrights in the market are owned by [Nintendo]((https://www.nintendo.com/)).
Do not distribute the game without permission from Nintendo If any infringement is caused thereby, it has nothing
to do with the software. If any infringing material is designed in the software, please send an email to
cnnes4j@126.com Notify me to delete the corresponding infringing materials.
## Development
### document
If you want to write your own simulator or understand the internal structure of the simulator, the following resources
can provide you with some basic knowledge of the simulator:
* [NES Documentation (PDF)](http://nesdev.com/NESDoc.pdf)
* [NES Reference Guide (Wiki)](http://wiki.nesdev.com/w/index.php/NES_reference_guide)
* [6502 CPU Reference](http://www.obelisk.me.uk/6502/reference.html)
### Assembly debugging(Experimental)
> Main interface -> Tool -> Debug
![Assembler](SNAPSHOTS/assemblera.png)
> Snapshot memory view (Memory)
>
![Assembler](SNAPSHOTS/MemoryView.png)
## Special thanks
| name | describe |
|-----------------------------------------|--------------------------------------------------------------|
| [Jetbrain](https://www.jetbrains.com/) | Provide a complete set of integrated development environment |
| [NES forum](https://forums.nesdev.org/) | Provide technical support |
没有合适的资源?快使用搜索试试~ 我知道了~
基于java语言实现任天堂红白机模拟器.zip
共197个文件
java:116个
png:28个
css:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 162 浏览量
2024-05-14
06:55:16
上传
评论
收藏 1.4MB ZIP 举报
温馨提示
java 简单性 Java看起来设计得很像C++,但是为了使语言小和容易熟悉,设计者们把C++语言中许多可用的特征去掉了,这些特征是一般程序员很少使用的。例如,Java不支持goto语句,代之以提供break和continue语句以及异常处理。Java还剔除了C++的操作符过载(overload)和多继承特征,并且不使用主文件,免去了预处理程序。因为Java没有结构,数组和串都是对象,所以不需要指针。Java能够自动处理对象的引用和间接引用,实现自动的无用单元收集,使用户不必为存储管理问题烦恼,能更多的时间和精力花在研发上。 面向对象 Java是一个面向对象的语言。对程序员来说,这意味着要注意其中的数据和操纵数据的方法(method),而不是严格地用过程来思考。在一个面向对象的系统中,类(class)是数据和操作数据的方法的集合。数据和方法一起描述对象(object)的状态和行为。每一对象是其状态和行为的封装。类是按一定体系和层次安排的,使得子类可以从超类继承行为。在这个类层次体系中有一个根类,它是具有一般行为的类。Java程序是用类来组织的。
资源推荐
资源详情
资源评论
收起资源包目录
基于java语言实现任天堂红白机模拟器.zip (197个子文件)
sys_sound.c 3KB
apu_player_jni.c 2KB
memory.c 2KB
test.c 768B
jni_util.c 745B
str_util.c 376B
ascii.chr 2KB
nes.conf 2KB
GameHallStyle.css 8KB
Common.css 5KB
DebuggerStyle.css 916B
DHandle.css 429B
Nes4j.css 309B
TextPopup.css 198B
DNesHeaderStyle.css 168B
GameWorldStyle.css 168B
SystemPalette.css 108B
DException.css 87B
GameHall.fxml 3KB
DNesHeader.fxml 3KB
Debugger.fxml 2KB
GameWorld.fxml 2KB
.gitignore 34B
asoundlib.h 2KB
cn_navclub_nes4j_app_audio_NativePlayer.h 978B
sys_sound.h 604B
type.h 539B
memory.h 482B
jni_util.h 340B
str_util.h 178B
nes.inc 5KB
Render.java 28KB
CPU.java 21KB
PPU.java 20KB
DMChannel.java 15KB
Cartridge.java 13KB
MMC3Mapper.java 12KB
APU.java 10KB
GameWorld.java 9KB
MMC1Mapper.java 8KB
GameHall.java 7KB
NesConsole.java 7KB
KonamiVRC24.java 6KB
MemoryBus.java 6KB
Debugger.java 5KB
FrameCounter.java 5KB
LoadingPane.java 5KB
DHandle.java 5KB
CPUControlPane.java 5KB
Envelope.java 5KB
BreakLine.java 5KB
OSUtil.java 4KB
JoyPad.java 4KB
PulseChannel.java 4KB
MemoryBusAdapter.java 4KB
SweepUnit.java 4KB
Channel.java 3KB
BinUtil.java 3KB
NoiseChannel.java 3KB
DragEventHandler.java 3KB
DPalette.java 3KB
DNesHeader.java 3KB
PPUControlPane.java 3KB
TriangleChannel.java 3KB
LengthCounter.java 2KB
NESConfig.java 2KB
NoiseSequencer.java 2KB
CPUStatus.java 2KB
PPUViewer.java 2KB
PPUControl.java 2KB
Mapper.java 2KB
NFormatter.java 2KB
JULoggerDelegate.java 2KB
GameTray.java 2KB
INes.java 2KB
SeqSequencer.java 2KB
JavaXAudio.java 2KB
IconPopup.java 2KB
EventBus.java 2KB
Divider.java 2KB
ExceptionDialog.java 2KB
OpenCodeFormat.java 2KB
FXResource.java 2KB
Launcher.java 2KB
PPUStatus.java 2KB
LoggerDelegate.java 2KB
Register.java 2KB
CNMapper.java 1KB
PPUMask.java 1KB
LinearCounter.java 1KB
NMapper.java 1KB
UIUtil.java 1KB
TriangleTimer.java 1KB
PMask.java 1KB
Timer.java 1KB
NativePlayer.java 1KB
Component.java 1KB
UXMapper.java 1KB
IconPopupSkin.java 1KB
NodeDragEvent.java 1KB
共 197 条
- 1
- 2
资源评论
野生的狒狒
- 粉丝: 2627
- 资源: 2164
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功