This is a generic two-pass NMOS 6502 assembler. Symbols are case-insensitive. A source can be a single file or a project using INCLUDE.
ORG &1900
OSWRCH = &FFEE
start:
LDX #0
.loop:
LDA message,X
BEQ done
JSR OSWRCH
INX
BNE .loop
.done:
RTS
message:
EQUS "HELLO"
EQUB 13,10,0
Numbers: &FF or $FF hexadecimal, %1010 binary, decimal integers. Expressions support + - * / % & | ^ << >>, parentheses, unary < low byte and > high byte. In prefix position * is the current assembly address.
Directives: ORG, EQUB/.BYTE/DB, EQUW/.WORD/DW, EQUD/.DWORD/DD, EQUS/.TEXT, SKIP/DS/RES, FILL, ALIGN, ASSERT, and INCLUDE "file.asm".
Labels: name: and BBC/BeebAsm-style .name are accepted. Constants may use name = expression or name EQU expression.
Address-size control: a literal written with four or more hex digits, e.g. LDA &00F0, forces absolute addressing where available. You can also write LDA.ABS symbol or LDA.ZP symbol. This matters when reproducing exact binaries.
Undocumented NMOS opcodes: common forms are supported, including SLO RLA SRE RRA SAX LAX DCP ISC ANC ALR ARR AXS LAS AHX SHY SHX TAS. The assembler's NOP abs,X form uses opcode &DC; exact alternative illegal encodings can always be emitted with EQUB. Disable undocumented opcodes using the toolbar checkbox.
Origin: if the source contains no ORG, the toolbar origin is used. This makes a source file relocatable without embedding an assembly address. An explicit ORG in the source takes precedence. A relocatable source may optionally contain a comment such as ; @default-origin &1900; when that file is loaded the value is copied into the Origin field, but it remains user-editable and is not an assembly directive.
Loader BASIC: source comments of the form ; @basic ENVELOPE1,1,0,0,0,1,1,1,100,-10,0,-10,100,0 are ignored by 6502 assembly but are copied, in source/INCLUDE order, into the tokenised BBC BASIC loader made by Save boot disk…. One @basic line becomes one BASIC line and runs after the loader selects MODE 7 but before machine-code installation. Star commands such as ; @basic *FX200,3 are also accepted. These directives never alter the machine-code binary.
Multi-ORG boot loading: when a source emits more than one segment, Save boot disk… automatically packs only the emitted bytes, stages that packed payload safely, then installs each segment at its own ORG address before entering the selected start label. Gaps are not written to BBC memory and are not stored as zero padding in the DFS program payload.
Advanced boot relocation: ; @relocate sourceStart,sourceEnd,destination remains available for older/special packed sources. Do not combine it with automatic multi-segment loading.
jsbeeb key remapping: source comments such as ; @jsbeeb-key Z=CAPSLOCK and ; @jsbeeb-key X=CTRL are ignored by 6502 assembly but are passed to jsbeeb when Run in jsbeeb is used. Each line maps one host key to one BBC key and becomes a jsbeeb URL parameter such as KEY.Z=CAPSLOCK. These directives never alter the machine-code binary or downloaded SSD.
Multiple ORGs: emitted ranges are shown as separate segments. “Save binary” creates one flat file from the lowest to highest emitted address and fills gaps with the selected fill byte. Each individual segment can also be downloaded from the Segments tab.