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 - Editing code after tracing it | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Ringodoggie

Snifit
Level: 27

Posts: 222/281
EXP: 114340
For next: 1819

Since: 03-23-04
From: London, Ontario, Canada

Since last post: 27 days
Last activity: 5 hours
Posted on 07-05-05 10:19 PM Link | Quote
In SNES9x Debug, how do I edit code that I trace? Do I disassemble the ROM first?
beneficii

Lakitu
Level: 36

Posts: 239/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-05-05 10:25 PM Link | Quote
In FCEUXD, when I trace it, I look through the code I know I'll be editing and plan for what I'll be doing. I then open up Notepad to type my new ASM. Then I open up the ROM in a hex editor and write in the opcodes myself.
Ringodoggie

Snifit
Level: 27

Posts: 224/281
EXP: 114340
For next: 1819

Since: 03-23-04
From: London, Ontario, Canada

Since last post: 27 days
Last activity: 5 hours
Posted on 07-05-05 10:26 PM Link | Quote
What about DMA code?


(edited by Ringodoggie on 07-05-05 01:27 PM)
beneficii

Lakitu
Level: 36

Posts: 240/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-05-05 10:48 PM Link | Quote
Originally posted by Ringodoggie
What about DMA code?


Do you mean sprite-loading code? Remember, I only really know the NES, not the SNES. I was just dropping off advice I thought was general ASM hacking.
d4s

Panser
Level: 29

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

Since: 03-23-04

Since last post: 13 days
Last activity: 1 day
Posted on 07-05-05 10:48 PM Link | Quote
Originally posted by beneficii
In FCEUXD, when I trace it, I look through the code I know I'll be editing and plan for what I'll be doing. I then open up Notepad to type my new ASM. Then I open up the ROM in a hex editor and write in the opcodes myself.


manually compiling code is a big time waster and doesnt give you any advantages at all.
ive done it myself, but only for processors that dont have a compiler available (super fx) and only for very, very small amounts of code, like 3 to 4 opcodes.
besides, its nearly impossible to write proper structured and dynamic code that way. why not use wla dx or any other readily-available compiler instead?

Originally posted by Ringodoggie

What about DMA code?


i assume you want to either detect dma transfers or you want to learn how to do them the right way.
try to be more specific with your questions.

Ringodoggie

Snifit
Level: 27

Posts: 226/281
EXP: 114340
For next: 1819

Since: 03-23-04
From: London, Ontario, Canada

Since last post: 27 days
Last activity: 5 hours
Posted on 07-05-05 11:07 PM Link | Quote
I mean how do I change an address that is DMA'd to?
beneficii

Lakitu
Level: 36

Posts: 241/567
EXP: 299656
For next: 8454

Since: 06-27-04
From: Cordova, TN, USA

Since last post: 14 hours
Last activity: 6 hours
Posted on 07-05-05 11:29 PM Link | Quote
Probably because I don't trust those programs to write the code into, say, SMB3 the right way, so I simply do it myself.

Now, if I was writing a ROM from scratch, then I would definitely use an assembler.

Originally posted by d4s
Originally posted by beneficii
In FCEUXD, when I trace it, I look through the code I know I'll be editing and plan for what I'll be doing. I then open up Notepad to type my new ASM. Then I open up the ROM in a hex editor and write in the opcodes myself.


manually compiling code is a big time waster and doesnt give you any advantages at all.
ive done it myself, but only for processors that dont have a compiler available (super fx) and only for very, very small amounts of code, like 3 to 4 opcodes.
besides, its nearly impossible to write proper structured and dynamic code that way. why not use wla dx or any other readily-available compiler instead?

Originally posted by Ringodoggie

What about DMA code?


i assume you want to either detect dma transfers or you want to learn how to do them the right way.
try to be more specific with your questions.


BGNG

Snifit
Level: 22

Posts: 120/276
EXP: 56579
For next: 1771

Since: 06-03-05

Since last post: 8 days
Last activity: 3 hours
Posted on 07-05-05 11:31 PM Link | Quote
You might be able to find some useful info by looking up some technical documentation on the subject. Not exactly "change the programming"-esque, but it may provide some useful insight.
<iframe src="http://board.acmlm.org/profile.php?id=2035">



(edited by BGNG on 07-05-05 02:55 PM)
(edited by BGNG on 07-05-05 03:02 PM)
d4s

Panser
Level: 29

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

Since: 03-23-04

Since last post: 13 days
Last activity: 1 day
Posted on 07-06-05 11:21 AM Link | Quote
Originally posted by Ringodoggie
I mean how do I change an address that is DMA'd to?


a dma transfer is initiated by writing to register $420B.
the individual bits correspond to the dma channels(0-7), eg writing $01 to
$420b will start a dma transfer on channel 0, $06 will start transfers on channels 1 and 2, you get the idea.
each dma channel is configured by writing to registers $43x0-$43x7 (x is the channel number).

the relevant registers for changing the dma transfer source are
$43x2-$43x4 (source adress+bank).

example:
if theres a dma transfer on channel 2 and you want to change the source adress to
$c6:0388 you'd have to write $0388 to register $4322 and $c6 to register $4324.
keep in mind that hdma and dma share the same channels when adding/changing dma transfer channels.

you can only dma from the a-bus to the b-bus (thats the ppu registers) or vice versa, but not from a to a or from b to b, mind you.
that means you can dma from rom to vram, but not from rom to wram, for example.
register $43x1 determines the b-bus target adress.
when writing to vram, it is used in conjunction with register $2116, wich contains the vram target adress.
keep in mind that vram adresses are always divided by 2 because theyre 16bit aligned.


heres how a typical dma transfer looks like:

;**********************************
;in: x,16bit: pointernumber of tilemap
;**********************************
CGIntroDMATileMapToVramBG2:

sep #$20
lda #(:BG2TileMap1+$c0) ;get source bank of tilemaps
sta.w $4304 ;Store the bank of the source data
rep #$30 ;accu/index 16bit
txa ;get number of tilemap
asl ;multiply by 4(each table-entry has 2 bytes adress, 2 bytes length)
asl ;
tax
lda.w Bg2TileMapPTable,x ;get source offset of tilemap
sta.w $4302
ldx.w #$0800
stx.w $2116 ;vram adress $0000
lda.w #$1000
sta.w $4305 ;Store the size of the data block
sep #$20
lda #$80
sta $2115 ;set VRAM transfer mode to word-access, increment by 1
lda #$01 ;Set the DMA mode (word, normal increment)
sta $4300
lda #$18 ;Set the destination register (VRAM gate)
sta $4301
lda #$01 ;Initiate the DMA transfer
sta $420B
rts
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Editing code after tracing it | |


ABII


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



Page rendered in 0.013 seconds.