Commodore 64 OS running on Atari 8-bit hardware

Overview

Atari 64

This is the Commodre 64 KERNAL, modified to run on the Atari 8-bit line of computers. They're practically the same machine; why didn't someone try this 30 years ago?

HOW TO BUILD

Working XEX file and ROM image can be downloaded at the release page: https://github.com/unbibium/atari64/releases

You will need bash, dasm, and Python 3.

You can get dasm at https://github.com/dasm-assembler/dasm/

Run ./build.sh and it should do everything.

WHAT YOU GET

  • rom.a000 an 8K BASIC ROM
  • rom.d800 a 10K ROM containing PETSCII font and OS
  • atari64.xex an executable that you can load into an 800XL. It will copy itself behind the ROM and run from RAM. I patched the RAMTAS section so it doesn't think the BASIC area is free for BASIC programs.

HOW TO RUN

To run it in the emulator as if you'd taken an Atari 800's ROMs and swapped them out with these:

  • atari800 -config atari64.cfg You can extrapolate this to decide how to run it on real hardware.

The atari64.xex should run from any DOS or boot loader.

WHAT IT DOES

The keyboard, the PETSCII screen editor, and BASIC work.

Use the BREAK key to stop a running BASIC program. you'll note it doesn't work while an INPUT statement is running. I'll get the RESET button working real soon.

The Atari logo key will type the pi character.

Shift-Atari logo will switch between uppercase-graphics and lowercase-uppercase character set.

Hold the OPTION, SELECT, or START key to type the graphics characters you'd ordinarily type with the Commodore logo key.

If a lot of text is scrolling by, you can hold the OPTION key to slow down the scrolling, like you would hold down CTRL on a real C64.

Known issues:

  • if the C64 OS is in RAM, RESET reboots the original Atari OS. Supposedly the old Translator disk got around this somehow.
  • no way yet to save or load BASIC programs
  • there's no I/O at all actually
  • PETSCII color will never work.

WHY

Recently the 8-Bit Guy did a video about the Apple 1 computer, and how you can simulate an Apple 1 with a Commodore 64 program that just reproduces the terminal I/O and runs the programs natively. It got me thinking, why couldn't I do the same thing with two other machines? The Atari 800XL and Commodore 64 have such similar memory maps and ROM switching capabilities that it seemed my best bet was to try to compile the CBM KERNAL on the Atari 800XL and see how much I could get to work.

i wonder if I've hit the wall or if some mad genius will figure out how to wire a real Datasette in there and run actual PET programs.

HOW

I used mist64's cbmsrc project as a starting point. The first thing I had to do was reformat the C64 KERNAL and BASIC's source code so that it would compile in DASM. I wrote a python script for that, but still had to manually add segment definitions and such, so that it would compile neatly.

Next, I had to make sure I could actually run these ROMs at all on an Atari emulator. The 8K BASIC ROM was straightforward enough, and the original Atari 800 used 10K of ROM. I used the extra 2K for the chargen ROM, which only needs half the space because it doesn't include the reverse characters. I worked out how to configure atari800 to run it -- if I got a black screen, I'd press F8 and look around in the monitor to make sure everything was there.

Next I rewrote the code that set up the screen and I/O. I'd add declarations to kernal/declare as I went. I hard-coded an ANTIC display list in ROM to point to where the C64 usually draws the screen at $0400. I'd rewrite the screen initialization code to set up ANTIC and GTIA to point to that display list. Once I got that working, I found it was already displaying the C64 BASIC V2 splash screen. The cursor wasn't blinking, and of course the keyboard didn't work, but I could feed PETSCII characters into the keyboard buffer through the monitor, and I tested a few BASIC commands that way.

Getting the cursor to blink was my next task. I looked at all the Atari documentation I could find to figure out how the vertical blank interrupt worked. I was setting the right flags, but nothing worked, until I realized that the vertical blank is an NMI in the Atari. On the Commodore it's an IRQ. So I switched the addresses at $FFFA and $FFFE, and that got me much closer.

I rewrote the keyboard scan routine to handle the Atari keyboard, and removed most of the color code from the screen editor.

I also had to modify BASIC's RND(0) function to draw from the POKEY instead of the CIA chips. The lack of a CIA/POKEY equivalent on the DCPU-16 is probably why I had to use RND(1) in my demo video instead.

Currently, there's no I/O outside of the screen and keyboard whatsoever. It'll take more expertise than I have to figure out any possible way of saving and loading programs. Even describing the obstacles is a bit out of my league at this point.

I might tear out all the rs232 code to make room for other people to attempt stuff, even though the 800XL has a larger ROM space to work in already. I'll leave the tape code in just because I have a hunch that isn't a total lost cause yet, but it's only a hunch.

ACKNOWLEDGEMENTS

You might also like...
Easy installer for running Amazon AVS Device SDK on Raspberry Pi

avs-device-sdk-pi Scripts to enable Alexa voice activation using Picovoice Porcupine If you like the work, find it useful and if you would like to get

