KERNAL
From Wikipedia, the free encyclopedia
- 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, Commodore 64, 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 CPU's 64K address space ($E000-$FFFF).
The KERNAL was initially written for the Commodore PET by John Feagans, who introduced the idea of separating the BASIC routines from the operating system. It was further developed by several people, notably Robert Russell added many of the features for the VIC-20 and the C64.
Contents |
[edit] Example of use
A simple, yet 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).
[edit] About the misspelling
The KERNAL was known as kernel1980 Robert Russell misspelled the word in his notebooks forming the word kernal. When Commodore technical writers Neil Harris and Andy Finkel collected Russell's notes and used them as the basis for the VIC-20 programmer's manual, the misspelling followed them along and stuck.
inside of Commodore since the PET days, but inAccording 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, using the correct spelling of kernel.
[edit] Notes
- ↑ See On The Edge: The Spectacular Rise and Fall of Commodore, page 202.
- ↑ 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
- ↑ The kernal jump table, used to access all the subroutines in the kernal, was an array of JMP (jump) instructions leading to the actual subroutines. This feature ensured compatibility with user-written software in the event that code within the kernal ROM needed to be relocated in a later revision.
- ↑ Many of the kernal subroutines (e.g., OPEN and CLOSE) were vectored through page three in RAM, allowing a programmer to intercept the associated kernal calls and add to or replace the original functions.
[edit] References
- Bagnall, Brian: On The Edge: The Spectacular Rise and Fall of Commodore, ISBN 0-9738649-0-7