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 @@ - - -
-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:
-In the syntax subdirectory you'll find xasm syntax definitions -for all of these editors.
-Filter=xasm (*.asx)|*.asx -HLTabWidth=0 -IndentChar= -UnIndentChar= -Comment=0000800080000005000 -Identifier=8000000880000005000 -Key=00FF000080000005000 -Label=0000000080000005000 -Number=8000000880000005000 -Preprocessor=0080800080000005010 -Reserved word=00FF000080000005000 -Space=0080800080000005000 -String=0080008080000005000 -Symbol=8000000880000005000 -
xasm|asx||\ --Add the following line at the end of SciTEGlobal.properties: -
import xasm -
Compilator File=C:\U\XASM.EXE -Compilator Param=/q /o:%Dir%%Name%.xex %File% -Compilator LOG= -Compilator Run=C:\Atari\a800win\Atari800Win.exe -run %Dir%%Name%.xex -Compilator Help= -Compilator SaveAll=1 -Compilator ParsLog=%F (%L) * -Compilator Capture=1 --(replace the paths to xasm and the emulator).
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 Fusikxasm 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.
-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 --
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:
- -File | Size | Description |
---|---|---|
xasm-3.0.0-win32.zip | -98 KB | xasm 3.0.0 for Windows |
xasm-3.0.0-linux.tar.gz | -128 KB | xasm 3.0.0 for Linux |
xasm-3.0.0-src.zip | -16 KB | xasm 3.0.0 source code |
xasm261.zip | -25 KB | xasm 2.6.1 for DOS/Windows |
xasm252.zip | -38 KB | xasm 2.5.2 for DOS/Windows (includes -X-BOOT, X-LOAD and X-HEAD) |
Hosted by Atari Area
- - + + + + +xasm is a free tool for programming old 8-bit computers based on the 6502 processor.
+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.
+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 ++
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.
+ +For other systems, such as GNU/Linux and MacOS X, install the latest D compiler +and compile xasm from source code.
+Need a good decompression routine for 6502? +See my inflate routine.
+Alternatively, you may use Unix-style options, for example:
xasm -i -d DEBUG=1 -l listing.lst source.asx
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 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.Syntax | Chip | Value in the Atari 8-bit computer mode (opt g-) |
@@ -150,17 +139,17 @@ different location of hardware registers.
$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
The following unary operators are supported:
+The following unary operators are supported:
Compare and logical operators assume that zero is false and a non-zero is true. They return 1 for true.
While calculating an expression, signed 32-bit arithmetic is used. -When range of 32 bits is exceeded, the 'Arithmetic overflow' error -is generated.
+When range of 32 bits is exceeded, an 'Arithmetic overflow' error +occurs.five equ 5 here equ *
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
ins 'file'[,offset[,length]]The first byte in a file has the offset of zero.
ins 'picture.raw' ins 'file',-256 insert last 256 bytes of file ins 'file',10,10 insert bytes 10..19 of file
run addr +
run addris equivalent to:
org $2e0 @@ -383,18 +364,16 @@ is equivalent to: Example:run main
ini showpic
ert *>$c000 ert len1>$ff||len2>$ff
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.
jne destis equivalent to: @@ -486,28 +465,28 @@ and substitutes two commands: mvx source dest = ldx source : stx dest mvy source dest = ldy source : sty dest
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+1When <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+1If 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
Piotr Fusik (fox@scene.pl)
How to configure a text editor for a convenient use -of xasm
xasm home page (http://xasm.atari.org)
diff --git a/syntax/xasm.properties b/xasm.properties similarity index 89% rename from syntax/xasm.properties rename to xasm.properties index 8bb3a7a..909f64d 100644 --- a/syntax/xasm.properties +++ b/xasm.properties @@ -1,5 +1,4 @@ -# xasm settings for SciTE (www.scintilla.org) -# written by Piotr Fusik