0% found this document useful (0 votes)
30 views21 pages

Placement Preparation: System Software Iii Cse A

The document provides information about the SIC machine architecture including details of the registers, instruction format, addressing modes, assembler directives and object file format. It describes the five registers in SIC - Accumulator, Index, Linkage, Program Counter and Status Word. It also explains different addressing modes like direct, immediate, indexed, indirect, base relative and PC relative addressing used in SIC. The assembler directives EQU, RESB and WORD and their purposes are defined. Finally, the formats for the object file records - header, text, end and modification are outlined.

Uploaded by

Sreemol R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views21 pages

Placement Preparation: System Software Iii Cse A

The document provides information about the SIC machine architecture including details of the registers, instruction format, addressing modes, assembler directives and object file format. It describes the five registers in SIC - Accumulator, Index, Linkage, Program Counter and Status Word. It also explains different addressing modes like direct, immediate, indexed, indirect, base relative and PC relative addressing used in SIC. The assembler directives EQU, RESB and WORD and their purposes are defined. Finally, the formats for the object file records - header, text, end and modification are outlined.

Uploaded by

Sreemol R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

PLACEMENT PREPARATION

SHEET NO : 1 SYSTEM SOFTWARE III CSE A

2 MARKS:

1. Define Operating System.


Operating systems are concerned with management of all the resources in the
computer. It acts as an interface between the user and the system and provides an environment
to run other programs.

2. Differentiate interpreter and complier.


Main difference between interpreter and compiler is that Interpreter executes a version
of the source program directly instead of translating it into a machine code.
Compilers generate machine language code, taking into account hardware
characteristics as the number and type of registers and the machine instructions available.

3. Expand SIC and SIC/XE


SIC: Simplified Instructional Computer.
SIC/XE: XE stands for extra equipment or extra expensive.

4. Name some system software.


Some of the system software’s are Compiler, Loader, Assembler, Debugger etc.

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)

7. State the purpose of Assembler Directives. Give example.


The assembler directives or pseudo instructions are not translated to machine
instructions; instead they provide instructions to the assembler itself.
E.g. BYTE, WORD which direct the assembler to generate constants as a part of the object
program.
8. What are the types of software? Explain with examples.
System software e.g. Operating System
Application software e.g. Word, spreadsheet etc.

9. What do you mean by forward reference? Give e.g.


It is a reference to the label which is defined later in the program. If we translate the
program line by line we will be unable to process the address of the label .So most assembler
make two passes over the source program. The first pass does little more than scan the source
program for label definitions and assign addresses. The second pass performs most of the
actual translation.

10. What do you mean by relocatable program?


The assembler does not know the actual location where the program will be loaded; it
cannot make the necessary changes in the addresses used by the program. However the
assembler can identify for the loader those parts of the object program that need modification
.An object program that contains the information necessary to perform this kind of
modification is called a relocatable program.

11. What is a macro processor?


It is an aid to assembler language programming. It is often combined with or closely
related to the assembler.

12. What is a program?


Program is defined as a set of sequential instructions which performs a particular
operation.

13. What is system software?


System software consists of a variety of programs that support the operations of the
computer. This software makes it possible for the user to focus on an application or other
problem to be solved, without needing to know the details of how the machine works
internally.

14. What is an assembler?


The Assembler translates the mnemonic operation codes to their machine language
equivalents and assigns machine addresses to symbolic labels used by the programmer.

15. What is direct addressing?


Here the address is directly given in the instruction.
Target Address (TA) = Address in instruction.
E.g. Consider alpha=104H and (104) = 9D4C11H
Then,
TA = 104H
(A) = 9D4C11H
16. What is immediate addressing?
The operand is directly given in the instruction and it can be combined with base
relative and PC relative.
E.g. ADD #first.

17. What is indexed addressing?


