Your place is saved automatically on this browser.
What 'assemble' means
The Z80 cannot execute the text 'ld a,$42'. It can only execute numerical instruction codes. An assembler translates human-readable assembly source into machine-code bytes.
In Odin, enter:
A successful assembly on this machine finishes with ASSEMBLED OK in green.
From source text to executable bytes
It is worth seeing the whole transformation again now that we have real source code:
The assembler is therefore a translator and organiser. It is not the CPU, and it does not execute the instructions itself.
Inspect the label with T
Enter:
Odin reports:
$6000: startThis means that Odin resolved the label start to address $6000. The label itself is for us and for the assembler. The Z80 ultimately works with the numerical address.
A first deliberate assembly error
Real assembly work includes errors. It is better to meet one intentionally now than to treat the first unexpected error message as a disaster.
Return to the editor and temporarily replace the RET line with a word that is not a Z80 instruction, for example:
Return to the Monitor and enter A. Odin should reject the source rather than produce a successful assembly. The exact wording and presentation of the diagnostic may depend on the build, so read what your copy of Dev.2k reports rather than expecting a particular sentence.
Now return to the editor, restore RET, return to the Monitor and assemble again. Confirm that ASSEMBLED OK returns.
Common causes of early assembly errors
- A mistyped instruction mnemonic.
- A missing or mistyped register name.
- Malformed numeric syntax.
- A label typed differently in two places.
- Editing the wrong source document.
- Trying to run before the source has assembled successfully.
Do not try to memorise opcode bytes
Likewise, you do not need to memorise every common register use from the earlier table. Use it as a reference; repetition will make the common patterns familiar.
