Compare commits

...

86 Commits

Author SHA1 Message Date
Piotr Fusik 9732817a0b Modernize the RPM spec. 2023-07-11 10:56:46 +02:00
Piotr Fusik 70c907bae6 Revert "Warn about a comment starting with a comma."
Breaks Jaskier's MPT player.
https://sourceforge.net/p/asap/bugs/32/

This reverts commit 7a666799ac.
2023-05-07 21:03:40 +02:00
Piotr Fusik 7a666799ac Warn about a comment starting with a comma. 2023-02-28 16:59:52 +01:00
Piotr Skamruk 95136d1546 Tune variable/func names after sequencing support added 2022-12-20 15:52:39 +01:00
Piotr Fusik ca5e88950f xasm 3.2.1 release. 2022-12-08 11:49:40 +01:00
Piotr Fusik 138331193a DMD seems to no longer append ".exe". 2022-12-08 09:53:32 +01:00
Piotr Fusik 30c96357bc Allow stdout for the listing and label table. 2022-12-08 09:27:19 +01:00
Jakub Husak 83d2f8ff1d Refactor LDA and STA with existing routines. 2022-12-02 15:23:07 +01:00
Adrian Matoga 9aae1ad4c4 Instruction pairing extended to more than two instructions. 2022-11-30 10:11:12 +01:00
Piotr Fusik f33c112ac6 Switch CI from Travis to GitHub Actions.
Close #10
2022-11-29 14:08:39 +01:00
Piotr Fusik 57661276c2 Fix "Error processing arguments: Missing value for argument --compiler=". 2022-11-29 14:04:51 +01:00
Piotr Fusik a4225b6128 GitHub Actions don't know gdc. 2022-11-29 14:01:33 +01:00
Piotr Fusik 1da9f77458 Add the missing part of GitHub Actions. 2022-11-29 13:59:41 +01:00
Piotr Fusik 2b7d21ae43 Continuous Integration with GitHub Actions. 2022-11-29 13:51:14 +01:00
Adrian Matoga 2f67b3bab4 Allow stdin/stdout instead of files for source and object. 2022-11-29 11:22:55 +01:00
Piotr Fusik afb9f7830e Update DEB packaging. 2022-07-23 11:45:14 +02:00
Piotr Fusik 95cb5ae592 install-scite non-executable. 2021-12-23 16:43:11 +01:00
Piotr Fusik 8f6621f079 Update DEB packaging. 2021-12-23 16:41:52 +01:00
Piotr Fusik 52982169df xasm 3.2.0 release. 2021-06-22 21:20:00 +02:00
Piotr Fusik 8c7ef1a922 Reword the manual. 2021-06-21 22:44:34 +02:00
Piotr Fusik 1a90ca04d3 Bump the copyright year. 2021-06-21 22:42:13 +02:00
Piotr Fusik 73b382f9b7 Fix macOS notarization. 2021-06-21 22:40:50 +02:00
Piotr Fusik 7ba3f9f597 Signed the Windows binary. 2021-06-20 19:01:53 +02:00
Piotr Fusik b815a448cd Migrate to travis-ci.com. 2021-06-16 09:11:04 +02:00
Piotr Fusik 274dda9dd2 Wait for macOS notarization. 2021-06-04 21:50:23 +02:00
Piotr Fusik da58ad7950 Sign and notarize the macOS binary. 2021-06-04 21:38:25 +02:00
Piotr Fusik 52ef8c05d6 OPT ?+ for MADS compatibility. 2021-03-25 09:03:23 +01:00
Piotr Fusik 6f25038d95 On macOS install in /usr/local/bin.
Close #8
2021-03-24 10:49:14 +01:00
Adrian Matoga 57ef9b5c83 Fix failed assertion when opt l+ is used 2021-03-15 07:18:15 +01:00
Adrian Matoga 8f06fec50c Enable simple local labels. 2021-03-14 19:46:09 +01:00
Piotr Fusik d50d484e1f Update DEB packaging. 2020-10-29 20:07:35 +01:00
Piotr Fusik 65a2c1fbdd Deprecate DOS-style options. 2020-05-25 21:36:28 +02:00
Piotr Fusik d3908ec95e Don't report error deleting the object file on error.
Most likely the file doesn't exist.
2020-05-21 19:38:49 +02:00
Piotr Fusik 647cf9f3cf Don't cast to arrays of mutable bytes. 2019-12-04 23:23:47 +01:00
Piotr Fusik 819701b9be Optimize moving negative immediate word. 2019-12-04 23:16:21 +01:00
Piotr Fusik 301b904f60 xasm 3.1.1 release. 2019-11-20 17:43:51 +01:00
Piotr Fusik 420a83a897 Adapt srcdist to new tools. 2019-10-29 20:16:03 +01:00
Piotr Fusik 2f8e97499d Fix unreachable statement. 2019-10-16 09:28:13 +02:00
Piotr Fusik 7ad066fc6f Remove the object file on error even if not written.
Close #4.
2019-10-16 09:24:36 +02:00
Piotr Fusik a0bfe1366d Remove the object file on error.
Close #4.
2019-10-14 10:56:46 +02:00
Piotr Fusik 384643ab84 Test with GDC and LDC. 2019-10-06 18:46:12 +02:00
Piotr Fusik 177ece15fc Add Travis badge. 2019-10-06 17:35:21 +02:00
Piotr Fusik 99099938b5 Silence unit tests. 2019-10-06 17:24:59 +02:00
Piotr Fusik cb92f715a9 Fix "dub test". 2019-10-06 17:07:42 +02:00
Piotr Fusik 110d2c4dad Introduce DUB. 2019-10-06 17:00:48 +02:00
Piotr Fusik ce134af833 Cleanup .gitignore. 2019-08-24 09:47:52 +02:00
Piotr Fusik 92eac212cc Apply dos2unix. 2019-08-24 09:46:29 +02:00
Piotr Fusik 90276dbe86 std.conv is already imported. 2019-08-24 09:43:41 +02:00
maraflush 2e43507088 fix compilation issue
fix :
xasm.d(2655): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"ea" instead.
xasm.d(2656): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"18a2006105" instead.
xasm.d(2657): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"a9cd8d3412a9ab8d3512" instead.
xasm.d(2658): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"05a6efef8945" instead.
xasm.d(2660): Error: Built-in hex string literals are obsolete, use std.conv.hexString!"400100000000 401200000000 410123000000 441234567890 461234567890 3f5000000000 3f0300000000 3f1664534589 701000000000" instead.
2019-08-24 09:17:57 +02:00
Piotr Fusik cc0eaf0e48 Rename the documentation so that GitHub formats it. 2019-03-26 23:48:10 +01:00
Piotr Fusik 2dad630a75 Update some links. 2019-03-26 23:34:56 +01:00
Piotr Fusik 36a4853b54 Fix whitespace. 2017-07-29 14:06:15 +02:00
Piotr Fusik c4fc8ef51a License. 2017-07-28 21:36:10 +02:00
Piotr Fusik ef297a78c7 Reword README slightly. 2017-02-08 19:59:22 +01:00
Piotr Fusik 061088aa62 Update for DMD v2.073. 2017-02-08 19:32:42 +01:00
Piotr Fusik dd3466a947 SciTE: Fix the open filter. Add to the Language menu. 2016-12-15 20:43:40 +01:00
peterdell d2bd24a128 Add .gitignore 2016-01-03 11:23:16 +01:00
peterdell 8d0870d1a1 Fix typo in readme 2016-01-03 11:21:17 +01:00
Piotr Fusik d7c22cec84 Include label name in the unused label warning.
Close #1.
2016-01-03 08:47:19 +01:00
Piotr Fusik b42f9dc2bf Support a:/f: modifiers on run/ini. 2014-12-31 14:30:09 +01:00
Piotr Fusik 5680efc7f5 Improve I/O performance on Windows (especially network drives).
Reported by Marek Pavlik.
2014-09-26 16:42:54 +02:00
Piotr Fusik 8c6ff185af vim-xasm 2014-07-22 10:22:17 +02:00
Piotr Fusik 5970a93423 xasm 3.1.0 release. 2014-07-20 19:10:41 +02:00
Piotr Fusik 389f7446e0 Exclude xasm.o from OS X distribution. 2014-07-20 17:39:35 +02:00
Piotr Fusik 3cec1c8ee8 Extend OS X compatibility: 32-bit binary for 10.6. 2014-07-20 17:14:36 +02:00
Piotr Fusik 60d28a5c24 xasm-scite DEB. 2014-06-12 21:19:11 +02:00
Piotr Fusik de22438740 More details about the SciTE integration. 2014-06-12 17:24:51 +02:00
Piotr Fusik cc5568795e RPM and tar.gz distributions. 2014-06-12 17:24:12 +02:00
Piotr Fusik d1276f3d97 DEB distribution. 2014-06-11 14:41:49 +02:00
Piotr Fusik 2d8b3cde17 Update README. 2014-06-11 12:00:06 +02:00
Piotr Fusik c357fba52c OS X distribution. 2014-06-10 13:50:42 +02:00
Piotr Fusik 61327c8e5b "opt u-" disables "/u" unused label warnings. 2014-04-30 09:19:49 +02:00
Piotr Fusik 167c441fed INS: optimize "opcode" if length not specified as one. 2014-04-04 20:26:33 +02:00
Piotr Fusik 3a845f9a4f INS: allow line repeating (suggested by Marek Pavlik), taking "opcode", skip/repeat branches. 2014-04-04 20:20:40 +02:00
Piotr Fusik 50bae061f7 Remove duplicate filenames for -M. 2014-02-21 23:29:58 +01:00
Piotr Fusik 520145268a If cannot open the file to be included, report error in the ICL line. 2014-02-21 23:06:03 +01:00
Piotr Fusik 059b631aab Generate manpage. 2013-10-02 13:24:57 +02:00
Piotr Fusik f2e7796c87 6502 inflate is a separate project. 2013-10-02 13:16:42 +02:00
Piotr Fusik 61bffbb8ec README for GitHub. 2013-05-10 20:14:56 +02:00
Piotr Fusik a2d6f9c864 DMD64 compilation errors reported by Vadim Akimov. 2013-03-19 11:13:26 +01:00
Piotr Fusik 3fc9b5c0f5 Get rid of the deprecated std.stream. 2013-03-19 11:12:12 +01:00
Piotr Fusik 406354e06c Updated to DMD 2.061. Implemented /p outside Windows. Restored blank lines in the listing. 2013-02-19 17:37:14 +01:00
Adrian Matoga 6992795f55 Upgraded to DMD 2.051. 2013-02-19 14:59:55 +01:00
Piotr Fusik 034b95ea83 xasm 3.0.2 release. 2013-01-07 12:07:32 +01:00
Piotr Fusik fa25272ccd xasm 3.0.1 release. 2013-01-07 12:07:32 +01:00
Piotr Fusik 66501ef2fd xasm 3.0.0 release. 2013-01-07 12:07:31 +01:00
30 changed files with 4344 additions and 4934 deletions

