PassOne Module Client Specifications


Purpose

The Pass1 module is a function, called by the main program module, to perform pass 1 of a two-pass assembler. During Pass 1, the assembler constructs a symbol table which contains addresses for labels that appears in the source code. The addresses for labels are determined by using a location counter, which is incremented whenever memory is needed for data or instructions.

Client Data Model

SymTab is the data type of the symbol table linked list. Each node, SymNode, in this list contains three fields of information:

Field Comments
name name of symbol, a string of characters
address integer address value of symbol
next reference to next SymNode

SymTab is created in CreateSymTab(), each SymNode is added to SymTab by calling InsertNode(). Before inserting symbols to SymTab, SearchSymTab() is called to check for symbol duplication.

Error handling policy

All symbols are compared with the list of directives, labels, and opcodes to assure no duplicates, and non-use of reserved words. If any error occurs during pass 1, at the end of pass 1 the program prints out all error messages and resets SymTab pointer to NULL.

Importing Information

Use of the functions listed in the Client Data Model, requires the following :
#include "header.h"  - contains definition of symbol table, token      
                       structure etc. 
#include <stdio.h> - contains c standard functions
#include <stdlib.h> - contains c standard functions
#include <string.h> - contains c string functions

Public Data Types

Public Functions

Pass One

SymbolTable Creation

Data Retrieval and Modification


Page URL: http://geocities.datacellar.net/sunsetstrip/frontrow/3153/Programs/pass1client.html
Page Author: Team 4
1