Skip to content

6502 Assembler

Chysn edited this page Jan 23, 2022 · 22 revisions

To assemble instructions, enter

.A addr mne [operand]

where addr is a valid 16-bit hexadecimal address, mne is a 6502 mnemonic, and operand is a valid operand. A description of the 6502 instructions is beyond the scope of this document.

wAx will assemble the instruction at the specified address. If the instruction was entered in direct mode, wAx will provide a prompt for the next address after the instruction. You may enter another instruction, or press RETURN.

Note that the comma is an alias for A:

., addr mne [operand]

Comments

wAx stops parsing text after a semicolon, so everything after a semicolon is a comment.

.A 1800 AND #$01 ; MASK BIT 0

Immediate Mode Operands

wAx supports several types of operands for immediate mode instructions (e.g., LDA #)

.A 1800 LDA #$0C        ; HEX BYTE
.A 1802 LDY #"J"        ; PETSCII CHARACTER
.A 1804 AND #%11110000  ; BINARY BYTE
.A 1806 CMP #250        ; BASE-10 BYTE

Accumulator Mode Operand

wAx supports both explicit and implicit syntax for accumulator mode instructions (ROR, ROL, LSR, ASL):

.A 1800 ROR A  ; TAKE YOUR
.A 1802 ROR    ; PICK!

Arithmetic

wAx allows you to apply simple arithmetic to address operands by placing + or - after the operand. The range is a hexadecimal value between -F and +F. For example:

.A 1800 STA @V+1
.A 1800 STA $9000+5
.A 1800 LDA ($FF-F),Y

Entering Data

For additional details, see Memory Editor.

In addition to 6502 code, you may also enter program data with the @ tool. The following formats are supported:

Text

You may enter quoted text of up to 16 characters:

.A 1800 "YOUR TEXT HERE"

Hex Bytes

You may enter up to four bytes (in direct mode) or up to eight bytes (in a BASIC program) using a colon:

.A 1800 :1A 2B 3C 4D

Binary Bytes

You may enter one binary byte (eight bits) using a percent sign:

.A 1800 %00110001

Advanced Assembler Topics

Clone this wiki locally