Atari eight-bit / 6502

MAC/65 & assemblers

From numbered assembly listings to direct control of an Atari’s hardware.

← All programming languages

6502 programming with MAC/65

MAC/65 is OSS’s macro assembler and editor for Atari eight-bit computers. Assembly language names the instructions executed by the 6502, giving programmers control over memory, timing, graphics, and sound. Macros package repeated instruction sequences. The cartridge version combines the development tools with DDT, a machine-language debugger.

Example: change the screen color

This short MAC/65 routine sets COLOR2, the operating system’s shadow color register at address 710, to a reddish color ($44). In the standard text display that changes the background. The OS copies the shadow value to the hardware during vertical blank.

MAC/65 — numbered source listing
0100     *= $3000
0110 COLOR2 = $02C6
0120 START LDA #$44
0130     STA COLOR2
0140     RTS
0150     *= $02E0
0160     .WORD START
Expected result: the text-screen background becomes reddishIllustrative preview

The background changes from the usual blue to a reddish color. Existing text is preserved and the routine prints nothing. This preview uses an empty text screen; the exact shade varies with the Atari palette and display.

Enter the numbered lines in MAC/65. To assemble the source in memory to a DOS-loadable file, enter the command below with a writable disk in drive 1. Load COLOR.OBJ using the DOS binary-load option; the run vector at $02E0 starts the routine. Use a standard graphics-0 text display to see the background change.

MAC/65 editor command — write COLOR.OBJ
ASM ,,#D:COLOR.OBJ
Expected result: COLOR.OBJ is createdIllustrative preview
COLOR.OBJAtari DOS-loadable machine-code file

On a successful assembly, MAC/65 writes COLOR.OBJ to drive 1 and displays an assembly listing. This file preview is not an assembler transcript. Load the file through DOS to get the reddish-background result above.

Reference: OSS MAC/65 manual — disk and cartridge commands.

Reference: Mapping the Atari — memory map.

Other Atari assembler alternatives

  • Atari Assembler Editor: Atari’s cartridge-based editor, assembler, and debugger; an earlier route into 6502 programming.
  • Atari Macro Assembler (AMAC): the disk-based macro assembler distributed through APX, used with a separate text editor.
  • ATasm: a cross-assembler for a modern computer, with syntax closely related to MAC/65 and output suitable for Atari DOS.
  • MADS: a cross-assembler with extensive macros and Atari-oriented output options.
  • ca65: the assembler in the cc65 toolchain; paired with ld65 and Atari linker configurations to build eight-bit executables.

The 6502 instructions transfer between these tools, but line numbers, directives, macros, and build commands can differ. Use each assembler’s own manual when moving a listing.

Reference: Atari Roots — using Atari assemblers.

Reference: Atari Macro Assembler manual collection.

Reference: ATasm project documentation.

Reference: MADS instructions.

Reference: cc65 Atari target documentation.