-
Notifications
You must be signed in to change notification settings - Fork 2
6502 Assembler
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]
wAx stops parsing text after a semicolon, so everything after a semicolon is a comment.
.A 1800 AND #$01 ; MASK BIT 0
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
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!
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:
You may enter quoted text of up to 16 characters:
.A 1800 "YOUR TEXT HERE"
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
You may enter one binary byte (eight bits) using a percent sign:
.A 1800 %00110001
wAx keeps track of the address after the last-assembled instruction. This address can be inserted into your code with the asterisk (*). This is especially useful when using BASIC programs for assembly. So instead of writing this:
10 .A 1800 LDA #"J"
20 .A 1802 JSR $FFD2
30 .A 1805 BRK
you can write this:
10 .A 1800 LDA #"J"
20 .A * JSR $FFD2
30 .A * BRK
This allows you to easily relocate the code by changing its address on the first line.
The * is called the "Command Pointer." You may set the address of the Command Pointer by using the * tool:
5 *1800
10 .A * LDA #"J"
20 .A * JSR $FFD2
30 .A * BRK
An * is replaced with the Command Pointer address in wAx commands, except for within the * tool itself, and within quoted strings. If, for some reason, you use it as an operand, remember to use $:
.A 1800 JSR $CB1E
.A 1803 JMP $*