locate my code

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

locate my code

Post by KanedaFr » Sat Feb 13, 2016 12:48 am

Hi,

When I write some asm code, I often use

Code: Select all

dc.w 0xDEAD
myfunc:
...
rts
dc.w 0xBEEF
to locate my code on the rom.bin when debugging/optimizing

I know i could use NM and all others tools for binary analysis or debug but I like this one, only needed a hex editor to check code


I wonder if something exist on C ?
Could I add "dead code" ?

Code: Select all

void func()
{
deadcode1;
....
deadcode2;
}

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: locate my code

Post by Sik » Sat Feb 13, 2016 5:34 am

That's what the debugging information is for, it keeps track of the addresses of all the functions (heck, the individual lines even).

Also in asm you can use listings for the same effect. Got accustomed to it after I got tired of Regen crashing every single time I actually need the debugger :P (now I just look at the BSOD screen and look for the address in the listing)
Sik is pronounced as "seek", not as "sick".

cero
Very interested
Posts: 339
Joined: Mon Nov 30, 2015 1:55 pm

Re: locate my code

Post by cero » Sat Feb 13, 2016 9:45 am

Well, you could write to a global, but the compiler may reorder your write.

global_u32 = 0xdeadbeef;

KanedaFr
Administrateur
Posts: 1139
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Re: locate my code

Post by KanedaFr » Sat Feb 13, 2016 10:40 pm

@sik : I know ;)
Like i said, i was looking for a very easy and limited option, when all you have is a compiler and a text editor (which support hexa)
I'll try to see if nm could extract me a easy to read listing.....

@cero : yep, this code could be anywhere, not on start/end of func

Post Reply