Нужно написать Интерпретатор ассемблера
Laboratory work 5Assembly interpreter
In this laboratory work you should write a simple assembly interpreter Java (language is up to you).
You are given the following instructions:
Arithmetic:
• ADD, SUB, MUL, DIV, INC, DEC
Data transfer: • MOV, XCHG
Pseudo-ops:
• DB, DW, DD
and variables should meet following requirements:
- Variable name should be legal as it’s described in
Lecture 7 slide 6
- Values of variables should be expressed in binary,
decimal, hexadecimal and in characters (note that characters can be both in letter and ASCII)
o Use radix symbol to differentiate data type as it’s described in Lecture 7 slide 10
Your task is to write the assembly interpreter. As input you should write a one or multiple assembly statements. For example, the statement:
VARIABLE_NAME DB ‘Hello, assembly!’
should print out ‘Hello, assembly!’ string.
You can also input multiple statements. For example:
TEST_VAR DB 1 INC TEST_VARshould create a variable called “TEST_VAR” with initial value 1, increments the value of “TEST_VAR” and print out the value: 2.
Here are some more examples:
In: VAR_A DB 6 VAR_B DB 1
ADD VAR_A VAR_B INC VAR_AOut: 8
In: HEX_VAR DB 8ABh HEX_VAR_2 DB B78h SUB HEX_VAR HEX_VAR_2Out: DADh
In: CHAR_VAR DB 41h CHAR_VAR_2 DB 42h
MOV CHAR_VAR CHAR_VAR_2 Out: 41h