Indexed addressing mode is mainly used for array manipulation. Here the target address
is calculated by the sum of the address in the instruction and the content of x.
TA= address in instruction +(x)
E.g. LDA alpha, x

18. What is indirect addressing?


In indirect addressing the operand is not directly given in the instruction. The address
of the operand is given in the instruction.
TA= (address in instruction)
E.g. ADD address

19. What is program counter relative and base relative addressing?


These two addressing modes are used in SIC/XE in format 3 address mode.
a. Base relative:
TA= (B) + displacement
Where, 0<= displacement <= 4095 Indication: b=1, p=0

The displacement field is interpreted as 12-bit unsigned integer.


b. PC relative:
TA= (PC) + displacement
Where -2048<= displacement <= 2047 Indication: b=0,
p=1 the displacement field is interpreted as 12-bit signed
integer with negative values represented in 2’s complement.
20. What is the instruction length of the SIC machine instruction format?
The instruction length of SIC machine instruction format is 12 bits or 3 bytes.

21. Write the format of the END record.

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

E.g. H^avg^ 000150^ 00005B


Here the program name must be represented in six bits (if it exceeds 6 bits truncate the
extra bits else if the program name is less than 6 bytes add blank spaces after the name). The
starting address and the length of the program must be represented in 6 bytes.

23. Write the format of the text record


Column No Description
1 T(text record)
2-7 Starting address of object code in this text record
8-9 Length of the object code in this text record
10-69 30 bytes of object code can be stored in these
columns.(2 columns holds 1 byte of object code)

E.g. T^000150^ 03^ 00015C


(For LDA first, where LDA address is 150 first’s address is 15C and opcode of LDA is 00)

24. Write the format of the modification record Modification


record is only used when there is need for reallocation of address. It is same as text record.
Always place modification record below text record.

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

BASICS OF MACHINE ARCHITECTURE

1. SIC MACHINE ARCHITECTURE:

1.1 SIC Registers:


SIC has 5 registers for special purposes. All the 5 registers are of size 3 bytes. i.e. 24
bits.

Register Name Machine Equivalent Functionality


Accumulator(A) 0 When executing arithmetic
operation it is acts as a
special purpose register.
Otherwise it is acts as a
general purpose register.
Index register(X) 1 1. Used for manipulating
arrays.
2. Used in indexed
addressing mode.
Linkage Register(L) 2 1. Used for holding the
return address.
2. Recursions, nesting
functions must be avoided in
SIC machine. Because the
return address is
overwritten if
recursion/nesting functions
are used.
Program counter(PC) 8 It stores the address of the
next instruction to be
executed.
Status Word(SW) 9

1.1.1. Status Word (SW):


Bit Position Field Name
0 Mode-processor is operating mode.
0 indicates user mode
1 indicates supervisor mode
1 Idle-processor is idle or not
0-processor is running
1-processor is idle
2-5 Processor ID
6-7 Conditional codes
8-11 Internal Mask-the status of the
mask able interrupts can be
specified.
12-15 Unused
16-23 Icode-interrupt code. If no
interrupt occurs they are taken as
garbage value.

1.2 SIC Instruction Format:

Opcode X Operand

8 bits 1bit 15bits

1.3 SIC Instruction Set:

General Syntax Machine Equivalent Notational Explanation

DATA TRANSFER INSTRUCTIONS

LDA m 00H (m,m+1,m+2)->(A)


STA m 0CH (m,m+1,m+2)<-(A)
LDL m 08H (m,m+1,m+2)->(L)
STL m 14H (m,m+1,m+2)<-(L)
LDX m 04H (m,m+1,m+2)->(X)
STX m 10H (m,m+1,m+2)<-(X)
STSW m E8H Store status word content into
memory
LDCH m 50H (m)->(right most byte of A)
STCH m 54H (m)<-(right most byte of A)

ARITHMETIC INSTRUCTIONS

ADD m 18H (A)+(m,m+1,m+2)->(A)