Tool for running a high throughput data ingestion/transformation workload with MongoDB

Mongo Mangler The mongo-mangler tool is a lightweight Python utility, which you can run from a low-powered machine to execute a high throughput data i

Running a complete single-node all-in-one cluster instance of TIBCO ActiveMatrix™ BusinessWorks 6.8.0.

TIBCO ActiveMatrix™ BusinessWorks 6.8 Docker Image Image for running a complete single-node all-in-one cluster instance of TIBCO ActiveMatrix™ Busines

SQL centered, docker process running game

REQUIREMENTS Linux Docker Python/bash set up image "docker build -t game ." create db container "run my_whatever/game_docker/pdb create" # creating po

Various programs in Atari BASIC for #FujiNet for Atari 8-bit
Various programs in Atari BASIC for #FujiNet for Atari 8-bit

FujiNet Various programs in Atari BASIC for #FujiNet for Atari 8-bit FujiNet-3D Tic Tac Toe In 1978, Scott Adams wrote a 3-D Tic Tac Toe game, for pla

Accurately dump Commodore 64 tapes
Accurately dump Commodore 64 tapes

TrueTape64 A cheap, easy to build adapter to interface a Commodore 1530 (C2N) Datasette to your PC to dump and preserve your aging Commodore 64 softwa

Python Commodore BBS multi-client

python-cbm-bbs-petscii Python Commodore BBS multi-client This is intended for commodore 64, c128 and most commodore compatible machines (as the new Co

SystemSix is an e-Ink
SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather

SystemSix is an e-Ink "desk accessory" running on a Raspberry Pi. It is a bit of nostalgia that can function as a calendar, display the weather, the c

A3C LSTM  Atari with Pytorch plus A3G design
A3C LSTM Atari with Pytorch plus A3G design

NEWLY ADDED A3G A NEW GPU/CPU ARCHITECTURE OF A3C FOR SUBSTANTIALLY ACCELERATED TRAINING!! RL A3C Pytorch NEWLY ADDED A3G!! New implementation of A3C

An environment to run atari-like games in VGDL.
An environment to run atari-like games in VGDL.

vgdl An environment to run atari-like games in VGDL. Requirements python = 3.6 Installation pip install -r requirements.txt Usage # Create an enviro

a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself.
a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself.

Handy Project a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself. the handy pro

ActNN: Reducing Training Memory Footprint via 2-Bit Activation Compressed Training
ActNN: Reducing Training Memory Footprint via 2-Bit Activation Compressed Training

ActNN : Activation Compressed Training This is the official project repository for ActNN: Reducing Training Memory Footprint via 2-Bit Activation Comp

S2-BNN: Bridging the Gap Between Self-Supervised Real and 1-bit Neural Networks via Guided Distribution Calibration (CVPR 2021)
S2-BNN: Bridging the Gap Between Self-Supervised Real and 1-bit Neural Networks via Guided Distribution Calibration (CVPR 2021)

S2-BNN (Self-supervised Binary Neural Networks Using Distillation Loss) This is the official pytorch implementation of our paper: "S2-BNN: Bridging th

PyTorch implementation of Wide Residual Networks with 1-bit weights by McDonnell (ICLR 2018)
PyTorch implementation of Wide Residual Networks with 1-bit weights by McDonnell (ICLR 2018)

1-bit Wide ResNet PyTorch implementation of training 1-bit Wide ResNets from this paper: Training wide residual networks for deployment using a single

QTool: A Low-bit Quantization Toolbox for Deep Neural Networks in Computer Vision

This project provides abundant choices of quantization strategies (such as the quantization algorithms, training schedules and empirical tricks) for quantizing the deep neural networks into low-bit counterparts.

Implementation of accepted AAAI 2021 paper: Deep Unsupervised Image Hashing by Maximizing Bit Entropy
Implementation of accepted AAAI 2021 paper: Deep Unsupervised Image Hashing by Maximizing Bit Entropy

Deep Unsupervised Image Hashing by Maximizing Bit Entropy This is the PyTorch implementation of accepted AAAI 2021 paper: Deep Unsupervised Image Hash

Bit is Python's fastest Bitcoin library and was designed from the beginning to feel intuitive, be effortless to use, and have readable source code.

Bit is Python's fastest Bitcoin library and was designed from the beginning to feel intuitive, be effortless to use, and have readable source code.

Comments
  • Changing color does not work

    Changing color does not work

    Hello, great work!

    I have found a bug: Changing colors does not work.

    Like: PRINT "{RED}Hello World does not change the cursor color.

    Also, poking 646,X does not change the color, but I expected that.

    bug 
    opened by mczero80 1
  • Allow SAVE/LOAD to disk

    Allow SAVE/LOAD to disk

    CBM disk drives took responsibility for the filesystem. Reading and writing files were simple serial transactions between the computer and the drive. This is why you could turn on the machine and just type LOAD"*",8,1 and it would load the first file on disk.

    Atari disk drives had a microprocessor, but it was limited to reading and writing by sector. Atari computers had disk routines, but they were limited to reading the first few sectors from disk and loading enough code to boot the rest of the disk. To access a filesystem, a DOS had to be loaded into memory. There were multiple filesystems, and not all were compatible with each other.

    With these two competing paradigms in play, designing a way to save to disk is going to be difficult.

    Options as I see them:

    • create some serial adapter to connect real CBM disk drives, and adapt CBM's I/O directly
    • adapt Atari's sector-based I/O protocol, AND write a filesystem around it, to use Atari disk drives.
    enhancement help wanted 
    opened by unbibium 1
  • Allow SAVE/LOAD to tape

    Allow SAVE/LOAD to tape

    The advantage of saving or loading to a tape or audio device, is that you don't have to worry about filesystems.

    The disadvantage is that it won't be fast, and not a lot of people in retro computing still have working tape drives.

    Implementation options:

    • Build a Datasette adapter to some Atari port, and adapt CBM's tape code directly to use it.
    • Adapt CBM's tape code to work with Atari Program Recorders.
    • Adapt Atari's tape code.

    I can't do it myself; I don't have a working tape drive for either system at the moment.

    enhancement help wanted 
    opened by unbibium 2
  • BREAK key does not work

    BREAK key does not work

    ``At least using Altirra emulator, haven't tested on a real machine. It does not break the execution.

    There was no INPUT routine running when I tested it. Just something like 10 PRINT"HELLO World" and 20 GOTO 10.

    bug 
    opened by mczero80 1
Releases(v0.9.1)
  • v0.9.1(Aug 13, 2021)

    While I've left in most of the I/O in case some mad scientist decides to turn the joystick ports into a Datasette or IEC interface, I don't think the RS-232 routines are worth keeping around. The Commodore 64's built-in RS-232 code could barely keep up with 1200 baud.

    this copy of atari64.xex was compiled with the HELPRESET flag, so you can use the HELP key as a RESET key, until I figure out how to trap that key properly in a RAM OS. The roms are compiled without this option. This process isn't automatic in the build script.

    Source code(tar.gz)
    Source code(zip)
    atari64.xex(18.09 KB)
    rom.a000(8.00 KB)
    rom.d800(10.00 KB)
  • 0.9(Aug 11, 2021)

Owner
Nick Bensema
Nick Bensema
a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself.

Handy Project a bit of my project :) and I use some of them for my school lesson or study for an exam! but some of them just for myself. the handy pro

