It is currently Wed Oct 18, 2017 4:28 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 116 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
 Post subject:
PostPosted: Sun Feb 13, 2011 7:40 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
- My $0.02 if that matter... :) In my CPU emulator, I use a syntax that helps me to identify the opcode and its addressing mode. In short words, it's opcode string + addressing mode number. So, you have LDA1, STA1 or LDA6 etc..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 13, 2011 1:01 pm 
Offline
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 744
Location: Shelton, Washington.
a suggestion with this program, frantik:

add an NSF disassembler, as an option or as a seperate program with at least minimal-to-no bankswitching support!

see the NSF file format on the wiki for more info:
http://wiki.nesdev.com/w/index.php/NSF

but is a great tool otherwise, should be a good FREE alternative even if it isn't portable!

_________________
AKA SmilyMZX/AtariHacker.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 13, 2011 2:30 pm 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
Hamtaro126 wrote:
even if it isn't portable!


it's "portable" in the sense that it can be used on any major OS.. though for mac/linux you will have to install PHP first. just think of it as a "dependency" ;)

the windows EXE in the zip file is mostly the PHP interpreter with the script packed inside of it.. it's possible to do the same thing with a unix executable, just no one has done it

actually.. it would be super trivial to make a web-based form for this so i might do that as well.. then it can even be used on CromeOS :D


btw, check out the output of excitebike.. i used a code/data log that was 94% complete as well as a couple dozen user defined labels. i think the disasm looks pretty nice :D when using the c/d logs, if an unknown area is encountered, it just assumes that it's probably the same type as the previous byte, unless the address is a known program code label created by a jump or branch. using this method, you don't have to have 100% complete logs to generate good output

this tool should really simplify the initial stages of creating completely documented disassemblies like doppleganger's SMB disassembly


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 13, 2011 9:21 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
Minor change (my OCD is kicking in):

Code:
;-------------------------------------------------------------------------------
; break vector
;-------------------------------------------------------------------------------
break:      .hex 83 00         ; $fff0: 83 00     Invalid Opcode - SAX ($00,x)
            .hex 04 14         ; $fff2: 04 14     Invalid Opcode - NOP JoyMirrorGame
            .hex 04 14         ; $fff4: 04 14     Invalid Opcode - NOP JoyMirrorGame
            .hex 04 14         ; $fff6: 04 14     Invalid Opcode - NOP JoyMirrorGame
            .hex 04 d4         ; $fff8: 04 d4     Invalid Opcode - NOP $d4

;-------------------------------------------------------------------------------
; Vector Table
;-------------------------------------------------------------------------------
vectors:    .dw nmi            ; $fffa: 3b c2     Vector table
            .dw reset          ; $fffc: 84 c1     Vector table
            .dw break          ; $fffe: f0 ff     Vector table


This is technically the IRQ/BRK vector. Most games would use this for hardware IRQs. Naming it "break" and "break vector" is a bit misleading. Possibly naming the label "irqbrk" and the comment as "IRQ/BRK vector" would be better?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 13, 2011 9:23 pm 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
ok, thanks, i'll change it :) any other "OCD" stuff like that is very welcome!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 6:20 am 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
made some changes, mostly to do with how the output is displayed, but one cool thing is support for jump tables.. if a user defined label ends with "JumpTable" then all of the following pairs of bytes are assumed to be labels (until the next label is encountered)

Version 1.3

and again, the RAW output of excitebike from the program (using a code data log and fair amount of user defined memory and PRG labels, .. i've been disassembling excitebike for a bit now )


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 7:18 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19093
Location: NE Indiana, USA (NTSC)
Nice idea. Would it be too hard to add support for labels starting with RTSTable, where the following two-byte values are assumed to be one less than a label?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 4:09 pm 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
tepples wrote:
Nice idea. Would it be too hard to add support for labels starting with RTSTable, where the following two-byte values are assumed to be one less than a label?


good suggestion :D.. i was already planning on adding support for pointer tables (where all the low bytes are listed first then the high bytes) but RTSTable sounds like a good idea too

btw can you name an example of a Mapper 0 game which uses RTS Tables?


Last edited by frantik on Mon Feb 21, 2011 4:57 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 4:56 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
Code:
            .hex b9 88 00                    ; $e45f: b9 88 00  Bad Addr Mode - LDA $0088,y


Why can't it specify LDA $0088,Y? The Zero Page,Y form of this instruction does not exist, so there's no conflict.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 21, 2011 5:00 pm 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
Dwedit wrote:
Code:
            .hex b9 88 00                    ; $e45f: b9 88 00  Bad Addr Mode - LDA $0088,y


Why can't it specify LDA $0088,Y? The Zero Page,Y form of this instruction does not exist, so there's no conflict.


thanks, i added a check for that addressing type in the next version.. now exicitebike is "bad addr mode" free.. i thought it was weird that the original code seemed to be waste a few bytes


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2011 11:33 am 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
working out some bugs... now it's faster and can produce valid output in only 2 passes with a complete CDL file.

tepples do you (or anybody) have an example of an NROM game which uses the RTS trick? from my searches so far i think i've just heard of final fantasy using it. i have the code implemented to disassemble it but i need a test case


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2011 11:52 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19093
Location: NE Indiana, USA (NTSC)
frantik wrote:
tepples do you (or anybody) have an example of an NROM game which uses the RTS trick? from my searches so far i think i've just heard of final fantasy using it. i have the code implemented to disassemble it but i need a test case

Two of my NROM-128 games use it. LJ65 uses one RTS dispatcher for the playfield's state and calls it once for each player (I think the variable was called curTurn). Concentration Room uses three: one for the title screen menu, one for the game state, and one for the CPU opponents' state.

EDIT: Will explain further below


Last edited by tepples on Tue Feb 22, 2011 11:59 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2011 11:57 am 
Offline

Joined: Tue Mar 03, 2009 3:56 pm
Posts: 298
cool thanks.. and since i'm feeling lazy, could you tell me the location of one of the RTS tables in one of your games? :D

edit.. nm, i see the source for concentration room is included so i can just use that


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2011 12:02 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19093
Location: NE Indiana, USA (NTSC)
In LJ65
src/t.s#game_cycle

In Concentration Room
src/litemain.s#titleDispatch is a really tricky one: it pushes the address of a handler for a title screen menu item, and then instead of RTSing directly into the handler, it JMPs to a routine that clocks the random number generator, and that RTSes into the handler. src/aidiocy.s#doAI and src/memorygame.s#stateDispatch are more straightforward. Notice that every time you build these in ca65, the addresses of these routines will change. By default, Concentration Room is preprocessed by a shuffler so that I can 1. more easily find buffer overflows and 2. trace leaks should I ever make an enhanced version of the game for selling copies on carts. You can disable this by changing shufflemode in the makefile.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 22, 2011 12:50 pm 
Offline
User avatar

Joined: Thu Jan 19, 2006 5:08 pm
Posts: 744
Location: Shelton, Washington.
the WORDs specified in my CDL turn to BYTEs.

And I think (I read) the next version should fix it,

EDIT: Sorry if I reminded you, but aren't you still going to add minimal NSF support?

You can use CDLs with the NSFs using FCEUX Code/Data Logger!

_________________
AKA SmilyMZX/AtariHacker.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 116 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: FrankenGraphics, Google Adsense [Bot] and 11 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group