xasm 3.0.1 release.

This commit is contained in:
Piotr Fusik 2007-04-22 21:16:22 +02:00
parent 66501ef2fd
commit fa25272ccd
15 changed files with 251 additions and 850 deletions

View File

@ -1,136 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Configuring editors for xasm</title>
<meta name="Author" content="Piotr Fusik"/>
</head>
<body>
<h2>How to configure a text editor for a convenient use of xasm</h2>
<p>This document describes, how to setup a text editor to:</p>
<ul>
<li>highlight xasm mnemonics</li>
<li>invoke the assembler with a single keystroke</li>
<li>place the cursor where an assembly error occured</li>
</ul>
<p>Of course these features are not available in the <i>Windows Notepad</i>,
so you must pick another text editor. Fortunately there are many
general-purpose text editors for Windows. I'll focus on the following:</p>
<ul>
<li><i>EditPlus</i>
(<a href="http://www.editplus.com">www.editplus.com</a>)</li>
<li><i>ConTEXT</i>
(<a href="http://www.context.cx">www.context.cx</a>)</li>
<li><i>Code-Genie</i>
(<a href="http://www.code-genie.com">www.code-genie.com</a>,
looks like the editor is no longer supported)</li>
<li><i>PSPad</i>
(<a href="http://www.pspad.com">www.pspad.com</a>)</li>
<li><i>Programmers Notepad 2</i>
(<a href="http://www.pnotepad.org">www.pnotepad.org</a>)</li>
<li><i>Crimson Editor</i>
(<a href="http://www.crimsoneditor.com">www.crimsoneditor.com</a>)</li>
<li><i>SciTE</i>
(<a href="http://www.scintilla.org">www.scintilla.org</a>),
also available for Linux</li>
</ul>
<h3>Highlighting xasm mnemonics</h3>
<p>In the <tt>syntax</tt> subdirectory you'll find xasm syntax definitions
for all of these editors.</p>
<ul>
<li><i>EditPlus</i>:
Select <b>Tools/Preferences</b>, then <b>Files/Settings &amp; syntax</b>,
then <b>Add</b>. Type <b>Description</b> (<tt>xasm</tt>),
<b>File extensions</b> (<tt>asx</tt>), click <b>...</b> next to <b>Syntax
file</b> and locate the <tt>xasm.stx</tt> file. Then click
<b>Syntax colors</b> and select your favourite colors.</li>
<li><i>ConTEXT</i>: Just copy <tt>xasm.chl</tt>
to the <tt>Highlighters</tt> subdirectory of the <i>ConTEXT</i>
directory.</li>
<li><i>Code-Genie</i>:
Copy <tt>xasm.cgsyn</tt> to the <tt>syn</tt> subdirectory in the
<i>Code-Genie</i> directory. Edit <tt>cgenie.conf</tt>, you can do it by
selecting <b>View/Settings</b>. Type:<br/>
<tt>DefaultSyntax&nbsp;xasm&nbsp;asx</tt><br/>
near other <tt>DefaultSyntax</tt> lines.</li>
<li><i>PSPad</i>: Copy <tt>xasm.ini</tt> to the
<tt>Syntax</tt> subdirectory of the <i>PSPad</i> directory. Edit
<tt>PSPad.ini</tt>. In the <tt>[Config]</tt> section set:<br/>
<tt>UserHighLighterName=xasm</tt><br/>
In the <tt>[General]</tt> section set:
<pre>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
</pre></li>
<li><i>Programmers Notepad 2</i>: Copy <tt>xasm.scheme</tt>
to the <tt>schemes</tt> subdirectory of the <i>Programmers Notepad</i>
directory. You have to select the xasm scheme each time you open a source
file, as I don't know how to associate the scheme with the <tt>asx</tt>
extension.</li>
<li><i>Crimson Editor</i>: Copy <tt>xasm.key</tt>
and <tt>xasm.spc</tt> to the <tt>spec</tt> subdirectory
of the <i>Crimson Editor</i>. Copy <tt>extension.asx</tt> to the <tt>link</tt>
subdirecory of the <i>Crimson Editor</i>.</li>
<li><i>SciTE</i>: Copy <tt>xasm.properties</tt> to the <i>SciTE</i> directory.
Add the following line to <tt>menu.language</tt> in <tt>SciTEGlobal.properties</tt>:
<pre>xasm|asx||\
</pre>
Add the following line at the end of <tt>SciTEGlobal.properties</tt>:
<pre>import xasm
</pre></li>
</ul>
<h3>Single-keystroke assembly</h3>
<ul>
<li><i>EditPlus</i>: Select <b>Tools/Configure User Tools</b>.
Then click <b>Add Tool</b>, type <b>Menu text</b> (<tt>xasm</tt>),
<b>command</b> (path to <tt>xasm.exe</tt>), <b>Argument</b>
(<tt>$(FilePath)</tt>) and <b>Initial directory</b>
(<tt>$(FileDir)</tt>). Check <b>Capture output</b>.</li>
<li> <i>ConTEXT</i>: Select <b>Options/Environment Options</b>, then
the <b>Execute Keys</b> tab. Click <b>Add</b>, type <tt>asx</tt>, click
e.g. <b>F9</b>, locate <tt>xasm.exe</tt> by pressing the <tt>...</tt> button
in the top-right corner. Type <b>Start in</b> (<tt>%p</tt>)
and <b>parameters</b> (<tt>%n</tt>). Check <b>Use short DOS names</b>
and <b>Capture console output</b>.
Type <b>Compiler output parser rule</b> (<tt>%n (%l)</tt>).</li>
<li><i>Code-Genie</i>: Select <b>View/Settings</b>, type:<br/>
<tt>AddUserTool&nbsp;xasm&nbsp;xasm.exe&nbsp;/p\s$FP&nbsp;CaptureOutput&nbsp;$FD</tt><br/>
near other <tt>AddUserTool</tt> lines (if <tt>xasm.exe</tt> is not on your
<tt>PATH</tt>, then you must type full path to it).</li>
<li><i>PSPad</i>: Edit the <tt>[General]</tt> section of <tt>PSPad.ini</tt>:
<pre>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
</pre>
(replace the paths to xasm and the emulator).</li>
<li> <i>Programmers Notepad 2</i>: Select <b>Tools/Add tools</b>. Select
<b>Scheme</b>: <tt>xasm</tt>. Click <b>Add</b>. Fill: <b>Name</b>,
<b>Command</b>, <b>Folder</b> (<tt>%d</tt>) and <b>Parameters</b> (<tt>%f</tt>).
For error parsing, you should fill a custom pattern on the <b>Console I/O</b>
tab. However, PN 2.0.5.48 <b>crashes</b> when entering <tt>"("</tt> !</li>
<li> <i>Crimson Editor</i>: Select <b>Tools/Conf. User Tools</b>. Select
an empty slot, fill <b>Menu Text</b>, <b>Command</b>, <b>Argument</b>
and <b>Initial Dir</b>. Check <b>Capture output</b>.</li>
<li> <i>SciTE</i>: The configuration is already in <tt>xasm.properties</tt>.</li>
</ul>
<h3>Placing the cursor where an assembly error occured</h3>
<p>This works same for all these editors: just double-click the line
with the error message.</p>
</body>
</html>

