nesdev.com
http://forums.nesdev.com/

Disassembler on nes emulator
http://forums.nesdev.com/viewtopic.php?f=2&t=15909
Page 1 of 1

Author:  RomarioSilva [ Sat May 06, 2017 6:34 am ]
Post subject:  Disassembler on nes emulator

hey people, i'm have some problems with disassembly some opcodes.
someone have any sugestions or online dissasembler, because i cant use then correctly.
thx!

Author:  nesrocks [ Sat May 06, 2017 7:31 am ]
Post subject:  Re: Disassembler on nes emulator

I have succesfully disassembled the whole ghostbusters rom into reassemblable code using disasm and asm6. There were minor edits and tweaks that had to be done.

Author:  dougeff [ Sat May 06, 2017 10:20 am ]
Post subject:  Re: Disassembler on nes emulator

If the ROM is bigger than NROM, you probably need to split the ROM into smaller chunks, before disassembling with disasm.

I wrote a disassembler, but it's not as advanced as disasm, except that it breaks the ROM into smaller chunks for you. (requires Python 3). Also, requires a complete NES file, with correct header.

https://github.com/nesdoug/NES-DISASSEMBLER


That reminds me, I forgot about the pull request. Hmm.

Author:  RomarioSilva [ Sun May 14, 2017 6:18 am ]
Post subject:  Re: Disassembler on nes emulator

Thx for the help.

Author:  RomarioSilva [ Sun May 14, 2017 6:21 am ]
Post subject:  Re: Disassembler on nes emulator

I have one ask.
int numbers of 8 bits, are represent as: 0 - 255 or (-128(negative) to 127(positive)), because i'm have some problems to set negative flag.

Author:  Quietust [ Sun May 14, 2017 6:27 am ]
Post subject:  Re: Disassembler on nes emulator

RomarioSilva wrote:
int numbers of 8 bits, are represent as: 0 - 255 or (-128(negative) to 127(positive))

To the 6502, values in memory and registers are simultaneously signed and unsigned - no matter what operation you do on them, the result is exactly the same, and the processor Flags will be set for both cases (e.g. ADC will update both C for unsigned Carry and V for signed Overflow).

In a disassembler you should pretty much always display numbers as unsigned, preferably in hexadecimal. It's up to the person reading the disassembly to interpret things further.

Author:  Oziphantom [ Sun May 14, 2017 9:13 am ]
Post subject:  Re: Disassembler on nes emulator

Negative Flag = bit 7

$80 N = 1
$7F N = 0

There is no "logic" behind it.

Author:  RomarioSilva [ Mon May 15, 2017 4:10 am ]
Post subject:  Re: Disassembler on nes emulator

Thx guys. :D

Author:  na_th_an [ Mon May 22, 2017 3:37 am ]
Post subject:  Re: Disassembler on nes emulator

Well, in fact there *is* logic behind it. 80-FF are negative numbers because of the used notation, two's complement. One of the main advantages about it is that you can consider a byte value unsigned or signed depending on the context; arithmetic operations will always make sense. If you substract 04 from 01, the result is FD ('cause past 0, you start over: 1->0->FF->FE->FD), which, in two's complement, is -3.

The N flag is just an aid to the programmer, and it is kind of copied from bit 7 of the value in the accumulator after certain instructions (as negative numbers, 80-FF, all have bit 7 set).

Author:  Oziphantom [ Wed May 24, 2017 4:13 am ]
Post subject:  Re: Disassembler on nes emulator

Sorry, by Logic I was refereeing to Logic Gates. I.E the N is just a mirror of the 7th bit, there are no AND/OR/NOR/NAND logic involved in determining its value. Although as you point out there is a gate to enable the copy as it only happens on some instructions.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/