In the mid eighties a new language popped up for the Atari 8 bits. It was called “Action!“. I got it after some friends got it. It was only available on a bank switching cartridge, meaning there was more too it than would fit in memory while still allowing you to do anything useful; so parts of it got swapped out of memory to make room for other parts that need to run.
Until Action! came along I had mainly been using BASIC with very minor dabbling in Assembly. Assembly was elusive, horribly complex, and fraught with dis-appointment as I couldn’t do the one thing I really wanted to do – simply print some text on the screen. But I’ve talked about all that in my 6502 blog entries where I actually learned 6502 Assembly. So in reality, Action! was my introduction to structured programming on the 8 bit. My first introduction to structure programming was in high school using Pascal on a DEC multi-user system (MicroVAX I believe, but don’t recall if it was I or II).
After some time I was able to write programs in Action!. However it came late enough in time that I was entering college and would move on to C. The concepts I learned in Action! would greatly ease my transition to C.
In the late 90’s and again in the early 2000’s I would pick up Action! and start writing different things, but my goals were always too ambitious and I would end up losing interest due to complexity and hitting road blocks due to gaps in my knowledge from a) the language perspective; and b) the Atari hardware perspective. At these times the knowledge had slowly tricked out.
So here I am again wanting to learn Action! While I didn’t learn Assembly as well as I had set out, I did learn enough to satisfy myself. I may re-approach it later to further advance my knowledge, but for now I want to re-focus on Action!.
First I refreshed my knowledge of Action! data types.
There are 3 basic types:
- Byte (Char): 8 bit value. Possible values ranging from 0 to 255. As the name suggest it takes one byte of memory.
- Card: 16 bit value. Possible values ranging from 0 to 65535. This is stored in 2 bytes of memory with the least significant byte (LSB) first, followed by the most significant bit (MSB).
- Int: 15 bit value (signed). Possible values from -32768 to 32767. This is stored in 2 bytes of memory (signed) in the LSB,MSB format.
These type can also be created in ARRAYs.
Next I refreshed my knowledge of Action! variable declaration and initialization. Here are 3 basic forms:
- byte x,y : This declares 2 variables (x and y) of type BYTE. Their values are not initialized.
- int n= : This declares 1 variable (n) of type INT. It’s value is initialized to 10.
- card x=$8000 : This declares 1 variable (x) of type CARD. Its value is set to that of memory location $8000. Think of this as a pointer to that memory location.
I’m not going to cover the operands completely because they are so similar to other languages. I will cover some syntax shortcuts though.
If you want to increment a variable (x) by one, the construct
x = x + 1
works in most languages. It will work in Action! as well, but as with C and many other languages, there are ways to write this more efficiently. In Action! you can use the construct:
x == +1
Shortcuts for subtraction, etc are similar.
The editor is where you are when you first start Action!. It is helpful to learn at least the following two commands for loading and saving your files:
- Load is actually Read and is invoked with CTRL-SHFT-R. The status line at the bottom will then ask for the filename to read.
- Save is actually Write and is invoked with CTRL-SHFT-W. The status line at the bottom will then ask for the filename to write.
In addition, you will need to know how to get into the Monitor so you can compile and run. From the editor use CTRL-SHFT-M to access the Action! Monitor. From the Monitor, use “E” to return to the Editor.
With some of the basics covered, I want to print something to the screen. This is done using the one of the print functions. There are 5 different ways to use print. Two are detailed here, I’ll cover the others when they become relevant.
Print(“text”) : This outputs on the screen the text passed to it.
PrintE(“text”) : This outputs on the screen the text passed to it and follows it with a EOL (carriage return).
In the sample below I’m assigning line numbers, though Action! does not use them:
1: printe("Unfinished Bitness") 2: printe("") 3: print("Hello ") 4: printe("Action!")
- Line 1: Outputs to the screen, with a carriage return, the text “Unfinished Bitness”.
- Line 2: Outputs to the screen, only a carriage return.
- Line 3: Outputs to the screen, without a carriage return, the text “Hello “.
- Line 4: Outputs to the screen, with a carriage return, the text “Action!”.
To run a program in Action!, it must first be compiled. From the editor you use CTRL-SHFT-M to get to the monitor. Then use “C” to compile. Once compiled, use “R” to run it.
Next time I’ll discuss Action! PROCedures and FUNCtions.
Sets x to the value of $8000 and $8001 since the type is CARD. 🙂
(And I’m getting back into it after a long time away.)
Yes, thanks for the clarification. My original text was BYTE but I changed it for diversity.