View File

@ -1,2 +0,0 @@
LANGSPEC:XASM.SPC
KEYWORDS:XASM.KEY

View File

@ -1,56 +0,0 @@
# xasm syntax for Code-Genie 3.0 (www.code-genie.com)
# written by Piotr Fusik <fox@scene.pl>
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

View File

@ -1,55 +0,0 @@
// xasm highlighter for ConTEXT v0.97.1 (www.fixedsys.com/context)
// written by Piotr Fusik <fox@scene.pl>
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

View File

@ -1,134 +0,0 @@
# xasm highlighter for PSPad 4.2.1 (pspad.zde.cz)
# written by Piotr Fusik <fox@scene.pl>
[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=

View File

@ -1,17 +0,0 @@
[-COMMENT-:GLOBAL]
# xasm keyword file for Crimson Editor (www.crimsoneditor.com)
# written by Piotr Fusik <fox@scene.pl>
[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

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- xasm scheme for Programmers Notepad 2 (http://www.pnotepad.org)
Written by Piotr Fusik <fox@scene.pl>
-->
<Scheme>
<keyword-classes>
<keyword-class name="xasm">
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
</keyword-class>
</keyword-classes>
<language name="xasm" title="xasm">
<lexer name="asm"/>
<use-keywords>
<keyword key="0" name="Keywords" class="xasm"/>
</use-keywords>
<use-styles>
<style name="Default" key="32" font="font.monospace"/>
<style name="Comment" key="1" class="comment"/>
<style name="String" key="3" class="string"/>
<style name="Operator" key="4" class="operator"/>
<style name="Keyword" key="6" class="keyword"/>
<style name="Char" key="12" class="char"/>
<style name="Error" key="13" class="error"/>
</use-styles>
</language>
</Scheme>

View File

@ -1,14 +0,0 @@
# xasm specification file for Crimson Editor (www.crimsoneditor.com)
# written by Piotr Fusik <fox@scene.pl>
$CASESENSITIVE=NO
$DELIMITERS=~`!@#$%^&*()+=|{}[]:;"',.<>/?
$QUOTATIONMARK1="
$QUOTATIONMARK2='
$LINECOMMENT=;
$LINECOMMENT2=*
$INDENTATIONON=
$INDENTATIONOFF=
$PAIRS1=()
$PAIRS2=[]
$PAIRS3={}

View File

@ -1,133 +0,0 @@
#TITLE=xasm
; xasm syntax file for EditPlus 2.11 (www.editplus.com)
; written by Piotr Fusik <fox@scene.pl>
#DELIMITER=+-*/%&|^!~=<>()[]{},:"#
#QUOTATION1='
#QUOTATION2="
#CONTINUE_QUOTE=n
#LINECOMMENT=;
#LINECOMMENT2=^!*
#COMMENTON=
#COMMENTOFF=
#COMMENTON2=
#COMMENTOFF2=
#ESCAPE=
#CASE=n
#PREFIX1=
#PREFIX2=
#PREFIX3=
#PREFIX4=
#PREFIX5=
#SUFFIX1=
#SUFFIX2=
#SUFFIX3=
#SUFFIX4=
#SUFFIX5=
#KEYWORD=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
#

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,102 +1,105 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>xasm</title>
<meta name="Description" content="xasm is a 6502 cross-assembler for DOS/Windows/Linux."/>
<meta name="Keywords" content="xasm,6502,cross-assembler,atari"/>
<meta name="Author" content="Piotr Fusik"/>
<style type="text/css">
body { background-color: #c0f0c0; color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; }
h1 { background-color: #008080; color: #ffffff; padding-left: 10px; }
h3 { background-color: #008080; color: #ffffff; padding-left: 10px; }
th { background-color: #008080; color: #ffffff; }
table { margin-bottom: 12px; }
td { background-color: #40a090; color: #ffffff; text-align: left; padding-left: 10px; padding-right: 10px; }
td a { color: #ffffff; }
hr { color: #008080; height: 5px; }
</style>
</head>
<body>
<h1>xasm.atari.org</h1>
<p><b>xasm</b> 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.
<b>xasm</b> is freeware.</p>
<p>Version 3.0.0 is a complete rewrite from the x86 assembly language
to the <a href="http://www.digitalmars.com/d">D programming language</a>.
<b>xasm</b> is now available for Linux.</p>
<h3>Features</h3>
<p>Although <b>xasm</b> does not support user-defined macros, it has a rich
set of built-in facilities.</p>
<p>Here is some typical 6502 code (also valid in <b>xasm</b>):</p>
<pre>
lda #&lt;dest
sta ptr
lda #&gt;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
</pre>
<p>And here is the same code rewritten in a xasm-specific way:</p>
<pre>
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
</pre>
<h3>Usage</h3>
<p>Although <b>xasm</b> 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:</p>
<p><img src="cgenie.gif" alt="6502 code in Code-Genie"/></p>
<h3>Download</h3>
<div style="text-align: center">
<table>
<tr><th>File</th><th>Size</th><th>Description</th></tr>
<tr><td><a href="xasm-3.0.0-win32.zip">xasm-3.0.0-win32.zip</a></td>
<td style="text-align: right">98 KB</td><td>xasm 3.0.0 for Windows</td></tr>
<tr><td><a href="xasm-3.0.0-linux.tar.gz">xasm-3.0.0-linux.tar.gz</a></td>
<td style="text-align: right">128 KB</td><td>xasm 3.0.0 for Linux</td></tr>
<tr><td><a href="xasm-3.0.0-src.zip">xasm-3.0.0-src.zip</a></td>
<td style="text-align: right">16 KB</td><td>xasm 3.0.0 source code</td></tr>
<tr><td><a href="xasm261.zip">xasm261.zip</a></td>
<td style="text-align: right">25 KB</td><td>xasm 2.6.1 for DOS/Windows</td></tr>
<tr><td><a href="xasm252.zip">xasm252.zip</a></td>
<td style="text-align: right">38 KB</td><td>xasm 2.5.2 for DOS/Windows (includes
X-BOOT, X-LOAD and X-HEAD)</td></tr>
</table>
</div>
<h3>Links</h3>
<ul>
<li><a href="http://www.cc65.org">cc65</a></li>
<li><a href="http://g2f.atari8.info/mads/">Mad-Assembler</a></li>
<li><a href="http://www.npsnet.com/danf/cbm/cross-development.html">6502
Cross-Development Languages and Tools List</a></li>
</ul>
<hr/>
<p><i>Hosted by <a href="http://atariarea.histeria.pl">Atari Area</a></i></p>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>xasm</title>
<meta name="Description" content="xasm is a 6502 cross-assembler for Windows and Linux." />
<meta name="Keywords" content="xasm,6502,cross-assembler,atari,8-bit" />
<meta name="Author" content="Piotr Fusik" />
<style type="text/css">
body { background-color: #f8f8f8; color: black; font-family: sans-serif; }
h1 { color: #20a0a0; border-bottom: solid 3px #d0d0d0; }
h2 { color: #20a0a0; border-bottom: solid 2px #d0d0d0; }
</style>
</head>
<body>
<h1>xasm - 6502 cross-assembler</h1>
<p>xasm is a free tool for programming old 8-bit computers based on the 6502 processor.</p>
<h2>History</h2>
<p>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
<a href="http://www.digitalmars.com/d">D programming language</a>.
The rewrite introduced a bug, hopefully fixed in version 3.0.1
released 22nd April 2007.</p>
<h2>Syntax</h2>
<p>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):</p>
<pre>
lda #&lt;dest
sta ptr
lda #&gt;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
</pre>
<p>Using xasm features this code can be rewritten to:</p>
<pre>
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
</pre>
<h2>Usage</h2>
<p>xasm is a command-line tool so you additionally need a general-purpose text editor.
I use <a href="http://www.scintilla.org/SciTE.html">SciTE</a>.
Syntax highlighting definition for it is included with xasm.
To install it, copy <em>xasm.properties</em> to the SciTE directory,
select <em>Options / Open Global Options File</em>, type <kbd>import xasm</kbd>
at the end and save the global configuration file.</p>
<p><img src="scite.png" alt="xasm code in SciTE" /></p>
<h2>Download</h2>
<ul>
<li><a href="xasm-3.0.1-win32.zip">xasm 3.0.1 for Windows</a></li>
<li><a href="xasm-3.0.1-src.zip">xasm 3.0.1 source code</a></li>
<li><a href="xasm261.zip">xasm 2.6.1 for DOS/Windows</a></li>
</ul>
<p>For other systems, such as GNU/Linux and MacOS X, install the latest D compiler
and compile xasm from source code.</p>
<h2>Inflate</h2>
<p>Need a good decompression routine for 6502?
See my <a href="inflate.html">inflate routine</a>.</p>
<h2>Links</h2>
<ul>
<li><a href="http://atari800.sourceforge.net/">Atari800 emulator</a></li>
<li><a href="http://sources.pigwa.net/">Atari XL/XE Source Archive</a></li>
<li><a href="http://www.cc65.org/">cc65 cross-compiler</a></li>
<li><a href="http://epi.atari8.info/hcasm.php">HardCore Assembler</a></li>
<li><a href="http://mads.atari8.info/">Mad-Assembler</a></li>
</ul>
</body>
</html>

BIN
www/scite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

83
xasm.d
View File

@ -1,11 +1,10 @@
// xasm 3.0.0 by Piotr Fusik <fox@scene.pl>
// 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 <fox@scene.pl>
// 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;

View File

@ -1,8 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>xasm 3.0.0</title>
<title>xasm 3.0.1</title>
<meta name="Author" content="Piotr Fusik"/>
</head>
<body>
@ -20,9 +20,8 @@ the <tt>.obx</tt> extension.</p>
<h2>OPTIONS</h2>
<dl>
<dt><tt>/c</tt></dt>
<dd>Enable listing false conditionals.
Lines skipped due to a false condition are not listed by default.</dd>
<dt><a name="new_deflabel"/><tt>/d:label=value</tt></dt>
<dd>List lines skipped due to a false condition.</dd>
<dt><a id="new_deflabel"/><tt>/d:label=value</tt></dt>
<dd>Define a label.
<tt>label</tt> should be a valid label name.
<tt>value</tt> may be any expression (it may use forward references
@ -30,49 +29,42 @@ to labels defined in the source file).
You may use several <tt>/d</tt> options to define many labels
from the command line.</dd>
<dt><tt>/i</tt></dt>
<dd>Disable listing included sources. Only main source file will be
listed.</dd>
<dd>Do not list included files. Only main source file will be listed.</dd>
<dt><tt>/l[:filename]</tt></dt>
<dd>Enable listing. If no <tt>filename</tt> is given, the listing is written
<dd>Generate a listing. If no <tt>filename</tt> is given, the listing is written
to <tt>source.lst</tt>, where <tt>source</tt> is the name of the source file
(without the extension).</dd>
without the extension.</dd>
<dt><tt>/o:filename</tt></dt>
<dd>Specify object file name. The default is <tt>source.obx</tt>.
<dd>Set object file name. The default is <tt>source.obx</tt>.
You may use the null device (<tt>/o:nul</tt>) to generate no object file.</dd>
<dt><a name="new_fullpaths"/><tt>/p</tt></dt>
<dt><a id="new_fullpaths"/><tt>/p</tt></dt>
<dd>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.</dd>
<dt><a name="new_quiet"/><tt>/q</tt></dt>
This option works only on Windows and is silently ignored on other platforms.</dd>
<dt><a id="new_quiet"/><tt>/q</tt></dt>
<dd>Suppress info messages.
Prevents <b>xasm</b> 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.</dd>
Quiet mode. Prevents <b>xasm</b> from printing the logo and the summary.</dd>
<dt><tt>/t[:filename]</tt></dt>
<dd>List label table. If no <tt>filename</tt> given, the table is appended
<dd>List label table. If <tt>filename</tt> is omitted then the table is appended
to the listing.</dd>
<dt><a name="new_unlabels"/><tt>/u</tt></dt>
<dd>Warn of unused labels. A warning message will be issued for each label,
whose value is never used.</dd>
<dt><a id="new_unlabels"/><tt>/u</tt></dt>
<dd>Issue a warning message for each label whose value is unused.</dd>
</dl>
<p>Alternatively, you may use Unix-style options, for example:</p>
<pre>xasm -i -d DEBUG=1 -l listing.lst source.asx
</pre>
<h2>SYNTAX</h2>
<p>Source files should be plain ASCII files. Supported are LF, CR, CR/LF
and Atari line terminators. <b>xasm</b> is not case-sensitive, so you can mix
upper- and lower-case for labels and instructions.</p>
<p>Source files should be plain ASCII files. LF, CR, CR/LF and Atari line terminators
are supported. Labels and instructions are case-insensitive.</p>
<p><b>xasm</b> is backward compatible with Quick Assembler.
If you want to assembly QA sources with <b>xasm</b>, simply replace ATASCII
specific characters with their integer representation. You also have to change
all <tt>OPT</tt> directives, but usually you only need to remove them.</p>
To compile QA sources with <b>xasm</b>, simply replace ATASCII-specific characters
with their integer codes. You also have to change all <tt>OPT</tt> directives,
but usually you can simply remove them.</p>
<p>A <i>label</i> 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 <tt>EQU</tt> directive,
(with no spaces before). Unless you use the <tt>EQU</tt> directive,
the label is assigned the current value of the origin counter.</p>
<p>Instructions and directives must be preceded with
whitespace. Note that in <b>xasm</b> you can use instruction and directive
<p>Instructions and directives must be preceded with some whitespace.
Note that in <b>xasm</b> you can use instruction and directive
names as label names. For example</p>
<pre>nop
</pre><p>defines a label called <tt>nop</tt>, whereas</p>
@ -85,23 +77,21 @@ of full comment lines:</p>
* so it is
label | and this too
</pre>
<p><a name="new_linerep"/>Lines with instructions (and some directives)
<p><a id="new_linerep"/>Lines with instructions (and some directives)
may be <i>repeated</i>. A single line may be assembled several times,
for example:</p>
<pre>:4 asl @
table :32*5 dta 5
</pre>
<p>In lines with instructions or directives, a comment starts after
the instruction/directive has been successfully parsed. That is, <b>xasm</b>
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.</p>
<p>In lines with instructions or directives, a comment starts immediately
after the instruction/directive has been successfully parsed.
That is, <b>xasm</b> does not require a special character to start a comment.</p>
<pre> 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
</pre>
<p><a name="new_pairing"/>You may put two instructions on the same line.
In this case they have the same operand. For example:</p>
<p><a id="new_pairing"/>You may put two instructions in one line
so they share the operand. For example:</p>
<pre> eor:sta foo
</pre>
<p>is equivalent to</p>
@ -110,29 +100,28 @@ In this case they have the same operand. For example:</p>
</pre>
<p>Note that</p>
<pre> lda:tax #0
</pre><p>is allowed (<tt>#0</tt> is a comment for <tt>tax</tt>).</p>
</pre><p>is allowed because <tt>#0</tt> is treated as a comment for <tt>tax</tt>.</p>
<h2>EXPRESSIONS</h2>
<p>Expressions are numbers combined with operators and brackets.
You should use square brackets, because parentheses are reserved
for the indirect addressing.</p>
<p>Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff.
A number may be:</p>
for 6502 indirect addressing.</p>
<p>Numbers can be expressed as:</p>
<ul>
<li>a decimal number, e.g. <tt>-12345</tt></li>
<li>a hexadecimal number, e.g. <tt>$abcd</tt></li>
<li>a binary number, e.g. <tt>%10100101</tt></li>
<li>a 32-bit decimal integer, e.g. <tt>-12345</tt></li>
<li>a 32-bit hexadecimal integer, e.g. <tt>$abcd</tt></li>
<li>a 32-bit binary integer, e.g. <tt>%10100101</tt></li>
<li>an ASCII character, e.g. <tt>'a'</tt> or <tt>"a"</tt></li>
<li>the origin counter value: <tt>*</tt></li>
<li>origin counter: <tt>*</tt></li>
<li>a hardware register, e.g. <tt>^4e</tt></li>
<li><a name="new_opcode"/>an op-code, e.g. <tt>{lda #0}</tt> equals
<li><a id="new_opcode"/>an op-code, e.g. <tt>{lda #0}</tt> equals
<tt>$a9</tt></li>
<li><a name="new_linecnt"/>the line repeat counter: <tt>#</tt></li>
<li><a id="new_linecnt"/>the line repeat counter: <tt>#</tt></li>
</ul>
<p>Abbreviations of Atari hardware registers are provided to save you
the trouble of typing two extra characters (<tt>^4e</tt> vs <tt>$d40e</tt>)
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.</p>
the location of hardware registers.</p>
<table>
<tr><th>Syntax</th><th>Chip</th>
<th>Value in the Atari 8-bit<br/>computer mode (<tt>opt g-</tt>)</th>
@ -150,17 +139,17 @@ different location of hardware registers.</p>
<td><tt>$D40x</tt></td><td><tt>$D40x</tt></td></tr>
</table>
<p>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.
<a name="new_op_op"/>You can skip the operand if the addressing mode
<a id="new_op_op"/>You can skip the operand if the addressing mode
is fixed. Examples:
<tt>{lda #}</tt>, <tt>{jsr}</tt>, <tt>{bne}</tt>, <tt>{jmp ()}</tt>,
<tt>{sta a:,x}</tt>.</p>
<p>You can use the line repeat counter (<tt>#</tt>) in the repeated lines.
It counts the iterations starting from zero. Examples:</p>
<pre>:3 dta # ; generates three bytes: 00, 01, 02.
<pre>: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
<li><tt>&amp;&amp;</tt> Logical AND</li>
<li><tt>||</tt> Logical OR</li>
</ul>
<p><a name="new_unary"/>The following unary operators are supported:</p>
<p><a id="new_unary"/>The following unary operators are supported:</p>
<ul>
<li><tt>+&nbsp;</tt> Plus (does nothing)</li>
<li><tt>-&nbsp;</tt> Minus (changes the sign)</li>
@ -221,25 +210,24 @@ and Java, their priorities are different than in these languages.</p>
<p>Compare and logical operators assume that zero is false and a non-zero
is true. They return 1 for true.</p>
<p>While calculating an expression, signed 32-bit arithmetic is used.
When range of 32 bits is exceeded, the '<tt>Arithmetic overflow</tt>' error
is generated.</p>
When range of 32 bits is exceeded, an '<tt>Arithmetic overflow</tt>' error
occurs.</p>
<h2>DIRECTIVES</h2>
<dl>
<dt><tt><b>EQU</b></tt> - assign a value of an expression to the label</dt>
<dd>Note that a label represents a number, not a text macro.<br/>
Examples:
<dd>Examples:
<pre>five equ 5
here equ *
</pre></dd>
<dt><a name="new_opt"/><tt><b>OPT</b></tt> - set assembly options</dt>
<dt><a id="new_opt"/><tt><b>OPT</b></tt> - set assembly options</dt>
<dd>Five options are available:
<ul>
<li><tt>F</tt> - fill the space between <tt>ORG</tt>s
with <tt>$FF</tt> bytes</li>
with <tt>$FF</tt></li>
<li><tt>G</tt> - Atari 5200 mode for hardware register abbreviations</li>
<li><tt>H</tt> - generate Atari executable headers</li>
<li><tt>L</tt> - generate listing</li>
<li><tt>O</tt> - generate object file</li>
<li><tt>L</tt> - write to the listing</li>
<li><tt>O</tt> - write to the object file</li>
</ul>
You can turn any of these on or off.<br/>
The default (if no <tt>OPT</tt> specified) is <tt>opt f-g-h+l+o+</tt>.<br/>
@ -249,15 +237,13 @@ Examples:
opt f+g+h- useful for Atari 5200 cartridges - raw output format, 5200 hw regs
</pre></dd>
<dt><tt><b>ORG</b></tt> - change value of the origin counter</dt>
<dd>You can set some options applied to the new header (if headers are
enabled):
<dd>If Atari executable headers are enabled, you can use a prefix:
<ul>
<li><tt>a:</tt> tells <b>xasm</b> to always make a header, even it is
unnecessary, like in <tt>ORG *</tt>.</li>
<li><tt>f:</tt> works same as <tt>a:</tt>, but additionally tells to generate
a <tt>$FF,$FF</tt> prefix before the header. <b>xasm</b> adds it
at the beginning of the file by default, so use this option only if you want
the <tt>$FF</tt>'s somewhere inside.</li>
<li><tt>a:</tt> starts a new block even if it is not necessary because
the new address equals the current address.</li>
<li><tt>f:</tt> is same as <tt>a:</tt>, but additionally generates
a <tt>$FF,$FF</tt> prefix before the new header. The prefix is automatically
generated at the beginning of the file.</li>
</ul>
Examples:
<pre> org $600
@ -267,13 +253,12 @@ table org *+100
In the latter example <tt>table</tt> points to 100 bytes
of uninitialized data (label is assigned to <tt>*</tt>
before the <tt>ORG</tt> directive is executed).
<p><a name="new_orgr"/>Starting with version 2.6.0, <b>xasm</b> supports code
<p><a id="new_orgr"/>Starting with version 2.6.0, <b>xasm</b> 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.
<b>xasm</b> differentiates between the address that it used
for code generation from the address that is used for generating
Atari executable headers. <tt>org r:</tt> 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.
<tt>org r:</tt> changes the address that it used for code generation
but not the address used for generating Atari executable headers.
Example:</p>
<pre> 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:</p>
<pre>where_am_i equ *-code_zpage+code_loaded
</pre></dd>
<dt><a name="new_dta"/><tt><b>DTA</b></tt> - define data</dt>
<dd>There are various data types:
<dt><a id="new_dta"/><tt><b>DTA</b></tt> - define data</dt>
<dd>
<ul>
<li>integers
<ul>
@ -311,21 +296,20 @@ where:
<li><tt>center</tt> is a number which is added to every sine value</li>
<li><tt>amp</tt> is the sine amplitude</li>
<li><tt>size</tt> is the sine period</li>
<li><tt>first,last</tt> define range of values in the table.
<li><tt>first,last</tt> define the range of sine arguments.
They are optional. The default are <tt>0,size-1</tt>.</li>
</ul>
Example: <tt>dta a(sin(0,1000,256,0,63))</tt> defines a table of 64 words
representing a quarter of sine with the amplitude of 1000.</li>
<li>real numbers: <tt>r(-1.23456e12)</tt><br/>
Real numbers are written in the 6-byte Atari Floating-Point format.</li>
Real numbers are stored in the 6-byte Atari Floating-Point format.</li>
<li>text strings
<ul>
<li>ASCII strings: <tt>c'Text'</tt> or <tt>c"Text"</tt></li>
<li>ANTIC strings: <tt>d'Text'</tt> or <tt>d"Text"</tt></li>
</ul>
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.<br/>
marks. You can include the quotation marks in the string by doubling them.<br/>
Placing a <tt>*</tt> character after a string inverts
the highest bit in every byte of the string.</li>
</ul>
@ -345,7 +329,7 @@ Examples:
icl 'lib/fileio'
</pre>
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.</dd>
<dt><tt><b>END</b></tt> - end assembling file</dt>
<dd>Remaining part of the file is not assembled. If this statement does
@ -358,23 +342,20 @@ Example:
<dt><tt><b>INS</b></tt> - insert contents of file</dt>
<dd>Copies every byte of the specified file into the object file and updates
the origin counter, as if these bytes were defined with <tt>DTA</tt>.<br/>
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:
<pre>
ins 'file'[,offset[,length]]
</pre>
The first byte in a file has the offset of zero.<br/>
If the offset is negative, it is counted from the end of the file.<br/>
If the offset is negative, it counts from the end of the file.<br/>
Examples:
<pre>
ins 'picture.raw'
ins 'file',-256 insert last 256 bytes of file
ins 'file',10,10 insert bytes 10..19 of file
</pre></dd>
<dt><tt><b>RUN</b></tt> - generate run address</dt>
<dd>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.
<pre> run addr
<dt><tt><b>RUN</b></tt> - set run address in the Atari executable format</dt>
<dd><pre> run addr
</pre>
is equivalent to:
<pre> org $2e0
@ -383,18 +364,16 @@ is equivalent to:
Example:
<pre> run main
</pre></dd>
<dt><tt><b>INI</b></tt> - generate init address</dt>
<dd>An Atari executable program may have some routines which are executed
during the loading process. There may be many init blocks in one file.<br/>
Example:
<dt><tt><b>INI</b></tt> - set init address in the Atari executable format</dt>
<dd>Example:
<pre> ini showpic
</pre></dd>
<dt><tt><b>ERT</b></tt> - generate an error if an expression is true</dt>
<dt><tt><b>ERT</b></tt> - generate error if expression evaluates to true</dt>
<dd>Examples:
<pre> ert *&gt;$c000
ert len1&gt;$ff||len2&gt;$ff
</pre></dd>
<dt><a name="new_eli"/><tt><b>IFT</b></tt> - assemble if expression is
<dt><a id="new_eli"/><tt><b>IFT</b></tt> - assemble if expression is
true<br/>
<tt><b>ELI</b></tt> - else if<br/>
<tt><b>ELS</b></tt> - else<br/>
@ -433,11 +412,11 @@ to use a <tt>CLC</tt> before <tt>ADC</tt> for every simple addition.<br/>
<tt>CLC</tt> and <tt>ADC</tt>.</dd>
<dt><tt><b>SUB</b></tt> - subtraction</dt>
<dd>It is <tt>SEC</tt> and <tt>SBC</tt>.</dd>
<dt><a name="new_repskip"/><tt><b>RCC, RCS, REQ, RMI, RNE, RPL, RVC,
<dt><a id="new_repskip"/><tt><b>RCC, RCS, REQ, RMI, RNE, RPL, RVC,
RVS</b></tt> - conditional repeat</dt>
<dd>These are branches to the previous instruction.
They take no operand, because the branch target
is the address of previously assembled instruction.<br/>
is the address of the previously assembled instruction.<br/>
Example:
<pre> 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.</dd>
jumps</dt>
<dd>These are a kind of 'long' branches. While standard branches
(such as <tt>BNE</tt>) have range of -128..+127, these jumps have range
of all 64 kB.<br/>
of 64 kB.<br/>
Example:
<pre> jne dest
</pre>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
</pre></dd>
<dt><a name="new_mwinde"/><tt><b>MWA, MWX, MWY</b></tt> - move word using
<dt><a id="new_mwinde"/><tt><b>MWA, MWX, MWY</b></tt> - move word using
accumulator, X or Y</dt>
<dd>These pseudo-commands require two operands
and are combinations of two <tt>MV*</tt>'s:
one to move the low byte, and the other to move the high byte.<br/>
You can't use indirect nor pseudo addressing mode with <tt>MW*</tt>.
Destination must be an absolute address (optionally indexed).<br/>
When source is also absolute, an <tt>mw* source dest</tt> will be:
Destination must be an absolute address, optionally indexed.<br/>
When source is also an absolute address, an <tt>mw* source dest</tt> expands to:
<pre> mv* source dest
mv* source+1 dest+1
</pre>
When source is an immediate, an <tt>mw* #immed dest</tt> will be:
When source is an immediate value, an <tt>mw* #immed dest</tt> expands to:
<pre> mv* &lt;immed dest
mv* &gt;immed dest+1
</pre>
When <tt>&lt;immed</tt> equals <tt>&gt;immed</tt> and <tt>immed</tt>
is not forward-referenced, <b>xasm</b> uses an optimization:
is not forward-referenced, <b>xasm</b> skips the second <tt>LD*</tt>:
<pre> mv* &lt;immed dest
st* dest+1
</pre>
If possible, <tt>MWX</tt> and <tt>MWY</tt> use increment/decrement
commands. E.g. <tt>mwx #1 dest</tt> is assembled as:
commands. For example, <tt>mwx #1 dest</tt> expands to:
<pre> ldx #1
stx dest
dex
@ -523,24 +502,24 @@ the <tt>@</tt> character (as in Quick Assembler).</p>
which use the low/high byte of a 16-bit word constant.
They are for Quick Assembler compatibility.
You can use traditional <tt>#&lt;</tt> and <tt>#&gt;</tt>.
Note <tt>lda &gt;$ff+5</tt> loads 1 (<tt>&gt;$104</tt>),
Note that <tt>lda &gt;$ff+5</tt> loads 1 (<tt>&gt;$104</tt>),
while <tt>lda #&gt;$ff+5</tt>
loads 5 (<tt>0+5</tt>) to the accumulator, because the unary operator
<tt>&gt;</tt> has a higher priority than the binary plus.</p>
<p>In absolute addressing modes, <b>xasm</b> examines the expression
and uses zero-page addressing mode if it supposes it's possible.
You may override it with <tt>a:</tt> and <tt>z:</tt> prefixes.</p>
<p>You can explicitly choose absolute (<tt>a:</tt>)
and zero-page (<tt>z:</tt>) addressing modes.</p>
<p>Examples:</p>
<pre>
nop
asl @
lda &gt;$1234 assembles to lda #$12
lda &gt;$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
</pre>
<p>There are also pseudo addressing modes, which are similar to
<p>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
<tt>MWA</tt>, <tt>MWX</tt> and <tt>MWY</tt>:</p>
@ -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
<a name="new_adrmodes"/> cmd (z),0+ = ldy #0 : cmd (z),y : iny
<a id="new_adrmodes"/> cmd (z),0+ = ldy #0 : cmd (z),y : iny
cmd (z),0- = ldy #0 : cmd (z),y : dey
</pre>
<h2>CHANGES</h2>
<h2>HISTORY</h2>
<h3>Version 3.0.1 (2007-04-22)</h3>
<ul>
<li>fixed a bug in <tt>OPT H-</tt> mode</li>
<li>made <b>xasm</b> compilable with the latest D compiler v1.010
(there were incompatible changes in the D language and library)</li>
</ul>
<h3>Version 3.0.0 (2005-05-22)</h3>
<ul>
<li>rewritten from the x86 assembly language to the
@ -714,8 +699,6 @@ addressing modes</a></li>
<h2>AUTHOR</h2>
<p>Piotr Fusik (<a href="mailto:fox@scene.pl">fox@scene.pl</a>)</p>
<h2>SEE ALSO</h2>
<p><a href="editors.htm">How to configure a text editor for a convenient use
of xasm</a></p>
<p>xasm home page
(<a href="http://xasm.atari.org">http://xasm.atari.org</a>)</p>
</body>

View File

@ -1,5 +1,4 @@
# xasm settings for SciTE (www.scintilla.org)
# written by Piotr Fusik <fox@scene.pl>
# xasm settings for SciTE (http://www.scintilla.org/SciTE.html)
file.patterns.asx=*.asx
filter.asx=xasm (asx)|$(file.patterns.asm)|