don't click here

Basic Questions & Answers thread

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

  1. rata

    rata

    Member
    690
    73
    28
    Argentina
    Trying to be useful somehow.
    I can't remember exactly the numbers but I recall that they are 4 digits and they sort of sum up in a fashion like, 0002 increments red, 0020 green and 0200 blue. Then when the numbers overlap, you end up with an odd digit so it doesn't mess up with the info. If you toy around a little with Knuckles Chaotix debug menu, you can alter palettes in real time so you can figure out how they work.
     
  2. nineko

    nineko

    I am the Holy Cat Tech Member
    6,308
    486
    63
    italy
  3. MainMemory

    MainMemory

    Kate the Wolf Tech Member
    4,742
    338
    63
    SonLVL
    32X doesn't have tiles, it has a framebuffer. Graphics data can be stored in any format the developers want. There's an editor for the Chaotix sprite format in SonLVL.
     
    • Like Like x 2
    • Informative Informative x 2
    • List
  4. Spicy Bread SSR

    Spicy Bread SSR

    You can call me Mal if you like Member
    10
    7
    3
    Does anyone know how Sonic 1 loads object palettes in its code? I'm making a character hack base, and I don't want to change the object mappings unless I need to
     
  5. One thing i have wondered about the Neon Cowgirl sign from Sonic Adventure 1 that was censored was if it's "Moan" Sound Effect is still in the sound test, If so which Number?
     
  6. Brainulator

    Brainulator

    Regular garden-variety member Member
    Since I have no idea if and when this question was ever answered here, I must ask:

    In 68000 assembly programming, when is it better to use a clr command versus a move command with a source operand that resolves to 0? I'm curious why some functions use one and not the other.
     
  7. PhyChris

    PhyChris

    Member
    10
    2
    3
    Sup people :) are there any sonic1,2 or 3 hacks that show different character behavior, like castlevania or contra?
     
  8. Rufus_Iskv

    Rufus_Iskv

    Member
    5
    0
    1
    Russia
  9. bookman the stinky

    bookman the stinky

    literal trash Member
    197
    15
    18
    the dong
    find motivation
    Is there any particular reason why the Special Stages in Sonic CD make the sound engine chug balls? It happens on real hardware and on an emulator. I'd almost say it's due to the plane scaling/rotation effects running alongside game code, but the fact that there's no audio issues in the US CD BIOS screens could rule that out. Poor optimization of code perhaps?
     
  10. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    Using ASM68k, is it possible to redefine an existing instruction with a macro? For example if I wanted nop to be $1234 instead of $4e75.
     
  11. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    I don't think you can redefine the 68k mnemonics with ASM68K, I think they get priority over macro definitions.

    Two possible alternatives; 1. create a macro with a unique name similar say "mnop" or whatever, 2. alter the exe at offset A7BF and change the two bytes from 4E 71 to 12 34.
     
  12. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    That does give me the idea of changing "nop" in the exe to "bop" or something, then I'd be free to use nop however I wanted. It's not stored as an ascii string though.
     
  13. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Actually, it sorta is...

    The way ASM68K deals with processing mnemonics is by indexing the first letter against a jump table from a to z. It has a subroutine for each valid letter, so there's a subroutine specifically for instructions that start with "n":

    • "neg"
    • "negx"
    • "nop"
    • "not"
    • "nbcd".
    It checks the next two letters as a word (comparing for "eg", "op", "ot", and finally "bc", for instructions such as "neg" and "negx" the conditional jump for "eg" will then check for "x" in the subsequent routine.

    So effectively, all you need to do is nop out (ironically) the comparison and conditional jump for "op" in this subroutine.

    Goto offset A655 and replace 66 3D 6F 70 0F 84 4A 01 00 00 with 90's.

    The "nop" is now not recognised as a valid instruction by ASM68K. You can now create a macro for nop to do something totally different, and create a macro for bop to place in 4E71 to your liking.
     
    • Informative Informative x 2
    • List
  14. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    Very interesting, thanks.

    I notice "op" and the others conveniently have an = sign before them, which makes it really easy to find any instruction. In case you were wondering, I'm going to add Z80 support to ASM68k with macros.
     
  15. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Ahhh, you probably should have said, AURORA☆FIELDS has already done this here (link on the post appears to be down, so have a mirror).

    For opcodes which are shared with 68k (add, sub, or, and, nop, etc), she prefixed the Z80 versions with a z (e.g. zadd, zsub, and znop and so on...). You should probably consider contacting her, she is very knowledgeable of ASM68K as an assembler, and has a fair number of tricks up her sleeve.

    Out of interest; if I'm understanding rightly, it seems you're favouring nop for Z80 rather than 68k, is there a particular reason for this? How comes not the other way around, i.e. "bop" for Z80?
     
    Last edited: Jul 7, 2021
  16. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    I did see that, but I want to do it a bit differently.

    nop will be used by both Z80 and 68k. Which version is used depends on whether a Z80 flag has been set by another macro, sort of like how it works in AS. It'll look something like this:

    nop: macro
    if z80 = true
    dc.b 0
    else
    bop
    endc endm

    Preserving the original instruction with a different name keeps the macros simple.
     
  17. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,202
    432
    63
    Japan
    Ahhh, awesome idea! That would be absolutely delightful if you can pull it off~

    Still not entirely sure why you need "bop" specifically, couldn't you use:

    nop: macro
    if z80 = true
    dc.b 0
    else
    dc.w $4E71
    endc endm

    Directly? I assume there must be an alternative reason.

    At any rate, I'll stop with the questions, but I am certainly interested in progress on this. Feel free to shoot me a PM if you need a bit of help.
     
  18. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    Yes, I'd actually just use $4e75 for nop. The nop/bop thing was an example. I mainly had this method in mind for more complicated instructions where I don't want to manually reconstruct the 68k versions.

    Inevitably I'll run into more problems so I'll let you know if I need help.
     
  19. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    So far so good, except for this:

    Code (Text):
    1.  
    2. ex   af,af'
    3.  
    ASM68k fails on this line because the apostrophe makes it think there's a string:

    Code (Text):
    1.  
    2. Error : No closing quote on string
    3.  ex af,af
    4.  
    I was hoping there'd be an option to disable/change quote characters, but I can't find one in the manual.
     
  20. Hivebrain

    Hivebrain

    Administrator
    3,049
    161
    43
    53.4N, 1.5W
    Github
    When I have a macro that sets a variable, that variable appears to be the same throughout the program, even though the macro is used multiple times with different values for the variable. How do I use a variable that varies?

    This is what I'm doing:

    Code (Text):
    1.  
    2. getzreg:   macro       ; convert register to numerical value
    3.        if strcmp("\1","a")
    4.        zreg: = 7
    5.        elseif strcmp("\1","b")
    6.        zreg: = 0
    7.        elseif strcmp("\1","c")
    8.        zreg: = 1
    9.        elseif strcmp("\1","d")
    10.        zreg: = 2
    11.        elseif strcmp("\1","e")
    12.        zreg: = 3
    13.        elseif strcmp("\1","h")
    14.        zreg: = 4
    15.        elseif strcmp("\1","l")
    16.        zreg: = 5
    17.        elseif strcmp("\1","(hl)")
    18.        zreg: = 6
    19.        else
    20.        endc
    21.        endm
     
    Last edited: Jul 11, 2021