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
Open Source Management System for Botanic Garden Collections.

BotGard 3.0 Open Source Management System for Botanic Garden Collections built and maintained by netzkolchose.de in cooperation with the Botanical Gar

netzkolchose.de 1 Dec 15, 2021
A PDM plugin to publish to PyPI

PDM Publish A PDM plugin to publish to PyPI NOTE: Consider if you need this over using twine directly Installation If you installed pdm via pipx: pipx

Branch Vincent 20 Aug 06, 2022
Python library to decode the EU Covid-19 vaccine certificate

DCC Utils Python library to decode the EU Covid-19 vaccine certificate, as specified by the EU. Setup pip install dcc-utils Make sure zbar is installe

Developers Italia 13 Mar 11, 2022
A frontend to ease the use of pulseaudio's routing capabilities, mimicking voicemeeter's workflow

Pulsemeeter A frontend to ease the use of pulseaudio's routing capabilities, mimicking voicemeeter's workflow Features Create virtual inputs and outpu

Gabriel Carneiro 164 Jan 04, 2023
Tool to generate wrappers for Linux libraries allowing for dlopen()ing them without writing any boilerplate

Dynload wrapper This program will generate a wrapper to make it easy to dlopen() shared objects on Linux without writing a ton of boilerplate code. Th

Hein-Pieter van Braam 25 Oct 24, 2022
Render to print for blender 2.9+

render_to_print_blender_addon ** render2print: Blender AddOn for Blender 2.90.0+ ** Calculates camera parameters to allow printing a rendered image to

5 Nov 19, 2021
Blender Add-on That Provides Quick Access to Render Controls

Blender Render Buttons Blender Add-on That Provides Quick Access to Render Controls A Blender 3.0 compatablity update of Blender2.8x-RenderButton v0.0

Don Schnitzius 3 Oct 18, 2022
sfgp is a package that aggregates individual scripts and notebooks, primarily written for the basic analysis tasks of genetics and pharmacogenomics data.

sfgp is a package that aggregates individual scripts and notebooks, primarily written for the basic analysis tasks of genetics and pharmacogenomics data.

Vishal Sarsani 1 Mar 31, 2022
tg-nearby Trilateration of nearby Telegram users as described in my corresponding article.

tg-nearby Trilateration of nearby Telegram users as described in my corresponding article. Setup If you want to toy with the code in this repository

Maximilian Jugl 75 Dec 26, 2022
A modern message based async agent framework

Munggoggo A modern message based async agent framework An asyncio based agent platform written in Python and based on RabbitMQ. Agents are isolated pr

24 Dec 28, 2022
jmespath.rs Python binding

rjmespath-py jmespath.rs Python binding.

messense 3 Dec 14, 2022
Solve various integral equations using numerical methods in Python

Solve Volterra and Fredholm integral equations This Python package estimates Volterra and Fredholm integral equations using known techniques. Installa

Matthew Wildrick Thomas 18 Nov 28, 2022
Машинное обучение на ФКН ВШЭ

Курс "Машинное обучение" на ФКН ВШЭ Конспекты лекций, материалы семинаров и домашние задания (теоретические, практические, соревнования) по курсу "Маш

Evgeny Sokolov 2.2k Jan 04, 2023
Beacon Object File (BOF) to obtain a usable TGT for the current user.

Beacon Object File (BOF) to obtain a usable TGT for the current user.

Connor McGarr 109 Dec 25, 2022
ROS Foxy + Raspi + Adafruit BNO055

ROS Foxy + Raspi + Adafruit BNO055

Ar-Ray 3 Nov 04, 2022
Fonts used to be an install-and-forget thing, but many of are now updated regularly.

Your font manager. Fonts used to be an install-and-forget thing, but many of are now updated regularly. fontman helps you keep track of the fonts you

Nico Schlömer 20 Feb 07, 2022
A Python application that helps users determine their calorie intake, and automatically generates customized weekly meal and workout plans based on metrics computed using their physical parameters

A Python application that helps users determine their calorie intake, and automatically generates customized weekly meal and workout plans based on metrics computed using their physical parameters

Anam Iqbal 1 Jan 13, 2022
Agora-token-helper - Some help tools for AgoraToken

Agora Token Helper Support AgoraToken version 001 - 006. But for security reason

All you need to understand CRUD and MVP in DRF

Book-Store-API This an API which has been put in place just to make you order for books, upload books with price, image and all, pay and automtically

Oladipo Adesiyan 6 Jul 03, 2022
My Analysis of the VC4 Assembly Code from the RPI4

My Analysis of the VC4 Assembly Code from the RPI4

Nicholas Starke 31 Jul 13, 2022