Untitled

Download as pdf or txt
Download as pdf or txt
You are on page 1of 95

23) Module 1 Problems

Module 1 - Problems

Give the target address generated for the following instruction, if:
(B)=006000, (PC) = 003000, (X) = 000090
i) 010030 ii) 0310C303 iii) 002600 iv) 03C300

Instruciton Opcode n i x b p e Displacement/address TA

032600 0000 00 1 1 0 0 1 0 0110 0000 0000 003600

0310C303 0000 00 1 1 0 0 0 1 0000 1100 0011 0000 0011 0C303

03C300 0000 00 1 1 1 1 0 0 0011 0000 0000 063900

002600 0000 00 0 0 0 0 1 0 0110 0000 0000 003600

010030 0000 00 0 1 0 0 0 0 0000 0011 0000 0030

Generate the object code for the following SIC programs:


1.
SUM START 4000 Given details of
opcode for instruction
FIRST LDX ZERO LDX=04
LDA ZERO LDA=00
LOOP ADD TABLE, X TIX=2C
TIX COUNT STA=0C
JLT LOOP RSUB=4C
STA TOTAL ADD=18
RSUB JLT=38
TABLE RESW 2000
COUNT WORD 10
ZERO WORD 0
TOTAL RESW 1
END FIRST

Loc Label Mnemon Operand Object code Opcode X Operand Address


ic (8) (1) (15)
4000 SUM START 4000
4000 FIRST LDX ZERO 045788 0000 0100 0 101 0111 1000 1000
4003 LDA ZERO 005788 0000 0000 0 101 0111 1000 1000
4006 LOOP ADD TABLE, X 18C015 0001 1000 1 100 0000 0001 0101
4009 TIX COUNT 2C5785 0010 1100 0 101 0111 1000 0101
400C JLT LOOP 384006 0011 1000 0 100 0000 0000 0110
400F STA TOTAL 0C578B 0000 1100 0 101 0111 1000 1011
4012 RSUB 4C0000 0100 1100 0 000 0000 0000 0000
4015 TABLE RESW 2000
5785 COUNT WORD 10 00000A
5788 ZERO WORD 0 000000
578B TOTAL RESW 1
578E END FIRST

2000*3 = 6000 (1770 in Hex) -> 1770 +4015 = 5785


WORD will occupy 3 bytes, irrespective of values
RESW will reserve specified no*3
Object Program:
H^SUM ^004000^00178E Length->578E-4000
T^004000^15^045788^005788^18C015^2C5785^384006^0C578B^4C0000
T^005785^06^00000A^000000
E^004000

2.

Loc Label Mnem Operand Object Opcode X Operand Address


onic code (8) (1) (15)
3500 Example START 3500
3500 LDX Zero 04351F 0000 0100 0 011 0101 0001 1111
3503 Loop LDCH Str1, X 50B50F 0101 0000 1 011 0101 0000 1111
3506 STCH Str2, X 54B517 0101 0100 1 011 0101 0001 0111
3509 TIX Maxlimit 2C3522 0010 1100 0 011 0101 0010 0010
350C JLT Loop 383503 0011 1000 0 011 0101 0000 0011
350F Str1 BYTE C ‘Software’ 535146545
7415245
3517 Str2 RESB 8
351F Zero WORD 0 000000
3522 Maxlimit WORD 8 000008
3525 END
3517+8=351F
351F+3=3522
‘Software’ – Find ASCII value of each character
Object Program:
H^ Exampl^003500^000025 Length->3525-3500
T^003500^17^04351F^50B50F^54B517^2C3522^383503^5351465457415245
T^00351F^06^000000^000008
E^003500

Generate the complete object program for the following SIC/XE assembly language
programs.

1. 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

Assume: LDX-04, LDA-00, LDB-68, ADD-18, TIX-2C, JLT-38, STA-OC, RSUB-4C

Loc Length Label Mnemonic Operand Object code


0000 SUM START 0
1 0000 3 FIRST LDX #0 050000
2 0003 3 LDA #0 010000
3 0006 4 +LDB #TABLE2 69101790
BASE TABLE2
4 000A 3 LOOP ADD TABLE, X 1BA013
5 000D 3 ADD TABLE2, X 1BC000
6 0010 3 TIX COUNT 2F200A
7 0013 3 JLT LOOP 3B2FF4
8 0016 4 +STA TOTAL 0F102F00
9 001A 3 RSUB 4F0000
10 001D 3 COUNT RESW 1
11 0020 1770 TABLE RESW 2000
12 1790 1770 TABLE2 RESW 2000
13 2F00 3 TOTAL RESW 1
14 2F03 END FIRST

2000*3=6000 -> convert to hex 1770+0020=1790


1790 + 1770 = 2F00

Object Program:
H^SUM ^000000^002F03
T^000000^1D^050000^010000^69101790^1BA013^1BC000^2F200A^3B2FF4^0F102F00^4F0
000
E^000000

2.
Line 6 = +LDCH BUFFER, X
Loc Len Label Mnemonic Operand Obj code
105D Op(6) n i x b p e Disp(12 or 20)
105D 2 B410
105F 3 7721A6 0111 01 1 1 0 0 1 0 0001 1010 0110
1062 3 E32012 1110 00 1 1 0 0 1 0 0000 0001 0010
1065 3 332FFA 0011 00 1 1 0 0 1 0 1111 1111 1010
1068 4 53901078 0101 00 1 1 1 0 0 1 0000 0001 0000 0111 1000
106C 3 DF2008 1101 11 1 1 0 0 1 0 0000 0000 1000
106F 2 B850
1071 3 3B2FEE 0011 10 1 1 0 0 1 0 1111 1110 1110
1074 3 4F0000 0100 11 1 1 0 0 0 0 0000 0000 0000
1077 1 05
1078 400
1208 2
120A

Object Program:
H^WRREC ^00105D ^0001AD
T^00105D^1B^B410^7721A6^E32012^332FFA^53901078^DF2008^B850^3B2FEE^4F0000^0
5
E^00105D

3. Generate the object code and complete object program for the following SIC/XE assembly
language program, indicating the entries of appropriate data structures.

Use the opcodes given below for the mnemonics in the source program:

CLEAR – B4 LDT-74 LDCH-50


STCH-54 TIXR-B8 JLT-38

COPY START 0
CLEAR X
LDT #11
MOVECH LDCH STR1, X
STCH STR2, X
TIXR T
JLT MOVECH
STR1 BYTE X’5445535440535452494E47’
STR2 RESB 11
END COPY

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy