Lazer Interactivce Symbollic Assembler

Apple II LISA Assembler Cheat Sheet

Basic Syntax

LABEL    OPCODE    OPERAND    ;COMMENT
  • Labels start in column 1
  • Opcodes typically start at column 10
  • Operands typically start at column 18
  • Comments begin with semicolon (;)

Essential Assembler Directives

Memory and Origin

         ORG    $address      ; Set origin address (e.g., ORG $800)
         OBJ    $address      ; Set object code address
         END                  ; End of source file

Data Definition

         DFB    byte,...      ; Define byte(s) (8-bit)
         DW     word,...      ; Define word(s) (16-bit, lo/hi format)
         DA     address,...   ; Define address (16-bit)
         ASC    "string"      ; ASCII string
         DCI    "string"      ; ASCII with high bit set on last char
         STR    "string"      ; Pascal string (length byte first)
         HEX    hexdata       ; Hex data (e.g., HEX 0A1B2C)
         DS     count         ; Define storage (reserve bytes)
         MSB    ON/OFF        ; Set high bit for ASC strings

Conditional Assembly

         DO     expression    ; Begin conditional assembly
         ELSE                 ; Alternative condition
         FIN                  ; End conditional block
         
         IF     expression    ; Single-line conditional

Symbols and Labels

         EQU    value         ; Define constant
LABEL    =      value         ; Alternative constant definition
         EXT    label,...     ; External labels
         ENT    label,...     ; Entry points (global labels)

Listing Control

         LST    ON/OFF        ; Listing on/off
         LSTDO  OFF           ; Don't list DO/FIN blocks
         PAG                  ; New page in listing
         TTL    "title"       ; Set listing title
         SKP    lines         ; Skip lines in listing
         CHR    char          ; Define string delimiter

File Operations

         PUT    filename      ; Include source file
         SAV    filename      ; Save object code
         DSK    filename      ; Specify disk file for object

Addressing Modes

         LDA    #$FF          ; Immediate
         LDA    $FF           ; Zero page
         LDA    $FF,X         ; Zero page,X
         LDA    $FF,Y         ; Zero page,Y
         LDA    $FFFF         ; Absolute
         LDA    $FFFF,X       ; Absolute,X
         LDA    $FFFF,Y       ; Absolute,Y
         LDA    ($FF,X)       ; Indexed indirect
         LDA    ($FF),Y       ; Indirect indexed
         JMP    ($FFFF)       ; Indirect (JMP only)

Operators and Expressions

Arithmetic Operators

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
!Modulo (remainder)

Logical Operators

OperatorDescription
&Bitwise AND
.OR.Bitwise OR
.EOR.Bitwise XOR
.NOT.Bitwise NOT

Comparison Operators

OperatorDescription
=Equal
<>Not equal
<Less than
>Greater than
<=Less than or equal
>=Greater than or equal

Special Operators

OperatorDescription
#Immediate mode prefix
<Low byte of expression
>High byte of expression
^Bank byte (65816)
*Current location counter

Pseudo Variables

*        Current address/location counter
]1-]9    Macro parameters (in macro definitions)

Common Macros

Define a Macro

name     MAC              ; Begin macro definition
         ; macro body
         <<<              ; End macro (or EOM)

Use a Macro

         name   param1;param2;param3

Example Macros

PRINT    MAC              ; Print string macro
         LDA    #<]1
         LDY    #>]1
         JSR    STROUT
         <<<

SAVE     MAC              ; Save registers
         PHA
         TXA
         PHA
         TYA
         PHA
         <<<

RESTORE  MAC              ; Restore registers
         PLA
         TAY
         PLA
         TAX
         PLA
         <<<

LISA Editor Commands

(If using integrated editor)

CommandFunction
AAppend lines
CChange lines
DDelete lines
EEdit (enter editor)
FFind string
IInsert lines
LList lines
MMove lines
NRenumber lines
PPrint to printer
QQuit editor
RReplace string
WWrite to disk

Common Program Structure

; Program header
         ORG    $800      ; ProDOS binary location

; Constants
BELL     EQU    $FF3A     ; Monitor bell routine
HOME     EQU    $FC58     ; Clear screen
COUT     EQU    $FDED     ; Character output
STROUT   EQU    $DB3A     ; String output

; Main program
START    JSR    HOME      ; Clear screen
         LDA    #<MSG
         LDY    #>MSG
         JSR    STROUT
         RTS

; Data
MSG      ASC    "HELLO, WORLD!"
         DFB    $8D,$00   ; CR + terminator

         END

; Save object code
         SAV    HELLO.OBJ

Memory Map Quick Reference

$0000-$00FF
Zero Page
$0100-$01FF
Stack
$0200-$02FF
Input buffer/Free space
$0300-$03FF
Vector locations
$0400-$07FF
Text screen 1
$0800-$0BFF
Text screen 2 (common load address)
$0C00-$1FFF
Free RAM
$2000-$3FFF
Hi-res page 1
$4000-$5FFF
Hi-res page 2
$6000-$BFFF
Free RAM (common program area)
$C000-$CFFF
I/O area
$D000-$FFFF
ROM/Language card

Common Monitor Routines

AddressNameDescription
$FD8ECROUTOutput carriage return
$FDEDCOUTOutput character in A
$FF3ABELLRing bell
$FC58HOMEClear text screen
$FB60PRBL2Print blanks (X = count)
$FDDAPRBYTEPrint byte in A as hex
$FF65MONEnter monitor
$FE80SETINVSet inverse text
$FE84SETNORMSet normal text

Tips

Case Sensitivity: LISA is generally not case-sensitive for opcodes and directives
Hex Numbers: Use $ prefix for hex (e.g., $FF00)
Binary Numbers: Use % prefix for binary (e.g., %10101010)
Local Labels: Use numbers (e.g., :1, :2) for local labels within routines
Comments: Use semicolons liberally for documentation
Listing Files: Generate listings with LST ON for debugging
Symbol Tables: Use meaningful label names for easier debugging

Error Messages

ErrorDescription
SYNTAX ERRORInvalid syntax in line
UNDEFINEDLabel or symbol not defined
DUPLICATELabel defined more than once
RANGEBranch out of range (>127 bytes)
MEMORY FULLSource too large for available memory
BAD OPERANDInvalid operand for instruction
Note: LISA syntax may vary slightly between versions. This guide covers LISA 2.5-2.6 commonly used on Apple II systems.