MAC/65

Medium
Cartridge
Year
1982
Publisher
Optimized Systems Software, Inc. (OSS)
Type
Development tool
Category
6502 macro assembler and editor
Developer
Stephen D. Lawrow (assembler/editor); Jim Dunion (DDT debugger)
Language
6502 machine language
Requirements
Atari 400/800/XL/XE; 16K OSS bank-switched cartridge (cartridge v1.00 needs the 400/800 OS) or disk version with DOS XL/OS/A+; disk drive recommended
Yellow OSS package for the MAC/65 cartridge, a lined notepad design reading "Compatible! Flexible! Fast!" above the Optimized Systems Software logo

Overview

MAC/65 was the assembler most serious Atari 8-bit programmers used. Optimized Systems Software (OSS) sold it, and it gave you a line-numbered editor, a two-pass macro assembler and a machine-language debugger in one package. Typing, assembling and testing all happened without leaving the program. It was quick and worked a lot like Atari BASIC, so it became the tool behind countless commercial games, magazine listings and utilities. Mark Chasin's 1984 book Assembly Language Programming for the Atari Computers listed only six assembler packages for the machine, and MAC/65 was one of them.

Behind the scenes

The family tree goes back to Atari's own Assembler Editor cartridge. Its source code passed to OSS, which turned it into the disk-based EASMD (Edit/ASseMble/Debug). The MAC/65 manual calls MAC/65 "a logical upgrade" from EASMD and says its look and feel deliberately follow it. Stephen D. Lawrow conceived and wrote the assembler. OSS noted that MAC/65 was trusted to assemble its own source. The bundled debugger, DDT ("Dunion's Debugging Tool"), was written by Jim Dunion.

The disk versions came first: the programs carry a 1982–83 copyright, and disk releases 2.00 and 4.20 are known. The cartridge followed around 1984 in versions 1.00 (orange label), 1.01 and 1.02 (black). OSS's newsletter called 1.02 the latest commercial version. OSS was later sold, and ACTION!, BASIC XL, BASIC XE and MAC/65 went to Tom Harker's ICD. A disk release of v4.2 from Fine Tooned Engineering also circulated in the 1990s. More recently, source code and builds of later, never-sold versions (MAC/65 3.6, "Mac XE" 3.4i, and an "Assembler 3.4") have been shared. Nobody has yet documented how they differ from the commercial releases.

Features

  • Tokenized source. MAC/65 checks each line's syntax as soon as you press RETURN, the same way Atari BASIC does, and stores it in a compact internal form. That is one reason it assembles so fast.
  • Familiar line format. A line number, then one space before a label or two spaces before an opcode. Labels can be up to 127 characters, all significant.
  • Real expressions. Operators have proper precedence, unlike the Atari cartridge, which just works left to right. < and > give the low and high byte of an address.
  • Macros and conditional assembly (.MACRO/.ENDM, .IF/.ELSE/.ENDIF), plus .INCLUDE for assembling other files from disk. Files to include must be SAVEd MAC/65 files, and an included file cannot include another.
  • Atari-specific directives such as .SBYTE (screen codes), .CBYTE, .FLOAT and .SET 6 (assemble with an address offset). The Rev 1.2 manual also adds 65C02 instructions.
  • Assemble anywhere. Source can come from memory or a disk file. The listing can go to the screen, printer or disk, and the object code to memory or a file, so programs larger than memory can be assembled.

Key editor commands

Command Purpose
ASM [#src],[#list],[#obj],[#xref] Assemble; omitted fields default to memory/screen
ASM ,#- Fastest possible assembly: no listing
SAVE #D:F.M65 / LOAD #D:F.M65 Save/load tokenized source (.M65 by convention)
LIST #D:F.ASM / ENTER #D:F.ASM[,M or ,A] Plain ATASCII text out/in; ,M merges, ,A numbers unnumbered text
NUM, REN, DEL, FIND, REP Auto-number, renumber, delete, search, replace
BLOAD / BSAVE Load or save binary memory blocks
DDT Enter the debugger
? $1200 Hex/decimal conversion (=4608)
DOS (or CP) Exit to DOS

A short example

This prints a line through CIO. Note the two leading spaces on lines that have no label:

10 ICCOM = $0342
20 ICBAL = $0344
30 ICBLL = $0348
40 CIOV = $E456
50  *= $5000
60 START LDX #0 ;IOCB 0 = screen editor
70  LDA #9 ;PUT RECORD
80  STA ICCOM
90  LDA #<MSG
100  STA ICBAL
110  LDA #>MSG
120  STA ICBAL+1
130  LDA #255
140  STA ICBLL
150  LDA #0
160  STA ICBLL+1
170  JSR CIOV
180  RTS
190 MSG .BYTE "HELLO FROM MAC/65",$9B

Type ASM ,,#D:HELLO.OBJ to write a binary file. In Atari DOS 2.x, load it with L and run it at address 5000 with M. If you assemble to memory instead, you need a .OPT OBJ line: MAC/65 deliberately produces no in-memory object code unless you ask, so a mistake can't overwrite DOS or your source.

Technical notes and gotchas

  • Phase errors. A forward reference to a zero-page label (one used before it is defined) causes a PHASE ERROR. The cure is to put zero-page equates at the top of the source. Users have argued for decades over whether this is a bug or a design choice made for speed.
  • Page 6 isn't free. MAC/65 and DDT use $480–$67F as buffers. Magazine routines written for page 6 need care; the manual shows a .SET 6 offset trick for building them elsewhere and moving them.
  • The cartridge reports an error on JSR or JMP to a zero-page address. OSS suggested macros that emit the opcode and address with .BYTE/.WORD instead.
  • The cartridge is a 16K OSS bank-switched design that occupies only 8K ($A000–$BFFF). Cartridge v1.00 needs the 400/800 OS; later versions work on XL/XE machines.

Using it today

Cartridge dumps, the disk versions and the manuals are on AtariMania. Altirra emulates the OSS bank-switching schemes (034M, 043M and M091), so choose the right mapper if a raw ROM image doesn't start. MAC/65 runs happily alongside SpartaDOS X and other modern DOSes. In 2024 David Arlington recorded a MAC/65 programming course on YouTube, which revived interest in the cartridge. If you'd rather edit on a PC, ATasm is a cross-assembler written to be "mostly Mac/65 compatible", and it accepts much existing MAC/65 code after you LIST it to ATASCII text and convert it to ASCII.

Credits