diff --git a/compack.asm b/compack.asm deleted file mode 100644 index b2d4163..0000000 --- a/compack.asm +++ /dev/null @@ -1,274 +0,0 @@ -; COMpack -; b. Fox - - IDEAL - P386 - MODEL TINY - CODESEG - ORG 100h - include 'fox.mak' -start: -; db 1024 dup(0) ;4 self-packing - -inplen = 24000 -outlen = 27000 - - print hello - mov di, 81h - movzx cx, [di-1] - jcxz usg - mov al, ' ' - repe scasb - je usg - push cx di - dec di - inc cx - mov al, '?' - repne scasb - pop di cx - jne nousg - -usg: print usgtxt - int 20h - -getfil: lea si, [di-1] - mov al, ' ' - repne scasb - jne noout1 - dec di -noout1: mov cx, di - sub cx, si - mov di, offset fname - rep movsb - mov bx, di -srchex: dec bx - cmp [byte bx], '\' - je addext - cmp [byte bx], '.' - je extexs - cmp bx, offset fname - ja srchex -addext: mov ax, 'c.' - stosw - mov ax, 'mo' - stosw -extexs: mov [word di], 0a0dh - mov [byte di+2], '$' - print namtxt - print fname - mov [byte di], 0 -rts: ret - - smartdisk - -nousg: print srctxt - call getfil - push si - - fopen - mov cx, inplen - fread inpbuf - mov dx, offset lontxt - cmp ax, inplen - je panic - push ax - add [filend], ax - fclose - pop cx - - mov dx, offset emptxt - jcxz panic - mov di, offset inpbuf - xor al, al - repe scasb - jne spox -panic: print - int 20h - -spox: dec di - push di - mov [filbgn], di - sub di, offset inpbuf - add [destad], di - add [reljad], di - lda cx - inc ax - call prilen - - pop bx - mov si, offset firflg - mov di, offset outbuf - -pack1: push si di - mov ax, 1 - mov bp, [filend] - lea si, [bx-0ffh] - cmp si, [filbgn] - jnb pack2 - mov si, [filbgn] - cmp si, bx - je packn - -pack2: mov di, bx - mov cx, bp - sub cx, bx - push si - repe cmpsb - pop si - je pack3 - dec di -pack3: mov cx, di - sub cx, bx - cmp cx, ax - jbe pack4 - lda cx - mov dx, si -pack4: inc si - cmp si, bx - jb pack2 - -packn: pop di si - mov bp, ax - sta cx - mov ax, 1 - -putfl1: cmp cx, 2 - rcl [byte si], 1 - jnc putfl2 - mov si, di - stosb -putfl2: loop putfl1 - - cmp bp, ax - mov al, [bx] - je putbyt - mov al, dl - sub al, bl -putbyt: stosb - mov ah, 1 - cmp [si], ah - jne swpflg - mov [si], ax - inc si -swpflg: add bx, bp - cmp bx, [filend] - jb pack1 - - shl [byte si], 1 - jnc corfl1 - mov al, 80h - stosb - jmp corfl3 -corfl1: stc -corfl2: rcl [byte si], 1 - jnc corfl2 -corfl3: rcl [firflg], 1 ;+ - xor al, al - stosb - - sub di, offset depack - mov [filend], di - - print pkdtxt - pop di - mov cx, 81h - add cl, [80h] - sub cx, di - jz nowri - mov al, ' ' - repe scasb - je nowri - mov ax, [filend] - inc ah - cmp ax, [destad] - ja nospac - - call getfil - fcreate - mov cx, [filend] - fwrite depack - fclose - -nowri: mov ax, [filend] - -prilen: mov di, offset lenlst - mov bx, 10 -outnm1: xor dx, dx - div bx - add dl, '0' -outnm2: mov [di], dl - dec di - test ax, ax - jnz outnm1 - mov dl, ' ' - cmp di, offset lennum - jnb outnm2 - print lentxt - ret - -nospac: mov dx, offset zertxt - dos 9 - jmp nowri - -hello db 'COMpack 1.0 by Fox/Taquart',eot -usgtxt db 'This is FREEWARE packer for .COM programs.',eol - db 'Syntax:',eol - db 'COMPACK inpfile [outfile]',eol - db '"inpfile" specifies source path\filename',eol - db '"outfile" specifies target path\filename',eol - db 'The ".COM" extension of filename is default and you don''t have to write it',eol - db 'If you don''t give "outfile" parameter, no file will be saved',eol - db 'and you can only watch the results of packing',eol -zertxt db 'If you want the file saved, you must compile some zero bytes at the beginning',eol - db 'of file to reserve the space for packed data. The code should immediately',eol - db 'follow the zeros.',eot - -srctxt db 'Source file:',eot -pkdtxt db 'Packed file:',eot -namtxt db ' Name: $' -lentxt db 'Length: ' -lennum db ' ' -lenlst db ' bytes',eot -emptxt db 'File is empty!',eot -lontxt db 'File is too long!',eot - smarterr - -filbgn dw inpbuf -filend dw inpbuf - -depack: mov si, offset packed-depack+100h - mov di, 100h -destad = word $-2 - mov al, 1 -firflg = byte $-1 - xor cx, cx -dep1: movsb - dec cx -dep2: inc cx -dep3: add al, al - jnz dep4 - lodsb - adc al, al ;+ -dep4: jnc dep2 - jcxz dep1 - sbb bx, bx ;+ - and bl, [si] - db 0fh,84h ;jz near -reljad dw depack-reljmp -reljmp: inc si - inc cx - push si - lea si, [di+bx] - rep movsb - pop si - jmp dep3 -packed: - -outbuf db outlen dup(?) - -fname: - -inpbuf db inplen dup(?) - - ENDS - END start \ No newline at end of file diff --git a/doc/6502proc.gif b/doc/6502proc.gif deleted file mode 100644 index 2db1ad8..0000000 Binary files a/doc/6502proc.gif and /dev/null differ diff --git a/doc/editors.htm b/doc/editors.htm index 51fbf2e..7b7fb52 100644 --- a/doc/editors.htm +++ b/doc/editors.htm @@ -1,66 +1,105 @@ - -
--
Back - - \ No newline at end of file + + +
+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 fucus on four of them:
+All of these have similar features. Personally I prefer +Code-Genie.
+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 +
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 four editors: just double-click the line +with the error message.
+ + diff --git a/doc/faq.htm b/doc/faq.htm deleted file mode 100644 index fe1473f..0000000 --- a/doc/faq.htm +++ /dev/null @@ -1,30 +0,0 @@ - - -I want to run xasm on my Amiga / Atari ST / Mac / ...
-Unfortunately xasm is written in x86 assembly language, so it is
-not portable.
-
Why xasm, not X-ASM as in previous versions?
-It's easier to pronounce. ;-)
-
Why 'second final edition'?
-Quote from FAQ in version 2.4, regarding 'final edition':
-Because I don't plan adding any new features. xasm is already a very
-sophisticated tool, much more powerful than Quick Assembler.
-Of course, it does not mean there won't be any new releases.
-Very likely there will be bug fixes.
-Comment to 'second':
-I found that new features are quite useful and easy to implement. :-)
-
What about supporting other 6502-based machines, other processors (65816 etc.) ?
-xasm is not a universal 6502 cross-assembler. If you need a portable
-cross-assembler (and maybe even an excellent C compiler), then visit
-www.cc65.org.
-
Back - - \ No newline at end of file diff --git a/doc/index.htm b/doc/index.htm deleted file mode 100644 index b8c2193..0000000 --- a/doc/index.htm +++ /dev/null @@ -1,46 +0,0 @@ - -
-
- - xasm 2.5.2 second final edition-Copyright (c) 1998-2002 by Piotr Fusik -- - this package contains following utilities (click program name for documentation): - -
other documents: - --xasm home page: -http://xasm.atari.org - - - Permission is granted to anyone to use this software and its documentation -for any purpose, including commercial applications, and redistribute it -freely in its original form. The author makes no representations about -the suitability of this software for any purpose. It is provided "as is" -without express or implied warranty. - |
-
| - - |
ift 0 -:label nop - eif --reported Label not defined before error for the repeat count. -
ift 0 -label - eif --reported No ORG specified error for the label definition. -
XASM source [options] -source is the name of source file. -If no extension is given, the .ASX is implied.
-Default action on invoking without options is to compile -writing to a file with the .OBX extension.
-
-
- xasm - 6502 cross-assembler xasm source [options] xasm is a cross-assembler which generates code for the 6502
+processor. source is the name of the source file. If no filename extension
+is given, .ASX is appended. The default action (when invoked without
+options) is to assembly source, writing the result to a file with
+the .OBX extension.
-
-
-If there was no error, variables point to the last issued warning.
-If no warning occured, they are removed from the environment.
-Note: NCE is an old editor for DOS. To learn about integration with
-modern text editors for Windows read this.
-
-
-
-
-
-Note: Much more powerful for this purpose is GNU make utility.
-In DOS and Windows you may use its DJGPP port (available from
-http://www.delorie.com/djgpp).
-
-
-
-
-There are following types of fields:
-
-In the latter form, you must use a minimum of an instruction field.
-It depends on the instruction, how many operands it takes.
-Every instruction takes constant number of operands, therefore
-there's no need to use a special character at the start of a comment, because after
-succesfully taking operands, X-Asm discards the remaining part of line.
-However, general purpose text editors may highlight
-the comments only if a special delimiter is used, and for that reason,
-the semicolon is recommended to start a comment.
-
-
-
-
-Single instruction always consists of 3 letters. It may be:
- Source files should be plain ASCII files. Although different line
+terminators are supported, CR/LF is recommended because it is the standard
+in the DOS/Windows environment. Lines must be no longer than 256
+characters. xasm is not case-sensitive, so you can mix upper-
+and lower-case for labels and instructions. xasm is backward compatible with Quick Assembler.
+If you want to assembly QA sources with xasm, simply convert the text
+file to CR/LF terminators and replace ATASCII specific characters with their
+integer representation. You also have to change all OPT directives,
+but usually you only need to 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,
+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
+names as label names. For example defines a label called nop, whereas is a 6502 instruction. Full comment lines must start with a semicolon, a pipe or an asterisk,
+with optional label definition and spaces before. Here are examples
+of full comment lines: Lines with instructions (and some directives)
+may be repeated. A single line may be assembled several times,
+for example: 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. You may put two instructions on the same line.
+In this case they have the same operand. For example: is equivalent to Note that is allowed (#0 is a comment for tax). Expressions are numbers combined with operators and brackets.
You should use square brackets, because parentheses are reserved
-for 6502 indirect addressing.
-
-
-Assembling options
-Following options are supported:
-
-
+
-By default lines skipped due to false condition are not listed.
-label should be a valid label name.
-value may be any expression (it may use forward references
+
+
+
+NAME
+SYNOPSIS
+DESCRIPTION
+OPTIONS
+
+
-If source is incorrect, X-Asm stops on first encountered error.
-With this option, X-Asm sets two environment variables:
-ERRFILE and ERRLINE.
-They may be used in a batch file to locate error and set editor's
-insertion point on it. For example, you may create following batch file:
-XASM %1 /e
-IF NOT ERRORLEVEL 1 GOTO ok
-NCE +%ERRLINE% %ERRFILE%
-:ok
-
-NCE stands for Norton Classic Editor.
-This option is useful for the Code-Genie editor (see
-here), which can jump to the error location
-only if full path is given.Exit codes
-Meaning of exit codes returned by X-Asm:
-3 = bad parameters, assembling not started
-2 = error occured
-1 = warning(s) only
-0 = no errors, no warnings
-Listing structure
-A line of listing contains:
-
-
-
-Listed are also generated headers. A xxxx-yyyy> in place of origin
-counter represents generated header: $xxxx is the first and
-$yyyy is the last byte of the block.
-A FFFF> represents two $ff bytes written as a header prefix.
-A plus sign placed after hex numbers stands for more bytes written to object
-in this line, not listed through lack of space.
-Label table structure
-A line of label table contains:
-
-
-
-
-n - label defined but not used elsewhere
-2 - label value known in pass 2 only (label definition uses forward
-reference and thus you can't make forward references to that label)
-
-SYNTAX
-
-Fields
-Source code is line-oriented. Every line of source consists of fields.
-Same sequence of characters used in different fields has completely different meaning.
-Fields are separated with one or more blank characters.
-There can't be any space within a field, except for strings and comments.
-
-Every line of source must match one of two general forms:
-
-
-In the first form, both fields are optional. Blank lines are ignored of course.
-Comment must here start with one of these characters: ; | or *
-(semicolon, pipe or asterisk). Any information in the line following
-such character is ignored.Label field
-This field is optional. It must start at first character in line, without
-any blank characters before. The purpose of using label field is to define a label.
-Label is a symbol representing an integer of range -$ffff..$ffff.
-Name of a label may contain letters, digits and underscores (_).
-Digit can not be label's first character.
-Name of a label may be as long as you want and all the characters
-are meaningful. In Quick Assembler only 6 leading characters were recognized
-and some sources may not compile under X-Asm for this reason.
-Defining a label without using EQU makes it equal to current value
-of the origin counter.
-Labels can't be redefined.Repeat count
-Repeating means here assembling single line several times as if
-there were several identical lines. Note it is not just duplicating
-bytes written to the object file.
-Repeat count, which can be any valid expression, has to be preceded
-with a colon.
-Examples:
-:4 asl @
-:2 dta a(*)
-
-In the latter example each DTA has different operand value.
-If repeat count equals zero, remaining part of line is not assembled.
-This allows compact single-line conditional assembly.
-
-Instruction field
-If this is the first field in a line, the line must start with at least
-one blank character. Instruction field consists of one or two instructions.
-The latter case is called instructions pairing, because a pair
-of instructions have shared operand. You separate instructions
-with a colon.
-Example:
- adc:sta $80
-
is equivalent to
- adc $80
- sta $80
-
-Note that
- lda:tax $80
-
is correct, because $80 is a comment for TAX.
-
-
-Operand field
-Some instructions don't need any operand,
-other need two operands.
-6502 commands require operand with proper
-addressing mode.SYNTAX
+nop
+
nop
+
; this is a comment
+ * so it is
+label | and this too
+
+:4 asl @
+table :32*5 dta 5
+
+ lda foo ; this is a comment
+ sta bar so it is
+ tax #0 tax requires no operand, so #0 starts a comment
+
+ eor:sta foo
+
+ eor foo
+ sta foo
+
+ lda:tax #0
+
EXPRESSIONS
+Numbers
-Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff.
-A number may be:
| -12345 |
| $abcd |
| %10100101 |
| 'a' or "a" |
| * |
| ^4e |
-An abbreviation of Atari hardware register is provided to save you trouble of typing -two extra characters (^4e vs $d40e) and to support porting software -between Atari 8-bit computers and Atari 5200 console. These are very similar machines, -one of biggest differences is different location of hardware registers.- --
-
-(x is a hexadecimal digit). -- Syntax Chip -Value in Atari 8-bit -
computer mode (OPT G-)Value in Atari 5200 -
game console mode (OPT G+)- ^0x GTIA $d00x $c00x - ^1x GTIA $d01x $c01x - ^2x POKEY $d20x $e80x - ^3x PIA $d30x error (there's no PIA chip) - ^4x ANTIC $d40x $d40x
| {lda #0} |
-Single-byte op-code of the instruction inside braces (e.g. value of {nop} is $ea). -Operand is discarded and is necessary only for identifying addressing mode. -Instruction should begin just after the left brace and the right brace should -immediately follow the operand or the command.-
-You can skip the operand, if the addressing mode is fixed. -Examples:
-{lda #}, {jsr}, {bne}, {jmp ()}, -{sta a:,x}. -
-
-
-Operators
-Binary operators:
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Remainder |
& | Bitwise and |
| | Bitwise or |
^ | Bitwise xor |
<< | Arithmetic shift left |
>> | Arithmetic shift right |
= | Equal |
== | Equal (same as =) |
<> | Not equal |
!= | Not equal (same as <>) |
< | Less than |
> | Greater than |
<= | Less or equal |
>= | Greater or equal |
&& | Logical and |
|| | Logical or |
+ | Plus (does nothing) |
- | Minus (changes sign) |
~ | Bitwise not (complements all bits) |
! | Logical not (changes true to false and vice versa) |
< | Low (extracts low byte) |
> | High (extracts high byte) |
-Operator precedence:
-
first | [] | (brackets) |
+ - ~ < > | (unary) | |
* / % & << >> | (binary) | |
+ - | ^ | (binary) | |
= == <> != < > <= >= | (binary) | |
! | (unary) | |
&& | (binary) | |
last | || | (binary) |
-Note that although the operators are similar to these used in C, C++ and Java, -their priorities are different than in these languages.
-Compare and logical operators assume that zero is false and a non-zero is true. -They return 1 for true.
-While calculating expression, signed 32-bit arithmetic is used. When range of 32 bits -is exceeded, 'Arithmetic overflow' error is generated.
- -
Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff. +A number may be:
+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.
+Syntax | Chip | +Value in the Atari 8-bit computer mode (opt g-) |
+Value in the Atari 5200 game console mode (opt g+) |
+
---|---|---|---|
^0x | GTIA | +$D00x | $C00x |
^1x | GTIA | +$D01x | $C01x |
^2x | POKEY | +$D20x | $E80x |
^3x | PIA | +$D30x | error (there's no PIA chip) |
^4x | ANTIC | +$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 left brace and the right brace should immediately follow the operand +or the instruction. +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. +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 ++
The follownig binary operators are supported:
+The following unary operators are supported:
+The operator precedence is following:
+first | [] | +(brackets) |
+ - ~ < > | +(unary) | |
* / % & << >> | +(binary) | |
+ - | ^ | +(binary) | |
= == <> != < > <= >= | +(binary) | |
! | +(unary) | |
&& | +(binary) | |
last | || | +(binary) |
Note that although the operators are similar to those used in C, C++ +and Java, their priorities are different than in these languages.
+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.
+five equ 5 +five equ 5 here equ * -- - -- OPT - set assembly options -
- Five options are available: -
-
-You can turn any of these on or off.- F - fill space between ORGs -(details here) -
- G - Atari 5200 mode for hardware register abbreviations -(details here) -
- H - generate Atari executable headers -
- L - generate listing -
- O - generate object file -
-Default (if no OPT specified) is opt f-g-h+l+o+.
+
opt l- listing off - opt l+o- listing on, object file off - opt f+g+h- useful for Atari 5200 cartridges - raw output format, 5200 hw regs -- - -
opt l- listing off + opt l+o- listing on, object file off + opt f+g+h- useful for Atari 5200 cartridges - raw output format, 5200 hw regs +
org $600 ++In the latter example table points to 100 bytes +of uninitialized data (label is assigned to * +before the ORG directive is executed). +org $600 org f:$700 table org *+100 --In the latter example table points to 100 bytes -of uninitialized data (label is assigned to * -before ORG directive is executed).+
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. +Example:
+org $8000 + ldx #code_length-1 + mva:rpl code_loaded,x z:code_zpage,x- + jmp code_zpage - -+- DTA - define data -
- There are various data types: -
-
- integers -
-
+code_loaded + org r:$30 +code_zpage + jmp * ; ... or something more sensible +code_length equ *-code_zpage +- bytes: b(200) or simply 200 -
- words: a(10000) -
- low bytes of words: l(511) defines byte 255 -
- high bytes of words: h(511) defines byte 1 -
Note that both * and label definitions use the counter used +for code generation. There is no direct access to the other counter, +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 +
-
-
-
+represented by two succesive quotation marks.
+Placing a * character after a string inverts +the highest bit in every byte of the string. + +Examples of DTA: +dta b(1,2),3,a(1000,-1),l(12345,sin(0,127,256)) dta d"ANTIC"*,c'It''s a string',$9b -- -
+
+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 addr -+ ins 'file',-256 insert last 256 bytes of file + ins 'file',10,10 insert bytes 10..19 of file +
run addr +is equivalent to: -
org $2e0 +org $2e0 dta a(addr) --Examples: -run start - run main -- -
ini init - ini showpic -- -
ert *>$c000 - ert len1>$ff||len2>$ff -- - -
noscr equ 1 +run main +
ini showpic +
ert *>$c000 + ert len1>$ff||len2>$ff +
noscr equ 1 widescr equ 1 ift noscr lda #0 @@ -676,139 +417,125 @@ widescr equ 1 lda #$22 eif sta $22f --Above example can be rewritten using line repeating feature: -
noscr equ 1 ++The above example can be rewritten using the line repeating feature: +
noscr equ 1 widescr equ 1 :noscr lda #0 :!noscr&&widescr lda #$23 :!noscr&&!widescr lda #$22 sta $22f -- -
-
- -
Pseudo-commands are built-in macros.
+ldx #0 +The example code copies memory $500-$5ff to $600-$6ff. Here is the same written with standard 6502 commands only: -ldx #0 mva:rne $500,x $600,x+ -+
ldx #0 +ldx #0 loop lda $500,x sta $600,x inx bne loop -- -
lda #40 +lda #40 add:sta $80 scc:inc $81 --In the above example word-size variable $80 is incremented by 40.
-Nor conditional repeat nor skip pseudo-commands require operand, -thus they can be paired with any other command.- -
jne dest -is equivalent to: -
seq:jmp dest -- -
jne dest +is equivalent to: +
seq:jmp dest +
inw dest -is equivalent to: -
inc dest +inw dest +is equivalent to: +inc dest sne:inc dest+1 -- -
mva source dest = lda source : sta dest +mva source dest = lda source : sta dest mvx source dest = ldx source : stx dest mvy source dest = ldy source : sty dest -- - -- 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 low byte, and the other to move high byte.
+
-You can't use indirect nor pseudo addressing mode with MW*. -Destination must be absolute address (optionally indexed).
-When source is also absolute, a mw* source dest will be: -mv* source dest +- 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: +mv* source dest mv* source+1 dest+1 --When source is an immediate, a mw* #immed dest will be: -mv* <immed dest ++When source is an immediate, an mw* #immed dest will be: +mv* <immed dest mv* >immed dest+1 --When <immed equals >immed and immed -is not forward-referenced, X-Asm uses optimization: -mv* <immed dest ++When <immed equals >immed and immed +is not forward-referenced, xasm uses an optimization: +mv* <immed dest st* dest+1 --If possible, MWX and MWY use increment/decrement -commands. E.g. mwx #1 dest is assembled as: -mvx #1 dest ++If possible, MWX and MWY use increment/decrement +commands. E.g. mwx #1 dest is assembled as: +ldx #1 + stx dest dex stx dest+1 -
- -There are two extra immediate addressing modes: -< and >, -which use low/high byte of 16-bit word constant. + + +
All addressing modes are entered in the standard 6502 convention except for +the accumulator addressing mode, which should be marked with +the @ character (as in Quick Assembler).
+There are two extra immediate addressing modes:
+< and >,
+which use the low/high byte of a 16-bit word constant.
They are for Quick Assembler compatibility.
-You can use traditional #< and #>.
-Note
- -In absolute addressing modes, X-Asm examines the expression and uses zero-page -addressing mode if it supposes it's possible. You may override it with -a: and z: prefixes.
- -Examples: -
+You can use traditional #< and #>. +Note 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.
+Examples:
+nop asl @ lda >$1234 assembles to lda #$12 @@ -816,89 +543,157 @@ Examples: lda a:0 generates 16-bit address jmp ($0a) lda ($80),y -- -There are also pseudo addressing modes, which are similar to +
There are also 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: -
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 +2 --A: X-Asm treats space as operand terminator. Remaining part of line -is a comment. You should write 1+2 without any spaces.
- -
-A: < and > are not only 'low' and 'high' -operators, but also 'low of immediate' and 'high of immediate' -addressing modes indicators. -In order to get lda $ab, write lda +>$abcd
- -
-A: You must use @ for accumulator addressing mode.
- -
label: lda #0 --A: 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 1 --while this does: -
-two equ one+one -one equ 1 --A: 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 pass --These values can be fixed in two passes.
three equ one+two --X-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 on the first one.
- -
Back - \ No newline at end of file +MWA, MWX and MWY:
+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 ++
ift 0 +:label nop + eif ++reported Label not defined before error for the repeat count
ift 0 +label + eif ++reported No ORG specified error for the label definition
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/doc/xboot.htm b/doc/xboot.htm deleted file mode 100644 index 7117eff..0000000 --- a/doc/xboot.htm +++ /dev/null @@ -1,98 +0,0 @@ - - --XBOOT [/p] obxfiles [atrpath][atrfile]
-Parameters in brackets are optional.
-If file name extension is omitted, the default .OBX or .ATR is added. -If no atrpath is given, disk images are written by default in -the directory where executables are.
-If file name contains spaces, you should enclose it in quotation marks.
-/p switch (or equivalent -p) forces writing 'professional -loader', which allows you to load code/data intro the RAM under ROM and starts -the program with disabled ROM and interrupts. By default, standard loader is -used, which can load any Atari executable not demanding DOS nor any special -loader.
-Both loaders disable Atari Basic, so you don't need to hold the OPTION key -while booting.
-Below are some examples:
-
-X-BOOT does not store the executable file in ATR as an Atari file. -You can't read it from an Atari DOS nor extract it somehow or other. -You can only run it by booting.
-For more details, read source files of the loaders: -
Back
-
-
\ No newline at end of file
diff --git a/doc/xbootpro.asx b/doc/xbootpro.asx
deleted file mode 100644
index 1a79b61..0000000
--- a/doc/xbootpro.asx
+++ /dev/null
@@ -1,64 +0,0 @@
-* Boot executable file loader coded by Fox/Taquart
-* Reads file from ATR prepared with X-BOOT.
-* Professional version - can load file under ROM.
-* Interrupts and ROM are disabled when running loaded program.
-
- opt h-
- org $480
-
-bufr equ $400 128-byte buffer
-
-tp equ $43 Temporary byte
-vc equ $44 Start and end vectors (4 bytes)
-
-* Boot code
-boot dta b(0,1),a(boot,$e477) Boot header
- mva #0 $22f Make screen blank...
- mva #$52 $2c8 ... and pink ;)
- lda 20 Wait for VBLK
- cmp:req 20
- mwa #rts $2e0 Set default run vector
- dta b({lda a:0}) Skip two bytes
-secrts sec Return with error
-rts rts
- mva:pha >rts $2e3 Set init address...
- mva:pha
-Important note: X-HEAD is an extremely simple tool. Jindrich Kubec
-wrote a tool with similar purpose, but much more features (disassembly
-in different formats, including X-Assembler), called ChkExe.
-You can find it on
-http://jindroush.atari.org.
-
-X-HEAD will read the file and display its headers in following format:
-
-The summary includes:
-All displayed numbers are hexadecimal, of course.
- Back
-
-
\ No newline at end of file
diff --git a/doc/xload.htm b/doc/xload.htm
deleted file mode 100644
index 64f3395..0000000
--- a/doc/xload.htm
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-It is experimental version. I'm not sure if it will work
-with every hardware. I've noticed it is not stable and sometimes
-transmission can hang or distortions in loaded data may appear.
-The reason is that there is no error-checking, while transmission is
-fast (57.6 kbits/sec).
-
-
-
-
-While loading, PC prints memory locations, which the program loads into.
-After the program is loaded and run, X-LOAD terminates. You may exit it
-earlier at any time by pressing the ESC key.
-
-
-While booting, X-LOAD accepts two commands for disk drive 1:
-
-The transmission protocol is very simple: Atari sends a byte to inform that
-it is ready for receiving data. Then PC sends a 3-byte header and a block
-of data. First two bytes of the header are the high and the low byte of the
-address of the last byte in the block minus $ff. Third byte equals low byte
-of ($100-block_length). Then come block data, which are loaded directly
-into their memory locations.
-For more details, view source files of the loaders:
- Back
-
-
\ No newline at end of file
diff --git a/doc/xloadpro.asx b/doc/xloadpro.asx
deleted file mode 100644
index c86a7e4..0000000
--- a/doc/xloadpro.asx
+++ /dev/null
@@ -1,60 +0,0 @@
-* Boot executable file loader coded by Fox/Taquart
-* Receives file from X-LOAD via SIO2PC interface.
-* Professional version - can load file under ROM.
-* Interrupts and ROM are disabled when running loaded program.
-
- opt h-
- org $400
-
-* Boot code
-boot dta b(0,1),a(boot) Boot header
-arts dta a(rts)
-
- dta b({lda #$60}) Skip rts
-rts rts
-
- sei Disable interrupts
- inc ^4e
- inc ^40 Make screen blank
- mva #$08 ^24 Set transmission speed
- mva #$00 ^26
- mva #$28 ^28
- sta ^29 Reset counters
- mva #$23 ^2f Send enable
- sta ^2d Send a byte
-wait sta ^4a Wait until sent
- asl @
- bcc wait
- mva #$13 ^2f Receive enable
- ldy #2
-head jsr get Receive address (high/low byte)
- sta stor,y
- mva arts-1,y $2e2-1,y Set init address
- pha Put return address on stack
- dey
- bne head
- jsr get Receive length (one byte)
- tax
-load jsr get Receive data
-stor sta a:0,x+ Store in memory
- bne load
- mva $10 ^2e Reset POKEY
- mva #3 ^2f
-init jmp ($2e2) Call init routine
-
-get lda #$20 Function: Receive one byte
- sta ^2e Enable receive interrupt
- bit:rne ^2e Wait for interrupt request
- sty ^2e Disable receive interrupt
- lda ^2d Get byte
- rts
-
-:boot+$80-* dta b(0) Padd with zeros to full sector
-
-* X-LOAD adds this block at the end of loaded file
-* It changes jmp ($2e2) to jmp ($2e0)
- opt h+
- org init+1
- dta l($2e0)
-
- end
\ No newline at end of file
diff --git a/doc/xloadstd.asx b/doc/xloadstd.asx
deleted file mode 100644
index 258e18d..0000000
--- a/doc/xloadstd.asx
+++ /dev/null
@@ -1,60 +0,0 @@
-* Boot executable file loader coded by Fox/Taquart
-* Receives file from X-LOAD via SIO2PC interface.
-* Standard loader - ROM and interrupts enabled while running loaded program.
-
- opt h-
- org $700
-
-* Boot code
-boot dta b(0,1),a(boot) Boot header
-arts dta a(rts)
-
- dta b({lda #$60}) Skip rts
-rts rts
-
- sei Disable interrupts
- inc ^4e
- mva #$08 ^24 Set transmission speed
- mva #$00 ^26
- mva #$28 ^28
- sta ^29 Reset counters
- mva #$23 ^2f Send enable
- sta ^2d Send a byte
-wait sta ^4a Wait until sent
- asl @
- bcc wait
- mva #$13 ^2f Receive enable
- ldy #2
-head jsr get Receive address (high/low byte)
- sta stor,y
- mva arts-1,y $2e2-1,y Set init address
- pha Put return address on stack
- dey
- bne head
- jsr get Receive length (one byte)
- tax
-load jsr get Receive data
-stor sta a:0,x+ Store in memory
- bne load
- mva $10 ^2e Reset POKEY
- mva #3 ^2f
- lsr ^4e Enable interrupts
- cli
-init jmp ($2e2) Call init routine
-
-get lda #$20 Function: Receive one byte
- sta ^2e Enable receive interrupt
- bit:rne ^2e Wait for interrupt request
- sty ^2e Disable receive interrupt
- lda ^2d Get byte
- rts
-
-:boot+$80-* dta b(0) Padd with zeros to full sector
-
-* X-LOAD adds this block at the end of loaded file
-* It changes jmp ($2e2) to jmp ($2e0)
- opt h+
- org init+1
- dta l($2e0)
-
- end
\ No newline at end of file
diff --git a/file_id.diz b/file_id.diz
deleted file mode 100644
index d085cd9..0000000
--- a/file_id.diz
+++ /dev/null
@@ -1,5 +0,0 @@
---== xasm 2.5.2: second final edition ==--
-interactive visual development environment
- only for 8-bit Atari programming gurus
-
- requirements: 386 + DOS or Windows
diff --git a/fox.mak b/fox.mak
deleted file mode 100644
index 17a0fdd..0000000
--- a/fox.mak
+++ /dev/null
@@ -1,248 +0,0 @@
-;b. Fox/Tqa
-
-eol equ 13,10
-eot equ 13,10,'$'
-
-;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
-
-MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
-_rge SUBSTR <_rg>, 1, 1
-IFIDNI _rge,
-xasm is a set of a few tools for developing software for Atari 8-bit computers
-on a PC with MS-DOS or Windows.
-Download (38 KB) |
-Browse documentation on-line |
-E-mail me
-
-
-News:
-
-Features of the assembler:
- xasm is a 6502 cross-assembler for DOS/Windows.
+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. Download version 2.6.0
+(22 KB, includes full documentation) xasm no longer includes the tools X-BOOT, X-LOAD and X-HEAD.
+If you really need them,
+download version 2.5.2 (38 KB). xasm is for people who are fluent in the 6502 assembly language.
+There is no sample code for beginners, no easy-to-use libraries.
+You are warned that programming 8-bit machines in the assembly language
+is a tedious work. There are several 6502 cross-assemblers to choose from and new ones
+still appear. Just search the web. Make sure to not overlook
+the cc65 compiler which includes
+a cross-assembler, portable across many host and target platforms. 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): And here is the same code rewritten in a xasm-specific way: 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: Hosted by Atari AreaX-HEAD version 1.1
-
-INTRODUCTION
-This tool prints headers of an Atari executable file.
-It shows, into which memory areas the file loads,
-and what are init and run addresses.CHANGES
-Version 1.1
-
-
-Version 1.0
-
-
-
-
-USAGE
-Simply run X-HEAD with executable filename. No options are supported. bbbb-eeee xxxx
-where bbbb is the begin, eeee - the end of the block,
-and xxxx is the execution (init or run) address.
-xxxx bytes - length of file, including headers
-xxxx blocks - number of headers
-xxxx inits - number of init blocks (02e2-02e3)
-xxxx modules - number of FFFF headers (one at the beginning is required)X-LOAD version 1.1
-
-INTRODUCTION
-This tool may be used to load an Atari executable file, stored on the PC,
-into a real Atari computer, via the SIO2PC interface.
-Only data input and data output lines are used, so X-LOAD should work
-with all types of the interface.CHANGES
-Version 1.1
-
-
-Version 1.0
-
-
-
-
-USAGE
-You should pass as the parameters the executable file name and optionally
-the options:
-
-After you run X-LOAD, you only have to boot your Atari and the program
-will be loaded and run.
-DETAILS
-First, X-LOAD sends a byte to Atari and then waits until the Atari is booted.
-The byte can be used to detect from Atari, that PC is ready for transmission.
-When you are testing your program, you may code periodic checking
-if a byte was received, and performing cold reset in that case.
-So you don't need to touch your Atari to run your program on it.
-
-After the Atari receives and runs the loader, the transmission runs at 57600
-bits/sec.
-
-You may have noticed that X-LOAD is somehow similar to X-BOOT, which also
-has two loaders. The main difference is that X-BOOT loaders use system
-routines to get sectors at regular speed of 19200 bits/sec.
-They use sector buffer and require some low memory locations not to be altered
-because of Atari operating system. In this respect X-LOAD loaders are better,
-because they allow loading into whole memory except for the loader code.
-
-
-
-
-
-
-
-
-
-
-
-
-
-xasm.atari.org
+Target audience
+Features
+
+ 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
+
+
+ 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
+
+