<s>
In	O
theoretical	O
computer	O
science	O
the	O
random-access	O
stored-program	O
(	O
RASP	O
)	O
machine	O
model	O
is	O
an	O
abstract	B-Application
machine	I-Application
used	O
for	O
the	O
purposes	O
of	O
algorithm	O
development	O
and	O
algorithm	O
complexity	O
theory	O
.	O
</s>
<s>
The	O
RASP	O
is	O
a	O
random-access	B-Application
machine	I-Application
(	O
RAM	O
)	O
model	O
that	O
,	O
unlike	O
the	O
RAM	O
,	O
has	O
its	O
program	B-Application
in	O
its	O
"	O
registers	O
"	O
together	O
with	O
its	O
input	O
.	O
</s>
<s>
Thus	O
the	O
RASP	O
is	O
to	O
the	O
RAM	O
as	O
the	O
Universal	O
Turing	B-Architecture
machine	I-Architecture
is	O
to	O
the	B-Architecture
Turing	I-Architecture
machine	I-Architecture
.	O
</s>
<s>
The	O
RASP	O
is	O
an	O
example	O
of	O
the	O
von	B-Architecture
Neumann	I-Architecture
architecture	I-Architecture
whereas	O
the	O
RAM	O
is	O
an	O
example	O
of	O
the	O
Harvard	B-Architecture
architecture	I-Architecture
.	O
</s>
<s>
But	O
unlike	O
actual	O
computers	O
the	O
RASP	B-Application
model	I-Application
usually	O
has	O
a	O
very	O
simple	O
instruction	O
set	O
,	O
greatly	O
reduced	O
from	O
those	O
of	O
CISC	B-Architecture
and	O
even	O
RISC	B-Architecture
processors	I-Architecture
to	O
the	O
simplest	O
arithmetic	O
,	O
register-to-register	O
"	O
moves	O
"	O
,	O
and	O
"	O
test/jump	O
"	O
instructions	O
.	O
</s>
<s>
Some	O
models	O
have	O
a	O
few	O
extra	O
registers	O
such	O
as	O
an	O
accumulator	B-General_Concept
.	O
</s>
<s>
Together	O
with	O
the	O
register	B-Application
machine	I-Application
,	O
the	O
RAM	O
,	O
and	O
the	O
pointer	B-Application
machine	I-Application
the	O
RASP	O
makes	O
up	O
the	O
four	O
common	O
sequential	O
machine	O
models	O
,	O
called	O
this	O
to	O
distinguish	O
them	O
from	O
the	O
"	O
parallel	O
"	O
models	O
(	O
e.g.	O
</s>
<s>
parallel	B-Operating_System
random-access	I-Operating_System
machine	I-Operating_System
)	O
[	O
cf	O
.	O
</s>
<s>
The	O
RASP	O
is	O
a	O
universal	O
Turing	B-Architecture
machine	I-Architecture
(	O
UTM	O
)	O
built	O
on	O
a	O
random-access	B-Application
machine	I-Application
RAM	O
chassis	O
.	O
</s>
<s>
The	O
reader	O
will	O
remember	O
that	O
the	O
UTM	O
is	O
a	O
Turing	B-Architecture
machine	I-Architecture
with	O
a	O
"	O
universal	O
"	O
finite-state	O
table	O
of	O
instructions	O
that	O
can	O
interpret	O
any	O
well-formed	O
"	O
program	B-Application
"	O
written	O
on	O
the	O
tape	O
as	O
a	O
string	O
of	O
Turing	O
5-tuples	O
,	O
hence	O
its	O
universality	O
.	O
</s>
<s>
While	O
the	O
classical	O
UTM	O
model	O
expects	O
to	O
find	O
Turing	O
5-tuples	O
on	O
its	O
tape	O
,	O
any	O
program-set	O
imaginable	O
can	O
be	O
put	O
there	O
given	O
that	O
the	B-Architecture
Turing	I-Architecture
machine	I-Architecture
expects	O
to	O
find	O
them	O
—	O
given	O
that	O
its	O
finite-state	O
table	O
can	O
interpret	O
them	O
and	O
convert	O
them	O
to	O
the	O
desired	O
action	O
.	O
</s>
<s>
Along	O
with	O
the	O
program	B-Application
,	O
printed	O
on	O
the	O
tape	O
will	O
be	O
the	O
input	O
data/parameters/numbers	O
(	O
usually	O
to	O
the	O
program	B-Application
's	O
right	O
)	O
,	O
and	O
eventually	O
the	O
output	O
data/numbers	O
(	O
usually	O
to	O
the	O
right	O
of	O
both	O
,	O
or	O
intermingled	O
with	O
the	O
input	O
,	O
or	O
replacing	O
it	O
)	O
.	O
</s>
<s>
The	O
"	O
user	O
"	O
must	O
position	O
the	B-Architecture
Turing	I-Architecture
machine	I-Architecture
's	O
head	O
over	O
the	O
first	O
instruction	O
,	O
and	O
the	O
input	O
must	O
be	O
placed	O
in	O
a	O
specified	O
place	O
and	O
format	O
appropriate	O
to	O
both	O
the	O
program-on-tape	O
and	O
the	O
finite-state	O
machine	O
's	O
instruction-table	O
.	O
</s>
<s>
The	O
RASP	O
mimics	O
this	O
construction	O
:	O
it	O
places	O
the	O
"	O
program	B-Application
"	O
and	O
"	O
data	O
"	O
in	O
the	O
holes	O
(	O
registers	O
)	O
.	O
</s>
<s>
A	O
point	O
of	O
confusion	O
:	O
two	O
sets	O
of	O
instructions	O
:	O
Unlike	O
the	O
UTM	O
,	O
the	O
RASP	B-Application
model	I-Application
has	O
two	O
sets	O
of	O
instructions	O
–	O
the	O
state	O
machine	O
table	O
of	O
instructions	O
(	O
the	O
"	O
interpreter	O
"	O
)	O
and	O
the	O
"	O
program	B-Application
"	O
in	O
the	O
holes	O
.	O
</s>
<s>
The	O
following	O
example	O
of	O
a	O
program	B-Application
will	O
move	O
the	O
contents	O
of	O
register	O
(	O
hole	O
)	O
#18	O
to	O
register	O
(	O
hole	O
)	O
#19	O
,	O
erasing	O
contents	O
of	O
#18	O
in	O
the	O
process	O
.	O
</s>
<s>
The	O
program-instructions	O
available	O
in	O
this	O
RASP	B-Application
machine	I-Application
will	O
be	O
a	O
simple	O
set	O
to	O
keep	O
the	O
example	O
short	O
:	O
</s>
<s>
As	O
the	O
RASP	B-Application
machine	I-Application
's	O
state	O
machine	O
interprets	O
the	O
program	B-Application
in	O
the	O
registers	O
,	O
what	O
exactly	O
will	O
the	O
state	O
machine	O
be	O
doing	O
?	O
</s>
<s>
will	O
list	O
in	O
time	O
sequence	O
the	O
state	O
machine	O
's	O
actions	O
as	O
it	O
"	O
interprets	O
"	O
converts	O
to	O
action	O
the	O
program	B-Application
:	O
</s>
<s>
So	O
it	O
adopts	O
#1	O
as	O
"	O
the	O
program	B-Application
counter	O
"	O
PC	O
.	O
</s>
<s>
The	O
role	O
of	O
the	O
program	B-Application
counter	O
will	O
be	O
to	O
"	O
keep	O
the	O
place	O
"	O
in	O
the	O
program	B-Application
's	O
listing	O
;	O
the	O
state	O
machine	O
has	O
its	O
own	O
state	O
register	O
for	O
its	O
private	O
use	O
.	O
</s>
<s>
Upon	O
start	O
,	O
the	O
state	O
machine	O
expects	O
to	O
find	O
a	O
number	O
in	O
the	O
PC	O
—	O
the	O
first	O
"	O
Program-Instruction	O
"	O
in	O
the	O
program	B-Application
(	O
i.e.	O
</s>
<s>
(	O
Without	O
the	O
use	O
of	O
the	O
indirect	O
COPYs	O
,	O
the	O
task	O
of	O
getting	O
the	O
pointed-to	O
program-instruction	O
into	O
#2	O
is	O
a	O
bit	O
arduous	O
.	O
</s>
<s>
Now	O
that	O
the	O
number	O
of	O
the	O
program-instruction	O
(	O
e.g.	O
</s>
<s>
3	O
=	O
"	O
JZ	O
"	O
)	O
is	O
in	O
register	O
#2	O
--	O
the	O
"	O
Program-Instruction	O
Register	O
"	O
PIR	O
—	O
the	O
state	O
machine	O
proceeds	O
to	O
decrement	O
the	O
number	O
until	O
the	O
IR	O
is	O
empty	O
:	O
</s>
<s>
If	O
the	O
IR	O
were	O
empty	O
before	O
decrement	O
then	O
the	O
program-instruction	O
would	O
be	O
0	O
=	O
HALT	O
,	O
and	O
the	O
machine	O
would	O
jump	O
to	O
its	O
"	O
HALT	O
"	O
routine	O
.	O
</s>
<s>
Now	O
the	O
state	O
machine	O
knows	O
what	O
program-instruction	O
to	O
execute	O
;	O
indeed	O
it	O
has	O
jumped	O
to	O
the	O
"	O
JZ_routine	O
"	O
sequence	O
of	O
instructions	O
.	O
</s>
<s>
hole	O
#6	O
,	O
into	O
the	O
Program-Instruction	O
Register	O
PIR	O
#2	O
.	O
</s>
<s>
It	O
simply	O
increments	O
twice	O
the	O
PC	O
and	O
then	O
unconditionally	O
jumps	O
back	O
to	O
the	O
instruction-fetch	O
phase	O
,	O
where	O
it	O
fetches	O
program-instruction	O
#8	O
(	O
DEC	O
)	O
.	O
</s>
<s>
Then	O
the	O
state	O
machine	O
unconditionally	O
goes	O
back	O
to	O
the	O
instruction	O
fetch	O
phase	O
,	O
where	O
it	O
fetches	O
program-instruction	O
#15	O
(	O
HALT	O
)	O
.	O
</s>
<s>
The	O
following	O
completes	O
the	O
RAM	O
's	O
state-machine	O
interpretation	O
of	O
program-instructions	O
,	O
INC	O
h	O
,	O
DEC	O
h	O
and	O
thus	O
completes	O
the	O
demonstration	O
of	O
how	O
a	O
RAM	O
can	O
"	O
impersonate	O
"	O
a	O
RASP	O
:	O
</s>
<s>
Without	O
indirect	O
state-machine	O
instructions	O
INCi	O
and	O
DECi	O
,	O
to	O
execute	O
the	O
INC	O
and	O
DEC	O
program-instructions	O
the	O
state	O
machine	O
must	O
use	O
indirect	O
copy	O
to	O
get	O
the	O
contents	O
of	O
the	O
pointed-to	O
register	O
into	O
spare	O
register	O
#3	O
,	O
DEC	O
or	O
INC	O
it	O
,	O
and	O
then	O
use	O
indirect	O
copy	O
to	O
send	O
it	O
back	O
to	O
the	O
pointed-to	O
register	O
.	O
</s>
<s>
When	O
a	O
RAM	O
is	O
acting	O
as	O
a	O
RASP	O
,	O
something	O
new	O
has	O
been	O
gained	O
:	O
unlike	O
the	O
RAM	O
,	O
the	O
RASP	O
has	O
the	O
capacity	O
for	O
self-modification	B-Application
of	O
its	O
program-instructions	O
(	O
the	O
state-machine	O
instructions	O
are	O
frozen	O
,	O
unmodifiable	O
by	O
the	O
machine	O
)	O
.	O
</s>
<s>
Cook-Reckhow	O
(	O
1971	O
)	O
(	O
p	O
.	O
75	O
)	O
comment	O
on	O
this	O
in	O
their	O
description	O
of	O
their	O
RASP	B-Application
model	I-Application
,	O
as	O
does	O
Hartmanis	O
(	O
1971	O
)	O
(	O
pp	O
.	O
</s>
<s>
subroutines	O
--	O
the	O
calling	O
routine	O
(	O
or	O
perhaps	O
the	O
subroutine	O
)	O
stores	O
the	O
return	B-Language
address	I-Language
"	O
return_address	O
"	O
in	O
the	O
subroutine	O
's	O
last	O
command	O
,	O
i.e.	O
</s>
<s>
"	O
The	O
Random	O
Access	O
Stored-Program	O
Machine	O
(	O
RASP	O
)	O
described	O
here	O
is	O
similar	O
to	O
the	O
RASP	O
's	O
described	O
by	O
Hartmanis	O
 [ 1971 ] 	O
 "	O
(	O
p	O
.	O
74	O
)	O
.	O
</s>
<s>
Their	O
purpose	O
was	O
to	O
compare	O
execution-times	O
of	O
the	O
various	O
models	O
:	O
RAM	O
,	O
RASP	O
and	O
multi-tape	O
Turing	B-Architecture
machine	I-Architecture
for	O
use	O
in	O
the	O
theory	O
of	O
complexity	B-General_Concept
analysis	I-General_Concept
.	O
</s>
<s>
The	O
salient	O
feature	O
of	O
their	O
RASP	B-Application
model	I-Application
is	O
no	O
provision	O
for	O
indirect	O
program-instructions	O
(	O
cf	O
their	O
discussion	O
p.75	O
)	O
.	O
</s>
<s>
This	O
they	O
achieve	O
by	O
requiring	O
the	O
program	B-Application
to	O
modify	O
itself	O
:	O
if	O
necessary	O
an	O
instruction	O
can	O
modify	O
the	O
"	O
parameter	O
"	O
(	O
their	O
word	O
,	O
i.e.	O
</s>
<s>
Their	O
RASP	O
's	O
registers	O
are	O
unbounded	O
in	O
capacity	O
and	O
unbounded	O
in	O
number	O
;	O
likewise	O
their	O
accumulator	B-General_Concept
AC	O
and	O
instruction	O
counter	O
IC	O
are	O
unbounded	O
.	O
</s>
