Placement Preparation: System Software Iii Cse A
Placement Preparation: System Software Iii Cse A
2 MARKS:
5. Name the data structures used by two pass assembler in Pass1 and Pass 2.
Symbol Table, Opcode Table, Location counter, intermediate file.
6. Name the registers and corresponding numbers present in the SIC machine.
Accumulator (0)
Index register (1)
Linkage register (2)
Program counter (8)
Status word (9)
Column No Description
1 E(end record)
2-7 Starting Address of execution
E.g. E^000150.
It indicates the end of the object program. The address must be represented in 6 bytes.
22. Write the format of the header record.
Column No Description
1 H(header record)
2-7 Program Name
8-13 Starting address of the program in hexadecimal
14-19 Length of the program
Column No Description
1 M(modification record)
2-7 Starting address of the address field to be modified
8-9 Length of the address constants in ½ bytes
25. Write the purpose of the assembler directives EQU, RESB, WORD
a. EQU-no memory allocation for this assembler directive. It is used for renaming the
constants
b. RESB-reserves the indicated number of bytes for the data area.
c. WORD-generates one-word integer constant
UNIT-1
Opcode X Operand
ARITHMETIC INSTRUCTIONS
LOGICAL INSTRUCTIONS
SI
1. Write an SIC assembly language program to add 2 numbers alpha and beta and store
the result at delta. Assume the addresses allocated for alpha, beta and delta is 103H,
106H, and 109H.
LDA alpha
ADD beta
STA delta
2. Write an SIC assembly language program to add an array of 10 integers starting from
the address 100H and store the result at 200H.Assume that already the memory
allocations are performed for the array, result, array size etc.
Format1:
8 bits
Operand
Format 2:
Format 3:
Format 4:
CLEAR X
CLEAR A
LDA #Three
LDS #Count
LOOP: LDT Address, X
ADDR T, A
ADDR B, X
COMPR X, S ; checks whether the count reaches 30H
or not
JLT LOOP ; jump if less than 30H to label
STA Result ; store the final result
2. Write a SIC-XE program to find whether a given number is prime number or not.
3. Write an SIC assembly language program to evaluate the following expression alpha
+ beta-(gamma-first) where alpha, beta, gamma, first are integers.
PASS I:
INTERMEDIATE FILE
SYMBOL TABLE
NAME ADDRESS
alpha 64
beta 67
gamma 6A
first 6D
result 70
begin 73
PASS II:
OBJECT PROGRAM:
H^bbeval^000064^000021
T^000064^0C^48934D^102030^4C9E36^3E2012
T^000073^12^00006A^1C006D^0C0070^000064^180067^1C0070^0C0070
E^000073
STEP 1
STEP 2
CALCULATION :
INITIAL VALUES
PL=0;
RL=0;
MC=0;
LC=0;
STEP 3:
CALCULATION:
Address of gamma is 6A
2. SUB first
Address of first is 6D
3. STA result
Address of result is 70
4. LDA alpha
Address of result is 64
5. ADD beta
Address of beta is 67
Address of result is 70
^1C0070
7. STA result
Address of result is 70
^1C0070
STEP 3:
E^000073
INTERMEDIATE FILE 2 :
SYMBOL TABLE :
NAME ADDRESS TYPE
FIRST 0 R
COUNT 1B R
TABLE 1E R
TABLE2 178E R
TOTAL 2EFE R
OPCODE n i x b p e displacement
0001 10 1 1 1 1 0 0 0000 0000 0000
M/C CODE : 1BC000
RL=10
PL=10
8) TIX COUNT
FORMAT : 3
ADDRESSING MODE : PC RELATIVE
OPCODE OF ADD :2CH
DISPLACEMENT = TARGETADDRESS – (PC)
= 1B - 13
= 08 H
OPCODE n i x b p e displacement
0010 11 1 1 0 0 1 0 0000 0000 1000
M/C CODE :2F2008
RL=13
PL=13
9) JLT LOOP
FORMAT : 3
ADDRESSING MODE : PC RELATIVE
OPCODE OF JLT :38H
DISPLACEMENT = TARGETADDRESS – (PC)
= 0A - 16
= F5 H
OPCODE n i x b p e displacement
0011 10 1 1 0 0 1 0 0000 1111 0101
M/C CODE :3B20F5
RL=16
PL=16
10) + STA TOTAL
FORMAT : 4
ADDRESSING MODE : PC RELATIVE
OPCODE OF STA :0CH
DISPLACEMENT = TARGETADDRESS – (PC)
= 2EFE - 1A
= 2EE4
OPCODE n i x b p e displacement
0000 11 1 1 0 0 1 1 0000 0010 1110 1110 0100
M/C CODE :0F302EE4
RL=1A
PL=1A
11) RSUB
FORMAT :1
OPCODE OF RSUB : 4CH
OPCODE
0100 1100
M/C CODE :4C
RL=1B
PL=1B
NEXT 4 INSTRUCTIONS ARE RESW INSTRUCTIONS , SO WE DON’T HAVE
TEXT RECORSDS FOR THAT.
BUT PL VALUE SHOULD BE INCREMENTED .
PL = 1B+3+1770+1770+3
THEREFORE
PL=2F01
RL=1B
OBJECT PROGRAM :
H ^ bbbSUM ^ 000000^002F01
T ^ 000000 ^ 00001B^050000^010000^69301784
^1BA011^1BC000^2F2008^3B20F5^0F302EE4^4C
E^000000