Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > kernal or kernel
2006-02-26 19:43
Oswald

Registered: Apr 2002
Posts: 5094
kernal or kernel

In computer science the kernel is the core of an operating system. It is a piece of software responsible for providing secure access to the machine's hardware and to various computer processes (computer programs in a state of execution). Since there can be many processes running at the same time, and hardware access is limited, the kernel also decides when and how long a program should be able to make use of a piece of hardware: this function is called scheduling. Accessing the hardware directly can be very complex, since there are many different hardware designs for the same type of component. Kernels usually implement some hardware abstraction (a set of instructions universal to all devices of a certain type) to hide the underlying complexity from the operating system and provide a clean and uniform interface to the hardware, which helps application programmers to develop programs that work with all devices of that type. The Hardware Abstraction Layer (HAL) then relies upon a software driver that provides the instructions specific to that device's manufacturing specifications.

...


a kernel is/does:

- a core of an operating system
- secure access to the machine's hardware
- secure access to various computer processes
- scheduling (when and how long a program should be able to make use of a piece of hardware)
- usually implements some hardware abstraction

which of the above is applicable to kernal ?

none.

kernal does basic IO stuff.
2006-02-26 20:51
Compyx

Registered: Jan 2005
Posts: 631
How about the Kernal routines such as OPEN, CLOSE, CHROUT, et cetera?

They provide some sort of abstraction: you don't have to know if your (serial) device is a printer or some disk-drive, you just provide data to be sent and the Kernal figures out where and how to send it..

Also: when sending PETSCII through CHROUT, the Kernal provides 'abstraction' once more: you don't need to worry about where the screen-RAM is located and how to set colors in the color-RAM, the Kernal provides these facilities.

Just my 2 cents ;)

2006-02-26 20:51
Radiant

Registered: Sep 2004
Posts: 639
That is a junk definition, IIRC Tanenbaum simply defines an operating system (the kernel being the core part) as the abstraction layer closest to the real hardware, in C64's case the KERNAL.
2006-02-26 20:56
Compyx

Registered: Jan 2005
Posts: 631
Read more one this: http://en.wikipedia.org/wiki/Kernel_(computer_science)
2006-02-26 21:03
Radiant

Registered: Sep 2004
Posts: 639
Compyx: Though that article applies mostly to modern (1990-) kernels. Multiprogramming is for example not a requisite for a kernel, not even the concept of multiple processes is. See also http://en.wikipedia.org/wiki/Operating_system
2006-02-26 21:21
Compyx

Registered: Jan 2005
Posts: 631
I know, I was just providing some insight as to where Oswald came up with the first paragraph in his post.

I agree that comparing the Kernal of the C64 (approx. 1981/1982) against specifications/requirements written years afterwards isn't exactly fair.

But do we really need a kernal, being demo-coders? Demo coding (at least to me) is all about direct-I/O programming: remember the old "wet your finger and rub it against your joystick-port"? That's about as close as you can get to 'direct-I/O' :)
2006-02-26 23:00
Oswald

Registered: Apr 2002
Posts: 5094
another definition:

The fundamental part of a program, typically an operating system, that resides in memory at all times and provides the basic services. It is the part of the operating system that is closest to the machine and may activate the hardware directly or interface to another software layer that drives the hardware.

at least kernal is not in any way the CORE of the c64 OS.

kernel also means the "essence" of sg.

kernal is kernal, and it can be only called kernel IMHO if we are as sloppy when calling a wolfenstein clone a doom clone. (where even wolfenstein is inaccurate)

I dont like the habit of calling it kernel. dont let lame pc terms enter our cosy c64 world, where we had the definitons for everything before pcs.
2006-02-26 23:04
Radiant

Registered: Sep 2004
Posts: 639
"Kernel" isn't a PC term, it predates PC's by more than 10 years. ;-)
2006-02-26 23:33
Merman

Registered: Dec 2002
Posts: 140
"kernel", strictly speaking means the middle bit of a nut.

Commodore's "kernal" was named after the fact, i.e. they came up with the system and then devised the silly acronym
2006-02-26 23:33
TDJ

Registered: Dec 2001
Posts: 1879
Plus, strictly speaking the c64 is a p.c. as well .. I even have some old magazines from the early 80's with ads that use that term.
2006-02-27 04:03
THE TEA DRINKER

