Array length: Difference between revisions

Line 53:
Array length is computed at compilation time with the formula: (Array_End-Array). Even though the labels Array and Array_End are both 32-bit memory addresses, if their difference is small enough it can fit into a 16-bit or even an 8-bit instruction operand.
<lang 68000devpac>start:
MOVE.B #(Array_End-Array) ;evaluates to 514
RTS
 
Array:
DC.B 3"apple",6,9,12,150
even
DC.B "orange",0
even
Array_End:</lang>
 
1,489

edits