SUB m 1CH (A)-(m,m+1,m+2)->(A)
MUL m 20H (A)*(m,m+1,m+2)->(A)
DIV m 24H (A)/(m,m+1,m+2)->(A)

LOGICAL INSTRUCTIONS

AND m 40H (A)&(m,m+1,m+2)->(A)


OR m 44H (A) |(m,m+1,m+2)->(A)
COMP m 28H (A):(m,m+1,m+2) and sets
conditional code
TIX m 2CH Test and increment index register
CONTROL TRANSFER INSTRUCTIONS
Jm 3CH (PC)<-(m)
JGT m 34H If conditional code is greater, then
(PC)<-(m)
JLT m 38H If conditional code is lesser, then
(PC)<-(m)
JEQ m 30H If conditional code is equal, then
(PC)<-(m)
JSUB m 48H (PC)->(L)
(PC)<-(m)
RSUB 4CH (L)->(PC)

PROGRAMMED I/O INSTRUCTIONS

TD m E0H If conditional code is equal, then


the device is busy.
If conditional code is lesser, then
the device is ready
RD m D8H (m)->right most byte of
accumulator
WD m DCH (m)<-right most byte of
accumulator

SI

1.4 SIC Assembly language programs:

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.

SIC assembly language program:

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.

Let us use the following symbols:

Address: to hold the base address of the array.


Result: to hold the final result
Zero: to hold the value zero
Count: to hold the value 30H
SIC assembly language program:

LDA Zero ; holding partial sum


LDX Zero ; initialize index register
LOOP: ADD Address, X ;
TIX Count ; test and increment index register
TIX Count
TIX Count
JLP LOOP ; jump if less than 30H to label
STA Result ; store the final result

3. Write an SIC Assembly language program to print an array of characters through an


output device whose number or port address is FCH. Assume the array size is set as 20,
and the array starts at 150H.

Let us use the following symbols:

Address: to hold the base address of the array.


Zero: to hold the value zero
Count: to hold the value 20(size of the array)
Portaddr: to hold the port address FCH

SIC assembly language program:

LDX Zero ; initialize index register


LOOP: LDCH Address, X
TEST: TD Portaddr
JEQ TEST ; checks whether the device is ready or not
WD Portaddr
TIX Count ; test and increment the index reg.
JLT LOOP ; jump if less than 20H to label

2. SIC-XE MACHINE ARCHITECTURE:

2.1 SIC-XE REGISTERS:


There are 9 registers in SIC-XE.
 Accumulator
 Index register
 Linkage register
 Program counter
 Status Word
The above five registers has the same functionalities as in SIC. (Refer section 1.1)
Register Name Machine Equivalent Functionality
Base Register(B) 3 Used for manipulating
Size-24 bits different elements in the
same array.
General purpose S – 4 They not meant for any
Registers(S & T) T–5 special purpose. Used for
Size-24bits holding address, index
etc.
Floating point 7 Used for holding the
Accumulator(F) floating point value.
Size-48bits

2.2 SIC-XE Instruction Format:

Format1:
8 bits
Operand

Format 2:

8bits 4bits 4bits


Opcode Reg1 Reg2

Format 3:

6 bits 1bit 1b 1b 1b 1b 1b 12 bits


Opcode n i x b P e displacement

Format 4:

6 bits 1bit 1b 1b 1b 1b 1b 20 bits


Opcode n i x b P e Address

2.3 SIC-XE Instruction Set:


SIC-XE contains all SIC instructions and some of the additional instructions. The
additional instructions are tabulated here:

General Syntax Machine Equivalent Notational Explanation


