Search   
Home  Print View  

 

Programmer's Manual

Branch Content

Symbols

Simply put, symbols represent expressions. You define symbols by using the directive #define or the equ construct. The assembler also auto-define some symbols (labels in particular) while parsing the code; in the following example, the value for label QUIT is not given explicitly but calculated by the assembler.

; Listing #2
; Examples of symbols used as both address and data
;
STU_STOP     equ   0x0000
CMD_RWD      equ   0x0004
TAPE_REG     equ   0x4000
START        equ   0x0400

#org   START
       ; Check if tape is stopped.
       ld     a, TAPE_REG
       cmp    STU_STOP      
       jnz    QUIT

      ; Sent Rewind command to the tape driver:
       mvi     a, CMD_RWD
       sto     a, TAPE_REG
:QUIT
    hlt

As seen in code, a valid symbol contains nothing but alphabetic and numeral characters as well as underscores ( _ ). The length is restricted to 40 characters and the first one can not be numeric.

Each symbol must be defined only once in the entire project scope, so caution must be observed specially with large projects composed by many files. Duplicated symbols will be reported as errors.

Homebuilt CPUs WebRing

JavaScript by Qirien Dhaela

Join the ring?

David Brooks, the designer of the Simplex-III homebrew computer, has founded the Homebuilt CPUs Web Ring. To join, drop David a line, mentioning your page's URL. He will then add it to the list.
You will need to copy this code fragment into your page.

Project start date: May 13 of 2009