Close

Directives

A project log for Assembly Language for ECM-16/TTL homebrew CPU

Sub-project where the assembly language is described; the assembler program progress updates are posted here

PavelPavel 11/24/2022 at 10:080 Comments

Following assembler directives are used:


structural directives:

these directives determine the context for code that comes after them

.const  -- optional block containing list of labeled constants -- primarily these are absolute addresses of memory mapped I/O ports

.text  -- indicates start of proper code block, containing instruction sequence

.data -- indication of start of block containing static variables


comment directive
Anything starting with hash symbol (#) and ending with newline is considered a comment and is ignored.

Example:

# this whole line is comment

    LDi r0 0x01   #comment: this operation adds 1 to value in register r0


assignment directive:

=  -- used as assignment statement in constants block

Example:

.const       #start of constants block

   constant_value = 0x1234 


size directives:

these are used only in data segment
.string -- byte-sized array, containing ascii symbols, the value assigned to it is in quotes. At the end of string there is at least one byte with zero value (0x00, C-like string)
.word -- 16-bit numeric value
.dword -- 32-bit numeric value
.long -- 64-bit numeric value

Example:

var_1:  .word     0x1234        
var_2:  .dword    0x1234678
var_3:  .long     0x1234567890123456
var_4:  .string   "example string, with \"quotes\" inside"

 All parts should be on the same string.

Discussions