DATA TRANFER INSTRUCTIONS
LDB m 68H (m,m+1,m+2)->(B)
SDB m 78H (m,m+1,m+2)<-(B)
LDS m 6CH (m,m+1,m+2)->(S)
STS m 7CH (m,m+1,m+2)<-(S)
LDT m 74H (m,m+1,m+2)->(T)
SDT m 84H (m,m+1,m+2)<-(T)
LDF m 70H (m,m+1...m+5)->(F)
STF m 80H (m,m+1...m+5)<-(F)
CLEAR r1 B4H (r1)<-0
RMO r1,r2 ACH (r1)->(r2)
LPS m DOH Load the processor status from
information beginning at memory
location m.
SSK m ECH SSK-Setting Secure Key
Protection key for address m<-(A)
STI m D4H Setting the interval timer form the
memory locations (m,m+1,m+2)
ARITHMETIC INSTRUCTIONS
ADDR r1,r2 90H (r2)<-(r2)+(r1)
SUBR r1,r2 94H (r2)<-(r2)-(r1)
MULR r1,r2 98H (r2)<-(r2)*(r1)
DIVR r1,r2 9CH (r2)<-(r2)/(r1)
ADDF m 58H (F)+(m.......m+5)->(F)
SUBF m 5CH (F)-(m.......m+5)->(F)
MULF m 60H (F)*(m.......m+5)->(F)
DIVF m 64H (F)/(m.......m+5)->(F)
TIXR m 2CH X<-(X)+1;(X):(m...m+2)
SPECIAL TYPE OF ARITHMETIC INSTRUCTIONS FOR CONVERSION
FIX C4H Float to integer
(F)------------------>(A)

FLOAT C0H Integer to float


(A)------------------>(F)

NORM C8H (F)------->(F)normalized


LOGICAL INSTRUCTIONS
COMPR r1,r2 A0H (r1):(r2)
Sets CC as <,if (r1)<(r2)
Sets CC as =,if (r1)=(r2)
Sets CC as >,if (r1)>(r2)
COMPF m 88H (F):(m,m+1,..m+5)
SHIFT INSTRUCTIONS
SHIFTL r1,n A4H r1<-(r1); left circular shift n bits.(In
assembled instruction, r2=n-1)
SHIFTR r1,n A8H r1<-(r1); right shift n bits, with
vacated bit positions set equal to
leftmost bit of (r1).(In assembled
instruction,r2=n-1)
MACHINE CONTROL INSTRUCTIONS
SVC m B0H Generate SVC interrupt.
I/O PROGRAMMING INSTRUCIIONS
SIO F0H Start I/O channel number
(A);address of channel program is
given by (S)
HIO F4H Halt I/O channel number(A)
TIO F8H Test I/O channel number (A)
2.4 SIC-XE Assembly language programs:

1. Write a SIC-XE program to add an array of 10H integers.

Let us use the following symbols:

Address: to hold the base address of the array


Count: to hold the value 30H (size of the array)
Result: to hold the final result
Three: to hold the value three

SIC-XE assembly language program:

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.

Let us use the following symbols:

Zero: to hold the value zero


Two: to hold the value two
Num: to hold the number to find whether it is prime or not
One: to hold the value one
Result: to hold the final result
Prime: value to be stored in result if it is prime number
Nonprime: value to be stored in result if it is non prime number

SIC-XE assembly language program:


LDT #One
LDS #Two
LOOP2: LDA Num
LOOP1: SUBR S, A
COMPR A, S
JLT EXIT1
J LOOP1
EXIT1: COMP Zero
JEQ NOPRIME
ADDR T, S
COMPR S, Num
JLT LOOP2
LDA #prime
J EXITALL
NOPRIME: LDA #Nonprime
EXITALL: STA Result

3. Write an SIC assembly language program to evaluate the following expression alpha
+ beta-(gamma-first) where alpha, beta, gamma, first are integers.

SIC-XE assembly language program:

Eval START 100


Alpha WORD 48934DH
Beta WORD A0B0C0H
Gamma BYTE X’4C9E36’
First WORD 80H
Result RESW 1
Begin LDA Gamma
SUB First
STA Result
LDA Alpha
ADD Beta
SUB Result
STA Result
END Begin

