Category:68000 Assembly: Difference between revisions

m
Line 26:
How you write the source code depends on your assembler and the syntax it uses. This page is written using Motorola syntax but there is also Milo syntax which has different conventions.
 
The following represent the Motorola syntax rules for code statements only (data blocks follow different rules than these, so don't be surprised that there's a difference.!)
 
 
Line 38:
 
* A number that begins with a % is a binary value.
 
* Single and double quotes can be used for ASCII values. When you type <code>MOVE.L "EGGS",D0</code> for example, this is equivalent to <code>MOVE.L #$69717183,D0</code>.
 
* The operand of <code>BTST</code>,<code>BSET</code>,<code>BCLR</code>, or <code>BCHG</code> represents a bit position, starting at the rightmost binary digit as 0 and counting up from right to left. For example, <code>BCLR #3,D0</code> performs the same bitwise operation that you would get from doing <code>AND.B #%11110111,D0</code>.
 
 
Data blocks, on the other hand, begin with <code>DC.B</code>, <code>DC.W</code>, or <code>DC.L</code> and each represents a constant numeric value. Strangely, you do NOT prefix these with # to signify them as constants (doing so will cause an error on most assemblers). However, you can use the $ or % modifiers to denote hexadecimal or binary.
 
Keep in mind that there is no requirement to use hexadecimal, decimal, or binary in your source code. It all gets converted to binary anyway. However, it is recommended to use the notation that is appropriate for how your data is meant to be interpreted, for readability purposes.
 
===Data Registers===
1,489

edits