Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

format of input file: Col 1-8 label optional Col 9 blank Col 10 + optional Col 11-17 mneumonic Col 18 blank Col 19 #, @,

format of input file:

Col 1-8 label optional

Col 9 blank

Col 10 + optional

Col 11-17 mneumonic

Col 18 blank

Col 19 #, @, = ... optional

Col 20-29 (operand) label, register, ',',X optional ...

Col 30-31 blank

Col 32-80 comments optional (NO PERIOD REQUIRED)

In java I am writing a program to construct a symbol table and calculate addressses based off this args[0]:

Imput file format

LABEL INSTRUCTION OPERAND

imput.txt file.

ADDRES START 100 //This is the starting address . tests pc forward addressing . tests base addressing . tests pc backward addressing NOW +LDB #BEGIN load base register // +LDB is a 4 byte instruction so next lines address is 104 (if a +is infront of instruction 4 bytes otherwise 3 bytes) XXX BASE BEGIN tell assembler //assembler directive so next line addess stil 104 YYY LDA BE A <- (m..m+2) //LDA is a 3 byte instruction so next address is 107 EN RESW 4 //(Reserve words)RESW normally 3 byte instuction but 4 words so 12 bytes or C in hex, next address is 113 BE WORD 2 // WORD is 3 byte constant no matter how many, next address is 116 BEGIN RESW 1 // one RESW so add 3 bytes to previous address, next address is 119 JUNK RESW 2200 // 2200 RESW's = 6600 bytes(3*2200) = 19C8 in hex. So 19C8 +119 = next address 1AE1 THERE RESW 1 //RESW = 3 bytes next address is 1AE4 ZZZ LDA JUNK //LDA = 3 bytes next address is 1AE7 MMM STA THERE // STA = 3 bytes next address is 1AEA END NOW

I want to write to a output file that caluclates the address and puts them on the left side. of the origional input file.

sample output file:

0100 ADDRES START 100 . tests pc forward addressing . tests base addressing . tests pc backward addressing 0100 NOW +LDB #BEGIN load base register 0104 XXX BASE BEGIN tell assembler 0104 YYY LDA BE A <- (m..m+2) 0107 EN RESW 4 0113 BE WORD 2 0116 BEGIN RESW 1 0119 JUNK RESW 2200 1AE1 THERE RESW 1 1AE4 ZZZ LDA JUNK 1AE7 MMM STA THERE 1AEA END NOW

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. Describe to a manager the different types of distance learning.

Answered: 1 week ago