<s>
KERNAL	B-Operating_System
is	O
Commodore	O
's	O
name	O
for	O
the	O
ROM-resident	O
operating	B-General_Concept
system	I-General_Concept
core	O
in	O
its	O
8-bit	O
home	O
computers	O
;	O
from	O
the	O
original	O
PET	B-Device
of	O
1977	O
,	O
followed	O
by	O
the	O
extended	O
but	O
related	O
versions	O
used	O
in	O
its	O
successors	O
:	O
the	O
VIC-20	B-Device
,	O
Commodore	O
64	O
,	O
Plus/4	B-Operating_System
,	O
Commodore	B-Operating_System
16	I-Operating_System
,	O
and	O
Commodore	B-Device
128	I-Device
.	O
</s>
<s>
The	O
Commodore	O
8-bit	O
machines	O
 '	O
KERNAL	B-Operating_System
consists	O
of	O
the	O
low-level	O
,	O
close-to-the-hardware	O
OS	O
routines	O
roughly	O
equivalent	O
to	O
the	O
BIOS	B-Operating_System
in	O
IBM	O
PC	O
compatibles	O
(	O
in	O
contrast	O
to	O
the	O
BASIC	B-Language
interpreter	I-Language
routines	O
,	O
also	O
located	O
in	O
ROM	B-Device
)	O
as	O
well	O
as	O
higher-level	O
,	O
device-independent	O
I/O	O
functionality	O
,	O
and	O
is	O
user-callable	O
via	O
a	O
jump	O
table	O
in	O
RAM	O
whose	O
central	O
(	O
oldest	O
)	O
part	O
,	O
for	O
reasons	O
of	O
backwards	O
compatibility	O
,	O
remains	O
largely	O
identical	O
throughout	O
the	O
whole	O
8-bit	O
series	O
.	O
</s>
<s>
The	O
KERNAL	B-Operating_System
ROM	B-Device
occupies	O
the	O
last	O
8	O
KB	O
of	O
the	O
8-bit	O
CPU	O
's	O
64	O
KB	O
address	O
space	O
( $E000	O
–	O
$FFFF	O
)	O
.	O
</s>
<s>
The	O
Adventure	O
International	O
games	O
published	O
for	O
the	O
VIC-20	B-Device
on	O
cartridge	O
are	O
an	O
example	O
of	O
software	O
that	O
uses	O
the	O
KERNAL	B-Operating_System
.	O
</s>
<s>
The	O
KERNAL	B-Operating_System
was	O
initially	O
written	O
for	O
the	O
Commodore	B-Device
PET	I-Device
by	O
John	O
Feagans	O
,	O
who	O
introduced	O
the	O
idea	O
of	O
separating	O
the	O
BASIC	O
routines	O
from	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
It	O
was	O
further	O
developed	O
by	O
several	O
people	O
,	O
notably	O
Robert	O
Russell	O
,	O
who	O
added	O
many	O
of	O
the	O
features	O
for	O
the	O
VIC-20	B-Device
and	O
the	O
C64	O
.	O
</s>
<s>
A	O
simple	O
,	O
yet	O
characteristic	O
,	O
example	O
of	O
using	O
the	O
KERNAL	B-Operating_System
is	O
given	O
by	O
the	O
following	O
6502	B-General_Concept
assembly	B-Language
language	I-Language
subroutine	O
(	O
written	O
in	O
ca65	B-Application
assembler	B-Language
format/syntax	O
)	O
:	O
</s>
<s>
The	O
KERNAL	B-Operating_System
was	O
known	O
as	O
kernel	B-Operating_System
inside	O
of	O
Commodore	O
since	O
the	O
PET	B-Device
days	O
,	O
but	O
in	O
1980	O
Robert	O
Russell	O
misspelled	O
the	O
word	O
as	O
kernal	B-Operating_System
in	O
his	O
notebooks	O
.	O
</s>
<s>
When	O
Commodore	O
technical	O
writers	O
Neil	O
Harris	O
and	O
Andy	O
Finkel	O
collected	O
Russell	O
's	O
notes	O
and	O
used	O
them	O
as	O
the	O
basis	O
for	O
the	O
VIC-20	B-Device
programmer	O
's	O
manual	O
,	O
the	O
misspelling	O
followed	O
them	O
along	O
and	O
stuck	O
.	O
</s>
<s>
According	O
to	O
early	O
Commodore	O
myth	O
,	O
and	O
reported	O
by	O
writer/programmer	O
Jim	O
Butterfield	O
among	O
others	O
,	O
the	O
"	O
word	O
"	O
KERNAL	B-Operating_System
is	O
an	O
acronym	O
(	O
or	O
,	O
more	O
likely	O
,	O
a	O
backronym	O
)	O
standing	O
for	O
Keyboard	O
Entry	O
Read	O
,	O
Network	O
,	O
And	O
Link	O
,	O
which	O
in	O
fact	O
makes	O
good	O
sense	O
considering	O
its	O
role	O
.	O
</s>
<s>
Berkeley	O
Softworks	O
later	O
used	O
it	O
when	O
naming	O
the	O
core	O
routines	O
of	O
its	O
GUI	O
OS	O
for	O
8-bit	O
home	O
computers	O
:	O
the	O
GEOS	B-Device
KERNAL	B-Operating_System
.	O
</s>
<s>
Surprisingly	O
,	O
the	O
KERNAL	B-Operating_System
implemented	O
a	O
device-independent	O
I/O	O
API	O
not	O
entirely	O
dissimilar	O
from	O
that	O
of	O
Unix	B-Application
or	O
Plan-9	B-Operating_System
,	O
which	O
nobody	O
actually	O
exploited	O
,	O
as	O
far	O
as	O
is	O
publicly	O
known	O
.	O
</s>
<s>
Due	O
to	O
limitations	O
with	O
the	O
6502	B-General_Concept
architecture	O
at	O
the	O
time	O
,	O
opening	O
an	O
I/O	O
channel	O
requires	O
three	O
system	O
calls	O
.	O
</s>
<s>
Likewise	O
,	O
no	O
means	O
exists	O
for	O
seeking	O
,	O
nor	O
for	O
performing	O
"	O
I/O	O
control	O
"	O
functions	O
such	O
as	O
ioctl( )	O
in	O
Unix	B-Application
.	O
</s>
<s>
Indeed	O
,	O
the	O
KERNAL	B-Operating_System
proves	O
much	O
closer	O
to	O
the	O
Plan-9	B-Operating_System
philosophy	O
here	O
,	O
where	O
an	O
application	O
would	O
open	O
a	O
special	O
"	O
command	O
"	O
channel	O
to	O
the	O
indicated	O
device	O
to	O
conduct	O
such	O
"	O
meta	O
"	O
or	O
"	O
out-of-band	O
"	O
transactions	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Commodore	B-Language
BASIC	I-Language
,	O
they	O
might	O
find	O
software	O
not	O
unlike	O
the	O
following	O
:	O
</s>
<s>
With	O
all	O
relevant	O
KERNAL	B-Operating_System
system	O
calls	O
vectored	O
,	O
programmers	O
can	O
intercept	O
system	O
calls	O
to	O
implement	O
virtual	O
devices	O
with	O
any	O
address	O
in	O
the	O
range	O
of	O
 [ 32 , 256 ] 	O
.	O
</s>
<s>
Conceivably	O
,	O
one	O
can	O
load	O
a	O
device	O
driver	O
binary	O
into	O
memory	O
,	O
patch	O
the	O
KERNAL	B-Operating_System
I/O	O
vectors	O
,	O
and	O
from	O
that	O
moment	O
forward	O
,	O
a	O
new	O
(	O
virtual	O
)	O
device	O
could	O
be	O
addressed	O
.	O
</s>
<s>
So	O
far	O
,	O
this	O
capability	O
has	O
never	O
been	O
publicly	O
known	O
as	O
utilized	O
,	O
presumably	O
for	O
two	O
reasons	O
:	O
(	O
1	O
)	O
The	O
KERNAL	B-Operating_System
provides	O
no	O
means	O
for	O
dynamically	O
allocating	O
device	O
IDs	O
,	O
and	O
(	O
2	O
)	O
the	O
KERNAL	B-Operating_System
provides	O
no	O
means	O
for	O
loading	O
a	O
relocatable	O
binary	O
image	O
.	O
</s>
