The Contiki Desktop OS for C64, NES, 8-bit Atari,
Adam Dunkels writes "This is for those of you who think that a text-based operating system that fits compressed on a 1.44Mb floppy counts as 'tiny': the brand new Contiki operating system and desktop environment for the Commodore 64, with ports to a bunch of other platforms such as the 8-bit Nintendo Entertainment System, the VIC-20, 8-bit Ataris, Atari Jaguar, the Tandy CoCo, and the Apple ][ under development. The Contiki system includes
the following: a multi-tasking kernel, a windowing
system and themeable GUI toolkit, a screen saver, a TCP/IP
stack, a personal
web server, and a web
browser. The Contiki web browser, which is likely to be the world's smallest browser given its extremely small memory footprint, is the world's first true web browser for an 8-bit system and probably makes the 21 years old Commodore 64 the oldest system ever to run a real web browser! All of the above programs are contained in a single, fully self-contained, 42 kilobytes large binary. The entire Contiki system with all programs running simultaneously is comfortable in 64 kilobytes of memory. The name 'Contiki' is derived from Thor
Heyerdahl's famous Kon-Tiki
raft which was able to sail across the Pacific Ocean despite being built using prehistoric techniques, something previously thought impossible. There are also screenshots
and a FAQ
avaliable."
where do I plug the RJ-45 cable into my NES?
Have you seen my stapler?
Will this work on the TI 99/4A or will I need a few extra 16k memory expansion cards to get up to snuff?
I still don't understand why any of you use these big computers. We only need 32k to do everything! I'm using one now and although I had to split this message over a cassette tape, it's still better than using those computers that Bill Gates said were too memory rich.
Check me if I'm wrong on this, but I believe the Atari 400/800 are a couple of years older than the C64, which would make *it* the oldest system to run a web browser. I had one (an 800) with 32 whopping-mo-fo-kilobytes of RAM in, like, 1981.
Yeah, that's right, I was a badass.
"Lawyers are for sucks."
- Doug McKenzie
This gets me to thinking about how much programing is probably "junk" programming these days. Anyone remember the sequal to Elite? Elite 2: Final Frontiers I think it was called. That had thousands of systems, planets, bases, stations, etc... set up in a game that had "realistic" physics. You could actually land on the planets yourself!
It was 1 disk big (1.44 floppy).
Now I look at Freelancer. A big CD full of great graphics. Yet at the same time I see it as not nearly as complex and thought out as Elite 2.
This is an interesting attempt not to make bigger programs, but tighter ones. Making the most of what you have. It feels like there is so much available on computers these days, that programs aren't concerned with getting the most out of it, just using as much of the bells and whistles as they can. Imagine using the same mentality on a modern computer!
Fuzzy Knights: New RPG Strips Tuesday and Friday!:
http://www.fuzzyknights.com
The Commodore 64 market has been screaming for an up to date operating system and web browser for decades. This should breathe new life into a sector which has been seen by many as obsolete, and may well trigger a renaissance in C64 development and application support.
If I seem short sighted, it is because I stand on the shoulders of midgets
You mean a version of Eliza that says things like "Comrades, we must seize the means of production!" and "Down with Capitalism!"
Sorry, I'll get me coat...
-- And when Justice is gone, there is always... Force. --Laurie Anderson, "Oh Superman"
Kudos to these guys. My first thoughts after, "No freakin' way!" were, "How the heck did they get ethernet and a C64 together?"
/. that had some sort of odd C64 hybrid that streamed audio?
I figured it was some sort of butt-slow serial hack, but instead they designed their own C64 ethernet cartridge! Nicely done.
Come to think of it, weren't these the same guys we saw a while back here on
What is Contiki and what is it good for?
Contiki is an Internet-enabled operating system and desktop environment for a number of smallish systems such as the 8-bit Commodore 64. In short, Contiki is the software needed to access the Internet and browse the web. What makes Contiki special is that it makes it possible to do this even from really constrained systems, which previously have been belived to be too small to be able to run this kind of software.
Is this about retro or nostalgia?
No. This is not about playing old games to revive childhood memories. It is about pushing the limits and doing things previously thought impossible.
What do I need to run Contiki?
A standard system to which Contiki is ported. In general, there are no expansion boards, CPU accelerators or extra memory cards required, not even a disk drive. An RS-232 (serial) card or Ethernet connection is required for Internet connectivity, however.
The typical system requirements for the Contiki system is about 20 kilobytes of RAM for the base functionality and about 50 kilobytes for full functionality (desktop icons, web browser, web server, etc.)
Do I need to upgrade my system to run Contiki?
No. Contiki is designed to work with unexpanded systems, so there is no need for megabytes of RAM or main board upgrades.
Does Contiki require megabytes of memory, or 16-bit CPU accellerator upgrades?
No, in general, Contiki does not require any upgrades, accelerators or expansion kits.
Does Contiki need assistance of a powerful server to reach the Internet?
No. Contiki does not require assistance of a powerful PC or *nix server to use the Internet. Everything (TCP/IP, HTTP, HTML, etc.) is done by Contiki on the 8-bit system.
Is the Contiki web browser really the first browser for 8-bit systems?
Yes. While there are other programs such as the HyperLink hyper-text document viewer that allow an 8-bit system to browse the web, these programs require a powerful *nix server to translate the Internet content to a simpler format that the 8-bit system understands.Contiki does not require assistance of a powerful server, but is fully self-contained.
There are also web browsers that claim to run on 8-bit system, but in reality require radically more powerful 16-bit CPUs and megabytes of memory. The Wave is such a browser.
Is it possible to use Contiki with a modem and a dial-up Internet account? Does Contiki support PPP?
Lawrence Chitty is currently working on PPP support for Contiki.
Is it possible to use Contiki with a broadband or DSL connection?
Yes, if you have an Ethernet card for your system, it is possible to use Contiki with a broadband or DSL connection.
Does Contiki support pre-emptive multitasking?
No, Contiki does cooperative multitasking. The reason for not supporting pre-emptive multitasking is that it would unnecessarily increase the complexity not only of the operating system, but also of the applications that would run under it. Pre-emptive multitasking is primarily useful in general purpose multiuser operating systems such as *nix, or in real-time systems where response time is critial. Contiki does not fit in either of those categories.
Where does the name "Contiki" come from?
The name "Contiki" is taken from Thor Heyerdahl's famous Kon-Tiki raft. Kon-Tiki was built using prehistoric techniques in order to prove that ancient Polynesians actually were able to sail from South America to the Polynesian islands. Similarly, Contiki runs on prehistoric computers, yet it is able to do much of a modern PC usually does.
Are there any other uses for Contiki?
The small size of Contiki could make it useful in small networked systems which are required to be very inexpensive. Such a system could be comprised of a low-cost, low-power, 8-bit microcontroller like an AVR, an Ethernet chip such as the CS8900a, an LCD display and three touch buttons - perhaps something similar to the Mosaic Industries EtherSmart Controller. Contiki would make it possible to surf the web from a device with only a small low-cost 8-bit microcontroller, without needing to use an expensive 32-bit CPU.
Contiki would not make a good environment for an end-user device such as a handheld PDA or a mobile GSM phone, however, as it don't have the kind of features expected from a web browsing environment of today. There is no Java, no Flash, and it even lacks support for images. Most modern handhelds, PDAs and mobile phones have quite a lot of computing power; many of them are even able to run a graphical version of Linux. For systems of that size, there are better environments than Contiki available.
At the heart of the Contiki desktop environment is the event driven Contiki kernel. Using non-preemptive multitasking, the Contiki event kernel makes it possible to run several programs in parallel. It also provides message passing mechanisms and timers to the running programs.
Processes
In the Contiki event kernel, a process is defined by three entities: the initialization function, the event handler and the idle loop. The idle loop is optional and is called repeatedly whenever the system has nothing else to do (i.e., when no events occur and no timers are scheduled). The event handler is called when an event occurs. The initialization function is used to initialize the program and to register to which events the process is listening. A process the does not have an idle loop must listen to at least one event, or else the process will never be scheduled and will therefore not ever run again.
Events
Events can be emitted by all processes and can be directed either towards a particular process, or towards all processes. If the processes are listening for the event, the event handler function will be invoked for each process. An emitted event is accompanied with a pointer that can be used for message passing between processes.
Timers
Timers are implemented using events; each event can be scheduled to occur at a given time in the future. The Contiki event kernel will emit the event when the timer goes off. Because the Contiki event kernel never preempts a running process, there are no guarantees about the time-out times.
Examples
The figure the left is an illustration of how the Contiki event kernel works. There are four processes in the system and when the system starts, each process' initialization function (here called init()) is called. After the initialization in done, no events are scheduled, so the idle functions of the processes are being run. Only process 2 implements an idle function, and it will be called repeatedly until event 1 is emitted. Processes 1 and 3 have registered a listener for event 1, and each process' event handler function is invoked in response to the event being emitted. Both event handler functions run to completion, after which no events are scheduled so the idle loop is run until event 2 is emitted some time later. Process 4 has registered a listener for this event, so its event handler function is invoked.
As a more concrete example of how the Contiki event kernel works, consider the Contiki desktop environment. Here, there are several processes running: the GUI and windowing system (i.e., the CTK toolkit), the TCP/IP stack, and all of the programs such as the web browser and e-mail client. Both CTK and the TCP/IP stack implements idle functions, whereas the other processes only implements event handlers. The CTK idle function checks for keypresses and TCP/IP stack's idle function polls the network device driver for incoming packets.
The Contiki Tool-Kit (CTK) provides graphical user interface primitives such as windows, dialog boxes, buttons and text editing to Contiki and its programs. CTK is designed to be highly modularized which makes it possible to change the appearence of it in a lot of ways and to adapt it to many platforms.
Frontends and themes
CTK is divided into two separate modules; the CTK backend, which handles how the user interacts with the windows, buttons, menus, etc., and the CTK frontend which draws the windows onto the screen and grabs keypresses from the user. It is this division that makes CTK portable.
It is also possible to create different CTK looks, themes, by changing the CTK frontend. Currently, there are three CTK themes:
ctk-conio
The textbased "base" theme of CTK. It is designed to be extremely portable; in order to port it to new platforms, it is sufficient to implement as few as three C functions.
ctk-eyecandy
A modern looking grayish theme with squared buttons and windows, and a vertical gradient background. Only runs on the Commodore 64 version of Contiki and was the first graphical theme to be implemented.
ctk-blueround
A blueish theme with rounded buttons and window borders for the Commodore 64.
Windows
Similar to most other desktop GUI systems, windows are central to the design of CTK. Windows are the container of all other user interface elements. In CTK, windows can be moved and closed, but they cannot be resized or iconified. The visible windows form a hierarchy where the bottom windows are overlapped by the front windows. The frontmost window receives the user input and is usually drawn in another color than the back windows.
Dialogs
Dialogs are a special kind of windows that do not have a normal window border, and are always on top of the other windows, and focused. Dialogs always appear at the center of the screen and cannot be moved around.
Menus
The CTK menus are similar to the Mac OS ones in that there is only one menubar and not one menubar per application. The default configuration is to have the menu bar at the top of the screen (like Mac OS), but since this it up to the actual frontend implementation, it could very well be drawn at the bottom of the screen.
Widgets
Like most GUI toolkits, CTK uses user interface widgets to manage the user interface. There are six widget types in CTK: separators, labels, buttons, hyperlinks, text entry widgets and icons.
Separators
Separators are passive widgets that only serves the single purpose of separating widgets from each other. Separators have a configurable width, but always has a height of one.
Labels
The CTK label widget is a passive widget that displays text. Both height and width are settable.
Buttons
CTK buttons are active widgets that, when pressed, emit a ctk_signal_button_pressed signal to the process that created the button.
Hyperlinks
CTK hyperlinks are active widgets that emit a ctk_signal_hyperlink_active signal when pressed and a ctk_signal_hyperlink_hover signal when they are selected. The signals are sent to all processes that are listening for the signal. This makes it possible for both the web browser process and the e-mail client process to listen for hyperlinks, and the e-mail process can choose to handle mailto: links, whereas the web browser handles hyperlinks starting with http://. The ctk_signal_hyperlink_hover signal lets the web browser change the status bar message when a hyperlink is selected.
Text entries
The CTK textentry widget is an active widget that is the primary text input method of CTK. The text that the text entry widget edits may be wider than the actual width of the widget, and the widget will scroll the text when the cursor moves off the right of the widget. The text entry widget can be multiple characters high.
Icons
The primary use of the CTK icon widget is to have desktop icons. When pressed, the CTK icon widget emits the ctk_signal_button_pressed signal.
The Contiki desktop environment uses version 0.9 of the uIP TCP/IP stack to provide Internet communication. uIP is designed to allow limited systems to enjoy full TCP/IP communication.
uIP provides the following protocols:
ARP (IP address to Ethernet MAC address protocol)
SLIP (Serial Line IP)
IP (fragment reassembly turned off for Contiki)
ICMP echo (ping)
Unicast UDP
TCP
In addition to the above protocols, a PPP implementation is currently being developed by Lawrence Chitty.
DNS - Domain Name System
In order to run the web browser, Contiki must implement the DNS protocol. DNS maps host names (like www.google.com) into a numerical IP address (like 216.239.51.101) by using a globally distributed database.
The DNS client in Contiki has a cache of hostname and IP address pairs so that a DNS lookup will not have to be made each time a Contiki program asks for an IP address. The size of the cache is configured at compile time and typically is about 10 entries large.
The DNS client implementation is not very heavily tested andmay fail with certain DNS names.
More information
For more information about the uIP TCP/IP stack, see the uIP homepage at: http://dunkels.com/adam/uip/.
How the heck do you get a new operating system onto a gaming console like the NES?
Are the game controller ports used as serial ports?
Do you use a specially made cartridge?
My blog
Programming on old 8-bit systems is very different from programming for windows/unix. You must know the hardware better and do optimisations you would not even think about on a modern computer.
Some people find that challanging and fun. Not everything needs to be useful.
Seriously, this is very cool stuff. I might dig up my old CBM from the attic to play with this. Now only to be able to hook my oceanic 1541 drive to my PC or my Mac somehow. Or are there ways to simulate a c64 disk drive from a PC with a resoldered C64 disk cable?
How _does_ one transfer software from PC to a real hardware C64 nowadays? Can some people in the know drop some pointers to FAQ's and links?
Please some clever person with no value on their time: Make a version for the spectrum, the world needs this! The speccy is a (modified) Z80, so is the NES (as I remember) - it should be possible and possibly quite easy that would be so cool! Web browsing on a rubber keyboard, those fancy CBM machines are almost "real" computers by comparison
URL: http://dunkels.com/adam/contiki/links.html
System information and emulators
Commodore 64/128
The Commodore 64 is based on the 6510 CPU, which is a 6502-derived 8-bit CPU. It has 64k of RAM and 16k ROM which includes a BASIC interpreter and some basic I/O services. Graphics is provided by the VIC chip which has 16 colors and a maximum resolution of 320x200 in hi-res mode. It provides a 40x25 raster of characters in character mode. The three voices of digital sound is produced by the SID chip.
The Commodore 128 is an extended version of the Commodore 64 that contains a 8510 CPU which is capable of 2 MHz operation and can address 128k RAM (hence the name Commodore 128). It also has a Commodore 64 compatibility mode which is extremely similar to a regular C64 but with a few minor differences.
SuperCPUThe SuperCPU is a 20 MHz 16-bit 65816-based computer that is plugged into the back of the Commodore 64 or 128. It uses the C64 keyboard and joysticks for input and the VIC and SID chips for audiovisual output. The SuperCPU is capable of addressing several megabytes of memory and is usually used together with a 16 megabytes RAM expansion board.
There are no SuperCPU emulators avaliable.
Links- The VICE emulator
is capable of emulating a large number of Commodore machines. It
emulates the C64, the C128, the VIC20, most of the PET models, and the
CBM-II. VICE runs under Windows, Linux, FreeBSD, and a number of other
host systems.
- Joakim Eriksson's Web
C64 emulator, written in Java, runs as an applet within a web
browser.
- Per Håkan Sundell's CCS64 emulator works
under Windows and DOS.
- The ec64
emulator is developed for Linux and was originally written entirely in
x86 assembler.
- An article by Simon
N Goodwin about C64 emulators.
- The Commodore
emulators category in the Dmoz has more links.
Operating systems and desktop environmentsCommodore 64/128
There are plenty of alternative operating systems for the C64, mostly written in 6502 assembler. Some of them are far from complete, however, and only appear as dark shadows on a few web pages - MagerValp's SMOS and my own osT are among those.
- GEOS from 1986 probably
is the most well-known graphical operating system for the C64. It is
still sold commercially by CMDKEY.com.
- LUnix NG is an
open-source multi-tasking operating system with TCP/IP/PPP-support, a
*nix-like command shell, and a number of *nix-like utilities
such as ls and cp.
- Craig Bruce's ACE is a
text-based single-tasking operating system for the 64 and the 128. It
provides a *nix-like command shell, a text-editor, a terminal program
for the SwiftLink RS232 interface, as well as device drivers for a
lot of devices
- GeckOS/A65 is a
multi-tasking operating system with TCP/IP support and a *nix-like
command shell.
- Wheels
is a version of GEOS that requires RAM expansion to run.
SuperCPUWith its 20 MHz and megabytes of memory, the SuperCPU is powerful enough to run fully-fledged graphical operating systems that rival early Machintosh or Microsoft Windows systems.
- Wings is a
TCP/IP-enabled graphical operating system for the SuperCPU. It
includes a MOD music player, JPEG viewer, web page download utility,
etc.
- JOS is an older version
of Wings.
Internet softwareTCP/IP and PPP connectivity
To surf the web, send or read email, etc., the first step is to actually get in touch with the Internet. This requires both physical access to an ISP, either via a modem and a phone-line or an Ethernet broadband connection, and the TCP/IP software running on the C64.
There are a number of programs that make it possible to reach the Internet with a C64/C128.
- LUnix NG contains a
TCP/IP stack and a PPP implementation which makes it possible to reach
the Internet using a modem and a dial-up ISP.
- GeckOS/A65 also
contains a TCP/IP stack, but no PPP dialer.
- My own uIP TCP/IP stack
has been used for some time to run a web server on a Commodore 64. uIP
currently does not include a PPP dialer.
- Novaterm 10
contains a PPP dialer and enough TCP/IP code to be able to run telnet
over the Internet.
Application programsSuperCPU
All of the above mentioned SuperCPU operating systems have TCP/IP support.
- The
Wave is a web browser for the SuperCPU (and not for the Commodore
64/128 as the web page claims) that runs under the Wheels operating
systems. Here
is another page with information about The Wave (that also falsely
claims that The Wave is for the Commodore 64/128). The latter page
also includes screenshots of The Wave in action.
Commodore 64/128Small graphical user-interfaces (GUIs)
User interfaces for embedded systems range from the simple buttons on the front of a washing machine to those of fully fledged web browser type interfaces on information stations. The underlying technology varies from simple electronic circuits to full-scale PC compatibles.
- PicoGUI is a GUI architecture
designed for embedded systems to desktop machines. It does not require
any supporting GUI system and can be used on anything from graphical
screens to text based systems. Their smallest target system are
handheld terminals and the compiled object code size is on the order
of hundreds of kilobytes.
- Microwindows/NanoGUI is
a graphical user interface system designed to run without support from
an underlying system. On 16-bit systems Microwindows is about 64k
large.
Small web browsersThe smallest web browsers are usually specially designed for the limitations of embedded systems and other specialized computers such as car navigation systems, set-top boxes and medical equipment. There are also a few small web browsers for old DOS PCs available.
You guys are so behind times man! Katz's buddy Junis from Afghanistan was beta testing this a year back!
Excellent! Now I can play Monty on the Run and Sanxion in Death Match mode..
Not everything needs to be useful.
That's ridiculous. Hobbies must be useful. That's why we all collect stamps & hotelsoap.
When will I end this grieving ? When will my future begin ?
Although the focus of this project is not the technology itself I think. This guy has proven to any employeer he will ever approach that he has superior skills when it comes to programming under tight constraints. Enjoy working in the embedded systems industry (and making money hand-over-fist doing it)!
What else is interesting about this is that it goes to show how foolish and blind nearly the entire computer industry is when it comes to technology advances. People can't upgrade to a 10GHz processor fast enough, when all they need to do is check their email. Companies are constantly wasting servers and replacing them with newer models. This is not necessary. Today's software is written so poorly that super high-end hardware is needed to make up for lazy/poor programmers. Look at what these ancient systems can do. That "old" PIII or PII or K6 sitting on your desk is a power house. What's the problem? The software you're running on it is likely to be wasting 75% of the CPU cycles it eats.
It's a shame there aren't more developers or at least software architects out there with this guy's talent. We'd all be saving a hell of a lot of money I think. Then again, hardware prices would increase in proportion to its long-term value. Then again, there's a lot of savings in many ways (largely environmental -- less junk being dumped into the wild at the beginning and end of a computer's life cycle). Of course, I wonder if most of the blame goes to businesses just trying to get software out the door as soon as possible without stopping to think about good design (in all senses).
Why bother.
All of the above is included in the self-contained Contiki binary, which is 42 kilobytes large and runs comfortably in 64 kilobytes of memory.
Kernel, GUI, screen saver, TCP/IP stack, web server, telnet client and web browser in 42 KB? Wow... I suppose the TCP/IP stack is based on his uIP code that's around 5 KB large, using 500 bytes of RAM. =) And I like how the GUI is skinnable. =)
Another cool part is of course that I've studied at the same university as him. hehe.. He was rather well-known there as a "decent" programmer. =) You know, those that writes a complex algorithm, compiles it once, and it works.
Beware: In C++, your friends can see your privates!
It's using the cc65 compiler, available here. My TRS-80 CoCo 3 port will use gcc, however, since I took the time to look at some old work done on targeting the 6809 with gcc.
That's not a full web browser, but a standalone HTML viewer that reads HTML pages from a disk and not from the Internet. The HTML viewer is only a small part of a full web browser. A real web browser must do a lot of other stuff as well: HTTP, TCP/IP, DNS lookups, etc. The Contiki web browser seems to do all that, so it is a real web browser and not just an HTML viewer (although an HTML viewer is part of the web browser).