Anatomy of assembly codeThe assembler processes the source file one line at a time. Lines are trimmed before processing so leading spaces and tab characters can be inserted for better formatting if desired. Each line could be one of the following types:
- Blank line : Will be ignored
- Comment : Starts with semicolon (;)
- Instruction : Syntactically valid Hieritage/1 instruction
- Label : Symbolic address. Start with colon (:)
- Symbol definition : In the form SYMBOL equ VALUE, or: #define SYMBOL = VALUE
- Origin directive : In the form #org ADDRESS
- Data directive : In the form #data EXPRESSION
- Output Format directive : In the form #format FORMAT
- Include directive : In the form #include FILE_NAME
Comments cannot appear in a line that is not a comment. Following is an example of acceptable assembly code.
; Listing #1
; ----------------------------------------------------
; HERITAGE/1 -- SAMPLE ASSEMBLY CODE
; ----------------------------------------------------
; This code implements INT 7 both vector and handler code
; for copying BUFF_SIZE words from BUFF_SRC to BUFF_DES
;
#format H12
#include vectors.equ
INT_7_CODE equ 0x0400
BUFF_SRC equ 0x4000
BUFF_DES equ 0x0800
BUFF_SIZE equ 0x0020
#org INT_7_VECTOR
#data INT_7_CODE
#org INT_7_CODE
mvi c, BUFF_SIZE
mvi d, BUFF_SRC
mvi e, BUFF_DES
:LOOP
ldx a, d
stoxa, e
inc d
inc e
dec c
jnz LOOP
jp QUIT
; garbage, just to justify the forward jump
#data 0xffff
:QUIT
ret
|
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
|