Registered: Jul 2005
Posts: 39
Dunno if this is the correct, but I think it's:

Used these as references: http://en.wikipedia.org/wiki/Kernal (copy pasted into this threath)
and if not then try this:
http://whatis.techtarget.com/wsearchResults/1,290214,sid9,00.ht..

KERNAL:

This article is about Commodore's 8-bit OS software. For the general OS core concept, see kernel (computer science).
The KERNAL is Commodore's name for the ROM-resident operating system core in its 8-bit home computers; from the original PET of 1977, via the extended, but strongly related, versions used in its successors; the VIC-20, C64, Plus/4, C16, and C128. The Commodore 8-bit machines' KERNAL consisted of the low-level, close to the hardware, OS routines (in contrast to the BASIC interpreter routines, also located in ROM), and was user callable via a jump table whose central (oldest) part, for reasons of backwards compatibility, remained largely identical throughout the whole 8-bit series. The Kernal rom occupies the last 8K of the 8-bit CPUs 64K address space (X'F000'-X'FFFF').

Example of use
A simple, still characteristic, example of applying the KERNAL is given by the following 6502 assembly language subroutine (written in ca65 assembler format/syntax):

MSG: .ASCIIZ "Hello, world!"
LDX #$F3 ; store length of string as two's complement value in x register
@LP: LDA MSG-$F3,X ; load character
JSR $FFD2 ; call CHROUT in order to output char to current output device (e.g., screen)
INX ; next character
BNE @LP ; loop back to load new char until whole string done, and then ...
RTS ; ... return from the subroutine
This code stub employs the CHROUT routine, found at address $FFD2 (65490), to send a text string to the default output device (e.g., the display screen).

Acronym or misspelling?
According to early Commodore 'myth' and reported by writer/programmer Jim Butterfield among others, the word KERNAL is an acronym (or maybe more likely, a backronym) standing for Keyboard Entry Read, Network, And Link, which in fact makes good sense considering its role. There's also, however, a theory that the word originated as a misspelling of the word "kernel"[1] by some unknown Commodore employee. Misspelling or not, Berkeley Softworks later used it when naming the core routines of its GUI OS for 8-bit home computers: the GEOS KERNAL.

The (completely different) OS core in the 16/32-bit Commodore Amiga series was called the Amiga ROM Kernel, i.e. using the correct spelling of kernel.

Notes
^ The kernel is the most fundamental part of a program, typically an operating system, that resides in memory at all times and provides the basic services. It is the part of the operating system that is closest to the machine and may activate the hardware directly or interface to another software layer that drives the hardware.
2006-02-27 08:51
trident

Registered: May 2002
Posts: 91
The KERNAL can definitely be called the kernel of the C64 OS as it provides the basic I/O hardware abstractions (disk, tape, serial lines, keyboard, screen). Since we have no multiprogramming on the C64 it is pointless to talk about scheduling or processes in this context.

A much more interesting discussion is why the Commodore people chose to call it the KERNAL instead of the kernel. As we've read on Wikipedia, the origins of the name is somewhat of a mystery even though plausible explanations exist. Did they see it as an inside joke? Did they smirk every time they typed the characters K E R N A L into the Programmers reference guide? Are there any old retired Commodore engineers reading this thread, chuckling wildly at us? ;-)
2006-02-27 13:23
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quote: Plus, strictly speaking the c64 is a p.c. as well .. I even have some old magazines from the early 80's with ads that use that term.

Yup, any computer which can load programs from some external media is a "personal computer". The "personal" relates to the way a computer can be adapted to personal needs (loading software etc). A pocket calculator is usually no PC, and a games console is also too limited to be called a PC (although you can swap software, you are not quite free with that).

And the KERNAL vs kernel matter: I agree with Oswald that "the KERNAL" is the C64 OS and is not identical to a kernel similar to a Linux kernel. Parts of the KERNAL may be called kernel, but at some parts it seems a bit too high level while at other parts it lacks stuff to be a kernel.
2006-02-27 16:26
trident

Registered: May 2002
Posts: 91
Quote: Yup, any computer which can load programs from some external media is a "personal computer". The "personal" relates to the way a computer can be adapted to personal needs (loading software etc). A pocket calculator is usually no PC, and a games console is also too limited to be called a PC (although you can swap software, you are not quite free with that).

