diff --git a/doc/editors.htm b/doc/editors.htm deleted file mode 100644 index c503fa8..0000000 --- a/doc/editors.htm +++ /dev/null @@ -1,136 +0,0 @@ - - - -Configuring editors for xasm - - - -

How to configure a text editor for a convenient use of xasm

-

This document describes, how to setup a text editor to:

- -

Of course these features are not available in the Windows Notepad, -so you must pick another text editor. Fortunately there are many -general-purpose text editors for Windows. I'll focus on the following:

- -

Highlighting xasm mnemonics

-

In the syntax subdirectory you'll find xasm syntax definitions -for all of these editors.

- -

Single-keystroke assembly

- -

Placing the cursor where an assembly error occured

-

This works same for all these editors: just double-click the line -with the error message.

- - diff --git a/syntax/extension.asx b/syntax/extension.asx deleted file mode 100644 index 405cde2..0000000 --- a/syntax/extension.asx +++ /dev/null @@ -1,2 +0,0 @@ -LANGSPEC:XASM.SPC -KEYWORDS:XASM.KEY diff --git a/syntax/xasm.cgsyn b/syntax/xasm.cgsyn deleted file mode 100644 index 95eeac0..0000000 --- a/syntax/xasm.cgsyn +++ /dev/null @@ -1,56 +0,0 @@ -# xasm syntax for Code-Genie 3.0 (www.code-genie.com) -# written by Piotr Fusik - -CaseInsensitive true - -FgColor #000000 - -BlockStart comment1 *\s -BlockEnd comment1 \n -Format comment1 b -FgColor comment1 #009300 - -BlockStart comment2 ; -BlockEnd comment2 \n -FgColor comment2 #009300 - -BlockStart comment3 |\s -BlockEnd comment3 \n -FgColor comment3 #009300 - -BlockStart string1 ' -BlockEnd string1 \n -BlockEnd string1 ' -BlockNotEnd string1 '' -FgColor string1 #800080 - -BlockStart string2 " -BlockEnd string2 \n -BlockEnd string2 " -BlockNotEnd string2 "" -FgColor string2 #800080 - -KeywordGroup keywords - adc add and asl bcc bcs beq bit - bmi bne bpl brk bvc bvs clc cld - cli clv cmp cpx cpy dec dex dey - dta eif eli els end eor equ ert - icl ift inc ini ins inw inx iny - jcc jcs jeq jmi jmp jne jpl jsr - jvc jvs lda ldx ldy lsr mva mvx - mvy mwa mwx mwy nop opt ora org - pha php pla plp rcc rcs req rmi - rne rol ror rpl rti rts run rvc - rvs sbc scc scs sec sed sei seq - smi sne spl sta stx sty sub svc - svs tax tay tsx txa txs tya -FgColor keywords #0000ff - -Nest comment1 -Nest comment2 -Nest comment3 -Nest string1 -Nest string2 -Nest keywords - -# eof diff --git a/syntax/xasm.chl b/syntax/xasm.chl deleted file mode 100644 index 8586bd0..0000000 --- a/syntax/xasm.chl +++ /dev/null @@ -1,55 +0,0 @@ -// xasm highlighter for ConTEXT v0.97.1 (www.fixedsys.com/context) -// written by Piotr Fusik - -Language: xasm -Filter: xasm files (*.asx)|*.asx -HelpFile: - -CaseSensitive: 0 - -LineComment: ; -BlockCommentBeg: -BlockCommentEnd: - -IdentifierBegChars: a..z A..Z _ -IdentifierChars: a..z A..Z _ 0..9 - -NumConstBegChars: 0..9 -NumConstChars: 0..9 abcdefABCDEF - -EscapeChar: - -KeyWords1: adc add and asl bcc bcs beq bit - bmi bne bpl brk bvc bvs clc cld - cli clv cmp cpx cpy dec dex dey - dta eif eli els end eor equ ert - icl ift inc ini ins inw inx iny - jcc jcs jeq jmi jmp jne jpl jsr - jvc jvs lda ldx ldy lsr mva mvx - mvy mwa mwx mwy nop opt ora org - pha php pla plp rcc rcs req rmi - rne rol ror rpl rti rts run rvc - rvs sbc scc scs sec sed sei seq - smi sne spl sta stx sty sub svc - svs tax tay tsx txa txs tya - -StringBegChar: ' -StringEndChar: ' -MultilineStrings: 0 - -UsePreprocessor: 0 - -CurrLineHighlighted: 0 - -SpaceCol: clWindowText clWindow -Keyword1Col: clBlue clWindow -Keyword2Col: clBlue clWindow -Keyword3Col: clBlue clWindow -IdentifierCol: clWindowText clWindow -CommentCol: clGreen clWindow -NumberCol: clWindowText clWindow -StringCol: clPurple clWindow -SymbolCol: clWindowText clWindow -PreprocessorCol: clWindowText clWindow -SelectionCol: clWhite clNavy -CurrentLineCol: clBlack clYellow diff --git a/syntax/xasm.ini b/syntax/xasm.ini deleted file mode 100644 index 9093dbd..0000000 --- a/syntax/xasm.ini +++ /dev/null @@ -1,134 +0,0 @@ -# xasm highlighter for PSPad 4.2.1 (pspad.zde.cz) -# written by Piotr Fusik -[Settings] -Name=xasm -HTMLGroup=0 -FileType=*.asx -CommentString= -ANSIComment=0 -PasComment=0 -SlashComment=0 -CComment=0 -SpecComment=0 -BasComment=1 -FoxComment=0 -REMComment=0 -ExclComment=0 -ByComment=0 -SharpComment=0 -SlashComment=0 -PerCentComment=0 -SinglQComment=0 -DblQComment=0 -SQLComment=0 -SingleQuote=1 -DoubleQuote=1 -Preprocessors=0 -IndentChar= -UnIndentChar= -TabWidth=0 -[KeyWords] -ADC= -ADD= -AND= -ASL= -BCC= -BCS= -BEQ= -BIT= -BMI= -BNE= -BPL= -BRK= -BVC= -BVS= -CLC= -CLD= -CLI= -CLV= -CMP= -CPX= -CPY= -DEC= -DEX= -DEY= -EOR= -INC= -INW= -INX= -INY= -JCC= -JCS= -JEQ= -JMI= -JMP= -JNE= -JPL= -JSR= -JVC= -JVS= -LDA= -LDX= -LDY= -LSR= -MVA= -MVX= -MVY= -MWA= -MWX= -MWY= -NOP= -ORA= -PHA= -PHP= -PLA= -PLP= -RCC= -RCS= -REQ= -RMI= -RNE= -ROL= -ROR= -RPL= -RTI= -RTS= -RVC= -RVS= -SBC= -SCC= -SCS= -SEC= -SED= -SEI= -SEQ= -SMI= -SNE= -SPL= -STA= -STX= -STY= -SUB= -SVC= -SVS= -TAX= -TAY= -TSX= -TXA= -TXS= -TYA= -[ReservedWords] -DTA= -EIF= -ELI= -ELS= -END= -EQU= -ERT= -ICL= -IFT= -INI= -INS= -OPT= -ORG= -RUN= diff --git a/syntax/xasm.key b/syntax/xasm.key deleted file mode 100644 index 3819406..0000000 --- a/syntax/xasm.key +++ /dev/null @@ -1,17 +0,0 @@ -[-COMMENT-:GLOBAL] -# xasm keyword file for Crimson Editor (www.crimsoneditor.com) -# written by Piotr Fusik -[KEYWORDS0:GLOBAL] -adc add and asl bcc bcs beq bit -bmi bne bpl brk bvc bvs clc cld -cli clv cmp cpx cpy dec dex dey -dta eif eli els end eor equ ert -icl ift inc ini ins inw inx iny -jcc jcs jeq jmi jmp jne jpl jsr -jvc jvs lda ldx ldy lsr mva mvx -mvy mwa mwx mwy nop opt ora org -pha php pla plp rcc rcs req rmi -rne rol ror rpl rti rts run rvc -rvs sbc scc scs sec sed sei seq -smi sne spl sta stx sty sub svc -svs tax tay tsx txa txs tya diff --git a/syntax/xasm.scheme b/syntax/xasm.scheme deleted file mode 100644 index 7ddd786..0000000 --- a/syntax/xasm.scheme +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - adc add and asl bcc bcs beq bit - bmi bne bpl brk bvc bvs clc cld - cli clv cmp cpx cpy dec dex dey - dta eif eli els end eor equ ert - icl ift inc ini ins inw inx iny - jcc jcs jeq jmi jmp jne jpl jsr - jvc jvs lda ldx ldy lsr mva mvx - mvy mwa mwx mwy nop opt ora org - pha php pla plp rcc rcs req rmi - rne rol ror rpl rti rts run rvc - rvs sbc scc scs sec sed sei seq - smi sne spl sta stx sty sub svc - svs tax tay tsx txa txs tya - - - - - - - - - - - -

