The YGREC8's Assembly Language Manual

Created lun. 16 oct. 2023 05:50:46 CEST by whygee@f-cpu.org
Version sam. 16 déc. 2023 03:43:00 CET


PRELIMINARY / WORK IN PROGRESS
It's not yet a definitive reference, check again soon.

Check the latest news and updates at ygrec8.com
and download the latest version from src.ygrec8.com
or if you prefer git : gitlab.com/fhwd/ygrec8

 ©2023 Yann Guidon
all documentation published under CC BY-NC-SA 4.0 license.






Introduction

This manual is limited to details and specifications for assemblers and disassemblers: programs that transform text into binary instructions or vice versa.

General syntax, conventions and other rules

This specification tries to keep the syntax of YGREC8 programs source code as simple and easy to understand and parse as possible. The assembler can be easily coded with sophisticated software tools (such as JavaScript or bison and flex) but low-level languages (even assembly languages) should work as well. Eventually (and even though this is very far fetched) the YGREC8 should be able to assemble its own programs, meaning that frivolous features are avoided (due to obvious space and resource constraints).

Pseudo-instructions

Before passing a line to the actual instruction assembler, the line can be pre-parsed and examined, looking for pseudo-instructions: these are commands that do not turn into actual instructions but do help manage the overall program's structures and definitions. The first word is parsed and tested:

• If the word starts with a dot "." then a pseudo-instruction is expected and looked-up. It could be one of those:

• Otherwise, if the word ends in ':' (and is not an number, a symbol or a keyword) then it is a label and its definition is added to the table of symbols. There is no separator before ':' and the label must be alone on the line. The line

plop:

is a shorthand to the line

.EQU plop $

The following line must fail:

plop :  ; MUST_FAIL: don't allow spaces before ":"

• Lastly, if none of the above applies, the line is passed to the actual assembler.

Basic Syntax

Keywords

In addition to the previous keywords, the assembler pre-defines the following keywords as elements of an instruction. The list may expand in the future but these are essential definitions:

Opcodes

The opcodes take 2 to 4 characters.

Aliases

Some instructions are encoded as a special case of other instructions (see aliases).

Registers

The register names take only 2 characters only.

Conditions

The conditions fit in 3 or 4 characters only, often shortened.

Forms

The instruction's textual format follows the binary format (except the condition which is a suffix). "Forms" are valid sequences of no, one or two arguments:

There is no clear requirement or syntax for interpreting a number as short or long (Imm4 or Imm8). The assembler first tries to fit values in a short immediate, allowing the eventual condition to be accepted. If an immediate exceeds the Imm4 range, then any explicit condition suffix is an error.



To be continued...

Now have a look at the YGREC8's Integration manual, the Programming manual or the Main YGREC8 Manual.