

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Prof. Balamohan Pawar delivered this lecture at Allahabad University for Aeronautical Engineering and Computer Programming course. Its main points are: Guide, Programming, Learning, Machine, Register, Load, Store, Label, Instruction, Move
Typology: Slides
1 / 3
This page cannot be seen from the preview
Don't miss anything!


: XOR Implementation
;Programmer
: Jayakanth Srinivasan
;Last Modified
: Feb 18 2003
; code segment
load
;Load register R1 with 1
load
R2,0xff
;Load register R2 with 11111111
load
R3,[first_number]
; first_number into register R3; move contents of location labeled
xor
; flip the 0's and 1's in the first number
store
R4, [result]
; store the result in location labeled result
halt
;halt the program.
first_number: ; data segment
db
result:
db
2
RXY
load
register[R]:=XY
1
RXY
load
3
RXY
store R,[XY]
D
0RS
load
E
0RS
store R,[S]
4
0RS
move
register[S]:=register[R]
5
RST
addi
register[R]:=register[S]+register[T]
integer add
6
RST
addf
floating-point add register[R]:=register[S]+register[T]
7
RST
or
register[R]:=register[S] OR register[T]
8
RST
and
register[R]:=register[S] AND register[T]
9
RST
xor
register[R]:=register[S] XOR register[T]
A
R0X
ror
register[R]:=register[R] ROR X
B
RXY
jmpEQ R=R0,XY
0XY
jmp
F
RXY
jmpLE R<=R0,X
C
000
halt
memory[register[S]]:=register[R]register[R]:=memory[register[S]]memory[XY]:=register[R] register[R]:=memory[XY]
bitwise OR
Program Header, Contains
Last ModifiedProgrammer NameProgram Name
Start of data segment Start of code segment
Rotate Right register R for X timesbitwise eXclusive OR bitwise AND
PC:=XY, if R=R PC:=XY, if R<=R0PC:=XY
Different fragments of code are not allowed to overlap.
Examples:
org
60h
load
;put this instruction at address $
immediate load
load
reg,number
load
reg,label
Examples:
load
load
R9,Label_of_something
direct load
load
reg,[adr]
Assign the memory contents at address adr to register reg.
Examples:- Address adr can be a number or a label.
load
load
R9,[Label_of_something]
indirect load
load
reg1,[reg2]
Assign the memory contents of which register reg2 holds the address to register reg1.
Example:
load
direct store
store
reg,[adr]
Address adr can be a number or a label.
Examples:
store
store
R9,[Label_of_something]
store indirect store
reg1,[reg2]
db
dataitem_1, dataitem_2, ..., dataitem_n
Puts data directly into the memory.
Example:
A dataitem can be either a number or a string.
store
An unlimited number of dataitems can be specified.
move
Examples:
db
move
reg1,reg
db
"Hello world",
origin
Example:
move
org
adr
integer addition
The next code starts at address adr.
Address adr must be a number.
addi
reg1,reg2,reg