Open source, Open mind.

AtariVM - Atari 800 Virtual Machine

What exactly is this program?

Its a Virtual Machine, NOT a Emulator.. It interprets Atari 800 Assembly Language
with a few extra instructions for modern computers
NO you cannot run Atari 800 ROMS but if you get the assembly source than it can be
This is meant to help you learn how to write a interpreter/virtual machine as well
as teach you the foundations of modern programming languages.

So how did this project get started?
Well its a long story actually, but here goes:

I got a book from my friend a long time ago
it was called  The Atari Assembler by Don Inman and Kurt Inman
It was written in 1981 and explains about the atari 400 and 800 (6502 Instructions)
I wanted to use the language, so I decided to write a interpreter that would
preform the same tasks as the old assembly language..I always have been interested
in compilers / interpreters / assemblers, so I thought writing something like this
would help me Understand. Plus ive always wanted to write a program which interprets a 
older systems way of operating kind of like a emulator.
Through doing this:
Learning the instructions and there opcodes, I began to have a firmer grasp
on my C and C++ programming .. This language is still very basic but i plan on making it
into a full virtual machine.. with special instructions that were not avialable back than
but still keeping the same look and feel of the old assembly language.

What this program contains:

The ability to output debug information in HTML instead of atari machine language
 so you can look at what the
assembly code would be translated to, which mnemoics stand for which machine instructions

The ability to produce debug output into the stdout so you can see what is going
on after the program finishes execution.. like what memory locations it changes..
and the status of the registers and flags

new additions to the language:
Ability to use a Register as a variable on the instructions
Interupt Instruction to have the program be able to preform
special operations via a interupt system call which can point to addresses
of functions written in C.

Why use this program?
To help understand the foundations of current programming languages

Command Line Arguments:

	print debug to the stdout and a html file
	now this mode should only be used if your applications dosent enter graphics mode
	because it prints out to the stdout every instruction and the status of the registers
	if your using a graphics mode application, than use the following 

	this will print the status of the current instruction pointer, and the status
        of the registers to window its running in
	this can be usefull for finding bugs

	the first argument is the name of the script file
	atari-vm script.ats 
        atari-vm script.ats --debug
        atari-vm script.ats --debug=gfx

Section A:

Notes on the language:

 $ stands for Hexadecimal Address
 # stands for decimal constant 
 #$ stands for Hexadecimal Constant

	The Flags

	0 = Negative Result Flag
	1 = Overflow Flag
	2 = Expansion Flag (Not Labeled)
	3 = Break Command Flag
	4 = Decimal Mode Flag
	5 = Intereupt disable flag
	6 = Zero result flag
	7 = Carry Flag


ADC - Add Memory to Accumulator with Carry
AND - And Memory to Accumulator with Carry
ASL - Shift Left One Bit (memory or accumulator)
BCC - Branch if Carry Flag is clear
BCS - Branch if Carry Flag is set
BEQ - Branch on result Zero
BIT - Test bits in accumulator with memory
BMI - Branch on result minus
BNE - Branch if result not zero
BPL - Branch on result plus
BRK - Unconditional break
BVC - Branch on overflow clear
BVS - Branch on overflow set
CLC - Clear Carry Flag
CLD - Clear Decimal Flag
CLI - Clear Interupt Flag
CLV - Clear overflow Flag
CMP - Compare memory and accumulator
CPX - Compare Memory and Register X
CPY - Compare Memory and Reigster Y
DEC - Decrement Memory or accumulator
DEX - Decrement X Register
DEY - Decrement Y Register
EOR - Exculsive Or memory or accumulator
INC - Incrmeent Memory or accumulator
* INT - New Instruction: Interupt  ( See Section B )
INX - Increment register X
INY - Increment register Y
JMP - Unconditonal Jump to Code label or address
JSR - Jump To Subroutine
LDA - Load accumulator with constant or memory
* LDM - New Instruction: Load Memory from at X register with constant string
LDX - Load X register with constant or memory
LDY - Load Y register with constant or memory
LSR - Shift right one bit
NOP - No operation 
ORA - Or accumulator with constant or memory
PHA - Push accumulator onto the stack
PHP - Push proccesscor flags onto the stack
PLA - Pull (pop) accumulator from the stack
PLP - Pull (pop) proccesscor flags from the stack
ROL - Rotate bits one left
ROR - Rotate bits one right
RTI - Return from interupt
RTS - Return from subroutine
SBC - Subtract memory and borrow from accum
SEC - Set carry flag
SED - Set decimal flag
SEI - Set interupt flag
STA - Store accumulator in memory
STX - Store register X in memory
STY - Store register Y in memory
TAX - Transfer accumulator to X register
TAY - Transfer accumulator to Y register
TSX - Transfer stack pointer to Index X
TXA - Transfer register X to accumulator
TYA - Transfer register Y to accumulator

Section B:

