2022-05-07 22:51:34 +03:00
# NesUEFI - A bootable NES Emulator running on UEFI
2022-05-07 23:25:48 +03:00
![alt text ](/splash.bmp "splash" )
2022-05-08 05:28:09 +03:00
**NesUEFI** is a **NES Emulator running without an operating system** directly on **Unified Extensible Firmware Interface (UEFI).** Simply place **NesUEFI** and nes roms in a pendrive and play. **NesUEFI file browser** will show the available roms. The core drivers (Graphics, File System, Timer) are written in c using **GNU-EFI** and the emulator part is a port of [LiteNES ](https://github.com/NJU-ProjectN/LiteNES ). Adafruit GFX Graphics Library is ported for GNU-EFI ecosystem in C for high level graphics operations and text rendering.
2022-05-07 22:51:34 +03:00
# Compile NesUEFI
## Requirements
- **GNU-EFI** Library. Download it from [here ](https://sourceforge.net/projects/gnu-efi/ ).
- **gcc-3.0 or newer**
- A version of **objcopy** that supports EFI applications
- **qemu** (To run without real hardware)
- **mtools** : Utilities to access MS-DOS disks from Linux (to run on qemu)
- **OVMF** (To run on qemu)
## Compile and install GNU-EFI Library
Go to gnu-efi source folder
```bash
2022-05-08 00:13:30 +03:00
make
make install
2022-05-07 22:51:34 +03:00
```
2022-05-07 23:45:28 +03:00
[Here ](compile_guide.md ) is a guide you can follow for more details on how to compile and run gnu-efi applications.
2022-05-07 22:51:34 +03:00
## Compile NesUEFI
Change the following macros in makefile to locate GNU-EFI **libraries** and **headers** installed on the previous step.
2022-05-07 23:50:57 +03:00
```makefile
2022-05-08 00:13:30 +03:00
INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
EFILIB = /usr/local/lib
2022-05-07 23:50:57 +03:00
```
2022-05-07 22:51:34 +03:00
# NesUEFI on qemu :
### Locate OVMF in Makefile:
To run the compiled application in qemu we need OVMF for UEFI emulation. OVMF is a port of Intel's tianocore firmware to the qemu virtual machine.
```makefile
2022-05-08 00:13:30 +03:00
OVMF_DIR = ../OVMF
2022-05-07 22:51:34 +03:00
```
Change **OVMF_DIR** directory in the makefile.
### Create Image
Add your roms here in the makefile to write it to your image. For example : test_1.nes, test_2.nes
2022-05-07 23:50:19 +03:00
```makefile
2022-05-08 00:13:30 +03:00
mcopy -i $(IMAGE).img splash.bmp ::
# Add your roms here
mcopy -i $(IMAGE).img test_1.nes ::
mcopy -i $(IMAGE).img test_2.nes ::
2022-05-07 23:50:19 +03:00
```
```bash
2022-05-08 00:13:30 +03:00
make img
2022-05-07 23:50:19 +03:00
```
2022-05-07 22:51:34 +03:00
### Run
2022-05-07 23:50:19 +03:00
```bash
2022-05-08 00:13:30 +03:00
make run
2022-05-07 23:50:19 +03:00
```
2022-05-07 22:51:34 +03:00
# NesUEFI on real hardware
2022-05-08 05:35:37 +03:00
**Do at your own risk. Under no circumstances shall the author be liable for any damage.**
2022-05-07 22:51:34 +03:00
Technically NesUEFI should not mess with your system. But you should at least know what you are doing.
- Format a pendrive with **FAT32** file system.
- Create ** /efi/boot/** folders in the pendrive
- Rename **main.efi** to **bootx64.efi** for **64 bit** and **bootia32.efi** for **32 bit** application.
- Copy **bootx64.efi** or **bootia32.efi** to boot folder.
- For **64 bit** application the pendrive should look like this : ** /efi/boot/bootx64.efi**
- For **32 bit** application the pendrive should look like this : ** /efi/boot/bootia32.efi**
2022-05-08 05:28:09 +03:00
- Copy **splash.bmp** on the root folder of the pendrive
- Copy your .nes roms in the pendrive.
2022-05-07 22:51:34 +03:00
2022-05-08 09:10:00 +03:00
# Demo Video on Real Hardware
2022-05-08 09:09:13 +03:00
[![IMAGE ALT TEXT HERE ](https://img.youtube.com/vi/-Juc1LT7Xls/0.jpg )](https://www.youtube.com/watch?v=-Juc1LT7Xls)
2022-05-08 09:10:00 +03:00
2022-05-08 09:11:37 +03:00
2022-05-08 09:12:09 +03:00
Watch on Youtube : https://www.youtube.com/watch?v=-Juc1LT7Xls
2022-05-07 22:51:34 +03:00
## Controls
2022-05-07 23:50:19 +03:00
| NesUEFI Key | Keyboard Key |
| ----------- | ----------- |
| Up | W |
| Down | S |
| Left | A |
| Right | D |
| Select | U |
| Start | I |
| A | K |
| B | J |
| Reload | R |
2022-05-07 22:51:34 +03:00
## Known Issues
- Mappers are not implemented yet.
- It does not support Audio emulation yet.
- Only single player is supported.
2022-05-08 05:28:09 +03:00
- NesUEFI only supports PS/2 keyboard. Most of the laptop keyboards should support it.
2022-05-07 22:51:34 +03:00
## Tested Games
Below games are currently tested on real hardware. But NesUEFI is not only limited to these games. It should technically run all the classic roms that use mapper 0. [Here ](https://nesdir.github.io/mapper0.html ) is a list of mapper 0 games.
- [x] Super Mario Bros
- [x] Popeye
- [x] Yie Ar Kung-Fu
- [x] Battle City
- [x] Super Arabian
- [x] Road Fighters
- [x] 1942
- [x] F1 Race
2022-05-07 23:22:29 +03:00
2022-05-07 22:51:34 +03:00
## TODO
- [x] Graphics
- [x] Timer
- [x] Keyboard
- [x] File System
- [x] File Browser
- [x] Graphics Library
- [ ] APU
- [ ] Mappers
- [ ] USB Keyboard Driver
## Acknowledgements
- https://wiki.osdev.org
- https://wiki.osdev.org/Tutorials
- https://wiki.osdev.org/UEFI
- https://wiki.osdev.org/GNU-EFI
- https://wiki.osdev.org/UEFI_App_Bare_Bones
- https://wiki.osdev.org/Loading_files_under_UEFI
2022-05-08 06:10:15 +03:00
- https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
2022-05-07 22:51:34 +03:00
- https://github.com/NJU-ProjectN/LiteNES
- https://learn.adafruit.com/adafruit-gfx-graphics-library
- https://edk2-devel.narkive.com/WhxSiG6I/edk2-directory-file-system-traversal-example
- https://www.youtube.com/watch?v=mpPbKEeWIHU& list=PLxN4E629pPnJxCQCLy7E0SQY_zuumOVyZ
- https://blog.fpmurphy.com/2015/08/display-bmp-details-and-image-in-uefi-shell.html#ixzz7SHLiufWS
- https://unsplash.com/photos/UqRnUzV5pjQ
2022-05-07 23:14:25 +03:00
- https://www.qmtpro.com/~nes
2022-05-07 22:51:34 +03:00
2022-05-07 23:23:33 +03:00
## Screenshots
![alt text ](/screenshots/0.png "Menu" )
![alt text ](/screenshots/1.png "Super Mario" )
2022-05-07 23:25:48 +03:00
![alt text ](/screenshots/2.png "Super Arabian" )
![alt text ](/screenshots/3.png "1942" )
2022-05-07 23:23:33 +03:00
2022-05-07 22:51:34 +03:00
# License
Licensed under the [MIT ](https://github.com/shadlyd15/NesUEFI/blob/master/LICENSE ) License.