xasm.atari.org

-

xasm is a 6502 cross-assembler. -It is mainly targeted at Atari 8-bit computers, -but it can be also used for programming -Atari 2600/5200/Lynx, Commodore C64, Apple ][ and others. -xasm is freeware.

-

Version 3.0.0 is a complete rewrite from the x86 assembly language -to the D programming language. -xasm is now available for Linux.

-

Features

-

Although xasm does not support user-defined macros, it has a rich -set of built-in facilities.

-

Here is some typical 6502 code (also valid in xasm):

-
-        lda #<dest
-        sta ptr
-        lda #>dest
-        sta ptr+1
-        ldx #192
-do_line
-        ldy #39
-do_byte
-        lda pattern,y
-        sta (ptr),y
-        dey
-        bpl do_byte
-        lda #40
-        clc
-        adc ptr
-        sta ptr
-        bcc skip
-        inc ptr+1
-skip
-        dex
-        bne do_line
-
-

And here is the same code rewritten in a xasm-specific way:

-
-        mwa     #dest ptr
-        ldx     #192
-do_line
-        ldy     #39
-        mva:rpl pattern,y (ptr),y-
-        lda #40
-        add:sta ptr
-        scc:inc ptr+1
-        dex:bne do_line
-
-

Usage

-

Although xasm comes with no editor, the documentation -describes integration (syntax highlighting and single-keystroke compilation) -with a few general-purpose text editors. Here is a screenshot -of the Code-Genie editor:

-

6502 code in Code-Genie

-

Download

-
- - - - - - - - - - - - -
FileSizeDescription
xasm-3.0.0-win32.zip98 KBxasm 3.0.0 for Windows
xasm-3.0.0-linux.tar.gz128 KBxasm 3.0.0 for Linux
xasm-3.0.0-src.zip16 KBxasm 3.0.0 source code
xasm261.zip25 KBxasm 2.6.1 for DOS/Windows
xasm252.zip38 KBxasm 2.5.2 for DOS/Windows (includes -X-BOOT, X-LOAD and X-HEAD)
-
-

Links

- -
-

Hosted by Atari Area

- - + + + + +xasm + + + + + + +

xasm - 6502 cross-assembler

+

xasm is a free tool for programming old 8-bit computers based on the 6502 processor.

+

History

+

First version of xasm was written in 1998. I needed a cross-assembler +that could understand the syntax of Quick Assembler +which I used for 8-bit Atari programming before I got a PC. +Initially xasm supported the syntax of QA and nothing more. +I quickly realized that I could extend the syntax to make it more expressive. +This led to xasm 2.0, still in 1998. I added some more features +next year. In 2002 I released many versions which contained +mostly bugfixes. In 2005 there were some minor enhancements and bug fixes, +as well as the whole assembler was rewritten from the x86 assembly language +it was initially written in to the +D programming language. +The rewrite introduced a bug, hopefully fixed in version 3.0.1 +released 22nd April 2007.

+

Syntax

+

6502 assembler code is usually full of LDA, STA, LDA, STA sequences. +With xasm you can use MVA as a shortcut for LDA/STA pair +or even MWA for 16-bit transfers. You can avoid defining labels +when you need short jumps, thanks to conditional skip +and repeat pseudo-instructions. You can put two instructions +that share their argument in one line. +These are just some of the features that help you program +in a more concise way. Let's look at typical 6502 code +(which is valid in xasm):

+
+        lda #<dest
+        sta ptr
+        lda #>dest
+        sta ptr+1
+        ldx #192
+do_line
+        ldy #39
+do_byte
+        lda pattern,y
+        sta (ptr),y
+        dey
+        bpl do_byte
+        lda #40
+        clc
+        adc ptr
+        sta ptr
+        bcc skip
+        inc ptr+1
+skip
+        dex
+        bne do_line
+
+

Using xasm features this code can be rewritten to:

+
+        mwa     #dest ptr
+        ldx     #192
+do_line
+        ldy     #39
+        mva:rpl pattern,y (ptr),y-
+        lda #40
+        add:sta ptr
+        scc:inc ptr+1
+        dex:bne do_line
+
+

Usage

+

xasm is a command-line tool so you additionally need a general-purpose text editor. +I use SciTE. +Syntax highlighting definition for it is included with xasm. +To install it, copy xasm.properties to the SciTE directory, +select Options / Open Global Options File, type import xasm +at the end and save the global configuration file.

+

xasm code in SciTE

+

Download

+ +

For other systems, such as GNU/Linux and MacOS X, install the latest D compiler +and compile xasm from source code.

+

Inflate

+

Need a good decompression routine for 6502? +See my inflate routine.

+

Links

+ + + diff --git a/www/scite.png b/www/scite.png new file mode 100644 index 0000000..7aa7f44 Binary files /dev/null and b/www/scite.png differ diff --git a/xasm.d b/xasm.d index c503d0f..64b18dd 100644 --- a/xasm.d +++ b/xasm.d @@ -1,11 +1,10 @@ -// xasm 3.0.0 by Piotr Fusik -// See the homepage at http://xasm.atari.org. -// This source code is free, redistributable and modifiable -// under the terms of the Artistic License (attached as artistic.txt). +// xasm 3.0.1 by Piotr Fusik +// http://xasm.atari.org -private import std.math; -private import std.stream; -private import std.string; +import std.math; +import std.stream; +import std.cstream; +import std.string; version (Windows) { @@ -32,7 +31,7 @@ version (Windows) { const char[] OPTION_P_DESC = "Ignored for compatibility"; } -const char[] TITLE = "xasm 3.0.0"; +const char[] TITLE = "xasm 3.0.1"; char[] sourceFilename = null; @@ -214,10 +213,10 @@ bit getOption(char letter) { } void warning(char[] msg) { - if (!(line is null)) { - stderr.printf("%.*s\n", line); + if (line !is null) { + derr.printf("%.*s\n", line); } - stderr.printf("%.*s (%d) WARNING: %.*s\n", + derr.printf("%.*s (%d) WARNING: %.*s\n", currentLocation.filename, currentLocation.lineNo, msg ); @@ -310,7 +309,7 @@ char[] readLabel() { column--; break; } - return label >= "A" ? label : cast(char[]) null; + return label >= "A" ? label : null; } void readComma() { @@ -835,7 +834,7 @@ debug int testValue(char[] l) { line = l; column = 0; readValue(); - printf("Value of %.*s is %x\n", line, value); + dout.printf("Value of %.*s is %x\n", line, value); return value; } @@ -1008,8 +1007,8 @@ void readAddrMode() { return; } addrMode = AddrMode.INDIRECT; - return; - default: + return; + default: illegalCharacter(); } break; @@ -1111,7 +1110,7 @@ debug AddrMode testAddrMode(char[] l) { line = l; column = 0; readAddrMode(); - printf("Addressing mode of \"%.*s\" is %x\n", line, addrMode); + dout.printf("Addressing mode of \"%.*s\" is %x\n", line, addrMode); return addrMode; } @@ -1195,7 +1194,7 @@ void ensureListingFileOpen(char letter, char[] msg) { if (listingStream is null) { listingStream = openOutputFile(letter, ".lst"); if (!getOption('q')) { - printf(msg); + dout.printf(msg); } listingStream.printf(TITLE ~ "\r\n"); } @@ -1258,7 +1257,7 @@ void listCommentLine() { } void listLabelTable() { - if (!(optionParameters['t' - 'a'] is null) && !(listingStream is null)) { + if (optionParameters['t' - 'a'] !is null && listingStream !is null) { listingStream.close(); listingStream = null; } @@ -1292,7 +1291,7 @@ void objectByte(ubyte b) { if (objectStream is null) { objectStream = openOutputFile('o', ".obx"); if (!getOption('q')) { - printf("Writing object file...\n"); + dout.printf("Writing object file...\n"); } } try { @@ -1346,7 +1345,8 @@ void putByte(ubyte b) { objectByte(b); } if (pass2) { - debug; else { + debug { + }else { objectByte(b); } if (listingColumn < 29) { @@ -1357,15 +1357,17 @@ void putByte(ubyte b) { listingColumn = 30; } } - if (origin >= 0) { + if (optionHeaders) { + if (origin < 0) + throw new AssemblyError("No ORG specified"); assert(blockIndex >= 0); if (!pass2) { blockEnds[blockIndex] = cast(ushort) loadOrigin; } + } + if (origin >= 0) { origin++; loadingOrigin = ++loadOrigin; - } else if (optionHeaders) { - throw new AssemblyError("No ORG specified"); } } @@ -2074,7 +2076,6 @@ void assemblyDtaNumbers(char letter) { case 'r': assemblyDtaReal(); break; - } switch (readChar()) { case ')': @@ -2443,7 +2444,7 @@ void assemblyIns() { } void assemblyInstruction(char[] instruction) { - if (!inOpcode && origin < 0 && !(currentLabel is null) && instruction != "EQU") { + if (!inOpcode && origin < 0 && currentLabel !is null && instruction != "EQU") { throw new AssemblyError("No ORG specified"); } instructionBegin = true; @@ -2768,11 +2769,11 @@ debug ubyte[] testInstruction(char[] l) { line = l; column = 0; assemblyInstruction(readInstruction()); - printf("%.*s assembles to", line); + dout.printf("%.*s assembles to", line); foreach (ubyte b; objectBuffer) { - printf(" %02x", b); + dout.printf(" %02x", b); } - printf("\n"); + dout.printf("\n"); return objectBuffer; } @@ -2811,7 +2812,7 @@ void assemblyPair() { void assemblyLine() { debug { - printf("%.*s\n", line); + dout.printf("%.*s\n", line); } currentLocation.lineNo++; totalLines++; @@ -2823,7 +2824,7 @@ void assemblyLine() { } char[] label = readLabel(); currentLabel = null; - if (!(label is null)) { + if (label !is null) { if (!inFalseCondition()) { if (!pass2) { if (label in labelTable) { @@ -2930,7 +2931,7 @@ void assemblyFile(char[] filename) { if (filenameExt(filename) < 0) { filename ~= ".asx"; } - if (!(currentLocation is null)) { + if (currentLocation !is null) { locations ~= currentLocation; } if (getOption('p')) { @@ -3090,7 +3091,7 @@ int main(char[][] args) { } continue; } - if (!(sourceFilename is null)) { + if (sourceFilename !is null) { exitCode = 3; } sourceFilename = arg; @@ -3099,10 +3100,10 @@ int main(char[][] args) { exitCode = 3; } if (!getOption('q')) { - printf(TITLE ~ "\n"); + dout.printf(TITLE ~ "\n"); } if (exitCode != 0) { - printf( + dout.printf( "Syntax: xasm source [options]\n" "/c Include false conditionals in listing\n" "/d:label=value Define a label\n" @@ -3124,25 +3125,25 @@ int main(char[][] args) { listLabelTable(); } } catch (AssemblyError e) { - if (!(line is null)) { - stderr.printf("%.*s\n", line); + if (line !is null) { + derr.printf("%.*s\n", line); } - stderr.printf("%.*s (%d) ERROR: %.*s\n", + derr.printf("%.*s (%d) ERROR: %.*s\n", currentLocation.filename, currentLocation.lineNo, e.msg ); exitCode = 2; } - if (!(listingStream is null)) { + if (listingStream !is null) { listingStream.close(); } - if (!(objectStream is null)) { + if (objectStream !is null) { objectStream.close(); } if (exitCode <= 1 && !getOption('q')) { - printf("%d lines of source assembled\n", totalLines); + dout.printf("%d lines of source assembled\n", totalLines); if (objectBytes > 0) { - printf("%d bytes written to the object file\n", objectBytes); + dout.printf("%d bytes written to the object file\n", objectBytes); } } return exitCode; diff --git a/doc/xasm.htm b/xasm.html similarity index 73% rename from doc/xasm.htm rename to xasm.html index 602708e..f624bf5 100644 --- a/doc/xasm.htm +++ b/xasm.html @@ -1,8 +1,8 @@ - - + + + -xasm 3.0.0 +xasm 3.0.1 @@ -20,9 +20,8 @@ the .obx extension.

OPTIONS

/c
-
Enable listing false conditionals. -Lines skipped due to a false condition are not listed by default.
-
/d:label=value
+
List lines skipped due to a false condition.
+
/d:label=value
Define a label. label should be a valid label name. value may be any expression (it may use forward references @@ -30,49 +29,42 @@ to labels defined in the source file). You may use several /d options to define many labels from the command line.
/i
-
Disable listing included sources. Only main source file will be -listed.
+
Do not list included files. Only main source file will be listed.
/l[:filename]
-
Enable listing. If no filename is given, the listing is written +
Generate a listing. If no filename is given, the listing is written to source.lst, where source is the name of the source file -(without the extension).
+without the extension.
/o:filename
-
Specify object file name. The default is source.obx. +
Set object file name. The default is source.obx. You may use the null device (/o:nul) to generate no object file.
-
/p
+
/p
Print fully qualified file names in listing and error messages. -This option is useful for the Code-Genie editor, which can jump to the error -location only if the full path is given. -This option works only on Windows and is silently ignored on Linux.
-
/q
+This option works only on Windows and is silently ignored on other platforms. +
/q
Suppress info messages. -Prevents xasm from printing its name and the summary (how many lines -assembled and bytes written). Good if you are building a project from many -source files and don't want tons of messages.
+Quiet mode. Prevents xasm from printing the logo and the summary.
/t[:filename]
-
List label table. If no filename given, the table is appended +
List label table. If filename is omitted then the table is appended to the listing.
-
/u
-
Warn of unused labels. A warning message will be issued for each label, -whose value is never used.
+
/u
+
Issue a warning message for each label whose value is unused.

Alternatively, you may use Unix-style options, for example:

xasm -i -d DEBUG=1 -l listing.lst source.asx
 

SYNTAX

-

Source files should be plain ASCII files. Supported are LF, CR, CR/LF -and Atari line terminators. xasm is not case-sensitive, so you can mix -upper- and lower-case for labels and instructions.

+

Source files should be plain ASCII files. LF, CR, CR/LF and Atari line terminators +are supported. Labels and instructions are case-insensitive.

xasm is backward compatible with Quick Assembler. -If you want to assembly QA sources with xasm, simply replace ATASCII -specific characters with their integer representation. You also have to change -all OPT directives, but usually you only need to remove them.

+To compile QA sources with xasm, simply replace ATASCII-specific characters +with their integer codes. You also have to change all OPT directives, +but usually you can simply remove them.

A label is a symbol that represents a 32-bit signed integer. You can define a label by putting its name at the beginning of a line -(with no spaces before). If you do not use the EQU directive, +(with no spaces before). Unless you use the EQU directive, the label is assigned the current value of the origin counter.

-

Instructions and directives must be preceded with -whitespace. Note that in xasm you can use instruction and directive +

Instructions and directives must be preceded with some whitespace. +Note that in xasm you can use instruction and directive names as label names. For example

nop
 

defines a label called nop, whereas

@@ -85,23 +77,21 @@ of full comment lines:

* so it is label | and this too -

Lines with instructions (and some directives) +

Lines with instructions (and some directives) may be repeated. A single line may be assembled several times, for example:

:4 asl @
 table :32*5 dta 5
 
-

In lines with instructions or directives, a comment starts after -the instruction/directive has been successfully parsed. That is, xasm -does not require a special character to start a comment. However, -you still can use one, because it is usually required for correct syntax -highlighting in text editors.

+

In lines with instructions or directives, a comment starts immediately +after the instruction/directive has been successfully parsed. +That is, xasm does not require a special character to start a comment.

 lda foo ; this is a comment
  sta bar so it is
- tax #0  tax requires no operand, so #0 starts a comment
+ tax #0  tax has no operand, therefore #0 starts this comment
 
-

You may put two instructions on the same line. -In this case they have the same operand. For example:

+

You may put two instructions in one line +so they share the operand. For example:

 eor:sta foo
 

is equivalent to

@@ -110,29 +100,28 @@ In this case they have the same operand. For example:

Note that

 lda:tax #0
-

is allowed (#0 is a comment for tax).

+

is allowed because #0 is treated as a comment for tax.

EXPRESSIONS

Expressions are numbers combined with operators and brackets. You should use square brackets, because parentheses are reserved -for the indirect addressing.

-

Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff. -A number may be:

+for 6502 indirect addressing.

+

Numbers can be expressed as:

Abbreviations of Atari hardware registers are provided to save you the trouble of typing two extra characters (^4e vs $d40e) and to ease porting software between Atari 8-bit computers and the Atari 5200 console. These are very similar machines, one of the biggest differences is -different location of hardware registers.

+the location of hardware registers.

@@ -150,17 +139,17 @@ different location of hardware registers.

SyntaxChip Value in the Atari 8-bit
computer mode (opt g-)
$D40x$D40x

An op-code is the single-byte op-code of the instruction inside braces. -The operand of the instruction is discarded and is necessary only for -identifying the addressing mode. The instruction should begin just after +The operand of the instruction is discarded and is necessary only +to recognize the addressing mode. The instruction should begin right after the left brace and the right brace should immediately follow the operand or the instruction. -You can skip the operand if the addressing mode +You can skip the operand if the addressing mode is fixed. Examples: {lda #}, {jsr}, {bne}, {jmp ()}, {sta a:,x}.

You can use the line repeat counter (#) in the repeated lines. It counts the iterations starting from zero. Examples:

-
:3 dta # ; generates three bytes: 00, 01, 02.
+
:3 dta # ; generates three bytes: 0, 1, 2.
 line_lo :192 dta l(screen+40*#)
 line_hi :192 dta h(screen+40*#)
 dl :59 dta $4f,a(screen+40*#),0,$4f,a(screen+40*#),0
@@ -188,7 +177,7 @@ dl :59 dta $4f,a(screen+40*#),0,$4f,a(screen+40*#),0
 
  • && Logical AND
  • || Logical OR
  • -

    The following unary operators are supported:

    +

    The following unary operators are supported:

    ORG - change value of the origin counter
    -
    You can set some options applied to the new header (if headers are -enabled): +
    If Atari executable headers are enabled, you can use a prefix:
      -
    • a: tells xasm to always make a header, even it is -unnecessary, like in ORG *.
    • -
    • f: works same as a:, but additionally tells to generate -a $FF,$FF prefix before the header. xasm adds it -at the beginning of the file by default, so use this option only if you want -the $FF's somewhere inside.
    • +
    • a: starts a new block even if it is not necessary because +the new address equals the current address.
    • +
    • f: is same as a:, but additionally generates +a $FF,$FF prefix before the new header. The prefix is automatically +generated at the beginning of the file.
    Examples:
     org $600
    @@ -267,13 +253,12 @@ table org *+100
     In the latter example table points to 100 bytes
     of uninitialized data (label is assigned to *
     before the ORG directive is executed).
    -

    Starting with version 2.6.0, xasm supports code +

    Starting with version 2.6.0, xasm supports code that is relocated in the memory at runtime. Let's say you want your code -to be run at the zero page. Typically you can't load it directly into this -place, so you load it at a different address and then move at the runtime. -xasm differentiates between the address that it used -for code generation from the address that is used for generating -Atari executable headers. org r: affects only the former one. +to be located on the zero page. You can't normally load it directly into this +place, so you load it at a different address and then move in your program. +org r: changes the address that it used for code generation +but not the address used for generating Atari executable headers. Example:

     org $8000
      ldx #code_length-1
    @@ -292,8 +277,8 @@ because I think this is not useful. If you really need it, you can
     always type something like:

    where_am_i equ *-code_zpage+code_loaded
     
    -
    DTA - define data
    -
    There are various data types: +
    DTA - define data
    +
    • integers
        @@ -311,21 +296,20 @@ where:
      • center is a number which is added to every sine value
      • amp is the sine amplitude
      • size is the sine period
      • -
      • first,last define range of values in the table. +
      • first,last define the range of sine arguments. They are optional. The default are 0,size-1.
      Example: dta a(sin(0,1000,256,0,63)) defines a table of 64 words representing a quarter of sine with the amplitude of 1000.
    • real numbers: r(-1.23456e12)
      -Real numbers are written in the 6-byte Atari Floating-Point format.
    • +Real numbers are stored in the 6-byte Atari Floating-Point format.
    • text strings
      • ASCII strings: c'Text' or c"Text"
      • ANTIC strings: d'Text' or d"Text"
      A character string consists of any of characters surrounded by quotation -marks. Within a string, a single quotation mark character is -represented by two succesive quotation marks.
      +marks. You can include the quotation marks in the string by doubling them.
      Placing a * character after a string inverts the highest bit in every byte of the string.
    @@ -345,7 +329,7 @@ Examples: icl 'lib/fileio'
    Note: for portability, you should use only relative paths and slash -as the separator. This guarantees that your sources will compile under Windows +as the separator. This assures that your sources will compile under Windows and Linux.
    END - end assembling file
    Remaining part of the file is not assembled. If this statement does @@ -358,23 +342,20 @@ Example:
    INS - insert contents of file
    Copies every byte of the specified file into the object file and updates the origin counter, as if these bytes were defined with DTA.
    -You may specify a range of the inserted file. The syntax is following: +You may specify a range of the file to insert. The syntax is:
      ins 'file'[,offset[,length]]
     
    The first byte in a file has the offset of zero.
    -If the offset is negative, it is counted from the end of the file.
    +If the offset is negative, it counts from the end of the file.
    Examples:
      ins 'picture.raw'
      ins 'file',-256  insert last 256 bytes of file
      ins 'file',10,10 insert bytes 10..19 of file
     
    -
    RUN - generate run address
    -
    An Atari executable program should specify a run address. -A program may be loaded in many areas of the memory and started from any -address. -
     run addr
    +
    RUN - set run address in the Atari executable format
    +
     run addr
     
    is equivalent to:
     org $2e0
    @@ -383,18 +364,16 @@ is equivalent to:
     Example:
     
     run main
     
    -
    INI - generate init address
    -
    An Atari executable program may have some routines which are executed -during the loading process. There may be many init blocks in one file.
    -Example: +
    INI - set init address in the Atari executable format
    +
    Example:
     ini showpic
     
    -
    ERT - generate an error if an expression is true
    +
    ERT - generate error if expression evaluates to true
    Examples:
     ert *>$c000
      ert len1>$ff||len2>$ff
     
    -
    IFT - assemble if expression is +
    IFT - assemble if expression is true
    ELI - else if
    ELS - else
    @@ -433,11 +412,11 @@ to use a CLC before ADC for every simple addition.
    CLC and ADC.
    SUB - subtraction
    It is SEC and SBC.
    -
    RCC, RCS, REQ, RMI, RNE, RPL, RVC, +
    RCC, RCS, REQ, RMI, RNE, RPL, RVC, RVS - conditional repeat
    These are branches to the previous instruction. They take no operand, because the branch target -is the address of previously assembled instruction.
    +is the address of the previously assembled instruction.
    Example:
     ldx #0
      mva:rne $500,x $600,x+
    @@ -465,7 +444,7 @@ In the above example the word-sized variable $80 is incremented by 40.
    jumps
    These are a kind of 'long' branches. While standard branches (such as BNE) have range of -128..+127, these jumps have range -of all 64 kB.
    +of 64 kB.
    Example:
     jne dest
     
    is equivalent to: @@ -486,28 +465,28 @@ and substitutes two commands: mvx source dest = ldx source : stx dest mvy source dest = ldy source : sty dest
    -
    MWA, MWX, MWY - move word using +
    MWA, MWX, MWY - move word using accumulator, X or Y
    These pseudo-commands require two operands and are combinations of two MV*'s: one to move the low byte, and the other to move the high byte.
    You can't use indirect nor pseudo addressing mode with MW*. -Destination must be an absolute address (optionally indexed).
    -When source is also absolute, an mw* source dest will be: +Destination must be an absolute address, optionally indexed.
    +When source is also an absolute address, an mw* source dest expands to:
     mv* source  dest
      mv* source+1 dest+1
     
    -When source is an immediate, an mw* #immed dest will be: +When source is an immediate value, an mw* #immed dest expands to:
     mv* <immed dest
      mv* >immed dest+1
     
    When <immed equals >immed and immed -is not forward-referenced, xasm uses an optimization: +is not forward-referenced, xasm skips the second LD*:
     mv* <immed dest
      st* dest+1
     
    If possible, MWX and MWY use increment/decrement -commands. E.g. mwx #1 dest is assembled as: +commands. For example, mwx #1 dest expands to:
     ldx #1
      stx dest
      dex
    @@ -523,24 +502,24 @@ the @ character (as in Quick Assembler).

    which use the low/high byte of a 16-bit word constant. They are for Quick Assembler compatibility. You can use traditional #< and #>. -Note lda >$ff+5 loads 1 (>$104), +Note that lda >$ff+5 loads 1 (>$104), while lda #>$ff+5 loads 5 (0+5) to the accumulator, because the unary operator > has a higher priority than the binary plus.

    -

    In absolute addressing modes, xasm examines the expression -and uses zero-page addressing mode if it supposes it's possible. -You may override it with a: and z: prefixes.

    +

    You can explicitly choose absolute (a:) +and zero-page (z:) addressing modes.

    Examples:

      nop
      asl @
    - lda >$1234	assembles to lda #$12
    + lda >$1234  assembles to lda #$12
      lda $100,x
    - lda a:0	generates 16-bit address
    + lda 0       zero-page (8-bit address)
    + lda a:0     absolute (16-bit address)
      jmp ($0a)
      lda ($80),y
     
    -

    There are also pseudo addressing modes, which are similar to +

    There are pseudo addressing modes, which are similar to pseudo-commands. You may use them just like standard addressing modes in all 6502 commands and pseudo-commands, except for MWA, MWX and MWY:

    @@ -552,10 +531,16 @@ in all 6502 commands and pseudo-commands, except for 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 : iny cmd (z),0- = ldy #0 : cmd (z),y : dey
    -

    CHANGES

    +

    HISTORY

    +

    Version 3.0.1 (2007-04-22)

    +
      +
    • fixed a bug in OPT H- mode
    • +
    • made xasm compilable with the latest D compiler v1.010 +(there were incompatible changes in the D language and library)
    • +

    Version 3.0.0 (2005-05-22)