16
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: tests
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
dc: [dmd-latest, ldc-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@main
- uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}
- run: dub build
- run: dub test

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
/xasm
/xasm.exe
/xasm.obj
/xasm.html
/xasm.1
/xasm-test-*
/MANIFEST
/.dub
/.project
/signed

77
Makefile Normal file
View File

@ -0,0 +1,77 @@
VERSION = 3.2.1
prefix = /usr/local
bindir = $(prefix)/bin
mandir = $(prefix)/share/man/man1
ifeq ($(OS),Windows_NT)
EXEEXT = .exe
endif
SEVENZIP = 7z a -mx=9 -bd -bso0
all: xasm$(EXEEXT) xasm.html
xasm$(EXEEXT): source/app.d
dmd -of$@ -O -release $<
xasm.html: xasm.1.asciidoc
asciidoc -o - $< | sed -e "s/527bbd;/20a0a0;/" >$@
xasm.1: xasm.1.asciidoc
a2x -f manpage $<
install: xasm xasm.1
mkdir -p $(DESTDIR)$(bindir) && install xasm $(DESTDIR)$(bindir)/xasm
mkdir -p $(DESTDIR)$(mandir) && install -m 644 xasm.1 $(DESTDIR)$(mandir)/xasm.1
uninstall:
$(RM) $(DESTDIR)$(bindir)/xasm $(DESTDIR)$(mandir)/xasm.1
install-scite: xasm.properties
mkdir -p $(DESTDIR)$(prefix)/share/scite && install -m 644 $< $(DESTDIR)$(prefix)/share/scite/xasm.properties
uninstall-scite:
$(RM) $(DESTDIR)$(prefix)/share/scite/xasm.properties
dist: srcdist ../xasm-$(VERSION)-windows.zip
srcdist: MANIFEST
$(RM) ../xasm-$(VERSION).tar.gz && /usr/bin/tar -c --numeric-owner --owner=0 --group=0 --mode=644 -T MANIFEST --transform=s,,xasm-$(VERSION)/, | $(SEVENZIP) -tgzip -si ../xasm-$(VERSION).tar.gz
MANIFEST:
if test -e .git; then (git ls-files | grep -vF .gitignore && echo MANIFEST) | sort | dos2unix >$@ ; fi
../xasm-$(VERSION)-windows.zip: xasm.exe xasm.html xasm.properties signed
$(RM) $@ && $(SEVENZIP) -tzip $@ xasm.exe xasm.html xasm.properties
signed: xasm$(EXEEXT)
signtool sign -d "xasm $(VERSION)" -n "Open Source Developer, Piotr Fusik" -tr http://time.certum.pl -fd sha256 -td sha256 $< && touch $@
deb:
debuild -b -us -uc
osx: ../xasm-$(VERSION)-macos.dmg
../xasm-$(VERSION)-macos.dmg: osx/xasm osx/bin
ifdef PORK_CODESIGNING_IDENTITY
codesign --options runtime -f -s $(PORK_CODESIGNING_IDENTITY) osx/xasm
endif
hdiutil create -volname xasm-$(VERSION)-macos -srcfolder osx -format UDBZ -fs HFS+ -imagekey bzip2-level=3 -ov $@
ifdef PORK_NOTARIZING_CREDENTIALS
xcrun altool --notarize-app --primary-bundle-id com.github.pfusik.xasm $(PORK_NOTARIZING_CREDENTIALS) --file $@ \
| perl -pe 's/^RequestUUID =/xcrun altool $$ENV{PORK_NOTARIZING_CREDENTIALS} --notarization-info/ or next; $$c = $$_; until (/Status: success/) { sleep 20; $$_ = `$$c`; print; } last;'
endif
osx/xasm: source/app.d
mkdir -p osx && dmd -of$@ -O -release $< && rm -f osx/xasm.o
osx/bin:
mkdir -p osx && ln -s /usr/local/bin $@
clean:
$(RM) xasm xasm.exe xasm.obj xasm.html xasm.1 signed
rm -rf osx
.PHONY: all install uninstall install-scite uninstall-scite dist srcdist MANIFEST deb osx clean
.DELETE_ON_ERROR:

112
README.md Normal file
View File