And the KERNAL vs kernel matter: I agree with Oswald that "the KERNAL" is the C64 OS and is not identical to a kernel similar to a Linux kernel. Parts of the KERNAL may be called kernel, but at some parts it seems a bit too high level while at other parts it lacks stuff to be a kernel.


I would argue that the C64 OS consists of the KERNAL and the BASIC, just like a Linux OS consists of the Linux kernel and a bunch of user space programs. The KERNAL is the kernel of the C64 OS - it is the only definition that makes sense, really.
2006-02-27 17:13
Oswald

Registered: Apr 2002
Posts: 5094
ok, so some of you think: kernal is the core of the c64 OS.

nice little core we have here, takes HALF of the ENTIRE OS. And what does the 2nd half of the OS do ? its a BASIC INTERPRETER.

Also if you have a core of an OS, where are the other layers using it ? nowhere ? hmm


kernal is not an OS CORE in any way, while kernel is.

but lets assume I agree that kernal in some sense is a kernel too.

calling it then based upon this all the way kernel, is like
calling Windows ALL the time "Operating system".

I think there's only one reason for everyone starting to use kernel. Its the linux hype. And its so much easyer to remember only one word, which is also connected to the "cool" system linux, and sounds so hackerish eh ?

IMHO ppl should show pay some respect, and not to call it kernel.


I *think* one of the possible explanation to this word is that C= engineers didnt think of it as a real kernel, but it did similar things, so they changed one letter, and we got kernal.


kernel=the essence of something, the inner part of a nut

kernel was always used as the innermost part of an OS with several abstraction layers and stuff. Kernal is not the innermost part of the c64 OS. its atleast the half of it.
2006-02-27 17:51
trident

Registered: May 2002
Posts: 91
The KERNAL is the lowest layer of the C64 OS (if we agree that the KERNAL + BASIC is the C64 OS). This has nothing to do with the size of the code of the KERNAL, nor with the size of the executable code of any other parts of the system. The KERNAL provides an abstract API that most definitely has been designed to be useful for applications other than the BASIC interpreter (the "user space" of the C64 OS), much like any other OS kernel.
2006-02-27 18:35
TNT
Account closed

Registered: Oct 2004
Posts: 189
Quoting Oswald
nice little core we have here, takes HALF of the ENTIRE OS.

Not really, as BASIC uses $e000-$e4b6 of kernal ROM :)
2006-02-27 19:06
Graham
Account closed

Registered: Dec 2002
Posts: 990
BASIC is definitely not the OS of the C64. You also don't call "bash" the OS of the Linux-kernel :D
2006-02-27 19:49
trident

Registered: May 2002
Posts: 91
Quote: BASIC is definitely not the OS of the C64. You also don't call "bash" the OS of the Linux-kernel :D

KERNAL + BASIC is the OS of the C64, just like the Linux kernel + bash (and most of the other stuff in the directories immediately below /) is a Linux OS.
2006-02-28 00:13
hannenz
Account closed

Registered: Nov 2002
Posts: 24
BASIC is NO OS. It's an interpreter. nothing more.
In my eyes, KERNAL is the OS of the C64 - whether you call it a kernel or not - well, who cares??!
2006-02-28 15:14
Oswald

Registered: Apr 2002
Posts: 5094
I do :). Everyone should take respect, and learn a lesson, the c64 ROM is called KERNAL, and it should be called that. The term kernel is used for 1000 times more sophisticated OS'es, and in meaning is not close enough.
2006-02-28 17:18
Graham
Account closed

Registered: Dec 2002
Posts: 990
If BASIC was the OS, why don't C64 programs without hardware banging run on Atari XL or Amstrad CPC? They also start with a BASIC prompt.
2006-02-28 18:00
Krill

Registered: Apr 2002
Posts: 2980
trident said: "KERNAL + BASIC is the OS of the C64" - BOTH together are the OS, and there's no debating about that. You switch on the computer and can immediately operate it via BASIC + KERNAL.
I totally agree with trident. See, we have a jump table at the end of the KERNAL. Looks like some hardware abstraction layer to me.
Also Oswald's connection only to linux is not quite clear to me. WinNT has a kernel, as well as unix systems and whatnot.
There are kernels that don't have some of the functionality of the KERNAL, and of course vice versa.
2006-02-28 18:17
Radiant

