SSOS Unit 1
SSOS Unit 1
CS2304
UNIT I INTRODUCTION
UNIT II ASSEMBLERS
⚫ Machine Dependent
⚫ Machine Independent
MACHINE INDEPENDENT
opcode x address
(8) (15)
INSTRUCTION SET
◦comparison:
●COMP - compares the value in
register A with a word in memory,
this instruction sets a condition code
CC to indicate the result
INSTRUCTION SET
⚫ 3-byte word:
◦LDA, STA, LDL, STL, LDX, STX
◦ A- Accumulator, L – Linkage
Register, X – Index Register
⚫ 1-byte: LDCH, STCH
⚫ No memory-memory move instruction
STORAGE DEFINITION
Example 1
LDA FIVE
STA ALPHA
LDCH CHARZ
STCHC1
.
ALPHA RESW 1
FIVE WORD 5
CHARZ BYTE C’Z’
C1 RESB 1
EXAMPLE PROGRAMS (SIC)
Example 2
LDA ALPHA
All arithmetic operations
ADD INCR are performed using register
SUB ONE A, with the result being left
in register A.
STA BEETA
ONE WORD 1
ALPHA RESW 1
BEETA RESW 1
INCR RESW 1
SIC/XE MACHINE ARCHITECTURE
•Memory
Maximum memory available on a SIC/XE
system is 1 Megabyte (220 bytes)
•Registers
Additional B, S, T, and F registers are
provided by SIC/XE
REGISTERS
B 3 Base register
S 4 General working register
T 5 General working register
F 6 Floating-point accumulator (48
bits)
FLOATING-POINT DATA TYPE
1 11 36
s exponent fraction
F*2(e-1024
)
INSTRUCTION FORMATS
Format 1 (1 byte) 8
op
8 4 4
Format 2 (2 bytes)
op r1 r2
Formats 1 and 2 are instructions do not reference
memory at all
CONTINUED…
Format 3 (3 bytes)
6 1 11111 12
op n i xbpe disp
Format 4 (4 bytes)
6 1 11111 20
op n i xbpe address
ADDRESSING MODES & FLAG BITS
•e - e = 0 means format 3, e = 1
means format 4
Format 3
Mode Indicatio Target address calculation
n
TA=(B)+ disp
Base relative b=1,p=0
(0≤disp ≤4095)
TA=(PC)+ disp
Program-counte
b=0,p=1 (-2048≤disp ≤2047)
r relative
FLAG BITS CONTINUED…
Format 3 or 4
Example 1 LDA #5
STA ALPHA
LDA #90
STCHC1
.
.
ALPHA RESW 1
C1 RESB 1
EXAMPLE PROGRAMS (SIC/XE)
•Immediate mode,
•register-direct mode,
•PC-relative,
•Register indirect with displacement,
•Register indirect indexed
INSTRUCTION SET
•Immediate mode,
•register-direct mode,
•PC-relative,
•Register indirect with displacement,
INSTRUCTION SET
LDT #11
LDX #0 : X=0
MOVECH LDCH STR1, X : LOAD A FROM STR1
STCH STR2, X : STORE A TO STR2
TIXR T : ADD 1 TO X, TEST (T)
JLT MOVECH
.
Looping .
and .
Indexing STR1 BYTE C ‘HELLO WORLD’
operation STR2 RESB 11
EXAMPLE PROGRAMS (SIC)
LDT #200
LDX #0
CLOOP TD INDEV
JEQ CLOOP
To transfer two RD INDEV
hundred bytes of
data from input STCH RECORD, X
device to memory
TIXR T
JLT CLOOP
.
.
INDEV BYTE X ‘F5’
RECORD RESB 200
EXAMPLE PROGRAMS (SIC)
JSUB READ
.
READ LDX ZERO
CLOOP TD INDEV
Subroutine to
JEQ CLOOP
transfer two RD INDEV
hundred bytes of STCH RECORD, X
data from input TIX B200 : add 1 to index compare 200 (B200)
device to memory
JLT CLOOP
RSUB
.
INDEV BYTE X ‘F5’
RECORD RESB 200
ZERO WORD 0
B200 WORD 200
EXAMPLE PROGRAMS (SIC/XE)
JSUB READ
.
.
READ LDT #200
LDX #0
CLOOP TD INDEV
JEQ CLOOP
RD INDEV
Subroutine to STCH RECORD, X
transfer two
hundred bytes of TIXR T : add 1 to index compare T
data from input JLT CLOOP
device to memory RSUB
.
.
INDEV BYTE X ‘F5’
RECORD RESB 200