# fogleman_nes **Repository Path**: linux2014/fogleman_nes ## Basic Information - **Project Name**: fogleman_nes - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-08 - **Last Updated**: 2025-07-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README --- ### 源码修改学习 ### 源码下载于https://github.com/fogleman/nes git clone git@github.com:fogleman/nes.git fogleman_nes ### 相关文档: http://www.360doc.com/content/18/0116/09/33564766_722316244.shtml ### 代码修正 ``` sed -i '' 's/"github.com\/fogleman\/nes/"fogleman_nes/g' $(find ./ -name '*.go') ``` --- ### 在msys2/mingw64下构建 ``` export PKG_CONFIG_PATH=D:\\D\\install_dir\\portaudio-19.7.0 rm -rf bin/ go build -gcflags="all=-N -l" -o bin/util_main ./util go build -gcflags="all=-N -l" -o bin/nes_main ./ ``` 其中portaudio-2.0.pc的内容如下: ``` prefix=D:\\D\\install_dir\\portaudio-19.7.0 exec_prefix=${prefix} libdir=${exec_prefix}\\lib includedir=${prefix}\\include Name: PortAudio Description: Portable audio I/O Requires: Version: 19 Libs: -L${libdir} -lportaudio -lm -lpthread Cflags: -I${includedir} -pthread ``` --- --- # go build -gcflags="all=-N -l" -o bin/nes_main ./ # pkg-config --cflags -- portaudio-2.0 Package portaudio-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `portaudio-2.0.pc' to the PKG_CONFIG_PATH environment variable Package 'portaudio-2.0', required by 'virtual:world', not found pkg-config: exit status 1 ``` export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/mingw64/lib/pkgconfig;sh my_build.sh ``` 如果要执行nes_main,需要将portaudio动态库复制到bin目录下; --- ### fc模拟器: https://zhuanlan.zhihu.com/p/682511343 https://juejin.cn/post/6844904178548998158?searchId=20250714215110D2FA733A69CE8102CADF --- --- --- ### Summary This is an NES emulator written in Go. ### Screenshots ![Screenshots](http://i.imgur.com/vD3FXVh.png) ### Title Screens http://www.michaelfogleman.com/static/nes/ ### Dependencies github.com/go-gl/gl/v2.1/gl github.com/go-gl/glfw/v3.1/glfw github.com/gordonklaus/portaudio The portaudio-go dependency requires PortAudio on your system: > To build portaudio-go, you must first have the PortAudio development headers > and libraries installed. Some systems provide a package for this; e.g., on > Ubuntu you would want to run apt-get install portaudio19-dev. On other systems > you might have to install from source. On Mac, you can use homebrew: brew install portaudio ### Installation The `go get` command will automatically fetch the dependencies listed above, compile the binary and place it in your `$GOPATH/bin` directory. go get github.com/fogleman/nes ### Usage nes [rom_file|rom_directory] 1. If no arguments are specified, the program will look for rom files in the current working directory. 2. If a directory is specified, the program will look for rom files in that directory. 3. If a file is specified, the program will run that rom. For 1 & 2, the program will display a menu screen to select which rom to play. The thumbnails are downloaded from an online database keyed by the md5 sum of the rom file. ![Menu Screenshot](http://i.imgur.com/pwetBLv.png) ### Controls Joysticks are supported, although the button mapping is currently hard-coded. Keyboard controls are indicated below. | Nintendo | Emulator | | --------------------- | ----------- | | Up, Down, Left, Right | Arrow Keys | | Start | Enter | | Select | Right Shift | | A | Z | | B | X | | A (Turbo) | A | | B (Turbo) | S | | Reset | R | ### Mappers The following mappers have been implemented: * NROM (0) * MMC1 (1) * UNROM (2) * CNROM (3) * MMC3 (4) * AOROM (7) These mappers cover about 85% of all NES games. I hope to implement more mappers soon. To see what games should work, consult this list: [NES Mapper List](http://tuxnes.sourceforge.net/nesmapper.txt) ### Known Issues * there are some minor issues with PPU timing, but most games work OK anyway * the APU emulation isn't quite perfect, but not far off ### Documentation Interested in writing your own emulator? Curious about the NES internals? Here are some good resources: * [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)