Action! (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
This article is about the programming language. For other uses, see Action! (disambiguation).
Action!
Action! screen shot
Developer: Optimized Systems Software
Latest Release: 3.6
Release date: 1983
Platform: Atari 400/800/XL/XE
Genre: Programming Language
Media: cartridge
License: Copyright © 1994 Fine Tooned Engineering

Action! is a programming language, with integrated editor, debugger, and 6502 compiler, for the Atari 8-bit family of microcomputers. Action! was created by Clinton Parker and released on cartridge by Optimized Systems Software in 1983. Its syntax is similar to that of ALGOL 68.

Action! is significant for its high performance, which allows games and graphics demos to be written in a high-level language without use of hand-written assembly language code. Action! language constructs were designed to map cleanly to 6502 opcodes.

A development library was available as a separate product called the Action! Toolkit. Action! was used to develop at least two commercial products: the Homepak productivity suite and Games Computers Play client program. The language was never ported to other systems.

In 2007 it inspired Effectus - a cross-compiler currently running on Windows and Linux targeting the Atari 8-bit. Effectus resembles Action! syntax and is intended to be as compatible as possible with it.

Data Types[edit]

Action! has three fundamental data types, all of which are numeric.

BYTE[edit]

Internally represented as an unsigned 8-bit integer. Values range from 0 to 255.
The CHAR keyword can also be used to declare BYTE variables.

 BYTE age=[21]      ; declare age and initialize it to the value 21
 BYTE leftMargin=82 ; declare leftMargin and store it at address 82

CARDinal[edit]

Internally represented as an unsigned 16-bit integer. Values range from 0 to 65,535.

 CARD population=$600             ; declare population and store it at address 1536 and 1537
 CARD prevYear, curYear, nextYear ; use commas to declare multiple variables

INTeger[edit]

Internally represented as a signed 16-bit integer. Values range from -32,768 to 32,767.

 INT veryCold = [-10]
 INT profitsQ1, profitsQ2,  ; declaring multiple variables can 
     profitsQ3, profitsQ4   ; span across multiple lines

Action! also has ARRAYs, POINTERs and user-defined TYPEs. No floating point support was provided.

An example of a user-defined TYPE:

 TYPE CORD=[CARD x,y]
 CORD point
 point.x=42
 point.y=23

Keywords[edit]

A "keyword" is any word or symbol that the ACTION! compiler recognizes as something special. It can be an operator, a data type name, a statement, or a compiler directive.

 AND       FI         OR         UNTIL    =     (
 ARRAY     FOR        POINTER    WHILE    <>    )
 BYTE      FUNC       PROC       XOR      #     .
 CARD      IF         RETURN     +        >     [
 CHAR      INCLUDE    RSH        -        >=    ]
 DEFINE    INT        SET        *        <     "
 DO        LSH        STEP       /        <=    '
 ELSE      MOD        THEN       &        $     ;
 ELSEIF    MODULE     TO         %        ^
 EXIT      OD         TYPE       !        @

Programming[edit]

Programming in Action! requires working with the editor and compiling/debugging in the monitor. The editor features a full-screen, scrolling display capable of displaying two windows. The editor also includes block operations and global search and replace. Compiling takes place in the monitor, a mode that allows compiling and debugging.

Action! is a one-pass compiler, which compiles the source code entirely in memory or from a file.[1] This allows great speed, but limits the amount of code that may be compiled.

Local variables are assigned fixed addresses in memory, instead of being allocated on the stack. This enables tight code to be generated for the 6502, but precludes the use of recursion.

Example code[edit]

The following is example code for Sieve of Eratosthenes written in Action!. In order to increase performance, it disables the ANTIC graphics co-processor, preventing its DMA engine from "stealing" CPU cycles during computation.

BYTE RTCLOK=20, ; addr of sys timer
     SDMCTL=559 ; DMA control

BYTE ARRAY FLAGS(8190)

CARD COUNT,I,K,PRIME,TIME

PROC SIEVE()

  SDMCTL=0 ; shut off Antic
  RTCLOK=0 ; only one timer needed

  COUNT=0         ; init count
  FOR I=0 TO 8190 ; and flags
    DO
    FLAGS(I)='T ; "'T" is a compiler-provided constant for True
    OD

  FOR I=0 TO 8190 ; and flags
    DO
    IF FLAGS(I)='T THEN
      PRIME=I+I+3
      K=I+PRIME
      WHILE K<=8190
        DO
        FLAGS(K)='F ; "'F" is a compiler-provided constant for False
        K==+PRIME
        OD
      COUNT==+1
    FI
    OD
  TIME=RTCLOK ; get timer reading
  SDMCTL=34   ; restore screen

  PRINTF("%E %U PRIMES IN",COUNT)
  PRINTF("%E %U JIFFIES",TIME)
RETURN

See also[edit]

References[edit]

External links[edit]