<s>
Little	B-Language
Computer	I-Language
3	I-Language
,	O
or	O
LC-3	O
,	O
is	O
a	O
type	O
of	O
computer	O
educational	B-Language
programming	I-Language
language	I-Language
,	O
an	O
assembly	B-Language
language	I-Language
,	O
which	O
is	O
a	O
type	O
of	O
low-level	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
It	O
features	O
a	O
relatively	O
simple	O
instruction	O
set	O
,	O
but	O
can	O
be	O
used	O
to	O
write	O
moderately	O
complex	O
assembly	O
programs	O
,	O
and	O
is	O
a	O
viable	O
target	O
for	O
a	O
C	B-Language
compiler	B-Language
.	O
</s>
<s>
The	O
language	O
is	O
less	O
complex	O
than	O
x86	B-Operating_System
assembly	O
but	O
has	O
many	O
features	O
similar	O
to	O
those	O
in	O
more	O
complex	O
languages	O
.	O
</s>
<s>
These	O
features	O
make	O
it	O
useful	O
for	O
beginning	O
instruction	O
,	O
so	O
it	O
is	O
most	O
often	O
used	O
to	O
teach	O
fundamentals	O
of	O
programming	O
and	O
computer	O
architecture	O
to	O
computer	B-General_Concept
science	I-General_Concept
and	O
computer	O
engineering	O
students	O
.	O
</s>
<s>
Courses	O
based	O
on	O
the	O
LC-3	O
and	O
Patt	O
and	O
Patel	O
's	O
book	O
are	O
offered	O
in	O
many	O
computer	O
engineering	O
and	O
computer	B-General_Concept
science	I-General_Concept
departments	O
.	O
</s>
<s>
All	O
of	O
the	O
registers	O
are	O
general-purpose	O
in	O
that	O
they	O
may	O
be	O
freely	O
used	O
by	O
any	O
of	O
the	O
instructions	O
that	O
can	O
write	O
to	O
the	O
register	O
file	O
,	O
but	O
in	O
some	O
contexts	O
(	O
such	O
as	O
translating	O
from	O
C	B-Language
code	O
to	O
LC-3	O
assembly	O
)	O
some	O
of	O
the	O
registers	O
are	O
used	O
for	O
special	O
purposes	O
.	O
</s>
<s>
Instructions	O
are	O
16	O
bits	O
wide	O
and	O
have	O
4-bit	O
opcodes	B-Language
.	O
</s>
<s>
The	O
instruction	O
set	O
defines	O
instructions	O
for	O
fifteen	O
of	O
the	O
sixteen	O
possible	O
opcodes	B-Language
,	O
though	O
some	O
instructions	O
have	O
more	O
than	O
one	O
mode	O
of	O
operation	O
.	O
</s>
<s>
Individual	O
instructions	O
 '	O
