














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















Symbol Hexa code Description
m: effective address M: memory word (operand) found at m
Introduction
AND 0 or 8 AND M to AC ADD 1 or 9 Add M to AC, carry to E LDA 2 or A Load AC from M STA 3 or B Store AC in M BUN 4 or C Branch unconditionally to m BSA 5 or D Save return address in m and branch to m+ ISZ 6 or E Increment M and skip if zero CLA 7800 Clear AC CLE 7400 Clear E CMA 7200 Complement AC CME 7100 Complement E CIR 7080 Circulate right E and AC CIL 7040 Circulate left E and AC INC 7020 Increment AC, carry to E SPA 7010 Skip if AC is positive SNA 7008 Skip if AC is negative SZA 7004 Skip if AC is zero SZE 7002 Skip if E is zero HLT 7001 Halt computer INP F800 Input information and clear flag OUT F400 Output information and clear flag SKI F200 Skip if input flag is on SKO F100 Skip if output flag is on ION F080 Turn interrupt on IOF F040 Turn interrupt off
0 0010 0000 0000 0100 1 0001 0000 0000 0101 10 0011 0000 0000 0110 11 0111 0000 0000 0001 100 0000 0000 0101 0011 101 1111 1111 1110 1001 110 0000 0000 0000 0000
Location Instruction Code (^000 ) 001 1005 002 3006 003 7001 004 0053 005 FFE 006 0000
000 LDA 004 Load 1st operand into AC 001 ADD 005 Add 2nd operand to AC 002 STA 006 Store sum in location 006 003 HLT Halt computer 004 0053 1st operand 005 FFE9 2nd operand (negative) 006 0000 Store sum here
Location Instruction Comments
INTEGER A, B, C DATA A,83 / B,- C = A + B END
Machine Language
ORG 0 /Origin of program is location 0 LDA A /Load operand from location A ADD B /Add operand from location B STA C /Store sum in location C HLT /Halt computer A, DEC 83 /Decimal operand B, DEC -23 /Decimal operand C, DEC 0 /Sum stored in location C END /End of symbolic program
Assembly Language
Location Content^ Symbolic Program
Hexadecimal Code
Assembly Language
Source Program - Symbolic Assembly Language Program Object Program - Binary Machine Language Program
1st pass: generates a table that correlates all user defined (address) symbols with their binary equivalent value 2nd pass: binary translation
Assembler
First pass
LC := 0
Scan next line of code Set LC
Label no
yes
yes no ORG
Store symbol in address- symbol table together with value of LC
END
Increment LC
Go to second pass
no
yes
DIMENSION A(100) INTEGER SUM, A SUM = 0 DO 3 J = 1, 100 3 SUM = SUM + A(J)
ORG 100 LDA ADS STA PTR LDA NBR STA CTR CLA ADD PTR I ISZ PTR ISZ CTR BUN LOP STA SUM HLT HEX 150 HEX 0 DEC - HEX 0 HEX 0 ORG 150 DEC 75
DEC 23 END
/ Origin of program is HEX 100 / Load first address of operand / Store in pointer / Load - / Store in counter / Clear AC / Add an operand to AC / Increment pointer / Increment counter / Repeat loop again / Store sum / Halt / First address of operands / Reserved for a pointer / Initial value for a counter / Reserved for a counter / Sum is stored here / Origin of operands is HEX 150 / First operand
/ Last operand / End of symbolic program
LOP,
ADS, PTR, NBR, CTR, SUM,
Program Loops
. ..
Programming Arithmetic and Logic Operations
Implementation of Arithmetic and Logic Operations
/ Clear E / Load multiplier / Transfer multiplier bit to E / Store shifted multiplier / Check if bit is zero / Bit is one; goto ONE / Bit is zero; goto ZRO / Load multiplicand / Add to partial product / Store partial product / Clear E / Load multiplicand / Shift left / Store shifted multiplicand / Increment counter / Counter not zero; repeat loop / Counter is zero; halt / This location serves as a counter / Multiplicand stored here / Multiplier stored here / Product formed here
Programming Arithmetic and Logic Operations
ASSEMBLY LANGUAGE PROGRAM
Programming Arithmetic and Logic Operations
/ Main program / Load X / Branch to subroutine / Store shifted number / Load Y / Branch to subroutine again / Store shifted number
/ Subroutine to shift left 4 times / Store return address here / Circulate left once
/ Circulate left fourth time / Set AC(13-16) to zero / Return to main program / Mask operand
Loc.
Subroutines
/ Load 1st operand into AC / Branch to subroutine OR / 2nd operand stored here / Subroutine returns here
/ 1st operand stored here / Result stored here / Subroutine OR / Complement 1st operand / Store in temporary location / Load 2nd operand / Complement 2nd operand / AND complemented 1st operand / Complement again to get OR / Increment return address / Return to main program / Temporary storage
Loc.
Subroutines
Input Output Program
Input Output Program