词条 | KERNAL |
释义 |
KERNAL[1] is Commodore's name for the ROM-resident operating system core in its 8-bit home computers; from the original PET of 1977, followed by the extended but strongly related versions used in its successors: the VIC-20, Commodore 64, Plus/4, C16, and C128. DescriptionThe Commodore 8-bit machines' KERNAL consists of the low-level, close-to-the-hardware OS routines roughly equivalent to the BIOS in IBM PC compatibles (in contrast to the BASIC interpreter routines, also located in ROM) as well as higher-level, device-independent I/O functionality, and is user-callable via a jump table whose central (oldest) part, for reasons of backwards compatibility,[2] remains largely identical throughout the whole 8-bit series. The KERNAL ROM occupies the last 8 KB of the 8-bit CPU's 64 KB address space ($E000-$FFFF). The jump table can be modified to point to user-written routines, for example rewriting the screen display routines to display animated graphics or copying the character set into RAM. This use of a jump table was new to small computers at the time.[3] The Adventure International games published for the VIC-20 on cartridge are an example of software that uses the KERNAL. Because they only use the jump table, the games can be memory dumped to disk, loaded into a Commodore 64, and run without modification.[4] 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, who added many of the features for the VIC-20 and the C64. ExampleA simple, yet characteristic, example of using the KERNAL is given by the following 6502 assembly language subroutine[5] (written in ca65 assembler format/syntax): CHROUT = $ffd2 ; CHROUT sends a character to the current output device CR = $0d ; PETSCII code for Carriage Return ; hello: ldx #0 ; start with character 0 next: lda message,x ; read character X from message beq done ; we're done when we read a zero byte jsr CHROUT ; call CHROUT to output char to current output device (defaults to screen) inx ; next character bne next ; loop back while index is not zero (max string length 255 bytes) done: rts ; return from subroutine ; message: .byte "Hello, world!" .byte CR, 0 ; Carriage Return and zero marking end of string This code stub employs the The nameThe KERNAL was known as kernel[6] inside of Commodore since the PET days, but in 1980 Robert Russell misspelled the word as kernal in his notebooks. 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.[7] 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. On device-independent I/OSurprisingly, the KERNAL implemented a device-independent I/O API not entirely dissimilar from that of Unix or Plan-9, which nobody actually exploited, as far as is publicly known. Whereas one could reasonably argue that "everything is a file" in these latter systems, others could easily claim that "everything is a GPIB-device" in the former. Due to limitations with the 6502 architecture at the time, opening an I/O channel requires three system calls. The first typically sets the logical filename through the Observe that no system call exists to "create" an I/O channel, for devices cannot be created or destroyed dynamically under normal circumstances. Likewise, no means exists for seeking, nor for performing "I/O control" functions such as ioctl() in Unix. Indeed, the KERNAL proves much closer to the Plan-9 philosophy here, where an application would open a special "command" channel to the indicated device to conduct such "meta" or "out-of-band" transactions. For example, to delete ("scratch") a file from a disk, the user typically will "open" the resource called Device numbers, per established documentation, are restricted to the range [0,16]. However, this limitation came from the specific adaptation of the IEEE-488 protocol and, in effect, applies only to external peripherals. With all relevant KERNAL system calls vectored, programmers can intercept system calls to implement virtual devices with any address in the range of [32,256). Conceivably, one can load a device driver binary into memory, patch the KERNAL I/O vectors, and from that moment forward, a new (virtual) device could be addressed. So far, this capability has never been publicly known as utilized, presumably for two reasons: (1) The KERNAL provides no means for dynamically allocating device IDs, and (2) the KERNAL provides no means for loading a relocatable binary image. Thus, the burden of collisions both in I/O space and in memory space falls upon the user, while platform compatibility across a wide range of machines falls upon the software author. Nonetheless, support software for these functions could easily be implemented if desired. Logical filename formats tends to depend upon the specific device addressed. The most common device used, of course, is the floppy disk system, which uses a format similar to Other devices, such as the keyboard (device 0), cassette (device 1), the display interface (device 3), and printer (device 4 and 5), require no filenames to function, either assuming reasonable defaults or simply not needing them at all. Notes1. ^Commodore 64 Programmer's Reference Guide. Commodore Business Machines, Inc., 1982, p. 268 2. ^The KERNAL jump table, used to access all the subroutines in the KERNAL, is an array of JMP (jump) instructions leading to the actual subroutines. This feature ensures compatibility with user-written software in the event that code within the KERNAL ROM needs to be relocated in a later revision. 3. ^{{cite web|url=https://archive.org/stream/byte-magazine-1983-01-rescan/1983_01_BYTE_08-01_Looking_Ahead#page/n239/mode/2up|title=Exploring the VIC-20}} 4. ^{{cite news | url=https://archive.org/stream/Ahoy_Issue_25_1986-01_Ion_International_US#page/n31/mode/2up |title=Speech Synthesizers for the Commodore Computers / Part II | work=Ahoy! | date=January 1986 |author=Kevelson, Morton |pages=32 |deadurl=no |accessdate=17 July 2014}} 5. ^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. 6. ^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 7. ^On The Edge: The Spectacular Rise and Fall of Commodore, page 202. 8. ^Commodore 128 Programmers Reference Guide, Commodore Business Machines, Inc., 1986, p. 382 External links
3 : Operating system kernels|Commodore 64|Nonstandard spelling |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。