DYSTOPIANPIXEL

Your Odin environment

Recognise the three command environments, check Dev.2k and establish a reliable editing and saving routine.

Next Asset Lab concept artwork showing sprite patterns, palette colours and animation frames
Next Asset Lab concept artwork · Begin with Odin Dev.2k and the foundations of Z80 assembly.
TUTORIAL 1 / PART 01

First identify the environment you are actually using

Three different places where you can type commands

At the start of this tutorial it is very easy to type the right command in the wrong place. That happened during our own first test, and it is worth turning into a lesson rather than treating it as a mistake to forget.

On the ZX Spectrum Next we are dealing with three different working environments. They can look similar because all of them accept keyboard input, but they understand different commands.

EnvironmentWhat it is for
NextZXOS / NextBASIC command promptThe operating-system and BASIC environment. This is where we launch Odin by entering .odin.
Odin MonitorOdin's command environment. Commands such as NEW, S, A, T, M, R, TL and TS belong here.
Odin EditorThe full-screen source editor in which we type and edit assembly-language source.

A useful habit is to pause before typing a command and ask: 'Which environment am I in?' This becomes second nature after a while.

Launch Odin

At the NextZXOS / NextBASIC command prompt, enter:

.odin

On the machine used for this project, the startup banner identifies the program as Odin Version Dev.2k and shows Copyright 2021. This matters because Odin has existed in different development versions, and we do not want to teach commands that belong to a different build.

Check the Monitor commands

In the Odin Monitor, the H command exposes the following commands on this installation:

A
L <filename>
NEW <filename>
S <filename>
SA
T
TL <filename>
TS <filename>
R
INFO
LS
CD
MD
M
REMOUNT

We will not assume that we understand every one of these commands merely because it appears in the help list. We will verify commands as we use them.

Installed Odin guides

The development machine contains odin.gde, odin-editor.gde and odin-monitor.gde. There is no separate odin-debugger.gde visible. However, running a program with R does display a register, flags and memory inspection screen, so this build clearly contains debugging or inspection behaviour even without a separate debugger guide file.

A safe Odin working routine

Before we move into processor theory, establish one practical habit. When experimenting in Odin, use the same small cycle repeatedly:

  1. EDIT source
  2. S save the native Odin source
  3. A assemble
  4. read and fix any errors
  5. S save the corrected source
  6. R run only when assembly is successful
  7. inspect registers / flags / memory

Saving before running is a simple safety habit. If experimental code locks the machine or forces a reboot, you are less likely to lose the source you just typed.

NEW creates a document; S makes the on-disk file

When we entered NEW tut01.odn inside Odin, Odin created a new source document for us to edit. The important practical point is that editing an in-memory document and having a saved file on the SD card are not the same thing.

The S command writes the current native Odin source to storage. LS then lets us confirm that the file is present. This distinction is similar to editing a document in a modern application before pressing Save.

Native Odin source and ordinary text are different

FilePurpose
tut01.odnOdin-native working source used conveniently inside Odin.
tut01.asmOrdinary text exported with TS, useful for archival, comparison and version control.

L loads the native Odin source. TL loads ordinary text and converts it into Odin's source representation. TS exports the current source as ordinary text.

If a command appears not to work

First check which environment you are in. NEW, A, S, T, M, R, TL and TS are Odin Monitor commands. .odin is entered at the NextZXOS / NextBASIC command prompt. The physical EDIT key switches between Odin's Monitor and Editor.

Typing the correct command at the wrong prompt is one of the easiest beginner mistakes to make, and it tells us nothing bad about your understanding of assembly. Always identify the environment before diagnosing a command.