You are on page 1of 7

Rs[i]=Ra[i]*Rb[i]-10

Soln.
LDT #90
LDX #0
LDS #3
LOOP LDA RA,X
MUL RB,X
SUB #10
STR RS,X
ADDR S,X
COMP X,T
JLT LOOP
RA RESW 30
RB RESW 30
RS RESW 30
STRNCPY START 0000
0000 STRT LDX INIT
0003 LOOP LDCH SR,X
0006 STCH DS,X
0009 TIX LEN
000C JLT LOOP
000F SR BYTE CABCDEF
0010 DS RESB 6
0016 INIT WORD 0
0019 LEN WORD 3
001C END STRT

PASS 1:
SYMPOL ADDRESS
STRT 0000
LOOP 0003
SR 000F
DS 0010
INIT 0016
LEN 0019

0000 STRT LDX INIT

0000 0100 0 000 0000 0001 0110


LDX=04
Object Code = 040016

0003 LOOP LDCH SR,X LDCH=50


50 1 000 0000 0000 1111
Object Code = 50800f

0006 STCH DS,X STCH=54


54 1 000 0000 0001 0000
Object Code=548010
0009 TIX LEN TIX=2C
2c 0 000 0000 0001 1001
Object Code = 2c0019

000C JLT LOOP JLT=38


38 0 000 0000 0000 0011
Object Code = 380003

PASS 2 :

STRNCPY START 0000 0000


0000 STRT LDX INIT 040016
0003 LOOP LDCH SR,X 50800F
0006 STCH DS,X 548010
0009 TIX LEN 2C0019
000C JLT LOOP 380003
000F SR BYTE CABCDEF
0010 DS RESB 6
0016 INIT WORD 0
0019 LEN WORD 3
001C END STRT

OBBJECT FILE :
H/STRNCOPY/000000/00001C
T/000000/03/040016
T/000003/0C/50800F/548010/2C0019/380003
E/000000

Literals (SIC-SIC/XE)
- The assembler generates the specified value as a
constant at some other memory location
- Ex : LDA =CEOF 032010
Immediate Operands (SIC/XE)
- The operand value is assembled as part of the
machine instruction
- Ex : LDA #3 010003

Control section : is a part of the program that can be


loaded and relocated independently of the other
parts of the program
Program Block : refer to segments of code that are
rearranged within a single object program unit . each
program block may contain several separate
segments of the source program .

How can one pass assemblers handle forward


references ?

- By using symbol defining statements (EQU).


LDA 1022
Starting address = 1000
(pc) = 1009
TA =disp + (PC)
Disp = TA (PC)
Disp = 1022-[1009+1000]= f019

+STCH BUFFER,X
M/000001/05
+STX LENGTH
M/000001/05
MAXLEN WORD BUFFEND-BUFFER
M/000000/06/+BUFFEND
M/000000/06/-BUFFER

You might also like