Write a SIC-XE program to add two numbers.

SIC-XE Assembly language program:

Addition START 150H


LDA First
ADD Second
STA Result
El J E1
First WORD 40H
Second BYTE X’AB9C4D’
Result RESB 3
END

SIC ASSEMBLY PROGRAM

PASS I:

eval START 100


alpha WORD 48934DH
beta WORD 102030H
gamma BYTE x’4C9E36’
first BYTE x’362012’
result RESW 1
begin LDA gamma
SUB first
STA result
LDA alpha
ADD beta
SUB result
STA result
END begin

INTERMEDIATE FILE

LABEL OPCODE OPERAND1 OPERAND2 ADDRESS


eval START 100 - -
alpha WORD 48934DH - 64
beta WORD 102030H - 67
gamma BYTE x’4C9E36’ - 6A
first BYTE x’362012’ - 6D
result RESW 1 - 70
begin LDA gamma - 73
SUB first - 76
STA result - 79
LDA alpha - 7C
ADD beta - 7F
SUB result - 82
STA result - 85
END begin - 88

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

STEPS FOLLOWED IN WRITING THE ABOVE PROGRAM:

STEP 1

HEADER RECORD^PROGRAM NAME^STARTING ADDRESS OF PROGRAM

STEP 2

TEXT RECORD^RECORD LENGTH^MACHINE CODE

CALCULATION :

INITIAL VALUES

PL=0;

RL=0;

MC=0;

LC=0;

1. eval START 100

The hexadecimal equivalent of 100 is 64H

So LC is initialized with 64H

2. alpha WORD 48934DH

RL=3, PL=3, MC=48934D

3. beta WORD 102030H

RL=6, PL=6, MC=48934D^102030


4. gamma BYTE x’4C9E36’

RL=9, PL=9, MC=48934D^102030^4C9E36

5. First BYTE x’362012’

RL=12, PL=12, MC=48934D^102030^4C9E36^362012

The instruction result RESW 1 contains RESW. So break the


text record.

STEP 3:

PL=12+3=15, RL=0, MC=0;

Here PL is added with 3 to calculate the length for RESW instruction.

CALCULATION:

PL=15, RL=0, MC=0;

1. begin LDA gamma

Opcode of LDA is 00H

Address of gamma is 6A

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

0000 0000 0 000000001101010 = 00006A

PL=18, RL=3, MC=00006A

2. SUB first

Opcode of SUB is 1CH

Address of first is 6D

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

00011100 0 000000001101101 = 1C006D


PL=1B, RL=6, MC=00006A^1C006D

3. STA result

Opcode of STA is 0CH

Address of result is 70

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

0000 1101 0 0000000001110000 = 0C0070

PL=1E, RL=9, MC=00006A^1C006D^0C0070

4. LDA alpha

Opcode of LDA is 00H

Address of result is 64

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINEEQUIVALENT

00000000 0 000000001100100 = 000064

PL=21, RL=C, MC=00006A^1C006D^0C0070^000064

5. ADD beta

Opcode of ADD is 18H

Address of beta is 67

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

0001 1000 0 000000001100111 = 180067

PL=24, RL=F, MC=00006A^1C006D^0C0070^000064^180067


6. SUB result

Opcode of SUB is 1CH

Address of result is 70

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

0001 1101 0 000000001110000 = 1C0070

PL=24, RL=12, MC=00006A^1C006D^0C0070^000064^180067

^1C0070

7. STA result

Opcode of STA is 0CH

Address of result is 70

Addressing mode is direct

The machine equivalent is

OPCODE ADDR MODE ADDRESS MACHINE EQUIVALENT

00001101 0 000000001110000 = 1C0070

PL=24, RL=12, MC=00006A^1C006D^0C0070^000064^180067

^1C0070

STEP 3:

END RECORD^STARTING ADDRESS OF EXECUTION

