Shift list elements to left by 3: Difference between revisions

m
Line 1,603:
===Zilog Z80===
This example code will not work on the Game Boy, as the Game Boy does not have the <code>RLD</code> or <code>RRD</code> instructions.
 
The <code>RLD</code> instruction is a very peculiar one. It rotates leftward the bottom four bits of the accumulator with the byte pointed to by HL. For example, if <code>A = &36</code> and <code>(HL) = &BF</code>, then a single <code>RLD</code> will result in <code>A = &3B</code> and <code>(HL) = &F6</code>. As it turns out, this can be used to rotate the entries in an array without using a ton of stack space.
 
<syntaxhighlight lang="z80">PrintChar equ &BB5A ;address of Amstrad CPC firmware routine, writes accumulator to stdout.
 
1,489

edits