Inverted syntax: Difference between revisions

No edit summary
Line 24:
The task is to demonstrate support for inverted syntax forms within the language by showing both the traditional and inverted forms.
=={{header|6502 Assembly}}==
 
===Branching===
Conditional branches are limited in the range they can branch; all branch statements cannot be more than 127 or -128 bytes away from their destination.
 
Line 47 ⟶ 49:
 
Now, what happens is that the opposite condition is checked. If X = 0, execution branches 3 bytes forward to "continue." Otherwise, the statement underneath the branch is executed, which is a jump back to the top.
 
===16-Bit Data===
Being a little-endian CPU, the "low byte" (rightmost 2 digits) of a 16-bit (4-digit) hexadecimal number is stored <i>before</i> the "high byte" (leftmost 2 digits). This is difficult for a human to read but easier for the CPU. The assembler allows the programmer to use a <code>dw</code> or <code>word</code> directive to define 16-bit data values in a manner easier for a person to read. The assembler swaps the order of the bytes automatically when assembling the source code.
<lang 6502asm>word $BEEF
byte $EF,$BE</lang>
A hexdump of these bytes would display them the same, i.e.: <pre>EF BE EF BE</pre>
 
=={{header|Ada}}==
 
1,489

edits