E^000073

Write the object program for the given SIC/XE program.


SUM START 0
FIRST LDX #0
LDA #0
+LDB #TABLE2
BASE TABLE2
LOOP ADD TABLE,X
ADD TABLE2,X
TIX COUNT
JLT LOOP
+STA TOTAL
RSUB
COUNT RESW 1
TABLE RESW 2000
TABLE2 RESW 2000
TOTAL RESW 1
END FIRST

INTERMEDIATE FILE 2 :

ADDRESS LABEL OPCODE OPERAND1 OPERAND2


- SUM START 0
0 FIRST LDX #0
3 LDA #0
6 +LDB #TABLE2
- BASE TABLE2
A LOOP ADD TABLE, X
D ADD TABLE2, X
10 TIX COUNT
13 JLT LOOP
16 +STA TOTAL
1A RSUB
1B COUNT RESW 1
1E TABLE RESW 2000
178E TABLE2 RESW 2000
2EFE TOTAL RESW 1
2F01 END FIRST

SYMBOL TABLE :
NAME ADDRESS TYPE
FIRST 0 R
COUNT 1B R
TABLE 1E R
TABLE2 178E R
TOTAL 2EFE R

PROGRAM LENGTH = 2F01 – 0 = 2F01 .

STEPS TO FORM A TEXT RECORD :


INITIALLY RECORD LENGTH (RL)=0 AND PROGRAMLENGTH (PL) =0
1) SUM START 0
PROGRAM NAME: SUM
STARTING ADDRESS: 0H
2) FIRST LDX #0
FORMAT : 3
ADDRESSING MODE :PURE IMMMEDIATE
OPCODE OF LDX :04H
OPCODE n i x b p e displacement
0000 01 0 1 0 0 0 0 0000 0000 0000
M/C CODE :050000
RL=3
PL=3
3) LDA #0
FORMAT : 3
ADDRESSING MODE :PURE IMMMEDIATE
OPCODE OF LDA :00H
OPCODE n i x b p e displacement
000000 0 1 0 0 0 0 0000 0000 0000
M/C CODE :010000
RL=6
PL=6
4) +LDB #TABLE2
FORMAT :4
ADDRESSING MODE :IMMEDIATE
OPCODE OF LDB : 68H
DISPLACEMENT = T.A - (PC)
=178E-0A
= 1784
OPCODE n I x b p e displacement
011010 0 1 0 0 1 1 0000 0001 0111 1000 0100
M/C CODE : 69301784
PL=0A
RL=0A
5) BASE TABLE2
BASE IS AN ASSEMBLER DIRECTIVE . SO THERE IS NO TEXT RECORD FOR
THIS INSTRUCTION.
IT ASSIGNS THE VALUE OF TABLE2 TO THE BASE REGISTER.
6) ADD TABLE,X
FORMAT : 3
ADDRESSING MODE :INDEXED WITH PC RELATIVE
OPCODE OF ADD :18H
DISPLACEMENT = TARGETADDRESS – (PC)
= 1E - 0D
= 11 H
OPCODE n i x b p e displacement
0001 10 1 1 1 0 1 0 0000 0001 0001
M/C CODE :1BA011
RL=D PL=D
7) ADD TABLE2,X
FORMAT : 3
ADDRESSING MODE :INDEXED WITH PC RELATIVE
OPCODE OF ADD :18H
DISPLACEMENT = TARGETADDRESS – (PC)
= 178E - 10
= 177E
THIS DISPLACEMENT IS NOT COMPATIBLE TO FORMAT 3 BECAUSE
DISPLACEMENT EXCEEDS 12 BITS .
SO INSTEADOF PC RELATIVE ,WE GO FOR BASE RELATIVE
THEREFORE A .M IS INDEXED WITH BASE RELATIVE .
DISPLACEMENT = TARGETADDRESS – (BASE)
= 178E - 178E
= 0

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

You might also like