New interupts:
The interupt instruction is followed by a constant
to stand for what will be called.. It manipulates the X,Y,A registers
and takes them for information for the specific interupt.

Current Supported New interupts



INT #01 - Print to the Screen

- Registers Effected
X contains the value of where to start to print the data to the stdout
Y register contains the value of where to stop printing the data to the stdout

INT #02 - Read From stdin
- Registers Effected
X contains the value of where to start to store data typed to the stdout
Y contains the value of where the input stops (length of the inputed string)


------ Begin Code Snipit ---------------

*= $1000
 ; simple echo of what the person types
START ; code label
LDX #100 ; load X register with constant (#) value 100
INT $02 ; Interupt (*New*) 0x2 in Hex ($)
INT $01 ; Interupt (*New*) 0x1 in Hex ($)
END ; end code label 


What this code does is Load the Register X with constant variable 0x100
than calls the interupt to 0x02 which asks the user for input
then calls the interupt with value 0x1 which prints to the screen

So how did it know where to stop printing?
the length of the string was stored in the Y register 
and the start was stored in the X register
so when we call INT $01 it automaticly knows where to print 
the data the user typed..


INT #03 - Read a decimal value
- Registers Effected
X contains the value of the variable read in from the stdin

INT #04 - Read a  Hexadecimal value
- Registers Effected
X contains the value of the variable read in from the stdin

INT #$13 - Set the Video Mode
- Registerse Effected
X contains the value of the video mode being successfully set

INT #$14 - Proccess Events
- Registers Effected
X contains 1 if the program is going to end
- Keyboard Input
the keyboard offset is 0xFFFF
so the keys when there pressed are there regular values + 0xFFFF
notice you must use the full hexadecimal value to grap input from the keyboard

INT #$15 - Update Screen
- This will swap the current screen with the buffer stored in memory
so you plot the pixels, than swap the data in memory to the data in video memory

INT #$16 - Plot a Pixel
- Registers Effected 
X contains the value of the X cordinate of the screen
Y contains the value of the Y cordinate of the screen
A contains the value of the pixel to be set

Notice were working in 8 bit mode since the accumulator is 1 byte 
So $FF is white and $00 is black

INT #$17 - Fill Accumulator with Random value
A Contains a random number 0x0 - 0xFF

INT #$18 - FIll accumulator with random value range
X contains start of random value range
Y contains end of random value range

INT #$19 - Test key value from Register Y and put state in Register X
X contains the value of whether the key is pressed
Y contains the key to test

INT #$056 - Print String to Video Buffer
Use the special Instruction LDM  with a string (allows backslash escape character sequence)

LDA #100
LDM "Test\n"

will load Test\n into Memory location 100 (decimal)
and store the end point of the memory in register Y

$56 has special memory locations that you should be aware of
and $FFE14 contain the X,Y cordinate for printing of the screen
how to use:
; ------------------------ begin code snipit ------------------------------
LDA #$0
LDM "Score:  \n"
STA $1FE11
STY $1FE12
INT #$13
LDA #$25
LDA #255
LDA #0
STA $1299
LDA $1FE11
LDY $1FE12
INT #$56
LDA #270
LDX #55
LDY #0
INT #$58
INT #$15
; test if escape key was pressed
LDY #$1B
INT #$19
CPY #0

; test for now

; fill the screen with black
LDX #0
INT #$57

JMP GAME ; loop back up to the start of the game loop

; draw rectangle subroutine

DRAWRECT ; takes X,Y, and accumulator 
; ------------------------------------------------------------------
ADC #5
INT #$16
ADC #16
ADC #32

; draw of the screen subroutine

INT #$14
LDX #5
LDY #5

ADC #36
CMP #0
LDX #5
ADC #20
CMP #0

; Add to Score subroutine
ADC #1

; ---------------------------- end code snipit

INT #$057 - System callback
X contains the Address of the callback

 - Address #$0 is fill screen with black (fast)

- more to be implemented soon or you can add your own callbacks

INT #$058 - Print Decimal Value to the string
X contains the screen X cordinate 
Y contains the screen Y cordinate
Accumulator contains the value
Memory location: $FFE15 contains the color

Section C:
-- Tutorial on the Language 

Okay so why would we want to learn a very old assembly langauge?
To better understand the roots of current programming languages:

First thing you need to learn about the VM's registers and what they do..
There are 3 general purpose registers, X,Y,and A (Accumulator)
There is also a special register called the flags register which contains
information that the instructions act on.. For example

LDA #0

In the above statements first we use the LDA mnemoic (or Load Acumulator instruction)
and give it the operand of $0001 hex or 1 Decimal 
Then we set a code label and name it loop . than we ADC ( Add with carry to acumulator )
with the operand of $0001 hex or 1 decimal
Now heres the important instruction
CMP $#FF compare the value FF with the value in the acumulator and set bit 0 of 
the flags register with ethier 1 or 0 depending on the result of the compare

