XASM source [options]source is name of source file. If no extension given, the .ASX is added by default.
Optional 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
| -12345 |
| $abcd |
| %10100101 |
| 'a' or "a" |
| * |
| ^31 |
| {lda #0} |
+ | 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.
adc:sta $80is equivalent to
adc $80 sta $80Single instruction always consists of 3 letters. It can be:
five equ 5 here equ *
opt l- listing off opt h- headers off opt l+h- listing on, headers off
org $600 org f:$700 table org *+100In the latter example table points to 100 bytes of uninitialized data (note label is assigned to * before ORG directive is executed).
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'
end
ins 'file'[,offset[,length]]First byte in file has offset 0.
ins 'picture.raw' ins 'file',-256 insert last 256 bytes of file ins 'file',10,10 insert 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 $22fAbove example can be rewritten using line repeating feature:
noscr equ 1 :noscr<>0 lda #0 :noscr=0 lda #$22 sta $22f
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 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),yThere are also pseudo addressing modes, which are similar to pseudo-commands. You may use them as standard addressing modes in all 6502 commands and pseudo-commands excluding MWA, MWX and MWY only:
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 cmd (z),0+ = ldy #0 : cmd (z),y : iny cmd (z),0- = ldy #0 : cmd (z),y : dey
label equ 1 +2A: X-Asm treats space as operand terminator. Remaining part of line is a comment. You should write 1+2 without any spaces.
A: < and > represent addressing modes
rather than LOW and HIGH operators.
You specify lda <table, not lda #<table
like in most 6502 assemblers.
A: You should use @ for accumulator addressing mode.
label: lda #0A: Label definition can not include a colon.
A: You should have explicit run address specified. Use run start directive. end takes no operand.
three equ one+two two equ one+one one equ 1while this does:
two equ one+one one equ 1A: X-Asm reads source twice (in pass 1 and pass 2) from the beginning until the end.
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 two passes.
three equ one+twoX-Asm will generate an error because it can't fix the value of three in second pass.
A: X-Asm displays only first error.
When you were assembling for the first time, both errors might exist,
but X-Asm stopped assembling on the first one.