execution	O
is	O
regulated	O
by	O
a	O
state	B-Architecture
machine	I-Architecture
implemented	O
with	O
a	O
control	O
ROM	B-Device
and	O
microsequencing	O
unit	O
.	O
</s>
<s>
The	O
architecture	O
supports	O
the	O
use	O
of	O
a	O
keyboard	O
and	O
monitor	O
to	O
regulate	O
input	O
and	O
output	O
;	O
this	O
support	O
is	O
provided	O
through	O
memory	B-Architecture
mapped	I-Architecture
I/O	I-Architecture
abstractions	O
.	O
</s>
<s>
All	O
data	O
in	O
the	O
LC-3	O
is	O
assumed	O
to	O
be	O
stored	O
in	O
a	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representation	O
;	O
there	O
is	O
no	O
separate	O
support	O
for	O
unsigned	O
arithmetic	O
.	O
</s>
<s>
The	O
I/O	O
devices	O
operate	O
on	O
ASCII	B-Protocol
characters	I-Protocol
.	O
</s>
<s>
The	O
LC-3	O
has	O
no	O
native	O
support	O
for	O
floating-point	B-Algorithm
numbers	I-Algorithm
.	O
</s>
<s>
The	O
LC-3	O
instruction	O
set	O
implements	O
fifteen	O
types	O
of	O
instructions	O
,	O
with	O
a	O
sixteenth	O
opcode	B-Language
reserved	O
for	O
later	O
use	O
.	O
</s>
<s>
Memory	O
accesses	O
can	O
be	O
performed	O
by	O
computing	O
addresses	O
based	O
on	O
the	O
current	O
value	O
of	O
the	O
program	B-General_Concept
counter	I-General_Concept
(	O
PC	O
)	O
or	O
a	O
register	O
in	O
the	O
register	O
file	O
;	O
additionally	O
,	O
the	O
LC-3	O
provides	O
indirect	O
loads	O
and	O
stores	O
,	O
which	O
use	O
a	O
piece	O
of	O
data	O
in	O
memory	O
as	O
an	O
address	O
to	O
load	O
data	O
from	O
or	O
store	O
data	O
to	O
.	O
</s>
<s>
Three	O
instructions	O
(	O
JSR	O
,	O
JSRR	O
,	O
and	O
TRAP	O
)	O
support	O
the	O
notion	O
of	O
subroutine	O
calls	O
by	O
storing	O
the	O
address	O
of	O
the	O
code	O
calling	O
the	O
subroutine	O
into	O
a	O
register	O
before	O
changing	O
the	O
value	O
of	O
the	O
program	B-General_Concept
counter	I-General_Concept
.	O
</s>
<s>
Because	O
there	O
is	O
no	O
room	O
left	O
in	O
the	O
LC-3	O
instruction	O
set	O
for	O
dedicated	O
port-mapped	B-General_Concept
I/O	I-General_Concept
instructions	O
,	O
hardware	O
implementations	O
typically	O
reserve	O
part	O
of	O
the	O
memory	B-General_Concept
map	I-General_Concept
for	O
memory-mapped	B-Architecture
I/O	I-Architecture
.	O
</s>
<s>
The	O
simulation	O
tools	O
include	O
an	O
assembler	B-Language
with	O
support	O
for	O
computerized	O
offset	O
computation	O
with	O
labels	O
and	O
the	O
insertion	O
of	O
constants	O
,	O
strings	O
,	O
and	O
blank	O
memory	O
locations	O
into	O
a	O
block	O
of	O
assembly	B-Language
code	I-Language
.	O
</s>
<s>
There	O
is	O
also	O
a	O
convention	O
for	O
using	O
the	O
C	B-Language
language	I-Language
on	O
the	O
LC-3	O
.	O
</s>
<s>
A	O
sample	O
assembler	B-Language
,	O
compiler	B-Language
,	O
and	O
simulator	O
are	O
provided	O
by	O
McGraw-Hill	O
.	O
</s>
<s>
The	O
calling	O
convention	O
for	O
C	B-Language
functions	O
on	O
the	O
LC-3	O
is	O
similar	O
to	O
that	O
implemented	O
by	O
other	O
systems	O
,	O
such	O
as	O
the	O
x86	B-Operating_System
ISA	O
.	O
</s>
<s>
When	O
running	O
C	B-Language
programs	I-Language
,	O
the	O
architecture	O
maintains	O
a	O
memory	O
model	O
that	O
includes	O
space	O
for	O
a	O
call	B-General_Concept
stack	I-General_Concept
and	O
dynamic	B-General_Concept
memory	I-General_Concept
allocation	I-General_Concept
.	O
</s>
<s>
In	O
this	O
model	O
,	O
four	O
of	O
the	O
processor	O
's	O
eight	O
general	O
purpose	O
registers	O
take	O
on	O
special	O
roles	O
:	O
R4	O
is	O
used	O
as	O
a	O
base	O
register	O
for	O
loading	O
and	O
storing	O
global	O
data	O
,	O
R5	O
is	O
used	O
to	O
point	O
to	O
the	O
current	O
function	O
's	O
area	O
on	O
the	O
call	B-General_Concept
stack	I-General_Concept
,	O
and	O
R6	O
is	O
used	O
as	O
a	O
stack	O
pointer	O
.	O
</s>
<s>
When	O
a	O
C	B-Language
function	O
is	O
called	O
under	O
this	O
model	O
,	O
the	O
function	O
's	O
parameters	O
are	O
pushed	O
onto	O
the	O
stack	O
right	O
to	O
left	O
.	O
</s>
<s>
The	O
reserved	O
opcode	B-Language
has	O
been	O
converted	O
into	O
a	O
shift	O
instruction	O
,	O
SHF	O
,	O
that	O
supports	O
arithmetic	O
and	O
logical	O
shifts	O
of	O
arbitrary	O
size	O
in	O
both	O
directions	O
.	O
</s>
