flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > Writing a NES emulator...

Author
Thread Post new topic Reply to topic
Mat Quasar



Joined: 15 Dec 2024
Posts: 87
Mat Quasar 17 Feb 2025, 12:44
Quote:

https://github.com/x86matthew
- Win16 emulator, NES emulator (in C++)


I also want to write NES emulator, using FASM.

I found it will emulate 8-bit 6502 CPU, and

Quote:

It has 3 general purpose register A/X/Y, and 3 special register P (status) /SP (stack pointer) /PC (program counter, or instruction pointer), all of them being 8-bit except PC which is 16-bit.


Quote:

16-bit addressable memory space.


Quote:

PPU (Picture Processing Unit) supporting rendering of 256x240 screen...


Quote:

APU (Audio Processing Unit) supporting 2 pulse channel, 1 triangle channel, 1 noise channel and 1 delta modulation channel.


I think I will also need to read the ROM in iNES format.

People using SDL for rendering input, video and audio. But I wish to learn from x86matthew, using native Windows GDI API functions!

I might drop the support of audio since I heard it is complicated to emulate or implement.

Does anyone have any resources to share? The nesdev website seems unreachable.

BTW, there is already a CHIP-8 emulator done by FASM member, you can search for it.
Post 17 Feb 2025, 12:44
View user's profile Send private message Reply with quote
wizgogo



Joined: 11 Dec 2020
Posts: 11
Location: Hell, Norway
wizgogo 17 Feb 2025, 13:44
You know @nocash?

He is an emulator developer, hacker and expert in reverse engineering. All his emulators are made using pure 100% Assembly Language. I read he is using TASM to program those emulators but the homebrew game he made Magic Floor is purely made using his own assembler named, A22i Assembler.

Right now he is busy working on documentating the 3DS and of course making a 3DS emulator. He also fixes some bugs in his no$psx emulator but didn't release it yet.

This is his website you can also see the documentations there.

http://problemkaputt.de/

But you can also visit him on forums like nesdev and psxdev.

http://forums.nesdev.org/memberlist.php?mode=viewprofile&u=5211
http://www.psxdev.net/forum/memberlist.php?mode=viewprofile&u=181
Post 17 Feb 2025, 13:44
View user's profile Send private message Reply with quote
Mat Quasar



Joined: 15 Dec 2024
Posts: 87
Mat Quasar 17 Feb 2025, 13:56
Nice stuff, I attach the NES specification here!

http://problemkaputt.de/everynes.htm


Description: From http://problemkaputt.de/everynes.txt
Download
Filename: everynes.txt
Filesize: 655.68 KB
Downloaded: 944 Time(s)

Post 17 Feb 2025, 13:56
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 772
Ali.Z 20 Feb 2025, 16:21

_________________
Asm For Wise Humans
Post 20 Feb 2025, 16:21
View user's profile Send private message Reply with quote
Mat Quasar



Joined: 15 Dec 2024
Posts: 87
Mat Quasar 24 Feb 2025, 14:30
I was referencing the nesdev website as nesdev.com which is wrong, it should be nesdev.org.

I seem to prefer the Nocash version of NES specification.
For example, Nocash's version:
( http://problemkaputt.de/everynes.htm#cpu65xxmicroprocessor )
Code:
Register/Immeditate to Register Transfer
  Opcode    Flags   Clk Native      Nocash              Expl.
  A8        nz----  2   TAY         MOV Y,A             ;Y=A    

...which is short and simple to understand, it even has "Nocash's instruction" version.

And the official Nesdev wiki is:
( https://www.nesdev.org/wiki/Instruction_reference#TAY )
Code:
TAY - Transfer A to Y
Y = A

TAY copies the accumulator value to the Y register.    


...which I found is hard to browse. I prefer it is sorted in list by category.

Total 56 instruction in NMOS 6502 CPU. This is no kidding, a huge project for me! It is like doing a 6502 disassembler.
This is the ROM emulator test, step-by-step, from ROM for CPU tests to ROM for PPU tests.
https://www.nesdev.org/wiki/Emulator_tests

I might be using Nocash's NO$NES to debug my project, since his Famicom NES emulator came with debugger and disassembler.


Description: 56 in total, of 6502 instruction
Filesize: 22.46 KB
Viewed: 267 Time(s)

6502.PNG




Last edited by Mat Quasar on 24 Feb 2025, 15:43; edited 1 time in total
Post 24 Feb 2025, 14:30
View user's profile Send private message Reply with quote
Mat Quasar



Joined: 15 Dec 2024
Posts: 87
Mat Quasar 24 Feb 2025, 14:31
Ali.Z wrote:
https://github.com/pubby/nesfab


It will take time for me to find out interesting part of it, after I have some progress in my project.
Post 24 Feb 2025, 14:31
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.