don't click here

Basic Questions & Answers thread

Discussion in 'Engineering & Reverse Engineering' started by Tweaker, May 29, 2008.

  1. MrMaestro

    MrMaestro

    Not your average member of a forum
    20
    0
    0
    Singapore
    Solving a Rubik's cube
    Parts of the S3K ring manager are the same for the collision manager however i got similar results to what you got by directly modifying the ring manager so try that next.

    On another note i have recently ported Clownacy's Sound Driver V2 to my hack and i keep getting an error upon building. I've altered it and reduced errors to 1 and that's the only error.

    The error is "> > >s2.asm(51957): error: addressing mode not allowed here"
    The cause is "> > > lea (Obj70_Positions).w,d0"
     
  2. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    What's the location of Obj70_Positions?

    Based on the name, it sounds like an array of data in the object's code. Anything with an address less than FFFF8000 uses (Obj70_Positions).l. Note the L at the end.
     
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    That's not correct. Any address from $00000000 to $00007FFF or $FFFF8000 to $FFFFFFFF can be referenced with word-sized addressing. Everything else requires longword addressing (or pc-relative addressing).
     
  4. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    ? Oh... I didn't know that bit about the 00-00007FFF bit. I thought it applied to all the addresses...

    Learnin' something new.
     
  5. MrMaestro

    MrMaestro

    Not your average member of a forum
    20
    0
    0
    Singapore
    Solving a Rubik's cube
    So i added .l at the end so it becomes lea (Obj70_Positions).l,d0 but i get the same error.
     
  6. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    Seems like everyone focused on the wrong part of the line... "lea" only accepts address registers on the right side. Try again something like
    Code (Text):
    1. lea (Obj70_Positions).w,a2
    And if it is still failing, then change the ".w" to a ".l". You can use any of the address registers; I am assuming that this happens inside some object's code, so you can't use a0.

    Edit: adding quote due to page break.
     
  7. RetroKoH

    RetroKoH

    Member
    1,662
    22
    18
    Project Sonic 8x16
    I feel embarrassed for missing that... thank you flamewing. :)
     
  8. cokyen

    cokyen

    Member
    24
    0
    0
    So we write to the control port ( Adress 00C00004 in m68k memory) ... Does the VDP independently and automatically constantly check m68000 address 00c00004 value ? Is it synced at the same frequency as the 68k to do this ?
     
  9. MrMaestro

    MrMaestro

    Not your average member of a forum
    20
    0
    0
    Singapore
    Solving a Rubik's cube
    It builds... YAY!, but the metropolis cogs are messed up

    Picture - http://www.mediafire.com/download/ajd0dccmbccpc4u/S2built.tga

    Open with Paint.NET
     
  10. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    From this post:

    (emphasis added)

    And no, the VDP is not synched to the 68k's frequency.

    And now comes the part where I say "... of course it did; you changed the code that loads the cog offsets." Without seeing exactly how you messed with that code, it is impossible to know how to fix it.

    Also: instead of giving links to download images, just put them as PNG in something like imgur.com and use the "insert image" button to put it on your post.
     
  11. cokyen

    cokyen

    Member
    24
    0
    0
    I am looking to buy a laptop. What specs would you say would be the minimum to properly run any emulation / debugging tools like Exodus etc which act slow when you are low in RAM and have the VDP window , the Z80 Window , the main 68000 window , the registers window etc... Basically what is a good spec list in general for any M68000 / Sega Genesis programming / Sonic Hacking for a Laptop?
     
  12. MrMaestro

    MrMaestro

    Not your average member of a forum
    20
    0
    0
    Singapore
    Solving a Rubik's cube
    Alrighty then

    The ASM File - https://www.mediafire.com/?cuy9g154cqim5a8
     
  13. AURORA☆FIELDS

    AURORA☆FIELDS

    The cute one here Tech Member
    216
    24
    18
    Finland
    AMPS
    First of all, if you want to ever run Exodus, ditch the idea of buying a laptop and buy an actual PC. I right now have Intel 5820K processor with default clock. This beast is 6-core 3.3GHz processor. Even it can not always run Exodus at 60FPS. I am sure though, it is a flaw in the emulator as I can run 4 instances before all of them will consistently run below 60FPS. I would buy a processor with at least 4 cores and 3GHz clock (probably better if higher). I would also get at least 8GB of system RAM, and fairly good graphics card to make sure there are no other bottlenecks. And really good cooling. If you are fine with something less intensive like Regen, pretty much any laptop that is 5 or less years old will do you fine, as long as you don't go looking from the lowest possible end (or those minilaptops, they will be guaranteed to have shit cooling and that kills the performance they could have).
     
  14. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    Right, on your file, find this:
    [68k]loc_286A2:
    move.w d1,objoff_36(a0)
    add.w objoff_34(a0),d1
    lea Obj70_Positions.l,a2[/68k]
    And change it to this:
    [68k]loc_286A2:
    move.w d1,objoff_36(a0)
    add.w objoff_34(a0),d1
    lea (Obj70_Positions).l,a1[/68k]
    This should fix the cogs.
     
  15. Fred

    Fred

    Taking a break Oldbie
    1,563
    117
    43
    Portugal
    Sonic 3 Unlocked
    Out of curiosity, what is this line doing? Is it loading the first longword of whatever's at the 'Obj70_Positions' label into a2?
     
  16. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,338
    412
    63
    Lincs, UK
    TurBoa, S1RL
    [68k]lea (Obj70_Positions).l,a1[/68k]

    loads the longword of whatever's at the Obj70_Positions label into a1;

    [68k]lea Obj70_Positions.l,a2[/68k]

    loads the address of the Obj70_Positions label itself into a2.

    Obj70_Positions in this case is just a number that corresponds with where the label would be in the compiled ROM. Without brackets, you're telling it to load that number; with brackets, you're telling it to load whatever is at that location in the ROM. Brackets indicate pointers.
     
  17. Fred

    Fred

    Taking a break Oldbie
    1,563
    117
    43
    Portugal
    Sonic 3 Unlocked
    I think I got mixed up here, sorry.

    One line you see very often due to the nature of the object engine is something like

    [68k]move.l #Obj_Whatever,(a0)[/68k]

    One error I've done more times than I'd care to admit is forgetting the '#' sign, which IIRC builds but does not do the thing that you wanted to do. I never looked much into this, but what are you telling the assembler when you omit the pound sign?
     
  18. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    This is completely, 100%, wrong. What it actually does is load the address Obj70_Positions into a1, just like:

    does into a2. This is a nonstandard, nonportable syntax, though, which is why I told him to change it. The real error was in the destination register.

    This rule of thumb is always wrong for lea and pea: these instructions never read from the target address. Ever.
     
  19. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,735
    334
    63
    SonLVL
    Most 68000 assemblers treat a raw number/label without a '#' sign in front of it as equivalent to a number in parentheses, as an address from/to which the data is to be read/written. As such, move.l Obj_Whatever,(a0) will read a longword from the address represented by Obj_Whatever to the address pointed to by a0. The '#' sign tells the assembler to instead treat it as an immediate value, changing the result to instead write the value of Obj_Whatever to the address pointed to by a0.
     
  20. flamewing

    flamewing

    Emerald Hunter Tech Member
    1,161
    65
    28
    France
    Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
    There is difference between lea and move which is relevant here, so I will take the time to explain it all:
    [68k]move.l #Blah,(a0) ; (1)
    move.l (Blah).w,(a0) ; (2)
    move.l (Blah).l,(a0) ; (3)
    move.l Blah(pc),(a0) ; (4)
    move.l Blah,(a0) ; (5)
    lea (Blah).w,a0 ; (6)
    lea (Blah).l,a0 ; (7)
    lea Blah(pc),a0 ; (8)
    lea Blah,a0 ; (9)[/68k]
    1. The longword address "Blah" is moved into the longword at address in a0;
    2. Word address Blah is sign-extended to longord; then, the longword at this location is moved into the longword at addres in a0;
    3. Longword at address Blah is moved into longword at addres in a0;
    4. Longword at address Blah (which must be within a 16-bit distance from pc) is moved into longword at address in a0;
    5. Assembled into (2) or (4) if possible, (3) otherwise;
    6. The word address Blah is sign-extended to longword and stored into a0;
    7. Longword address Blah is loaded into a0;
    8. Address Blah (which must be within a 16-bit distance from pc) is loaded into a0;
    9. Assembled into (6) or (8) if possible, (7) otherwise.
    Edit: Ninja'd by MainMemory.