Registered: Sep 2004
Posts: 639
MSDOS.SYS isn't really that much more sophisticated...
2006-02-28 18:49
Oswald

Registered: Apr 2002
Posts: 5094
IMHO kernal is lightyears far from the concept kernel means.

I give up.



2006-02-28 19:34
trident

Registered: May 2002
Posts: 91
Quote: If BASIC was the OS, why don't C64 programs without hardware banging run on Atari XL or Amstrad CPC? They also start with a BASIC prompt.

Just because two operating systems share the same programming language doesn't necessarily mean that they are binary compatible (i.e. that programs written and compiled for one system can "just run" on another system).

Obviously simple BASIC programs run under both the C64 BASIC and most other BASICs (e.g. 10 print "hello world", 20 goto 10). A tokenized C64 BASIC program probably wouldn't run on an Atari without some kind of translator. This is similar to how a simple C program in source code would compile and run unmodified under x86 Linux and SPARC Solaris, whereas a compiled program wouldn't run without some type of emulator or translator software.
2006-03-01 15:55
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:

IMHO kernal is lightyears far from the concept kernel means.


i'd go back to the 70s and have a look at what kinda trivial stuff they called "kernel" of their OSs back then. the c64 "kernal" is lightyears ahead of them probably.

"kernal" is just the name for the "kernel" of the commodore operating system (not limited to c64 afterall) - just like "linux" is the name for the "kernel" of a typical gnu/linux <insert holy RMS pee> OS.
2006-03-01 17:07
Graham
Account closed

Registered: Dec 2002
Posts: 990
@trident:

Then try some disk drive action. You cannot run the same program on Atari and C64 although both BASIC variants are coded by MicroSoft.
2006-03-01 18:56
Oswald

Registered: Apr 2002
Posts: 5094
anyone can post a link with a description of early kernels ?
2006-03-01 19:48
Puterman
Account closed

Registered: Jan 2002
Posts: 188
oswald: http://en.wikipedia.org/wiki/History_of_operating_systems

Or try google.
2006-03-01 20:36
trident

Registered: May 2002
Posts: 91
Quote: @trident:

Then try some disk drive action. You cannot run the same program on Atari and C64 although both BASIC variants are coded by MicroSoft.


So what? They are two completely different systems - why would we expect them to be 100% compatible? It does not matter that both systems were developed by the same company. A C64 BASIC program cannot be run under Microsoft Windows either, despite both operating systems being written by the same company.

Oswald: for an example of a system with very small kernel, take a look at the MIT Exokernel project: http://en.wikipedia.org/wiki/Exokernel The basic idea of the exokernel was to reduce the kernel to only perform secure multiplexing of hardware resources and leave all the rest - including multithreading, memory allocation, networking, etc - to a "library OS" that was built on top of the tiny kernel.

You who don't think that the KERNAL is the kernel of the C64 OS - where would you draw the line between the kernel and the user space of the C64 OS? I would say that the line is much more difficult to draw for the C64 than for an operating system designed for processors with a supervisory mode. For such systems, the kernel typically is defined as the software running in supervisory mode and the user space is defined as all software not running in supervisory mode. Transfer of control and information between the kernel and user space is done with system calls. In my view, the closest equivalent of system calls on the C64 is the KERNAL jump table, which provides an abstract API to the KERNAL services and does so in an address-independant way that is very similar to how a system call interface typically is designed.

I seems to me that the most natural division of kernel/user space for the C64 OS would be to view the KERNAL as the kernel and the rest (the BASIC interpreter and all user programs) as the user space. The reason for me to make this division is that the KERNAL is useful on its own - without the BASIC - whereas the BASIC requires the KERNAL. Also, since the KERNAL is located in ROM it has a form of memory protection against user programs. Yes, the BASIC is also located in ROM but that does not change the fact that the KERNAL is protected.

One could also argue that the entire C64 system (BASIC + KERNAL) could be considered to be the kernel of the C64 OS. However, this would go against the traditional definition of a kernel as being the *innermost* part of an operating system as there would be nothing *outside* of the kernel. Thus it would be pointless to speak of a kernel and a user space and we might just as well just call it "the OS".

