XASM source [options]'source' is name of source file. If no extension given, the .ASX is added by default.
Options are:
Errorlevels returned by X-Asm:
3 = bad parameters, assembling not started
2 = error occured
1 = warning(s) only
0 = no errors, no warnings
A plus sign placed after hex numbers stands for more bytes written to object in this line, not listed through lack of space.
^0x means $d00x
^1x means $d01x
^2x means $d20x
^3x means $d30x
^4x means $d40x
where x is a hexadecimal digit.
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder
& Bitwise and
| Bitwise or
^ Bitwise xor
<< Arithmetic shift left
>> Arithmetic shift right
= Equal
<> Not equal
!= Not equal (same as <>)
< Less than
> Greater than
<= Less or equal
>= Greater or equal
&& Logical and
|| Logical or
Operator precedence:
first [] * / % & << >> + - | ^ = <> != < > <= >= && last ||Compare and logical operators assume that zero is false and non-zero is true. They return -1 for true.
When calculating expression, 32-bit arithmetic is used. When range of 32 bits is exceeded, 'Arithmetic overflow' error is generated.
If result of expression has improper size, 'Value out of range' error occurs.
Note difference beetwen X-Asm 2.0 and QAsm/X-Asm 1.2: in older assemblers, which used 16-bit arithmetic, a LDA 0-1 was correct (LDA $ffff), but X-Asm 2.0 encounters an error: address can't be negative.
X-Asm recognizes now signed bytes: LDA #-1 is OK.
Name of label must begin in column 1 and can contain letters, digits and underscores (_). Digit can't be label's first character. Name of label can be as long as you want and all the characters are meaningful.
In Quick Assembler only 6 leading characters were recognized and some programs may not compile well under X-Asm for this reason.
Defining a label without using EQU makes it equal to current value of the origin counter. Label can't be redefined.
Examples:
five equ 5 ten equ five+five
Examples:
opt l- listing off opt h- headers off opt l+h- listing on, headers offRemember not to put a space between options:
opt l+ h-is actually
opt l+because h- is a comment.
Default (if no opt specified) is opt l+h+.
org $600 code will be located starting from $0600 table org *+100 'table' points to 100 bytes of uninitialized dataNew! You can set some options applied to new header (if headers are on):
org $600 rts org a:$601'a:' tells X-Asm to always make a header, even it is unnecessary (as in above). So by default X-Asm 2.0 does not generate unnecessary headers, distinct from QAsm and X-Asm 1.2.
org f:$700'f:' works same as 'a:', but additionally tells to generate a $ff,$ff prefix before header. X-Asm adds it to the first header in file by default, so use this option only if you want the $ff's somewhere inside.
You may also define a sinus table. Enter this expression:
sin(centre,amp,size,first,last)
where:
Placing a '*' character after a string inverts bit 7 in every byte of string.
dta b(2,5),a(1000,-1),l(12345,sin(0,127,256)) dta d"ANTIC"*,c'It''s a string',b(155)
Examples:
icl 'macros.asx' icl 'c:\atari\xasm\fileio.asx'
end
Examples:
ins 'picture.raw' ins 'tables.dat'New! You may specify range of inserted file. Syntax is:
ins 'file'[,offset[,length]]First byte in file has offset 0.
If offset is negative, it is counted from the end of file.
ins 'file',-256 inserts last 256 bytes of file ins 'file',10,10 inserts bytes 10..19 of file
run addris equivalent to:
org $2e0 dta a(addr)Examples:
run start run program
ini init ini showpic
ert *>$c000 ert len1>$ff||len2>$ff
noscr equ 1 ift noscr lda #0 els lda #$22 eif sta $22f
For example: a JNE DEST is replaced with:
beq *+5 jmp dest
inc dest bne _skip inc dest+1 _skip equ *The _skip label is not declared of course.
mva source dest = lda source : sta dest mvx source dest = ldx source : stx dest mvy source dest = ldy source : sty dest
You can't use indirect nor pseudo addressing modes with MW*.
Destination must be absolute address (indexed or not).
When source is also absolute, a MW* SOURCE DEST will be:
mv* source dest mv* source+1 dest+1When source is immediate, a MW* #IMMED dest will be
mv* <immed dest mv* >immed dest+1but when <IMMED = >IMMED and IMMED is not forward-referenced, X-Asm uses optimization:
mv* <immed dest st* dest+1
6502 commands require operand depending on the addressing mode. Addressing modes should be entered in standard convention except the accumulator addressing mode, which should be marked with a @ character (as in Quick Assembler).
There are two extra immediate addressing modes: < and >, which use low/high byte of word is used rather than byte value.
In absolute addressing modes, X-Asm examines expression and uses zero-page addressing mode if it thinks it is possible to do it. You may override it with a: and z: prefixes.
Examples:
nop asl @ lda >$1234 assembles to lda #$12 lda $100,x lda a:0 generates 16-bit address jmp ($0a) lda ($80),yNew! X-Asm 2.0 brings pseudo addressing modes. They are similar to pseudo-commands and you may use them as standard addressing modes in all 6502 commands and pseudo-commands, excluding MW*:
cmd a,x+ = cmd a,x : inx cmd a,x- = cmd a,x : dex cmd a,y+ = cmd a,y : iny cmd a,y- = cmd a,y : dey cmd (z),y+ = cmd (z),y : iny cmd (z),y- = cmd (z),y : dey cmd (z,0) = ldx #0 : cmd (z,x) cmd (z),0 = ldy #0 : cmd (z),y
label equ 1 + 2causes label to be equal 1 (+ 2 is treated as a comment).
You specify lda <table, not lda #<table like in most 6502 assemblers.
label: lda ^4b ERROR - colon after label name
Remember that unlike in other assemblers
end startdoes not tell the assembler that start is the run address (it is a comment). You must specify the run address with RUN directive.
Keep in mind that assembler should know all the values in second pass.
Example:
two equ one+one This value is known in 2nd pass only one equ 1 This value is known as early as in 1st passThese values can be fixed in 2 passes.
But if you insert following statement as first line:
three equ one+twoX-Asm will generate an error because it doesn't know the value of three in second pass.