The Macro Assembler AS

Discussion in 'Engineering & Reverse Engineering' started by Aurochs, Dec 17, 2006.

  1. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
    If you have a question about AS that you want answered, post it here. If I can't answer it myself, and I'm sufficiently piqued, I'll email Alfred Arnold about it.

    Any questions of the general form "yadda yadda yadda AS sucks yadda yadda" will be silently ignored.
     
  2. Weird Person

    Weird Person

    You lost two seconds reading this Member
    367
    0
    0
    Who knows?
    Where I can download it?
     
  3. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
  4. Hayate

    Hayate

    Tech Members Tech Member
    (Assuming by AS you mean ASM) What do bmi and bpl mean?
     
  5. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    No, by AS he means the AS assembler used in his Sonic 2 Disassembly :P
     
  6. Hayate

    Hayate

    Tech Members Tech Member
    o.

    I guess my question still holds, though.
     
  7. Quickman

    Quickman

    Tech Members Tech Member
    5,584
    0
    0
    :x
    omg porjcet
    Branch if MInus (sign bit set) and Branch if PLus (sign bit clear).
     
  8. Hivebrain

    Hivebrain

    Administrator Administrator
    2,766
    0
    16
    53.4N, 1.5W
    HivePal 2.0
    In other words, branch if a value is negative and branch if a value is 0 or positive.
     
  9. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    What's the AS equivalent of "even"?
     
  10. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
    Since several people have complained about AS emitting errors for indexed addressing modes, I've decided to explain it here.

    The problem is not in the instructions that give the errors. They are perfectly fine. The problem is in certain JMP statements, particuraly absolute jumps without a specified length. They take the form

    <tt>jmp someLabel</tt>

    When AS encounters this in the first pass, and <tt>someLabel</tt> hasn't been defined yet, it will reserve two extension words and move on. In the second pass, the extension words are filled in with the destination address, and if it's found to need only a single word, AS will size-optimize. This is precicely the problem.

    When that second word is removed, the entire ROM after that will be shifted down two bytes. This messes up all later references. Occasionally, the address space will be shifted such that AS will attempt to allocate extra space for other references - and if this isn't allowed for some addressing mode, it will emit an error.

    This is rather simple to fix. Simply specify the width of the destination address in absolute jumps. The above instruction becomes

    <tt>jmp (someLabel).[swl]</tt>

    You can choose any of s, w, or l for the length attribute depending on the expected address width. (s and w mean the same thing.) AS will emit an error if .[sw] isn't allowed because the destination address is too long.

    EDIT: s/path/pass
     
  11. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    [​IMG]
    I get this when building my hack with AS. The same source code, with bincludes changed to incbins, and "align 2"s changed to evens, works perfectly. Anybody has any idea of the problem?
     
  12. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    Attention, double posting: The previous problem was fixed by adding "padding off" to the very beginning of the code.
     
  13. shobiz

    shobiz

    Tech Members Tech Member
    How would one use a DATA segment? The AS manual is kinda vague about that.
     
  14. Puto

    Puto

    Shin'ichi Kudō, detective. Tech Member
    2,013
    0
    0
    Portugal, Oeiras
    Part of Team Megamix, but haven't done any actual work in ages.
    I think that's irrelevant for genesis programming.
     
  15. shobiz

    shobiz

    Tech Members Tech Member
    The reason I was asking was that Aurochs said he was going to use a data segment to define RAM variables in the 2007 release of his disassembly, and I was interested in seeing how that would have worked. Perhaps a PM would have been better, but meh.
     
  16. Xenowhirl

    Xenowhirl

    Tech Members Tech Member
    175
    0
    0
    You can define the RAM variables in the data segment like so:

    Code (Text):
    1. eqd macro x,{INTLABEL}
    2. __LABEL__ = x,DATA
    3.     endm
    then use eqd instead of equ when defining the variables.

    This seems to do nothing besides put a D next to the symbol in the assembler listing. Using "segment DATA" generates an error that no such segment exists, so I suspect AS has no concept of a data segment in 68000 programs.
     
  17. Aurochs

    Aurochs

    Единый, могучий Советский Союз! Tech Member
    2,343
    0
    0
    Whatever catches my fancy
    Xenowhirl is right. The 68k module only allows for a CODE segment.