amirkasra esmaeilian 13 Jul 5, 2021
Generate your personal 8-bit avatars using Cellular Automata, a mathematical model that simulates life, survival, and extinction

Try the interactive demo here ✨ ✨ Sprites-as-a-Service is an open-source web application that allows you to generate custom 8-bit sprites using Cellul

Lj Miranda 265 Dec 26, 2022
Apache Superset out of box version(Windows 64-bit)

superset_app Apache Superset out of box version (Windows 64bit) prepare job download 3 files python-3.8.10-embed-amd64.zip get-pip.py python_geohash‑0

Steven Lee 9 Oct 2, 2022
Tethered downgrade 64-bit iDevices vulnerable to checkm8

ra1nstorm Tethered downgrade 64-bit iDevices vulnerable to checkm8 Since the purpose of this tool is to tethered downgrade a device, after restoring p

mini_exploit 65 Nov 8, 2022
Update your Nintendo Switch cheats with one click, or a bit more~

Interactive-ASM-Cheats-Updater This updater unlocks your ability of updating most of the ASM cheats for Nintendo Switch. Table of Contents Functions Q

zzpong 63 Dec 27, 2022
Craxk is a SINGLE AND NON-REPLICABLE Hash that uses data from the hardware where it is executed to form a hash that can only be reproduced by a single machine.

What is Craxk ? Craxk is a UNIQUE AND NON-REPLICABLE Hash that uses data from the hardware where it is executed to form a hash that can only be reprod

null 5 Jun 19, 2021
A C-like hardware description language (HDL) adding high level synthesis(HLS)-like automatic pipelining as a language construct/compiler feature.

██████╗ ██╗██████╗ ███████╗██╗ ██╗███╗ ██╗███████╗ ██████╗ ██╔══██╗██║██╔══██╗██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝ ██████╔╝██║██████╔╝█

Julian Kemmerer 391 Jan 1, 2023
Airflow Operator for running Soda SQL scans

Airflow Operator for running Soda SQL scans

Todd de Quincey 7 Oct 18, 2022
tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel

tox-gh is a tox plugin which helps running tox on GitHub Actions with multiple different Python versions on multiple workers in parallel. This project is inspired by tox-travis.

tox development team 19 Dec 26, 2022
Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators

Cirq is a Python library for writing, manipulating, and optimizing quantum circuits and running them against quantum computers and simulators. Install

quantumlib 3.6k Jan 7, 2023