Most of the instructions explain themselves...

But heres some examples anyway: They can be found in the demo scripts folder..
Im workin on MasterPiece in the Atari Assembly Language, ill release it soon as i finish

Notes for PSP
name your font term.mxf (use a MasterX Font)
name your script default.ats
place default.ats in the same folder as EBOOT.PBP
load the game as normal
Download AtariVM DeveloperKit
Download AtariVM for Windows

Like this page


All The software on this site is free and Licensed under the GPL
Please Feel Free to Redistribute (As a Free Download) any of the software on this page.


Loading search widget...

Updates View All

UPDATE @ Wed Jun 14 09:04:55 PDT 2017
Added new version of Acid Cam v2.1.9. New filters/menu design. Download.

UPDATE @ Sun May 14 09:59:54 PDT 2017
Acid Cam for macOS supports 4K resolution so added a sample in 4K on YouTube. Acid Cam v2 Qt is now supported on Raspberry Pi 3/Raspbian.

UPDATE @ Sun Jan 8 10:58:07 PST 2017
Added new version of Acid Cam (v2.1.1) and a few new blog posts. Be sure to check out my GitHub page.

UPDATE @ Thu Dec 15 16:42:56 PST 2016
Updated bug report page with current projects on GitHub. Been working on Acid Cam v2.1.0 and adding new videos to the YouTube channel.

UPDATE @ Sun Jun 19 00:37:30 PDT 2016
Added XChip project to the blog I helped work on with my friend on GitHub.

UPDATE @ Thu Apr 7 11:56:17 PDT 2016
Added new version of Acid Cam for MacOS X.

UPDATE @ Wed Apr 6 08:52:07 PDT 2016
You can now download Acid Cam from Google Play.

UPDATE @ Fri Apr 1 09:59:08 PDT 2016
Finally signed up for twitter you can follow me here.

UPDATE @ Wed Oct 28 10:45:42 PDT 2015
This site now has a BitTorrent Tracker so I can share larger files.

UPDATE @ Sat Sep 12 04:07:24 PDT 2015
Added fixed versions of Super Stoner 420 and Apps collection that fix the issues with the software when running on MacOS X Yosemite.

UPDATE @ Mon Jun 15 15:35:52 PDT 2015
Spent a long time trying to figure out why OpenCV would not compile on Yosemite. Figured it out and statically linked Acid Cam VR 1.1 with the libraries so you no longer need the MacPorts version of OpenCV installed to /opt/local for it work. It should work as long as you have the Oculus Runtime.

UPDATE @ Sat Jun 6 16:11:40 PDT 2015
Added Acid Cam VR for Oculus Rift DK2 to the site with a version for Windows and MacOS X.

UPDATE @ Sun May 17 14:39:14 PDT 2015
It seems the first version of Acid Cam (1.7.7) is incompatible with MacOS X Yosemite for some reason. So if you using Yosemite just pick up version 2 of the program.

UPDATE @ Tue May 12 14:48:53 PDT 2015
Bad news, seems apple deprecated and now dropped support for one of the libraries that SDL 1.2 that I used to compile the majority of the games on this site. So that means I have to recompile and repackage the majority of these programs to get them to work on Yosemite. So the last version supported was 10.9.

UPDATE @ Fri May 8 10:30:56 PDT 2015
Added our first program for the Oculus 2. It requires that you at least have have the Oculus 2 Runtime.

UPDATE @ Wed Feb 11 11:24:23 PST 2015
Added a few new posts to my blog and have been adding new examples to my C++11 Repository

UPDATE @ Sat Dec 13 17:27:03 PST 2014
Added up to date version of Acid Cam 2 for Microsoft Windows.

UPDATE @ Wed Dec 10 11:12:16 PST 2014
The Site has been redesigned and its looking great. Thanks to my friend Daniel Daley who designed the page.

UPDATE @ Thu Oct 9 11:12:06 PDT 2014
Added a image file with the different LostSideDead graphics programs I have created. AlphaFlame HD Launcher needs to be copied to /Applications .

UPDATE @ Thu Oct 2 17:32:12 PDT 2014
Added a new version of Acid Cam v2.0.17 for Ubuntu Linux

UPDATE @ Fri Sep 19 15:19:11 PDT 2014
Made this music video with Alpha Flame HD quite a while ago, check it out!

UPDATE @ Fri Sep 12 14:56:55 PDT 2014
Added a compressed Archive containing the source code for Acid Cam 2 to the site.

UPDATE @ Thu Sep 11 14:51:50 PDT 2014
Added a video demonstration of Acid Cam for iPhone.

UPDATE @ Fri Aug 29 12:20:41 PDT 2014
Updated Acid Cam to version 2.0.16. Added all the filters from AF_Filter and you can now jump to any frame when processing a video.

Follow Me

Facebook Youtube Google Plus