The Commodore 64 and Operating Systems – Part 2     Leave a comment

The Commodore 64 and Operating Systems – Part 2

 

Games for GEOS on the Commodore 64

So, now we continue with this look at operating systems and how they‘re relevant to the Commodore 64.

Operating systems can be created either using Assembly Language/Machine Code for the CPU the hardware is based around, or by using a language which has a version running on that hardware, or on another system which can be used to produce code compatible for that hardware. How this is actually done can be quite complicated to understand.

The Commodore Kernal is a collection of routines which was used on all Commodore computers and updated for new models up to and including the Commodore 128, before Commodore abandoned it for the Amiga, as well as their own PC clones using third party PC BIOS ROMs and MS-DOS. You can read about this crap on http://sta.c64.org/cbm64krnfunc.html and https://www.c64-wiki.com/wiki/Kernal  The only really useful functions are to accept input, provide output, open files, load files, save files, and close files.

The way these calls are used has already been demonstrated in a previous post about the C128 built in MONITOR program. An example of this is below.

LDX #$00
LDA $1820,X
JSR $FFD2
INX
CPX #$0D
BNE $1802
JMP $1800
BRK

The program above uses $FFD2 CHROUT to output characters onto the text screen. These characters are held as data starting at address $1820 on the C128, but this should be $1020 on the C64, due to the different memory map. The program starts at $1800 on the C128, but this should be $1000 on the C64. You can read more about this in my post https://commodore64crap.wordpress.com/2013/10/29/the-commodore-128-the-fixed-and-upgraded-commodore-64-part-2/

CP/M only has 31 functions or calls, but the good excuse for this is that it came out in 1978, instead of 1982. The most useful calls are CONIN and CONOUT, to input and output characters from the keyboard. Apart from this there are functions for boot, both cold boot and warm boot. A cold boot starts from scratch, while a warm boot remembers what you were doing before your computer crashed and you reset the OS.

The “home computers“ such as the C64, Sinclair ZX Spectrum, Atari 8 bit, Acorn BBC Micro, Acorn Electron, Amstrad CPC and MSX, etc all booted into BASIC, but they also had a collection of ROM based routines. They were all coded in the Assembly Language/Machine Code for the CPU of each computer, meaning 6510/6502 for the C64, Atari, BBC Micro and Acorn Electron, but Z80 for the Sinclair ZX Spectrum, Amstrad CPC and MSX..

In 1969 onwards, years before the home computer boom, UNIX OS was created in some language on a PDP minicompurer which was probably Assembly Language/Machine Code, then rewritten in the C Programming Language. It was designed to be portable to different hardware. It has system calls or functions which have to be used in C. You can read about some or all of them on http://www.di.uevora.pt/~lmr/syscalls.html as well as http://www.tutorialspoint.com/unix_system_calls/ and http://www.csie.ntnu.edu.tw/~ghhwang/course_slices/OS/Unix_System_Calls.pdf

Years later, leading up to 1985, Amiga Workbench OS was also written in C, instead of in Assembly Language/Machine Code, but it was only designed for Amiga hardware, including a 68000, 68010, or 68020 CPU, as well as the custom chips Paula, Agnus, and Denise.

GEOS is an advanced GUI based OS for the C64, designed to look like the early Apple MacIntosh System Software or Digital Research GEM. It appears mainly as a monochrome system, but can use more than two colours at a time, unlike the early Mac. In spite of this, it never looks anything like as colourful as Atari ST GEM, or Amiga Workbench OS. It doesn‘t boot into BASIC, but into a desktop. It even fixes the C64 design faults by turning off the BASIC and Kernal ROMs, as well as loading a number of equates with meaningful names, similar to the Atari 8 bit computers. It contains functions including DrawPoint for plotting dots on the hires screen, HorizontalLine for drawing horizontal lines, VerticalLine for drawing vertical lines, DrawLine and i_Drawline for drawing diagonal lines! It was programmed in 6510/6502 Assembly Language. It allows users to run non GEOS C64 programs from the desktop, but also to write programs within GEOS. You can read more about it in “The Official GEOS Programmers Reference Guide“, as well as “GEOS Inside and Out“ (another Data Becker/Abacus book), both on http://www.bombjack.org/commodore/books.htm

I think that anyone out there wanting to create a brand new OS, not based on Linux, UNIX, or even on MS Windows, should get their hands on a Raspberry Pi computer, or a phone with an ARM CPU. This type of CPU is RISC (Reduced Instruction Set Chip), but I was surprised to read recently that it has lots of registers, a bit like the 68000 family, instead of the x86 family, or the 6502 family. While thinking up ideas for your new OS you could be watching lots of sci fi to see the way computers work there, then work out a way of actually doing it.

That‘s all for now! Look out for another amazing post about the C64 in the near future!

Advertisements

Posted December 22, 2017 by C64hater in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: