This commit changes the behavior of dcc6502, so that it consults the return value of fread(), and then increments the value of byte_count by the number returned by fread(), rather than implicitly incrementing it every time. Previously, a warning occurred during compilation, because the return value of fread() was ignored. Instead, the number of bytes in the input file were counted implicitly by incrementing a byte_count variable after every fread() call. Additionally, I created a two-byte test input file consisting of the bytes #$a9ff, which corresponds to LDA #$FF. When dcc6502 tried to disassemble this input file, it reported that the file had a size of three bytes. It reported the first two opcodes correctly, but then incorrectly displayed a BRK as the third opcode. After this change, the input file now has a reported size of two bytes, without the phantom BRK opcode at the end.
dcc6502
Disassembler for 6502 processors.
Features
- Simple command-line interface
- Single file, ANSI C source
- Annotation for addresses of Nintendo Entertainment System (NES) system registers
- Cycle-counting output
- Machine code display inline with the disassembly
History tidbit
The original 1.0 version of dcc6502 was written overnight on Christmas eve 1998. At the time, I (Tennessee Carmel-Veilleux) was a 16-year-old NES hacker learning 6502 assembly. Of course, as many teenagers are, I was a bit arrogant and really thought my code was pretty hot back then :) Fast-forward 15 years and I'm a grown-up engineer who is quite a bit more humble about his code. Looking back, I think the tool did the job, but obviously, 15 years of experience later, I would have made it quite a bit cleaner. The disassembler has floated online on miscalleanous NES development sites since 1998. I decided to put it on github starting at version 1.4 and I will be cleaning-up the code over until version 2.0.
This disassembler has made the rounds and has been used for a lot of different purposes by many different people over the years. Hopefully it will continue to be useful going forward.