Write a complete module that will be used as part of your SIC/XE assembler to evaluate the operand field of an assembly language statement.
Basic Algorithm
The expression file will contain one expression per line similar to the following (0 or more leading spaces):
@GREEN Indirect Addressing – use RFLAG value
#GREEN Immediate Addressing – use RFLAG value
GREEN,X Indexed Addressing – use RFLAG value
#9 Immediate Addressing – Absolute value
GREEN+YELLOW VALUE + VALUE and RFLAG + RFLAG
GREEN–15 VALUE – 15 and RFLAG – Absolute value
=0cABC Character Literal – 1 character per byte
=0x5A Hexadecimal Literal – 2 hexadecimal digits per byte
Rules for evaluating the relocatability of an expression:
Literal Table
Make sure that each module only contains items/operations directly related to that module.
Fully document all parts of your program:
All output should be in an easy to understand format.
All error messages must provide as much detail as possible.
Expression Processing Example
SYMS.DAT Expression File
PURPLE: 6 FALSE PURPLE+#17
BLACK: -7 TRUE @BLACK
PINK: 9 TRUE #WHITE
WHITE: 5 FALSE =0CDEFG
WHITE,X
22
=0X5A
PINK+#3
=0X5A
PINK–#3
@#25+RED
=0C5A
#7
When a symbol is encountered its attribute values are determined by looking up the symbol in the symbol table.
EXPRESSIONS
EXPRESSION VALUE RELOCATABLE N-Bit I-Bit X-Bit
RED 13 RELATIVE 1 1 0
PURPLE+#17 23 ABSOLUTE 1 1 0
@BLACK -7 RELATIVE 1 0 0
#WHITE 5 ABSOLUTE 0 1 0
WHITE,X 5 ABSOLUTE 1 1 1
#22 22 ABSOLUTE 0 1 0
PINK+#3 12 RELATIVE 1 1 0
PINK–#3 6 RELATIVE 1 1 0
@#25+RED 38 RELATIVE 1 0 0
#7 7 ABSOLUTE 0 1 0
LITERAL TABLE
NAME VALUE LENGTH ADDRESS
=0CDEFG 44454647 4 1
=0X5A 5A 1 2
=0C5A 3541 2 3
Notes:
Reviews
There are no reviews yet.