ATasm

Year
1999
Publisher
Open source (GPL)
Type
Development tool
Category
MAC/65-compatible 6502 cross-assembler
Developer
Mark Schmelzenbach
Language
C (portable; builds with GCC on Windows, Linux, macOS)
Requirements
PC running Windows, Linux or macOS; produces Atari binary-load files, ATR/XFD images or raw binaries
Atari text screen showing the line HELLO FROM ATASM

Overview

ATasm is a 6502 cross-assembler for people who grew up on OSS's MAC/65. It runs from the command line on a PC, reads ordinary text files, and assembles them "with lightning speed", in its author's words, into Atari binary-load files. It keeps the MAC/65 directives, macro syntax and Atari-specific extras that generic 6502 assemblers lack, so decades-old MAC/65 sources and macro libraries usually assemble with little or no change. It can also write the result straight into an ATR/XFD disk image or an emulator snapshot.

History

Mark Schmelzenbach wrote ATasm for himself. Coming back to the Atari through emulators, he missed his favourite assembler, the MAC/65 cartridge. His cartridge and his 130XE were 900 miles away, and the FTe disk release of MAC/65 (v4.2) was "not nearly as nice". He tried the UMich as6502 and André Fachat's XA, but neither had the Atari-specific directives he relied on, so he wrote his own. Version 0.90 was the first public release, on 1 January 1999. Later releases show what users needed:

  • 0.91–0.92 (Jan 1999): .XFD disk-image output and undocumented opcodes (-u)
  • 0.94: mimics MAC/65's mapping of LDA/STA zp,Y to absolute,Y
  • 1.00 (2002): released explicitly under the GPL
  • 1.01–1.02: raw binary output, include paths and command-line defines (contributed by B. Watson)
  • 1.04 (2003): extra passes to avoid the "dreaded PHASE ERROR" that MAC/65 users know well
  • 1.05: .BANK and .SET 6, .ATR support, Atari++ snapshots
  • 1.06–1.08 (2009–2014): label dumps (-l), .BANKNUM, debug list files (-g) and many fixes

The documented release in the current package is v1.08 ("Not a Typewriter Release", © 1998–2015).

Using it

atasm sample.m65                 -> sample.65o (Atari binary-load file)
atasm -v -s sample.m65 | more    -> also verbose trace and symbol table
atasm -DBASIC -DFOO=128 game.m65 -> predefine labels
atasm -xdos25.atr game.m65       -> also write GAME.65O into a DOS 2.x disk image
atasm -r cart.m65                -> raw binary (fill byte set with -f)
atasm -Iinclude -lgame.lab game.m65

The -x option needs a single- or enhanced-density image formatted with DOS 2.0S or 2.5. -m overlays your code onto a saved Atari800 or Atari800Win snapshot, so you can assemble and resume instantly. -l and -g write label and listing files for emulator debuggers, and -mae makes local labels behave the way they do in MAE.

Source looks like MAC/65 code, but line numbers are optional and ignored:

        .OPT NO LIST
        .INCLUDE sysequ.m65
        .INCLUDE iomac.lib       ; MAC/65 macro library
        .OPT LIST
        *=  $7000
SAMPLE  OPEN  3,8,0,"P:"
        PRINT 0,"That's all folks"
        CLOSE 3
        RTS

This fragment is adapted from sample.m65 in the package. It uses the classic OSS IOMAC.LIB macros unchanged.

What's added and what differs

ATasm is "mostly" MAC/65 compatible. It lifts the old memory-bound limits: macros can take any number of parameters and nest to any depth, .INCLUDEs nest without limit, and there can be up to 65,536 .LOCAL regions. New directives include .DC, .DS, .INCBIN, .WARN, .REPT/.ENDR (handy for building lookup tables) and .BANK for cartridge images over 64K or multi-segment loaders with INITAD blocks. Known differences:

  • It reads ASCII, not ATASCII or MAC/65 tokenized SAVE files. LIST your old source to disk in MAC/65 and convert the line endings first.
  • Comment lines must start with ;, not *.
  • .END, .PAGE, .TAB, .TITLE and most .SETs are ignored. Most .OPTs other than ERR/OBJ/LIST are ignored.
  • Unary < and > get proper precedence, so #>1000+2000 means (>1000)+2000. Schmelzenbach considers MAC/65's opposite behaviour a bug.
  • Macro names must be unique and can't clash with labels.

Today

ATasm was the assembler supported by the first release of the WUDSN IDE Eclipse plug-in, and it remains popular with people porting or maintaining MAC/65-era code. Active development has slowed, though. In 2020 an AtariAge user who filed bug reports on its SourceForge tracker found tickets there that were 11 years old, and talked about moving to ca65. For new projects MADS and ca65 have more momentum. For existing MAC/65 code, or if you simply like the OSS syntax, ATasm is the natural choice.

Credits