@ -0,0 +1,112 @@
[![GitHub Actions](https://github.com/pfusik/xasm/actions/workflows/test.yml/badge.svg)](https://github.com/pfusik/xasm/actions/workflows/test.yml)
xasm
====
xasm is a 6502 cross-assembler with original syntax extensions.
By default it generates binaries
for [Atari 8-bit computers](http://en.wikipedia.org/wiki/Atari_8-bit_family).
Syntax
------
6502 assembly code is full of LDA, STA, LDA, STA sequences.
With xasm you can use MVA as a shortcut for an LDA/STA pair or even MWA for 16-bit transfers.
Short branches can be replaced with conditional skip and repeat pseudo-instructions.
You can use a pair of instructions with a shared argument.
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 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
Using xasm's 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 syntax is an extension of Quick Assembler's (created in 1991 for Atari 8-bit).
Accumulator shifts should be written as in `asl @`.
Whitespace is important: it is required before the instruction
and disallowed in the operands, because it separates a comment from the operand, e.g.
lda #0 this is a comment, no need for a semicolon
This may look weird at first, but it enables nice features such as instruction pairs
and two-argument pseudo-instructions.
Usage
-----
xasm is a command-line tool.
Therefore you additionally need a programmer's text editor.
I use [SciTE](http://www.scintilla.org/SciTE.html).
To install xasm syntax highlighting and single-keystroke compilation,
copy `xasm.properties` to the SciTE directory.
For single source file programs, press Ctrl+F7 to compile.
You can double-click error messages to go to the incorrect line.
Press F5 to run the program in the emulator.
For larger projects, I use GNU Make. Press F7 to build (and possibly run)
a project as described in the `Makefile`. You can find my Makefiles in
[my repositories](https://github.com/pfusik?tab=repositories) on GitHub.
If you prefer VIM, see a link below.
Poetic License
--------------
This work 'as-is' we provide.
No warranty express or implied.
We've done our best,
to debug and test.
Liability for damages denied.
Permission is granted hereby,
to copy, share, and modify.
Use as is fit,
free or for profit.
These rights, on this notice, rely.
Download
--------
[xasm 3.2.1](https://github.com/pfusik/xasm/releases) for Windows, macOS, Ubuntu and Fedora.
Links
-----
* [Atari800](https://atari800.github.io/) - portable emulator of Atari 8-bit computers
* [Atari XL/XE Source Archive](http://sources.pigwa.net/) - source code of Atari demos, utilities and games
* [cc65](https://cc65.github.io/) - C cross-compiler targeting 6502-based systems
* [MADS](http://mads.atari8.info/) - another 6502/65816 cross-assembler, partially supporting xasm's syntax
* [vim-xasm](https://github.com/lybrown/vim-xasm) - VIM syntax highlighting for xasm
* [WUDSN IDE](http://wudsn.com/) - Eclipse plugin, front-end to several 6502 cross-assemblers, including xasm

23
debian/changelog vendored Normal file
View File

@ -0,0 +1,23 @@
xasm (3.2.1-1) UNRELEASED; urgency=low
* New release.
-- Piotr Fusik <fox@scene.pl> Thu, 8 Dec 2022 09:30:29 +0100
xasm (3.2.0-1) UNRELEASED; urgency=low
* New release.
-- Piotr Fusik <fox@scene.pl> Tue, 22 Jun 2021 20:59:45 +0200
xasm (3.1.1-1) UNRELEASED; urgency=low
* New release.
-- Piotr Fusik <fox@scene.pl> Wed, 20 Nov 2019 13:30:11 +0100
xasm (3.1.0-1) UNRELEASED; urgency=low
* First deb packaging.
-- Piotr Fusik <fox@scene.pl> Sun, 20 Jul 2014 19:08:15 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
10

16
debian/control vendored Normal file
View File

@ -0,0 +1,16 @@
Source: xasm
Maintainer: Piotr Fusik <fox@scene.pl>
Section: devel
Priority: optional
Standards-Version: 4.6.0
Build-Depends: debhelper (>= 7), dmd (>= 2), asciidoc-base
Package: xasm
Architecture: any
Depends: ${shlibs:Depends}
Description: 6502 cross-assembler with original syntax extensions.
Package: xasm-scite
Architecture: all
Depends: scite
Description: xasm syntax highlighting and single keystroke compilation for SciTE.

7
debian/copyright vendored Normal file
View File

@ -0,0 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Name: xasm
Source: https://github.com/pfusik/xasm
Files: *
Copyright: 1998-2021 Piotr Fusik <fox@scene.pl>
License: Poetic

6
debian/rules vendored Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:
$(MAKE) DESTDIR=$$(pwd)/debian/tmp prefix=/usr install install-scite

1
debian/xasm-scite.install vendored Normal file
View File

@ -0,0 +1 @@
usr/share/scite/xasm.properties

2
debian/xasm.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/bin/xasm
usr/share/man/man1/xasm.1

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,714 +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>xasm 2.6.1</title>
<meta name="Author" content="Piotr Fusik"/>
</head>
<body>
<h2>NAME</h2>
<p>xasm - 6502 cross-assembler</p>
<h2>SYNOPSIS</h2>
<p><tt>xasm source [options]</tt></p>
<h2>DESCRIPTION</h2>
<p><b>xasm</b> is a cross-assembler which generates code for the 6502
processor.</p>
<p><tt>source</tt> is the name of the source file. If no filename extension
is given, <tt>.ASX</tt> is appended. The default action (when invoked without
options) is to assembly <tt>source</tt>, writing the result to a file with
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>Define a label.
<tt>label</tt> should be a valid label name.
<tt>value</tt> may be any expression (it may use forward references
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><a name="new_environment"/><tt>/e</tt></dt>
<dd>Enable setting environment variables pointing at the error location.
With this option, <b>xasm</b> sets two environment variables:
<tt>ERRFILE</tt> and <tt>ERRLINE</tt>.
They may be used in a batch file to locate the error and set editor's
insertion point on it. If there was no error, the variables point at the last
issued warning. If no warning occured, they are removed from
the environment.</dd>
<dt><tt>/i</tt></dt>
<dd>Disable listing included sources. 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
to <tt>source.lst</tt>, where <tt>source</tt> is the name of the source file
(without the extension).</dd>
<dt><tt>/o:filename</tt></dt>
<dd>Specify 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>
<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.</dd>
<dt><a name="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>
<dt><tt>/t[:filename]</tt></dt>
<dd>List label table. If no <tt>filename</tt> given, 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>
</dl>
<h2>SYNTAX</h2>
<p>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. <b>xasm</b> is not case-sensitive, so you can mix upper-
and lower-case for labels and instructions.</p>
<p><b>xasm</b> is backward compatible with Quick Assembler.
If you want to assembly QA sources with <b>xasm</b>, simply convert the text
file to CR/LF terminators and 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>
<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,
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
names as label names. For example</p>
<pre>nop
</pre><p>defines a label called <tt>nop</tt>, whereas</p>
<pre> nop
</pre><p>is a 6502 instruction.</p>
<p>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:</p>
<pre>; this is a comment
* so it is
label | and this too
</pre>
<p><a name="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>
<pre> lda foo ; this is a comment
sta bar so it is
tax #0 tax requires no operand, so #0 starts a 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>
<pre> eor:sta foo
</pre>
<p>is equivalent to</p>
<pre> eor foo
sta foo
</pre>
<p>Note that</p>
<pre> lda:tax #0
</pre><p>is allowed (<tt>#0</tt> is 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>
<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>an ASCII character, e.g. <tt>'a'</tt> or <tt>"a"</tt></li>
<li>the origin counter value: <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
<tt>$a9</tt></li>
<li><a name="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>
<table>
<tr><th>Syntax</th><th>Chip</th>
<th>Value in the Atari 8-bit<br/>computer mode (<tt>opt g-</tt>)</th>
<th>Value in the Atari 5200<br/>game console mode (<tt>opt g+</tt>)</th>
</tr>
<tr><td><tt>^0x</tt></td><td>GTIA</td>
<td><tt>$D00x</tt></td><td><tt>$C00x</tt></td></tr>
<tr><td><tt>^1x</tt></td><td>GTIA</td>
<td><tt>$D01x</tt></td><td><tt>$C01x</tt></td></tr>
<tr><td><tt>^2x</tt></td><td>POKEY</td>
<td><tt>$D20x</tt></td><td><tt>$E80x</tt></td></tr>
<tr><td><tt>^3x</tt></td><td>PIA</td>
<td><tt>$D30x</tt></td><td>error (there's no PIA chip)</td></tr>
<tr><td><tt>^4x</tt></td><td>ANTIC</td>
<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 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
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.
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
</pre>
<p>The follownig binary operators are supported:</p>
<ul>
<li><tt>+&nbsp;</tt> Addition</li>
<li><tt>-&nbsp;</tt> Subtraction</li>
<li><tt>*&nbsp;</tt> Multiplication</li>
<li><tt>/&nbsp;</tt> Division</li>
<li><tt>%&nbsp;</tt> Remainder</li>
<li><tt>&amp;&nbsp;</tt> Bitwise AND</li>
<li><tt>|&nbsp;</tt> Bitwise OR</li>
<li><tt>^&nbsp;</tt> Bitwise XOR</li>
<li><tt>&lt;&lt;</tt> Arithmetic shift left</li>
<li><tt>&gt;&gt;</tt> Arithmetic shift right</li>
<li><tt>=&nbsp;</tt> Equal</li>
<li><tt>==</tt> Equal (same as <tt>=</tt>)</li>
<li><tt>&lt;&gt;</tt> Not equal</li>
<li><tt>!=</tt> Not equal (same as <tt>&lt;&gt;</tt>)</li>
<li><tt>&lt;&nbsp;</tt> Less than</li>
<li><tt>&gt;&nbsp;</tt> Greater than</li>
<li><tt>&lt;=</tt> Less or equal</li>
<li><tt>&gt;=</tt> Greater or equal</li>
<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>
<ul>
<li><tt>+&nbsp;</tt> Plus (does nothing)</li>
<li><tt>-&nbsp;</tt> Minus (changes the sign)</li>
<li><tt>~&nbsp;</tt> Bitwise NOT (complements all bits)</li>
<li><tt>!&nbsp;</tt> Logical NOT (changes true to false and vice versa)</li>
<li><tt>&lt;&nbsp;</tt> Low (extracts the low byte)</li>
<li><tt>&gt;&nbsp;</tt> High (extracts the high byte)</li>
</ul>
<p>The operator precedence is following:</p>
<table>
<tr><td>first</td><td><tt>[]</tt></td>
<td>(brackets)</td></tr>
<tr><td> </td><td><tt>+ - ~ &lt; &gt;</tt></td>
<td>(unary)</td></tr>
<tr><td> </td><td><tt>* / % &amp; &lt;&lt; &gt;&gt;</tt></td>
<td>(binary)</td></tr>
<tr><td> </td><td><tt>+ - | ^</tt></td>
<td>(binary)</td></tr>
<tr><td> </td><td><tt>= == &lt;&gt; != &lt; &gt; &lt;= &gt;=</tt></td>
<td>(binary)</td></tr>
<tr><td> </td><td><tt>!</tt></td>
<td>(unary)</td></tr>
<tr><td> </td><td><tt>&amp;&amp;</tt></td>
<td>(binary)</td></tr>
<tr><td>last </td><td><tt>||</tt></td>
<td>(binary)</td></tr>
</table>
<p>Note that although the operators are similar to those used in C, C++
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>
<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:
<pre>five equ 5
here equ *
</pre></dd>
<dt><a name="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>
<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>
</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/>
Examples:
<pre> 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
</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):
<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>
</ul>
Examples:
<pre> org $600
org f:$700
table org *+100
</pre>
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
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.
Example:</p>
<pre> org $8000
ldx #code_length-1
mva:rpl code_loaded,x z:code_zpage,x-
jmp code_zpage
code_loaded
org r:$30
code_zpage
jmp * ; ... or something more sensible
code_length equ *-code_zpage
</pre>
<p>Note that both <tt>*</tt> 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:</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:
<ul>
<li>integers
<ul>
<li>bytes: <tt>b(200)</tt> or simply <tt>200</tt></li>
<li>words: <tt>a(10000)</tt></li>
<li>low bytes of words: <tt>l(511)</tt> defines byte 255</li>
<li>high bytes of words: <tt>h(511)</tt> defines byte 1</li>
</ul>
You may enter many expressions in parentheses and combine different types
of data in a single line, separating things with commas.<br/>
You may also define a sine lookup table. The syntax is:<br/>
<tt>sin(center,amp,size,first,last)</tt><br/>
where:
<ul>
<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.
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>
<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/>
Placing a <tt>*</tt> character after a string inverts
the highest bit in every byte of the string.</li>
</ul>
Examples of <tt>DTA</tt>:
<pre>
dta b(1,2),3,a(1000,-1),l(12345,sin(0,127,256))
dta d"ANTIC"*,c'It''s a string',$9b
</pre></dd>
<dt><tt><b>ICL</b></tt> - include another source file</dt>
<dd>Specifies another file to be included in the assembly as if the contents
of the referenced file appeared in place of the <tt>ICL</tt> statement.
The included file may contain other <tt>ICL</tt> statements.
The <tt>.ASX</tt> extension is added if none given.<br/>
Examples:
<pre>
icl 'macros.asx'
icl 'c:\atari\xasm\fileio'
</pre></dd>
<dt><tt><b>END</b></tt> - end assembling file</dt>
<dd>Remaining part of the file is not assembled. If this statement does
not occur, the assembler stops assembling when it encounters the end
of the file.<br/>
Example:
<pre>
end
</pre></dd>
<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:
<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/>
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
</pre>
is equivalent to:
<pre> org $2e0
dta a(addr)
</pre>
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:
<pre> ini showpic
</pre></dd>
<dt><tt><b>ERT</b></tt> - generate an error if an expression is 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
true<br/>
<tt><b>ELI</b></tt> - else if<br/>
<tt><b>ELS</b></tt> - else<br/>
<tt><b>EIF</b></tt> - end if</dt>
<dd>With these directives you can construct fragments which
are assembled when a condition is met.
Conditional constructions can be nested.<br/>
Example:
<pre>noscr equ 1
widescr equ 1
ift noscr
lda #0
eli widescr
lda #$23
els
lda #$22
eif
sta $22f
</pre>
The above example can be rewritten using the line repeating feature:
<pre>noscr equ 1
widescr equ 1
:noscr lda #0
:!noscr&amp;&amp;widescr lda #$23
:!noscr&amp;&amp;!widescr lda #$22
sta $22f
</pre></dd>
</dl>
<h2>PSEUDO-COMMANDS</h2>
<p>Pseudo-commands are built-in macros.</p>
<dl>
<dt><tt><b>ADD</b></tt> - addition without carry</dt>
<dd>If you have ever programmed a 6502, you must have noticed that you had
to use a <tt>CLC</tt> before <tt>ADC</tt> for every simple addition.<br/>
<b>xasm</b> can do it for you. <tt>ADD</tt> replaces two instructions:
<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,
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/>
Example:
<pre> ldx #0
mva:rne $500,x $600,x+
</pre>
The example code copies memory $500-$5ff to $600-$6ff.
Here is the same written with standard 6502 commands only:
<pre> ldx #0
loop lda $500,x
sta $600,x
inx
bne loop
</pre></dd>
<dt><tt><b>SCC, SCS, SEQ, SMI, SNE, SPL, SVC, SVS</b></tt> - conditional
skip</dt>
<dd>These are branches over the next instructions. No operand is required,
because the target is the address of the instruction following
the next instruction.<br/>
Example:
<pre> lda #40
add:sta $80
scc:inc $81
</pre>
In the above example the word-sized variable $80 is incremented by 40.</dd>
<dt><tt><b>JCC, JCS, JEQ, JMI, JNE, JPL, JVC, JVS</b></tt> - conditional
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/>
Example:
<pre> jne dest
</pre>is equivalent to:
<pre> seq:jmp dest
</pre></dd>
<dt><tt><b>INW</b></tt> - increment word</dt>
<dd>Increments a 16-bit word in the memory.<br/>
Example:
<pre> inw dest
</pre>is equivalent to:
<pre> inc dest
sne:inc dest+1
</pre></dd>
<dt><tt><b>MVA, MVX, MVY</b></tt> - move byte using accumulator, X or Y</dt>
<dd>Each of these pseudo-commands requires two operands
and substitutes two commands:
<pre> mva source dest = lda source : sta dest
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
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:
<pre> mv* source dest
mv* source+1 dest+1
</pre>
When source is an immediate, an <tt>mw* #immed dest</tt> will be:
<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:
<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:
<pre> ldx #1
stx dest
dex
stx dest+1
</pre></dd>
</dl>
<h2>ADDRESSING MODES</h2>
<p>All addressing modes are entered in the standard 6502 convention except for
the accumulator addressing mode, which should be marked with
the <tt>@</tt> character (as in Quick Assembler).</p>
<p>There are two extra immediate addressing modes:
<tt>&lt;</tt> and <tt>&gt;</tt>,
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>),
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>Examples:</p>
<pre>
nop
asl @
lda &gt;$1234 assembles to lda #$12
lda $100,x
lda a:0 generates 16-bit address
jmp ($0a)
lda ($80),y
</pre>
<p>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
<tt>MWA</tt>, <tt>MWX</tt> and <tt>MWY</tt>:</p>
<pre> 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
<a name="new_adrmodes"/> cmd (z),0+ = ldy #0 : cmd (z),y : iny
cmd (z),0- = ldy #0 : cmd (z),y : dey
</pre>
<h2>CHANGES</h2>
<h3>Version 2.6.1 (2005-05-21)</h3>
<ul>
<li>no more "Arithmetic overflow" and "Division by zero" errors when correctly
using forward-referenced labels (bug found by Marcin Lewandowski)</li>
<li>the following now assembles:
<pre> ift 0
foo equ 1
ift foo
eif
eif
</pre>
(bug found by Adrian Matoga)</li>
<li>errors for non-existing <tt>INC @</tt> and <tt>DEC @</tt></li>
<li>negative numbers fixed in the listing</li>
</ul>
<h3>Version 2.6.0 (2005-02-07)</h3>
<ul>
<li>long file names are supported under Windows</li>
<li><a href="#new_orgr">support for code that is relocated at runtime</a></li>
<li><a href="#new_linecnt">line repeat counter</a></li>
<li>label values are now 32-bit, not just 17-bit</li>
<li>command-line options <tt>/n</tt> and <tt>/s</tt> are no longer
supported</li>
<li>fatal I/O errors (such as floppy not ready) no longer print the annoying
'<tt>Abort, Retry, Ignore</tt>' message</li>
</ul>
<h3>Version 2.5.2 (2002-10-03)</h3>
<ul>
<li>version 2.5.1 broke Unix EOLs - fixed</li>
<li>version 2.5.1 omitted all blank/comment/label lines, unless <tt>/c</tt>
was used</li>
</ul>
<h3>Version 2.5.1 (2002-08-21)</h3>
<ul>
<li>fixed assembling sources with Atari EOLs</li>
<li>blank/comment/label lines in false conditionals are now correctly omitted
in listing</li>
</ul>
<h3>Version 2.5 (2002-07-08)</h3>
<ul>
<li>fixed another bug, very similar to the previous one, e.g.
<pre> ift 0
:label nop
eif
</pre>
reported <tt>Label not defined before</tt> error for the repeat count</li>
<li><a href="#new_opt"><tt>OPT F+</tt> causes <tt>ORG</tt>s to fill the space
between the old and the new location with <tt>$FF</tt>s</a></li>
<li><a href="#new_opt"><tt>OPT G+</tt> enables Atari 5200 mode for hardware
register abbreviations</a></li>
</ul>
<h3>Version 2.4.1 (2002-06-27)</h3>
<ul>
<li>fixed a bug related to label definitions in conditionally skipped code,
e.g.
<pre> ift 0
label
eif
</pre>
reported <tt>No ORG specified</tt> error for the label definition</li>
</ul>
<h3>Version 2.4 (2002-05-22)</h3>
<ul>
<li>fixed a bug causing incorrect unary operator precedence</li>
<li>fixed wrong label value after a skip pseudo-command</li>
<li>the assembler is .EXE (.COM caused problems with DJGPP make due
to a bug in the DJGPP runtime)</li>
<li>the assembler is not compressed (so it occupies less space in the ZIP)</li>
<li>improved command-line parsing: options may be used before source file
name, tab character is a valid separator, <tt>/</tt> may be used as a directory
separator</li>
<li>error and warning messages are written to stderr, not stdout</li>
<li>added <tt>==</tt> (equals) operator, which is equivalent to
<tt>=</tt>(but is more natural for C/C++/Java programmers)</li>
<li><a href="#new_deflabel">added <tt>/d:label=value</tt> option: define
a label</a></li>
<li><a href="#new_fullpaths">added <tt>/p</tt> option: print full paths
in listing and error messages</a></li>
<li><a href="#new_quiet">added <tt>/q</tt> option: quiet mode</a></li>
<li><a href="#new_unlabels">added <tt>/u</tt> option: warn of unused
labels</a></li>
<li><a href="#new_opt">writing to the object file may be suppressed
with <tt>OPT O-</tt></a></li>
<li><a href="#new_eli">added <tt>ELI</tt> (else if) directive</a></li>
<li><a href="#new_mwinde"><tt>MWX</tt> and <tt>MWY</tt> may use
<tt>INX</tt>/<tt>DEX</tt> and <tt>INY</tt>/<tt>DEY</tt>, respectively,
for generating smaller code</a></li>
</ul>
<h3>Version 2.3 (2002-02-10)</h3>
<ul>
<li>double skip (e.g. <tt>SCC:SNE</tt>) bug fixed</li>
<li>real number two-digit exponent bug fixed</li>
<li>trailing spaces in a listing line are now truncated</li>
<li>label definitions allowed in blank, comment and repeated lines</li>
<li><a href="#new_unary">unary operators</a></li>
<li><a href="#new_dta"><tt>DTA</tt> implied byte mode</a></li>
<li><a href="#new_op_op">operand can be skipped for some op-codes</a></li>
</ul>
<h3>Version 2.2 (1999-09-10)</h3>
<ul>
<li>invalid absolute <tt>CPX</tt> and <tt>CPY</tt> op-codes fixed</li>
<li>fixed: addressing mode not checked for branch commands</li>
<li><tt>ICL</tt> in last line bug fixed</li>
<li><tt>OPT H-H+</tt> bug fixed</li>
<li>first <tt>ORG *</tt> bug fixed</li>
<li>origin setting not required until it is used</li>
<li>Unix ($0a), Macintosh ($0d) and Atari ($9b) EOLs allowed in the source</li>
<li>value of 'true' changed to 1</li>
<li><a href="#new_environment">setting environment variables on error
option</a></li>
<li>assembling only if source newer than object option</li>
<li><a href="#new_opcode">op-code extracting</a></li>
<li><a href="#new_linerep">line repeating</a></li>
<li><a href="#new_pairing">instructions pairing</a></li>
<li><a href="#new_repskip">conditional repeat and skip pseudo commands</a></li>
<li><a href="#new_adrmodes"><tt>(),0+</tt> and <tt>(),0-</tt> pseudo
addressing modes</a></li>
</ul>
<h3>Version 2.0 (1998-11-12)</h3>
<ul>
<li>truncating name of object bug fixed</li>
<li><tt>EQU</tt> and <tt>DTA</tt> forward reference bugs fixed</li>
<li>hex number recognizing bug fixed</li>
<li>now <tt>.OBX</tt> is the default extension for Atari executables</li>
<li>assembling options (switches and <tt>OPT</tt> directive)</li>
<li>listing generation</li>
<li>label table generation</li>
<li>conditional assembly</li>
<li>user errors</li>
<li>warnings</li>
<li>improved headers generation</li>
<li>improved expressions - 19 operators and brackets, 32-bit arithmetic</li>
<li>improved signed numbers</li>
<li>6 new pseudo commands (memory-to-memory move)</li>
<li>8 pseudo addressing modes</li>
<li>indirect conditional jumps</li>
<li>Atari floating-point numbers generation</li>
<li>improved <tt>INS</tt>: inserting specified part of file</li>
</ul>
<h3>Version 1.2 (1998-08-14)</h3>
<ul>
<li>first release</li>
</ul>
<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>
</html>

5
dub.sdl Normal file
View File

@ -0,0 +1,5 @@
name "xasm"
description "6502 cross-assembler with original syntax extensions"
authors "Piotr Fusik"
copyright "Copyright © 1998-2021, Piotr Fusik"
license "poetic"

3061
source/app.d Normal file

File diff suppressed because it is too large Load Diff

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
#

2
t.bat
View File

@ -1,2 +0,0 @@
tasm xasm /m5 /t /z /l
tlink xasm /x

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,79 +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>xasm</title>
<meta name="Description" content="xasm is a 6502 cross-assembler for DOS/Windows."/>
<meta name="Keywords" content="xasm,6502,cross-assembler,atari"/>
<meta name="Author" content="Piotr Fusik"/>
</head>
<body style="background-color: #c0ffc0">
<h1>xasm.atari.org</h1>
<p><b>xasm</b> 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.
<b>xasm</b> is freeware.</p>
<p><a href="xasm260.zip">Download version 2.6.0
(22 KB, includes full documentation)</a></p>
<p><b>xasm</b> no longer includes the tools X-BOOT, X-LOAD and X-HEAD.
If you really need them,
<a href="xasm252.zip">download version 2.5.2 (38 KB)</a>.</p>
<h3>Target audience</h3>
<p><b>xasm</b> 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.</p>
<p>There are several 6502 cross-assemblers to choose from and new ones
still appear. Just search the web. Make sure to not overlook
the <a href="http://www.cc65.org">cc65</a> compiler which includes
a cross-assembler, portable across many host and target platforms.</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 <a href="http://www.code-genie.com">Code-Genie</a> editor:</p>
<p><img src="cgenie.gif" alt="6502 code in Code-Genie"/></p>
<hr/>
<p><i>Hosted by <a href="http://atariarea.histeria.pl">Atari Area</a></i></p>
</body>
</html>

925
xasm.1.asciidoc Normal file
View File

@ -0,0 +1,925 @@
XASM (1)
========
:doctype: manpage
NAME
----
xasm - 6502 cross-assembler
SYNOPSIS
--------
*xasm* '[OPTIONS] SOURCE_FILE'
DESCRIPTION
-----------
*xasm* is a cross-assembler for the 6502 family processors.
'SOURCE_FILE' is the name of the source file
(you may omit the default `.asx` extension).
Using '-' as 'SOURCE_FILE' makes *xasm* read from standard input.
When invoked without any options, *xasm* assembles 'SOURCE_FILE'
and writes the result to an object file named 'SOURCE_FILE'
with the extension changed to `.obx`.
OPTIONS
-------
*-c*::
The listing should include conditionally skipped lines.
[[new_deflabel]]*-d* 'LABEL'='VALUE'::
Defines a label.
'LABEL' should be a valid label name.
'VALUE' may be any expression (potentially referencing labels defined in source files).
You may use several *-d* options to define many labels on the command line.
*-i*::
The listing file should exclude included files.
*-l* '[LISTING_FILE]'::
Generates a listing file.
Using '-' as 'LISTING_FILE' makes *xasm* write to standard output.
If 'LISTING_FILE' is omitted, the listing filename
is 'SOURCE_FILE' with the extension changed to `.lst`.
[[new_makefile]]*-M*::
Prints a `Makefile` rule.
First line of the rule lists 'OBJECT_FILE' as the target of the rule
and all source files (including the ones specified with `icl` and `ins`) as dependencies.
The second line contains the command line with 'OBJECT_FILE'
replaced by the *make* macro `$@` and 'SOURCE_FILE' replaced by the macro `$<`.
Dollar signs in the command line are doubled.
Your *make* or shell may require further escaping.
*-o* 'OBJECT_FILE'::
Sets output file name.
Using '-' as 'OBJECT_FILE' makes *xasm* write to standard output.
The default is 'SOURCE_FILE' with the extension changed to `.obx`, or
standard output if standard input was specified as source.
[[new_fullpaths]]*-p*::
Prints absolute paths in listing and error messages.
[[new_quiet]]*-q*::
Quiet mode. Prevents *xasm* from printing its banner and compilation summary.
*-t* '[LABEL_FILE]'::
Generates a label table.
Using '-' as 'LABEL_FILE' makes *xasm* write to standard output.
If 'LABEL_FILE' is omitted then the table is appended at the end of the listing.
[[new_unlabels]]*-u*::
Issues warnings for unreferenced labels.
Alternatively, you may use DOS-style options, for example:
-----------------------------------------------------------
xasm /i /d:DEBUG=1 /l:listing.lst source.asx
-----------------------------------------------------------
These are deprecated because they are incompatible with https://www.msys2.org[MSYS2].
SYNTAX
------
Source files should be plain ASCII files.
LF, CR, CR/LF and Atari ($9b) line terminators are supported.
Labels and instructions are case-insensitive.
*xasm* is backward compatible with Quick Assembler.
To compile QA sources with *xasm*, simply replace ATASCII characters
in string literals with the corresponding integers.
Also update all `OPT` directives, but often you can omit them.
A 'label' is a symbol that represents a signed 32-bit integer.
You define a label by putting its name at the beginning of a line
(with no spaces before).
The label will be assigned the current value of the 'origin counter'
(that is, the address of the compiled instruction),
unless you use it with the `EQU` directive to assign the specified value.
[[new_locallabel]]
Any label name starting with a `?` (question mark) is a 'local label'.
It is implicitly prefixed with the name of the most recently defined
'global label' (that is, a label without any `?` in name),
and remains visible until another global label is defined.
It is still possible to access a local label from anywhere in the source
by specifying its full name.
Local labels provide a way to reuse common, short label names while keeping
them unique.
Example:
----
foo ldy #0
?loop lda data,y ; full label name is FOO?LOOP
beq ?ret
jsr sendByte
iny:bne ?loop
?ret rts
bar lda baz
beq foo?ret ; ok
bne ?loop ; ERROR: Undeclared label: BAR?LOOP
----
'Instructions' and 'directives' must be preceded with some whitespace.
Without leading whitespace they are treated as label names.
For example:
----
nop
----
is a 6502 instruction, whereas
----
nop
----
(without leading space) defines a label called `nop`.
Whole-line comments must start with a semicolon, an asterisk or a pipe,
with an optional label definition and spaces before.
Here are examples of whole-line comments:
--------------------
; this is a comment
* so it is
label | and this too
--------------------
[[new_linerep]]
Lines with instructions (and selected directives) may be 'repeated'.
To assemble a single line several times,
precede the repeat count with a colon, for example:
-----------------
:4 asl @
mask_lookup :32 dta $80,$40,$20,$10,$08,$04,$02,$01
-----------------
In lines with instructions or directives, a comment starts immediately
after the instruction/directive has been successfully parsed.
That is, in such lines *xasm* does 'not' require any special character
to start a comment.
-------------------------------------------------------------
lda foo ; this is a comment
sta bar this too
tax #0 tax has no operand, therefore #0 starts this comment
-------------------------------------------------------------
[[new_pairing]]
You may put two or more instructions in one line so they share their operand.
For example:
------------
eor:sta foo
------------
is equivalent to
------------
eor foo
sta foo
------------
Note that
------------
lda:tax:tay #0
------------
is allowed because `#0` is treated as a comment for `tax` and `tay`.
EXPRESSIONS
-----------
Expressions are numbers combined with operators and brackets.
You should use square brackets, because parentheses are reserved
for 6502 indirect addressing.
A number is:
- a 32-bit decimal integer, e.g. `12345`
- a 32-bit hexadecimal integer, e.g. `$abcd`
- a 32-bit binary integer, e.g. `%10100101`
- an ASCII character, e.g. `'a'` or `"a"`
- the current value of the origin counter: `*`
- a hardware register (see below), e.g. `^4e`
- [[new_opcode]]an opcode (see below), e.g. `{lda #0}` is `$a9`
- [[new_linecnt]]the current value of the line repeat counter (see below): `#`
Abbreviations of Atari hardware registers are provided
to save two characters (`$d40e` vs `^4e`)
and to facilitate porting software between Atari 8-bit computers
and the Atari 5200 console.
These are very similar machines, one of the biggest differences
is the location of hardware registers.
[cols="^m,^d,^m,^d",options="header"]
|================================================
|Syntax|Chip |Value|Value in Atari 5200 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`
|================================================
The opcode syntax represents the opcode byte of the instruction inside braces.
The operand of the instruction is discarded and is needed 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.
[[new_op_op]]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: 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
----------------------------------------------------
The following 'binary operators' are supported:
- `+` 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
[[new_unary]]
The following 'unary operators' are supported:
- `+` Plus (no operation)
- `-` Minus (changes the sign)
- `~` Bitwise NOT (complements all bits)
- `!` Logical NOT (changes true to false and vice versa)
- `<` Low (extracts the low byte)
- `>` High (extracts the high byte)
Although the operators are similar to those used in C, C++, C# and Java,
their precedence is different:
- first: `[]` (brackets)
- `+ - ~ < >` (unary)
- `* / % & << >>` (binary)
- `+ - | ^` (binary)
- `= == <> != < > <= >=` (binary)
- `!` (unary)
- `&&` (binary)
- last: `||` (binary)
The compare and logical operators assume that zero is false
and a non-zero is true. They return 1 for true.
Expressions are calculated in signed 32-bit arithmetic.
An overflow is signalled with an "Arithmetic overflow" error.
DIRECTIVES
----------
*EQU* - assign the value of an expression to a label::
Examples:
+
----------
five equ 5
here equ *
----------
[[new_opt]]*OPT* - set assembler options::
Six options are available:
- `F` - fill the space between noncontiguous memory areas with `$FF` bytes
- `G` - Atari 5200 mode for hardware register abbreviations (`^xx`)
- `H` - generate Atari executable headers
- `L` - write the listing
- `O` - write the object file
- `U` - warn of unused labels
+
You can turn any of these on or off.
The default (before the first `OPT`) is `opt f-g-h+l+o+u+`.
For compatibility with MADS, `opt ?+` is accepted and ignored.
Examples:
+
------------------------------------------------------------------------------
opt l- listing off
opt l+o- listing on, object file off
opt f+g+h- useful for Atari 5200 cartridges - raw output, 5200 hw regs
opt ?+ MADS compatibility, no effect
------------------------------------------------------------------------------
*ORG* - set the origin counter::
If Atari executable headers are enabled (`opt h+`), you can include an operand prefix:
- `a:` starts a new block even if it's superfluous
because the new address equals the current address.
- `f:` is same as `a:`, but additionally generates a double `$FF` prefix
before the new header. This prefix is automatically generated
at the beginning of the file (no need to include `f:` in the first `ORG`).
+
Examples:
+
---------------
org $600
org f:$700
table org *+100
---------------
+
In the latter example `table` points to 100 bytes
of uninitialized data (label is assigned with `*`
before the `ORG` directive is executed).
+
[[new_orgr]]*xasm* supports code that is relocated at run time.
Let's say you want your code to be located on page zero for best performance.
You can't safely 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
mva:rpl code_loaded,x z:code_zpage,x-
jmp code_zpage
code_loaded
org r:$30
code_zpage
jmp * ; ... or something more sensible
code_length equ *-code_zpage
--------------------------------------
+
Note that both `*` and label definitions use the counter used
for code generation. There is no direct access to the other counter.
You can only calculate it:
+
---------------------------------------
where_am_i equ *-code_zpage+code_loaded
---------------------------------------
[[new_dta]]*DTA* - define data::
- integers
+
--
* bytes: `b(200)` or simply `200`
* words: `a(10000)`
* low bytes of words: `l(511)` (byte 255)
* high bytes of words: `h(511)` (byte 1)
You may enter many expressions in parentheses and combine different types
of data in single line, separating things with commas.
You may also build a sine lookup table. The syntax is:
-------------------------------
sin(center,amp,period,first,last)
-------------------------------
where:
* `center` is an integer which is added to every sine value
* `amp` is the sine amplitude
* `period` is the number of values per sine period
* `first,last` define the range of sine arguments.
They are optional. The default are `0,period-1`.
Example:
----------------------------
dta a(sin(0,1000,256,0,63))
----------------------------
defines a table of 64 words representing a quarter of sine with the amplitude of 1000.
--
- real numbers: `r(-1.23456e12)`
+
Real numbers are stored in the 6-byte Atari Floating-Point format.
- text strings
+
--
* ASCII strings: `c'Text'` or `c"Text"`
* ANTIC strings: `d'Text'` or `d"Text"`
A character string consists of any number of characters surrounded by quotation
marks. You can include the quotation marks in the string by doubling them.
Placing a `*` character after a string inverts
the highest bit in every byte of the string.
--
+
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* - include another source file::
Specifies another file to be included in the assembly as if the contents
of the referenced file appeared in place of the `ICL` statement.
The included file may contain other `ICL` statements.
The `.asx` extension is added if none given.
Examples:
+
-----------------
icl 'macros.asx'
icl 'lib/fileio'
-----------------
+
NOTE: For Windows/macOS/Linux portability use relative paths
and slashes as path separators.
*END* - end this source file::
May be used if the source file ends with something which shouldn't
be read by *xasm* (e.g. your notes).
*INS* - insert binary file contents::
Copies every byte of the specified file into the object file and updates
the origin counter, as if these bytes were specified in a `DTA`.
You may specify a range of the file to insert. The syntax is:
+
-----------------------------
ins 'file'[,offset[,length]]
-----------------------------
+
The first byte in a file has the offset of zero.
If the offset is negative, it counts from the end of the file.
Examples:
+
-----------------------------------------------
ins 'picture.raw'
ins 'file',-256 ; insert last 256 bytes of file
ins 'file',10,10 ; insert bytes 10..19 of file
-----------------------------------------------
*RUN* - set the Atari executable run address::
+
---------
run main
---------
+
is equivalent to:
+
------------
org $2e0
dta a(main)
------------
*INI* - set the Atari executable init address::
Example:
+
------------
ini showloadingpic
------------
*ERT* - abort the assembly with an error if an expression is true::
Examples:
+
-----------------------
ert *>$c000
ert len1>$ff||len2>$ff
-----------------------
[[new_eli]]*IFT* - assemble if expression is true::
*ELI* - else if::
*ELS* - else::
*EIF* - end if::
With these directives you can construct fragments which
are assembled only when a condition is met.
Conditional constructions can be nested.
Example:
+
-------------
noscr equ 1
widescr equ 1
ift noscr
lda #0
eli widescr
lda #$23
els
lda #$22
eif
sta $22f
-------------
+
NOTE: Alternatively, the above example can be written using the 'repeat line' feature:
+
--------------------------
noscr equ 1
widescr equ 1
:noscr lda #0
:!noscr&&widescr lda #$23
:!noscr&&!widescr lda #$22
sta $22f
--------------------------
PSEUDO COMMANDS
---------------
'Pseudo commands' are built-in macros. There are 'no' user-defined macros in *xasm*.
*ADD* - add without carry::
If you have ever programmed a 6502, you must have noticed that you had
to use a `CLC` before `ADC` for every simple addition.
+
*xasm* can do it for you. `ADD` replaces two instructions: `CLC` and `ADC`.
*SUB* - subtract::
It is `SEC` followed by `SBC`.
[[new_repskip]]*RCC, RCS, REQ, RMI, RNE, RPL, RVC, RVS* - conditional repeat::
These are branches to the previous instruction.
They take no operand, because the branch target is the address
of the previously assembled instruction or pseudo command.
Example:
+
-----------------------
ldx #0
mva:rne $500,x $600,x+
-----------------------
+
The above code copies a 256-byte memory block from $500 to $600.
Here is the same written with standard 6502 commands only:
+
--------------------
ldx #0
copy_loop lda $500,x
sta $600,x
inx
bne copy_loop
--------------------
*SCC, SCS, SEQ, SMI, SNE, SPL, SVC, SVS* - conditional skip::
These are branches over the next instruction. No operand is required,
because the target is the address of the instruction following
the next instruction.
Example:
+
--------------
lda #40
add:sta ptr
scc:inc ptr+1
--------------
+
In the above example the 16-bit variable `ptr` is incremented by 40.
*JCC, JCS, JEQ, JMI, JNE, JPL, JVC, JVS* - conditional jump::
These are long branches. While standard branches (such as `BNE`)
have range of -128..+127 bytes, these jumps have range of 64 KB.
For example:
+
---------
jne dest
---------
+
is equivalent to:
+
-------------
seq:jmp dest
-------------
*INW* - increment word::
Increments a 16-bit word in the memory.
Example:
+
---------
inw dest
---------
+
is equivalent to:
+
---------------
inc dest
sne:inc dest+1
---------------
*MVA, MVX, MVY* - move a byte using the accumulator, X or Y::
Each of these pseudo commands requires two operands
and substitutes two commands:
+
----------------------------------------
mva source dest = lda source : sta dest
mvx source dest = ldx source : stx dest
mvy source dest = ldy source : sty dest
----------------------------------------
[[new_mwinde]]*MWA, MWX, MWY* - move word using accumulator, X or Y::
These pseudo commands require two operands and are combinations of two `MVA`/`MVX`/`MWY`:
one to move the low byte, and the other to move the high byte.
You can't use indirect nor pseudo addressing mode with `MWA`/`MWX`/`MWY`.
Destination must be an absolute or zeropage address, optionally indexed.
When source is also an absolute or zeropage address, an `mwa source dest` expands to:
+
--------------------
mva source dest
mva source+1 dest+1
--------------------
+
When source is an immediate value, an `mwa #immed dest` expands to:
+
------------------
mva <immed dest
mva >immed dest+1
------------------
+
When `<immed` equals `>immed` and `immed` is not forward-referenced,
*xasm* skips the second `LDA`, generating the following code:
+
----------------
mva <immed dest
sta dest+1
----------------
+
If possible, `MWX` and `MWY` use increment/decrement instructions.
For example, `mwx #1 dest` expands to:
+
-----------
ldx #1
stx dest
dex
stx dest+1
-----------
ADDRESSING MODES
----------------
Addressing modes are entered in the standard 6502 convention.
An exception is the accumulator mode marked with the `@` character
for compatibility with Quick Assembler.
Also for Quick Assembler compatibility there are two extra immediate
addressing modes: `<` and `>`, which use the low/high byte of a 16-bit word constant.
Unlike in Quick Assembler, you can alternatively use
the more common syntax: `#<` and `#>`.
Note the difference:
-------------------------------
lda >$ff+5 ; loads 1 (>$104)
lda #>$ff+5 ; loads 5 (0+5)
-------------------------------
You can explicitly specify absolute (`a:`) and zero-page (`z:`) addressing modes.
Examples:
--------------------------------------
nop
asl @
lda >$1234 assembles to lda #$12
lda $100,x
lda 0 zero-page (8-bit address)
lda a:0 absolute (16-bit address)
jmp ($0a)
lda ($80),y
--------------------------------------
[[new_adrmodes]]
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`:
------------------------------------------
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
------------------------------------------
HISTORY
-------
Version 3.2.1 (2022-12-08)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- source can optionally be read from standard input, and object can be
written to standard output instead of files (by Adrian Matoga)
- <<new_pairing,any number of instructions in one line>> (by Adrian Matoga)
Version 3.2.0 (2021-06-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- <<new_locallabel,local labels>> (contributed by Adrian Matoga)
- fixed emitted bytes not shown in the listing after `OPT L+` (by Adrian Matoga)
- emit shorter code for moving a negative immediate value with `MWX`/`MWY`
- Windows binary signed
- macOS binary signed, notarized, installed in `/usr/local/bin`
Version 3.1.1 (2019-11-20)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- remove partial object file on error (requested by Bill Kendrick)
- report label name in the unused label warning (requested by Peter Dell)
- support `a:`/`f:` modifiers for `RUN`/`INI`
- improved performance with network drives (reported by Marek Pavlik)
Version 3.1.0 (2014-07-20)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- OS X, Ubuntu and Fedora distributions
- `INS` can be repeated (suggested by Marek Pavlik) and taken "opcode" of
- `OPT U-` disables <<new_unlabels,*/u*>> unused label warnings
(suggested by Marek Pavlik)
- if the file to be included cannot be opened, report an error in the `ICL` line
(suggested by Peter Dell)
- removed duplicate filenames for <<new_makefile,*/M*>>
- implemented <<new_fullpaths,*/p*>> outside Windows
- source code updated from D1 to D2
- project moved to GitHub
Version 3.0.2 (2009-10-17)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed "Branch out of range" error message - was overstated by 256 bytes
for backward branches
- <<new_makefile,new command-line option */M* prints a Makefile rule>>
- command-line options are now case-insensitive
- on Windows, error messages are printed in red, warnings in yellow
Version 3.0.1 (2007-04-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed a bug in `OPT H-` mode
- made *xasm* compilable with the latest D compiler v1.010
(there were incompatible changes in the D language and library)
Version 3.0.0 (2005-05-22)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- rewritten from the x86 assembly language to the
http://dlang.org/[D programming language] - Linux version
is now available and DOS is no longer supported
- no limits on line length, number of `ICLs`, `ORGs`,`IFTs` and labels
- Unix-style command-line options are supported
- the */e* option is removed
- the label table is now sorted alphabetically
Version 2.6.1 (2005-05-21)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- no more "Arithmetic overflow" and "Division by zero" errors for correct
use of forward-referenced labels (bug found by Marcin Lewandowski)
- an error was reported in the following correct code:
+
---------
ift 0
foo equ 1
ift foo
eif
eif
---------
+
(bug found by Adrian Matoga)
- errors for non-existing `INC @` and `DEC @`
- negative numbers fixed in the listing
Version 2.6.0 (2005-02-07)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- long file names are supported under Windows
- <<new_orgr,support for code relocated at runtime>>
- <<new_linecnt,line repeat counter>>
- label values are now 32-bit, not just 17-bit
- command-line options */n* and */s* are no longer supported
- fatal I/O errors no longer print the annoying "Abort, Retry, Ignore" message
Version 2.5.2 (2002-10-03)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- version 2.5.1 broke Unix EOLs - fixed
- version 2.5.1 omitted all blank/comment/label lines, unless */c* was used
Version 2.5.1 (2002-08-21)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed assembling sources with Atari EOLs
- blank/comment/label lines in false conditionals are now correctly omitted
in listing
Version 2.5 (2002-07-08)
~~~~~~~~~~~~~~~~~~~~~~~~
- fixed another bug similar to the previous one, for example:
+
----------
ift 0
:label nop
eif
----------
+
reported "Label not defined before" error for the repeat count
- <<new_opt,`OPT F+` causes `ORG` to fill the space
between the old and the new location with `$FFs`>>
- <<new_opt,`OPT G+` enables Atari 5200 mode for hardware
register abbreviations>>
Version 2.4.1 (2002-06-27)
~~~~~~~~~~~~~~~~~~~~~~~~~~
- fixed a bug related to label definitions in conditionally skipped code,
e.g.
+
----------
ift 0
label
eif
----------
+
reported "No ORG specified" error for the label definition
Version 2.4 (2002-05-22)
~~~~~~~~~~~~~~~~~~~~~~~~
- fixed incorrect unary operator precedence
- fixed wrong label value after a skip pseudo command
- the assembler is an .EXE (.COM caused problems with DJGPP *make* due
to a bug in the DJGPP runtime)
- the assembler executable is no longer compressed
- improved command-line parsing: options may be used before the source file name,
tab is a valid separator, slash may be used as a directory separator
- error and warning messages are written to stderr, not stdout
- added `==` (equals) operator, equivalent to `=`, but familiar to C/C++/Java programmers
- <<new_deflabel,added `/d:label=value` option: define a label>>
- <<new_fullpaths,added `/p` option: print full paths
in listing and error messages>>
- <<new_quiet,added `/q` option: quiet mode>>
- <<new_unlabels,added `/u` option: warn of unused labels>>
- <<new_opt,writing to the object file may be suppressed with `OPT O-`>>
- <<new_eli,added `ELI` (else if) directive>>
- <<new_mwinde,`MWX` and `MWY` may use `INX`/`DEX` and `INY`/`DEY`,
respectively, for generating shorter code>>
Version 2.3 (2002-02-10)
~~~~~~~~~~~~~~~~~~~~~~~~
- fixed double skip (e.g. `SCC:SNE`)
- fixed real numbers with two-digit exponent
- trailing spaces are trimmed from listing lines
- label definitions allowed in blank, comment and repeated lines
- <<new_unary,unary operators>>
- <<new_dta,`DTA` implied byte mode>>
- <<new_op_op,operand can be skipped for some opcodes>>
Version 2.2 (1999-09-10)
~~~~~~~~~~~~~~~~~~~~~~~~
- fixed invalid opcodes of absolute `CPX` and `CPY`
- fixed: addressing mode not checked for branch commands
- fixed `ICL` in last line
- fixed `OPT H-H+`
- fixed first `ORG *`
- no need to set the origin counter until it's needed
- allow Unix, Macintosh and Atari EOLs
- value of 'true' changed to 1
- command-line option to set environment variables on error
- commane-line option to assemble only if the source is newer than the object file
- <<new_opcode,opcode extracting>>
- <<new_linerep,repeat line>>
- <<new_pairing,two instructions in line>>
- <<new_repskip,conditional repeat and skip pseudo commands>>
- <<new_adrmodes,`(),0+` and `(),0-` pseudo addressing modes>>
Version 2.0 (1998-11-12)
~~~~~~~~~~~~~~~~~~~~~~~~
- fixed: object filename was truncated
- fixed forward references in `EQU` and `DTA`
- fixed hex numbers
- `.OBX` is now the default extension for the object file
- options (command-line switches and `OPT`)
- listing
- label table
- conditional assembly
- user errors (`ERT`)
- warnings
- 6 new pseudo commands (memory-to-memory move)
- 8 pseudo addressing modes
- indirect conditional jumps
- Atari floating-point numbers
- object file headers optimization
- improved expressions - 19 operators and brackets, 32-bit arithmetic
- improved signed numbers
- improved `INS`: inserting specified part of file
Version 1.2 (1998-08-14)
~~~~~~~~~~~~~~~~~~~~~~~~
- first release
AUTHOR
------
Piotr Fusik <fox@scene.pl>
SEE ALSO
--------
Website: https://github.com/pfusik/xasm[]

3513
xasm.asm

File diff suppressed because it is too large Load Diff

View File

@ -1,41 +1,42 @@
# xasm settings for SciTE (www.scintilla.org)
# written by Piotr Fusik <fox@scene.pl>
file.patterns.asx=*.asx
filter.asx=xasm (asx)|$(file.patterns.asm)|
lexer.$(file.patterns.asx)=asm
keywords.$(file.patterns.asx)= \
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
comment.block.asm=;
style.asm.32=
style.asm.1=$(colour.code.comment.line)
style.asm.2=
style.asm.3=$(colour.string)
style.asm.4=$(colour.operator)
style.asm.5=
style.asm.6=$(colour.keyword)
style.asm.7=
style.asm.12=$(colour.char)
style.asm.13=$(colour.error)
command.compile.$(file.patterns.asx)=xasm /o:$(FileName).xex $(FilePath)
command.build.$(file.patterns.asx)=make
if PLAT_WIN
command.go.$(file.patterns.asx)=start $(FileName).xex
if PLAT_GTK
command.go.$(file.patterns.asx)=atari800 -run $(FileName).xex
# xasm settings for SciTE (http://www.scintilla.org/SciTE.html)
file.patterns.xasm=*.asx
filter.xasm=xasm (asx)|$(file.patterns.xasm)|
*filter.xasm=$(filter.xasm)
lexer.$(file.patterns.xasm)=asm
*language.xasm=xasm|asx||
keywords.$(file.patterns.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
comment.block.asm=;
style.asm.32=
style.asm.1=$(colour.code.comment.line)
style.asm.2=
style.asm.3=$(colour.string)
style.asm.4=$(colour.operator)
style.asm.5=
style.asm.6=$(colour.keyword)
style.asm.7=
style.asm.12=$(colour.char)
style.asm.13=$(colour.error)
command.compile.$(file.patterns.xasm)=xasm /o:$(FileName).xex $(FilePath)
command.build.$(file.patterns.xasm)=make
if PLAT_WIN
command.go.$(file.patterns.xasm)=start $(FileName).xex
if PLAT_GTK
command.go.$(file.patterns.xasm)=atari800 -run $(FileName).xex

40
xasm.spec Normal file
View File

@ -0,0 +1,40 @@
Name: xasm
Version: 3.2.1
Release: 1
Summary: 6502 cross-assembler
License: Poetic
Source: http://pfusik.github.io/xasm/xasm-%{version}.tar.gz
URL: https://github.com/pfusik/xasm
BuildRequires: dmd >= 2, asciidoc
%description
xasm is a 6502 cross-assembler with original syntax extensions.
%global debug_package %{nil}
%prep
%setup -q
%build
make xasm xasm.1
%install
make DESTDIR=%{buildroot} prefix=%{_prefix} install
%files
%{_bindir}/xasm
%{_mandir}/man1/xasm.1.gz
%changelog
* Thu Dec 8 2022 Piotr Fusik <fox@scene.pl>
- 3.2.1-1
* Tue Jun 22 2021 Piotr Fusik <fox@scene.pl>
- 3.2.0-1
* Wed Nov 20 2019 Piotr Fusik <fox@scene.pl>
- 3.1.1-1
* Sun Jul 20 2014 Piotr Fusik <fox@scene.pl>
- 3.1.0-1
- Initial packaging