0% found this document useful (0 votes)
83 views4 pages

Generate Machine Code-Ss

The program generates machine code for a SIC/XE assembly language program that contains instructions to clear a register, load values into registers, add values to a register, increment a register, jump if less than, and store a value. The machine codes are provided for each instruction along with the addressing mode and displacement calculations where needed.
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)
83 views4 pages

Generate Machine Code-Ss

The program generates machine code for a SIC/XE assembly language program that contains instructions to clear a register, load values into registers, add values to a register, increment a register, jump if less than, and store a value. The machine codes are provided for each instruction along with the addressing mode and displacement calculations where needed.
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/ 4

Generate the machine codes for the following SIC/XE program.

(08 Marks, Dec 2018 )


SUM START 0000
0000 FIRST CLEAR X B410
0002 LDA #0 010000
0005 +LDB #TOTAL 69102346
BASE TOTAL
0009 LOOP ADD TABLE,X 1BA006
000C TIX COUNT 2F2006
000F JLT LOOP 3B4006

0012 STA TOTAL 0F4000

0015 COUNT RESW 1


0018 TABLE RESW 3000
2346 TOTAL RESB 1
2347 END FIRST
LDA→00 TIX→2C LDX→04 JLT→38 STA→0C
RSUB→4C ADD→18 LDB→68 CLEAR→B4

H^SUM- - -^000000^002347
T^000000^15^B410010000……
E^000000

OPCODE(6) N I X B P E DISPLACEMENT(12)

OPCODE(8) R1(4) R2(4)

OPCODE(6) N I X B P E ADDRESS(20)
Clear X
1011 0100 0001 0000

B410

LDA #0

000000 0 1 0 0 0 0 0000 0000 0000


OPCODE(6) N I X B P E DISPLACEMENT(12)

010000

+LDB #TOTAL

0110 10 0 1 0 0 0 1 0000 0010 0011 0100 0110


OPCODE(6) N I X B P E ADDRESS(20)

LDB=68 0110 10
TOTAL 02346
OBJECT CODE=69102346
ADD TABLE,X
ADD=18 TABLE=0018 PC=000C

0001 10 1 1 1 0 1 0 0000 0000 0110


OPCODE(6) N I X B P E DISPLACEMENT(12)

OBJECT CODE=1BA006
TA=PC+DISP
0018=000C+DISP
DISP=0018-000C= 006

TIX COUNT
TIX=2C , COUNT=0015, DIRECT , PC=000F

0010 11 1 1 0 0 1 0 0000 0000 0110


OPCODE(6) N I X B P E DISPLACEMENT(12)

TA=(PC)+DISP
DISP=0015-000F= 006
Object code=2F2006
JLT LOOP
JLT= 38 TA=0009 pc=0012

0011 10 1 1 0 1 0 0 0000 0000 0110


OPCODE(6) N I X B P E DISPLACEMENT(12)

3B4006 FFFFFFFFFFE65
TA=(B)+Disp
0018-0012=disp

STA TOTAL
STA= 0C TA=2346 pc=0015 B=2346

0000 11 1 1 0 1 0 0 0000 0000 0000


OPCODE(6) N I X B P E DISPLACEMENT(12)

0F4000
TA=B +DISP
2346-2346=DISP=000

You might also like