Skip to content

Assembler

WacKEDmaN edited this page Nov 16, 2026 · 3 revisions

Assembler

The assembler window (Tools → Assembler) uses RASM by Edouard BERGE, included in the program. Every RASM directive, macro, cruncher and expression works as from RASM's command line; the difference is that the code goes into the memory of the running machine.

Files and programs

  • New: a new program in a tab of its own, with a short sample.
  • Open...: opens a source file as a program, in a tab beside the programs that are open. If the program is open already, it is read again from the disc (if one of its tabs has changes that are not saved, it is only shown).
  • Save, Save as....
  • File → Open → Assembler source... also opens a program.

Programs and their linked files

  • Each program has a main file (its tab name is in orange) and the files it links: INCLUDE "file" and READ "file". The linked files open in tabs after the main file, by themselves.
  • F9 builds the program of the tab on show: from a linked file's tab, F9 builds that file's program. Only that program's edited files are saved before the build (RASM reads the linked files from the disc).
  • Each tab has a close button. Closing a main file closes its linked files too. A linked file that you close opens again at the next build. A tab with changes that are not saved asks before it closes.
  • The open programs open again at the next start.

Assemble and run

Button Key What it does
Assemble F9 Assembles into the machine's memory
Assemble + run Ctrl+F9 Assembles, then starts the program at its run address (RUN directive), or at its start
Run to cursor Ctrl+F10 Runs until the code of the cursor's line, past every breakpoint on the way, and pauses there
  • The ROMs over the program's memory are paged out before it runs.
  • The messages list shows the errors and warnings. Click one to go to its line (in its file's tab). The gutter marks the lines with errors.
  • The summary line shows the start, the length and the run address.
  • The symbols list shows the labels and their values. Type in the filter to find one.

Syntax

The syntax list sets RASM's compatibility mode:

Mode What it is
RASM RASM's own syntax
Maxam (-m) Maxam's left-to-right expressions
AS80 (-ass) AS80 syntax
UZ80 (-uz) UZ80 syntax
DAMS (-dams) DAMS syntax
Pasmo (-pasmo) Pasmo syntax
WinAPE WinAPE's assembler (below)

WinAPE syntax

For source written for WinAPE's assembler, this setting gives RASM's Maxam expressions (-m) and no ampersand: & is a hex prefix (&4000), as well as # and $.

The built-in assembler is RASM as its author publishes it. RASM knows some of WinAPE's directives itself, in every syntax: brk, list, nolist, let, charset, and relocate_start, relocate_end, relocate_table.

WinAPE directives that RASM does not know give an error. Examples: byte, text, word, rmem, defl, end, write, write direct, save, close, checksum and memory(). Change them to RASM's own directives (db, dw, ds, =), or assemble that source in WinAPE.

Breakpoints from the source

  • BRK labels: labels named BRK..., @BRK... or ....BRK become debugger breakpoints (as RASM's -eb option).

The editor

  • Syntax colouring: Colours... switches it on or off, and sets a colour for each kind of word (text, mnemonic, register, directive, number, string, comment, label, symbol).
  • The gutter shows the line numbers and the errors.
  • Mouse-over: after a build, put the mouse on a label to see its address and what memory holds there. Put it on a register to see its value.
  • The right-click menu has Run to here for the line under the mouse, Go to definition, Find..., Replace..., the comment switch and the line moves.
  • Undo and redo: Ctrl+Z, and Ctrl+Y or Ctrl+Shift+Z, or the toolbar's Undo and Redo. Each tab keeps its own history, also when the editor loses the focus (after F9, for example). Typing in one run is one step; a paste, a cut, a replace or a comment is one step each.
  • NOPs (a toolbar switch): a column beside the line numbers shows each line's cost in NOPs (one NOP is one microsecond). A line with several instructions (ld a,1 : out (c),a) shows their sum. min/max means a condition or a repeat decides. Put the mouse on a cost to see each instruction's cost. The costs were measured on the emulated CPC.
  • Drag and drop: drag a .asm, .c or .bas file onto the window to open it.

Find and replace

  • Ctrl+F opens the find bar over the editor. A word selected on one line goes into the box.
  • Enter or F3 finds the next match; Shift+Enter or Shift+F3 the match before. The search goes round past the end.
  • Aa matches the case; Word finds whole words only. The bar shows "3 of 12".
  • All the matches on the screen are marked; the one on show is darker.
  • Ctrl+H also opens the replace box: Replace changes the match on show and finds the next one; Replace all changes every match as one step for Undo.
  • Esc in the find box closes it and gives the keyboard back to the editor.

Go to definition and labels

  • F12, or Ctrl+click on a name, goes to the line that defines it. It looks in the file on show, then in the other files of the program, then in the symbols of the last build (shown in the disassembly).
  • The Labels tab (under the editor) lists the names the file defines: labels, equ and macros; in a C file, functions, #define and globals. A click goes to the line.

Comments and indents

  • Ctrl+/ puts a comment on or off for the selected lines (; in assembly, // in C).
  • Tab with several lines selected moves them in by one tab. Shift+Tab moves the selected lines (or the cursor's line) out.

Run to cursor

Run to cursor (Ctrl+F10, or the right-click menu) runs the machine to the first code of the cursor's line (or of the next line with code), past every breakpoint and watchpoint, and pauses there. If the program has not been started since the build, it starts it first. For assembly, it works in the program's main file tab.

C programs

A .c main file is built with SDCC instead of RASM. Refer to C programs.

Clone this wiki locally