Another approach would be to say that the KERNAL is the C64 OS and that the BASIC is only an application running on top of the OS. The problem with this definition would be that a user cannot directly interact with the KERNAL. If there were no BASIC ROM, a user could not do much with his C64. Since the purpose of an operating system is to allow users to interact with the system, we cannot really call the KERNAL itself the operating system of the C64.

Finally, we could say that the kernel of the C64 OS only comprises parts of the KERNAL. This is a fine definition, but it is also a problematic one as we must then be very specific where to draw the line between the kernel and the user space. Does SETLFS belong to the kernel or the user space? How about CINT? It soon becomes quite difficult and does not really help us in any way.

It seems that the most natural definition is to call the KERNAL the kernel of the C64 OS.
2006-03-02 06:52
Oswald

Registered: Apr 2002
Posts: 5094
trident, yes it is possible to look at the c64 "OS" as a kernel and higher level package. but if you dont want to rape it with this concept you wouldnt do that.

the OS&kernel concept and the c64 OS is as far as a modern car, and one pulled by horses. Of course you can say that the car pulled by horses already has the concept of the engine, chassis, gears, etc, but how wrong you are with that ?

There are several functions of kernal which is pretty extreme too high level to be considered as a kernel function. load a file, print to screen, read keyboard, show me a kernel function that does any of those ???
2006-03-02 08:46
trident

Registered: May 2002
Posts: 91
The C64 OS was developed in the late 1970s and the early 1980s for an 8-bit computer with 64k RAM. Nobody would expect such a system to be very similar to an operating system for a workstation from the same time and age, or for a contemporary PC for that matter.

"There are several functions of kernal which is pretty extreme too high level to be considered as a kernel function. load a file, print to screen, read keyboard, show me a kernel function that does any of those ???"

For BSD and Linux kernels the corresponding kernel functions would be open(), write(), and read(), respectively.
2006-03-02 17:30
chatGPZ

Registered: Dec 2001
Posts: 11386
and if you look at the implementation of the c-library for cc65 you will notice that many posix functions map practically directly to kernal routines - _just_ like its done in *nix/bsd
2006-03-18 11:16
Rayne
Account closed

Registered: Jan 2002
Posts: 30
The KERNAL was known as kernel inside of Commodore since the PET days, but in 1980 Robert Russell misspelled the word in his notebooks forming the word kernal. When commodore technical writers Neil Harris and Andy Finkel collected Russells notes and used them as the basis for the VIC-20 programmer's manual, the misspelling followed them along and stuck.

According to early Commodore 'myth' and reported by writer/programmer Jim Butterfield among others, the word KERNAL is an acronym (or maybe more likely, a backronym) standing for Keyboard Entry Read, Network, And Link, which in fact makes good sense considering its role. Berkeley Softworks later used it when naming the core routines of its GUI OS for 8-bit home computers: the GEOS KERNAL.

The (completely different) OS core in the 16/32-bit Commodore Amiga series was called the Amiga ROM Kernel, i.e. using the correct spelling of kernel.
2006-03-18 12:37
PopMilo

Registered: Mar 2004
Posts: 146
Well said!
2007-06-19 17:01
Oswald

Registered: Apr 2002
Posts: 5094
Quote: The KERNAL was known as kernel inside of Commodore since the PET days, but in 1980 Robert Russell misspelled the word in his notebooks forming the word kernal. When commodore technical writers Neil Harris and Andy Finkel collected Russells notes and used them as the basis for the VIC-20 programmer's manual, the misspelling followed them along and stuck.

According to early Commodore 'myth' and reported by writer/programmer Jim Butterfield among others, the word KERNAL is an acronym (or maybe more likely, a backronym) standing for Keyboard Entry Read, Network, And Link, which in fact makes good sense considering its role. Berkeley Softworks later used it when naming the core routines of its GUI OS for 8-bit home computers: the GEOS KERNAL.

The (completely different) OS core in the 16/32-bit Commodore Amiga series was called the Amiga ROM Kernel, i.e. using the correct spelling of kernel.


according to "on the edge" the first version is the truth. I stop my kernal mania at last.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
E$G/HF ⭐ 7
Guests online: 153
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.087 sec.