Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - im looking for a... | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
ziratha

Ninji
Level: 24

Posts: 9/231
EXP: 77808
For next: 317

Since: 06-29-04

Since last post: 4 days
Last activity: 17 days
Posted on 07-29-04 03:05 AM Link | Quote
hi , i intend to learn asm, ive gotten some faqs, and readmes from various websites but it all means zilch if i cant get to the asm, so i need a dissasembler, preferable a fairly good one at preferably compatible with snes level stuff.

I then need to be able to get to the asm code. so if i need a program for that, ill need to know, aka if its a .xxx extension i need to know what opens .xxx .

finally and less immediatly i need a assembler, only if the disaseembler doesn't assemble.



oh, and any learning guides you all happen to know about i would appreciate.

if you could even tell me the utilities you all use, that would be a start.



thanks for anything you post,


also if this has been covered in a post i missed, please point me to the said post.
but ive only seena few passing mentions of nesdev and another site.

NightHawk

Bob-Omb
Level: 39

Posts: 516/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 07-29-04 03:14 AM Link | Quote
Okay, first off, look here for disassemblers and assemblers for whatever you're dealing with (if it's not there, try google).
Assembler source documents are basically just regular text documents (like you'd create with Notepad, for instance); they only have a different extension to signal their purpose.

And again, for general tutorials, the link I gave earlier should have enough to at least get you started (and then you can come back with more specific questions ).
ziratha

Ninji
Level: 24

Posts: 10/231
EXP: 77808
For next: 317

Since: 06-29-04

Since last post: 4 days
Last activity: 17 days
Posted on 07-29-04 08:12 AM Link | Quote
ok thanks, any ideas are welcome.
d4s

Panser
Level: 29

Posts: 52/325
EXP: 142151
For next: 5734

Since: 03-23-04

Since last post: 13 days
Last activity: 1 day
Posted on 07-29-04 01:32 PM Link | Quote
the best way to learn assembler is learning by doing.
personally, ive also started with disassembling
a small rom(slideshow) and reassembling it.
however, this is far more complicated than it may seem.
some issues include:
the memory/accu and x/y settings.
you can change the size of the accumulator and
the x/y registers for 8 or 16bits, thats a byte or a word(two bytes)
on the fly.
while this may be useful for programmers, it often causes
disassemblers to misinterpret given data.

example pseudocode:

Blahblah:
REP $#30 ; set accumulator, memory, x and y regs to 16bit
LDA $80 ; load two bytes(16bit) from adress wram adress $80 into accumulator
STA $81 ; store accumulator in wram adress $81 and $82
BRA Wurst ; branch to routine Wurst

;*************************************************************
;problem
;*************************************************************
SomeRoutine:
LDA $#45 ; load 8bit value 45 into accumulator
JSR $00A9 ; jump to subroutine
RTS ;return
;*************************************************************


Wurst:
SEP $#20 ; set accumulator/memory to 8bit
REP $#10 ; set x/y regs to 16bit
BRA SomeRoutine ; branch always to SomeRoutine


the problem here is that the size of the accumulator is changed during execution.
disassemblers either have a fixed setting for it during disassembly or have some basic tracing features, but still, they get some data wrong.
the above code example would probably look like this when disassembled:

Blahblah:
REP $#30 ; set accumulator, memory, x and y regs to 16bit
LDA $80 ; load two bytes(16bit) from adress wram adress $80 into accumulator
STA $81 ; store accumulator in wram adress $81 and $82
BRA Wurst ; branch to routine Wurst

;*************************************************************
;problem
;*************************************************************
SomeRoutine:
LDA $#4520 ; the disasm thinks the accu is still 16bits and misinterprets the
LDA #$00 ; jsr ($#20 in hex) as the second byte to load with the above ; instruction. the LDA #$00 ($#A900) actually was the adress
; the deleted jsr instruction should have jumped to.
RTS ;return
;*************************************************************


Wurst:
SEP $#20 ; set accumulator/memory to 8bit
REP $#10 ; set x/y regs to 16bit
BRA SomeRoutine ; branch always to SomeRoutine



do you see the problem here?
the disassembler cant know if a hex value is an instruction, an adress or some other data. it can only try to guess the cpu status bits by preceding code, but this
doesnt work out %100 in most cases and leaves you wondering where the problem could be.

i ended up tracing the rom in an emulator to a textfile and then comparing the
data with the disassemblers output to see where it made mistakes.

also, you have to add the labels again if you want the routine
to be flexible (aka .org it everywhere you want) and this can be a bit tedious,
ecspecially if offsets or bank change are hardcoded.

try to get nevikstis starterkit first (http://nesdev.parodius.com).
i would recommend to use the assembler included there, wla-65816, its
pretty flexible.




(edited by d4s on 07-29-04 04:32 AM)
(edited by d4s on 07-29-04 04:36 AM)
loadingNOW

Red Paragoomba
Level: 14

Posts: 11/61
EXP: 10382
For next: 2689

Since: 07-15-04
From: Silent Hill

Since last post: 136 days
Last activity: 3 days
Posted on 07-29-04 03:00 PM Link | Quote
learning by doing is best. It's gerereally recommented to start with nes because you have a nice debugger and the instuctionset is not that complex
(i can't comment on that because i didn't start with 6502 becaue I came from a pc-reversing background).

@d4s: actually datasecure's ida does quite a good job there (assumes everything is data, once you type c it converts the line to code and goes on until it does not see any more code - this works very well in 8086 and PPC sets. it does work as well if you're working on arm/thumb tho but it's always possible to correct mistakes manually)
Euclid

Cheep-cheep
Level: 23

Posts: 87/193
EXP: 65528
For next: 2195

Since: 03-15-04
From: Australia

Since last post: 24 days
Last activity: 7 days
Posted on 07-29-04 04:52 PM Link | Quote
i got 2 words to add.

this site
ziratha

Ninji
Level: 24

Posts: 11/231
EXP: 77808
For next: 317

Since: 06-29-04

Since last post: 4 days
Last activity: 17 days
Posted on 07-30-04 10:26 PM Link | Quote
ok heres some updates/ questions please dont hate me due to my obvious stupidity

oi. ok update

i dled a whole bunch of stuff. but so far i cant find much useful maybe due to the fact that i most of them either dont accept .nes input or dont have texts that tell how to get the dissasembler to do what i want to do, maybe i need to find the home site for the programs? i found an actual nes dissassmbler, and decided on a rom to disassemble, i dissasemmbled it and then went over to an assembler and it wouldn't assemble, i figured it would have some errors but 3000????? wow anyway i tried a snes assembler and it only got 1000 errors so...?

new questions:
about assembly/deassembly

can i use a snes dissasmbler on a nes type file? if so, will it be able to be assembled back to the .nes format? im not entirely sure on this one.

when i dissassemble something like a .nes file shouldn't it the asm file be the same size as the .nes file? cause my asm file ended up smaller...

i got the snes starter kit, but am having problems with it, it wants a .obj file with my asm to compile, where/how do i get a . obj file?
about asm itself

if i change the asm to make it assemble thereby changing the code, and then make a asm fix/addon will this work on other copies of the rom? Because if the asm was changed due to my fixes, wouldn't that make my roms slightly differant from the origional copy? and possible cause problems patching?


what the heck is the comand dc.b, i found a large number of this command in my asm code, (i think its asm, it looks like it and its .asm) but i could find no mention of this code in any of my multitude of faqs/walkthrughs

so thats whats happened so far, im getting a very basic understanding of some of the commands and such .


thanks again for any responses and please feal free to ridicule me for my fKitten Yiffers so far, so long as you also post somthing usefull. :-p
NightHawk

Bob-Omb
Level: 39

Posts: 537/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 07-31-04 01:41 AM Link | Quote
Okay, first off with the tools... if you're hacking a .nes ROM, use (dis)assemblers for the NES, not the SNES, and vice versa.

Second, disassemblers don't really work very well for what you're trying to do... finding one that will give you code that can be re-assembled can be a major pain, depending on your platform.

And no, the ASM file shouldn't be the same size as the NES ROM... it should be much larger (instructions for the NES' CPU are 1 - 3 bytes in size, but the disassembly will usually have a line of about 20 characters - bytes - per instruction).

And about those errors... the reason that the SNES assembler is giving you fewer errors, might be because you used a disassembler that, while going through the data sections (remember that code/data look the same to a disassembler; only very advanced ones can tell the difference), decoded some bytes as instructions for the SNES' CPU, which will of course give you errors if you try to use an NES assembler on the results.

Changing the asm just to make it assemble shouldn't actually change the binary at all; if it does, something was done wrong.

"DC.B" means "DeClare Byte": it simply reserves one byte of space with the value following.


Did that make any sense to you?
If not, feel free to ask more questions.
ziratha

Ninji
Level: 24

Posts: 12/231
EXP: 77808
For next: 317

Since: 06-29-04

Since last post: 4 days
Last activity: 17 days
Posted on 07-31-04 02:14 AM Link | Quote
OK, THANSK IM GONNA HAFTA DOWNLOAD a new nes assembler/dissambler thanksfor the help.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - im looking for a... | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.017 seconds.