1
0
mirror of https://github.com/pfusik/xasm.git synced 2024-06-17 00:29:26 +00:00

Compare commits

...

127 Commits

Author SHA1 Message Date
Piotr Fusik
f5903fb199 Minor doc improvements. 2024-06-09 15:00:15 +02:00
Piotr Fusik
8eb2a5ae6f Migrate to the new macOS notarization tool.
The old one no longer works.
2024-05-18 21:45:34 +02:00
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
Piotr Fusik
7c81897091 xasm 2.6.1 release. 2013-01-07 12:07:31 +01:00
Piotr Fusik
f288e64747 xasm 2.6.1. 2013-01-07 12:07:31 +01:00
Piotr Fusik
aa5efc560f xasm 2.6.0 release. 2013-01-07 12:07:31 +01:00
Piotr Fusik
10c0c534ea xasm 2.6.0. 2013-01-07 12:07:31 +01:00
Piotr Fusik
a8f3501164 xasm 2.5.2 release. 2013-01-07 12:07:31 +01:00
Piotr Fusik
b32bd4a6ad xasm 2.5.2. 2013-01-07 12:07:31 +01:00
Piotr Fusik
49c7068598 xasm 2.5.1 release. 2013-01-07 12:07:31 +01:00
Piotr Fusik
4b099cbccc xasm 2.5.1. 2013-01-07 12:07:30 +01:00
Piotr Fusik
67621cb32c xasm 2.5 release. 2013-01-07 12:07:30 +01:00
Piotr Fusik
22438199b9 xasm 2.5. 2013-01-07 12:07:30 +01:00
Piotr Fusik
402b4b7a79 xasm 2.4.2 release prepared, but not published. 2013-01-07 12:07:30 +01:00
Piotr Fusik
97f39029d7 xasm 2.4.2. 2013-01-07 12:07:30 +01:00
Piotr Fusik
d85541b707 xasm 2.4.1 release. 2013-01-07 12:07:30 +01:00
Piotr Fusik
85c9d6a9c7 xasm 2.4.1. 2013-01-07 12:07:30 +01:00
Piotr Fusik
c46bf8a027 xasm 2.4 release. 2013-01-07 12:07:29 +01:00
Piotr Fusik
af437b3eaa xasm 2.4. 2013-01-07 12:07:29 +01:00
Piotr Fusik
a7279f7ea6 xasm 2.4.-2. 2013-01-07 12:07:29 +01:00
Piotr Fusik
f9a11b10e3 xasm 2.4.-3. 2013-01-07 12:07:29 +01:00
Piotr Fusik
4d04b07860 xasm 2.4.-4. 2013-01-07 12:07:29 +01:00
Piotr Fusik
cd7b15669a xasm 2.4.-5. 2013-01-07 12:07:29 +01:00
Piotr Fusik
fc969d9263 xasm 2.4.-6. 2013-01-07 12:07:29 +01:00
Piotr Fusik
323634d856 xasm 2.4.-7. 2013-01-07 12:07:29 +01:00
Piotr Fusik
e22a4aadc3 X-LOAD 1.1. 2013-01-07 12:07:29 +01:00
Piotr Fusik
5b92221d87 xasm 2.4.-8. 2013-01-07 12:07:29 +01:00
Piotr Fusik
4102fd8bb0 X-Assembler 2.3 release (missing source code of the assembler). 2013-01-07 12:07:28 +01:00
Piotr Fusik
88362dba94 X-BOOT 5.0. 2013-01-07 12:07:28 +01:00
Piotr Fusik
6a5daaff83 X-BOOT 4.1.-9. 2013-01-07 12:07:28 +01:00
Piotr Fusik
83d6d7d0ac X-Assembler 2.3.-5. 2013-01-07 12:07:28 +01:00
Piotr Fusik
0c019b97d1 X-Assembler 2.2 release. 2013-01-07 12:07:28 +01:00
Piotr Fusik
fd5370e7c4 X-LOAD 1.0 - loads Atari 8-bit executables via a SIO2PC cable. 2013-01-07 12:07:28 +01:00
Piotr Fusik
299ab916c8 X-BOOT 4.0. 2013-01-07 12:07:28 +01:00
Piotr Fusik
373483e365 X-Assembler 2.2. 2013-01-07 12:07:28 +01:00
Piotr Fusik
d7c0cf3dc0 GR0 1.1. 2013-01-07 12:07:28 +01:00
Piotr Fusik
c0af7e23a5 X-Assembler 2.1. 2013-01-07 12:07:28 +01:00
Piotr Fusik
8fd13bc4f4 X-BOOT 4.0 beta 2. 2013-01-07 12:07:28 +01:00
Piotr Fusik
da00b4d6b8 X-Assembler 2.1 beta. 2013-01-07 12:07:28 +01:00
Piotr Fusik
98b08afee8 Documentation converted to HTML. 2013-01-07 12:07:27 +01:00
Piotr Fusik
1223276618 GR0 1.0 - modifies MS-DOS font and colors so that it looks like Atari 8-bit. 2013-01-07 12:07:27 +01:00
Piotr Fusik
59a64376fc Collection of my MS-DOS / Turbo Assembler macros. 2013-01-07 12:07:27 +01:00
33 changed files with 4340 additions and 4128 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

74
Makefile Normal file
View File

@ -0,0 +1,74 @@
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 $@
/Applications/Xcode.app/Contents/Developer/usr/bin/notarytool submit --wait --keychain-profile recoilnotarization $@
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

BIN
atari.pal

Binary file not shown.

View File

@ -1,26 +0,0 @@
Version 2.0
===========
- truncating name of object bug fixed
- EQU & DTA forward reference bugs fixed
- hex number recognizing bug fixed
- now .OBX is default extension for Atari executables
- assembling options (switches and OPT directive)
- listing generation
- label table generation
- conditional assembling
- user errors
- warnings
- improved headers generation
- improved expressions - 19 operators and brackets, 32-bit arithmetic
- improved signed numbers
- 6 new pseudo commands (memory-to-memory move)
- 8 pseudo addressing modes
- indirect conditional jumps
- Atari floating-point numbers generation
- improved INS: inserting specified part of file
Version 1.2
===========
- first release
===

View File

@ -1,274 +0,0 @@
; COMpack
; b. Fox
IDEAL
P386
MODEL TINY
CODESEG
ORG 100h
include 'fox.mak'
start:
; db 1024 dup(0) ;4 self-packing
inplen = 24000
outlen = 27000
print hello
mov di, 81h
movzx cx, [di-1]
jcxz usg
mov al, ' '
repe scasb
je usg
push cx di
dec di
inc cx
mov al, '?'
repne scasb
pop di cx
jne nousg
usg: print usgtxt
int 20h
getfil: lea si, [di-1]
mov al, ' '
repne scasb
jne noout1
dec di
noout1: mov cx, di
sub cx, si
mov di, offset fname
rep movsb
mov bx, di
srchex: dec bx
cmp [byte bx], '\'
je addext
cmp [byte bx], '.'
je extexs
cmp bx, offset fname
ja srchex
addext: mov ax, 'c.'
stosw
mov ax, 'mo'
stosw
extexs: mov [word di], 0a0dh
mov [byte di+2], '$'
print namtxt
print fname
mov [byte di], 0
rts: ret
smartdisk
nousg: print srctxt
call getfil
push si
fopen
mov cx, inplen
fread inpbuf
mov dx, offset lontxt
cmp ax, inplen
je panic
push ax
add [filend], ax
fclose
pop cx
mov dx, offset emptxt
jcxz panic
mov di, offset inpbuf
xor al, al
repe scasb
jne spox
panic: print
int 20h
spox: dec di
push di
mov [filbgn], di
sub di, offset inpbuf
add [destad], di
add [reljad], di
lda cx
inc ax
call prilen
pop bx
mov si, offset firflg
mov di, offset outbuf
pack1: push si di
mov ax, 1
mov bp, [filend]
lea si, [bx-0ffh]
cmp si, [filbgn]
jnb pack2
mov si, [filbgn]
cmp si, bx
je packn
pack2: mov di, bx
mov cx, bp
sub cx, bx
push si
repe cmpsb
pop si
je pack3
dec di
pack3: mov cx, di
sub cx, bx
cmp cx, ax
jbe pack4
lda cx
mov dx, si
pack4: inc si
cmp si, bx
jb pack2
packn: pop di si
mov bp, ax
sta cx
mov ax, 1
putfl1: cmp cx, 2
rcl [byte si], 1
jnc putfl2
mov si, di
stosb
putfl2: loop putfl1
cmp bp, ax
mov al, [bx]
je putbyt
mov al, dl
sub al, bl
putbyt: stosb
mov ah, 1
cmp [si], ah
jne swpflg
mov [si], ax
inc si
swpflg: add bx, bp
cmp bx, [filend]
jb pack1
shl [byte si], 1
jnc corfl1
mov al, 80h
stosb
jmp corfl3
corfl1: stc
corfl2: rcl [byte si], 1
jnc corfl2
corfl3: rcl [firflg], 1 ;+
xor al, al
stosb
sub di, offset depack
mov [filend], di
print pkdtxt
pop di
mov cx, 81h
add cl, [80h]
sub cx, di
jz nowri
mov al, ' '
repe scasb
je nowri
mov ax, [filend]
inc ah
cmp ax, [destad]
ja nospac
call getfil
fcreate
mov cx, [filend]
fwrite depack
fclose
nowri: mov ax, [filend]
prilen: mov di, offset lenlst
mov bx, 10
outnm1: xor dx, dx
div bx
add dl, '0'
outnm2: mov [di], dl
dec di
test ax, ax
jnz outnm1
mov dl, ' '
cmp di, offset lennum
jnb outnm2
print lentxt
ret
nospac: mov dx, offset zertxt
dos 9
jmp nowri
hello db 'COMpack 1.0 by Fox/Taquart',eot
usgtxt db 'This is FREEWARE packer for .COM programs.',eol
db 'Syntax:',eol
db 'COMPACK inpfile [outfile]',eol
db '"inpfile" specifies source path\filename',eol
db '"outfile" specifies target path\filename',eol
db 'The ".COM" extension of filename is default and you don''t have to write it',eol
db 'If you don''t give "outfile" parameter, no file will be saved',eol
db 'and you can only watch the results of packing',eol
zertxt db 'If you want the file saved, you must compile some zero bytes at the beginning',eol
db 'of file to reserve the space for packed data. The code should immediately',eol
db 'follow the zeros.',eot
srctxt db 'Source file:',eot
pkdtxt db 'Packed file:',eot
namtxt db ' Name: $'
lentxt db 'Length: '
lennum db ' '
lenlst db ' bytes',eot
emptxt db 'File is empty!',eot
lontxt db 'File is too long!',eot
smarterr
filbgn dw inpbuf
filend dw inpbuf
depack: mov si, offset packed-depack+100h
mov di, 100h
destad = word $-2
mov al, 1
firflg = byte $-1
xor cx, cx
dep1: movsb
dec cx
dep2: inc cx
dep3: add al, al
jnz dep4
lodsb
adc al, al ;+
dep4: jnc dep2
jcxz dep1
sbb bx, bx ;+
and bl, [si]
db 0fh,84h ;jz near
reljad dw depack-reljmp
reljmp: inc si
inc cx
push si
lea si, [di+bx]
rep movsb
pop si
jmp dep3
packed:
outbuf db outlen dup(?)
fname:
inpbuf db inplen dup(?)
ENDS
END start

View File

@ -1,102 +0,0 @@
* This program examines 6502 bugs!
* Please read text after program first.
icmd equ $342
ibuf equ $344
ilen equ $348
ciomain equ $e456
org $8000
dta h(*) Buggy jump fetches this byte...
lda #$ff ... and jumps to this location
jmp cont
start lda #11 Clear screen
ldx <clstxt
ldy #1
jsr callio
* Check ADC bug
sed
lda #$99 BCD 99+01=00
add #1
cld
beq *+4 Z flag set: no bug
lda #$ff
ldx <adctxt
jsr print
* Check BRK bug
sei Disable IRQs
inc ^4e Disable NMIs
mva #$fe ^31 Disable ROM
mwa #nmi $fffa Set my NMI vector
mwa #irq $fffe Set my IRQ vector
lsr ^4e Enable VBLKI
irq brk BRK interrupt - infinite loop, so...
nmi inc ^31 NMI always occurs on BRK
cli
pla
pla
sub <irq
beq *+4 Return adr points BRK: no bug
lda #$ff
ldx <brktxt
jsr print
* Check JMP bug
jmp (jmpptr) You'll receive a warning from X-Asm here!
cont ldx <jmptxt
jsr print
jmp * Halt CPU
* Print results (A=$ff:bug or 0:no_bug, X=<cmdtxt)
print pha Save A
lda #11 CIO write command
ldy #3 Print 3 letters
jsr callio
ldx <nobtxt
pla Restore A
beq *+4 A=0: X=<nobtxt
ldx <bugtxt A<>0: X=<bugtxt
lda #9 CIO write_to_eol command
ldy #$ff Limit of printed characters
callio sta icmd Call "E:" CIO: A-cmd X-<buf Y-len
stx ibuf
mva >* ibuf+1
sty ilen
mvx #0 ilen+1 Channel 0, length<256
jmp ciomain
clstxt dta b(125) Clear screen control code
adctxt dta c'ADC'
brktxt dta c'BRK'
jmptxt dta c'JMP'
bugtxt dta c' bug detected!',b($9b)
nobtxt dta c' bug NOT detected.',b($9b)
ert *>*|$ff Program should fit on one page
org *|$ff
jmpptr dta a(jmp1)
jmp1 lda #0 JMP bug not detected
jmp cont
run start
end
The program above checks 3 bugs:
- 'ADC bug'
Flags N,V,Z are not properly set after ADC or SBC in decimal mode.
You can't rely on these flags after BCD operation.
- 'BRK bug'
If an interrupt occurs on a BRK, it is executed with BRK-like values on stack.
This means a BRK is simply passed-by if a NMI occurs.
Beware of using BRK with other interrupts.
- 'JMP bug' - JMP ($xxff) fetches address from $xxff and $xx00.
X-Asm 2.0 warns you of using such a jump.
All these bugs are supposedly fixed in CMOS chips.
===

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,61 +0,0 @@
Display List op-codes
=====================
Blank lines
-----------
$00 - 1 blank line
$10 - 2 blank lines
$20 - 3 blank lines
$30 - 4 blank lines
$40 - 5 blank lines
$50 - 6 blank lines
$60 - 7 blank lines
$70 - 8 blank lines
Jumps
-----
$01 $ll $hh - JMP $hhll - Jump & generate 1 blank line
$41 $ll $hh - JVB $hhll - Jump after vertical blank
Modes
-----
Most popular combinations of ANTIC modes with GTIA modes:
ANTIC mode | GTIA mode | OS mode | screen | font | bytes/line
----------------------------------------------------------------------
$2 | %00 | $0 | 40* 30* 2 | 128*8*8* 2 | 40
$2 | %01 | - | 40* 30*16 | 128*2*8*16 | 40
$2 | %10 | - | 40* 30* 9 | 128*2*8* 9 | 40
$2 | %11 | - | 40* 30*16 | 128*2*8*16 | 40
$3 | %00 | - | 40* 24* 2 | 128*8*8* 2 | 40
$4 | %00 | $c | 40* 30* 5 | 128*4*8* 4 | 40
$5 | %00 | $d | 40* 15* 5 | 128*4*8* 4 | 40
$6 | %00 | $1 | 20* 30* 5 | 64*8*8* 2 | 20
$7 | %00 | $3 | 20* 15* 5 | 64*8*8* 2 | 20
$8 | %00 | $3 | 40* 30* 4 | - | 10
$9 | %00 | $4 | 80* 60* 2 | - | 10
$a | %00 | $5 | 80* 60* 4 | - | 20
$b | %00 | $6 | 160*120* 2 | - | 20
$c | %00 | $e | 160*240* 2 | - | 20
$d | %00 | $7 | 160*120* 4 | - | 40
$e | %00 | $f | 160*240* 4 | - | 40
$f | %00 | $8 | 320*240* 2 | - | 40
$f | %01 | $9 | 80*240*16 | - | 40
$f | %10 | $a | 80*240* 9 | - | 40
$f | %11 | $b | 80*240*16 | - | 40
screen: columns*rows*colors
font: chars*sizex*sizey*colors
+$10 - Horizontal Scroll
+$20 - Vertical Scroll
+$40 $ll $hh - Load Screen Pointer $hhll
For all op-codes
----------------
+$80 - Display List Interrupt after getting all data for this line
When placing Display List in memory, remember it cannot cross 1 kB boundary.
Similarly, screen memory cannot cross 4 kB boundary.
===

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"

View File

@ -1,7 +0,0 @@
\/
/\ - Assembler 2.0
--------------------------
by Fox/Taquart
--------------------------
8-bit Atari 6502 assembler
for PC 386+ / MS-DOS

View File

@ -1,107 +0,0 @@
*** GTIA
HPOSP0 equ ^00 (w) Horizontal POSition of Player 0
KOLM0PF equ ^00 (r) KOLlision Missile 0 to Play Field
HPOSP1 equ ^01 (w) Horizontal POSition of Player 1
KOLM1PF equ ^01 (r) KOLlision Missile 1 to Play Field
HPOSP2 equ ^02 (w) Horizontal POSition of Player 2
KOLM2PF equ ^02 (r) KOLlision Missile 2 to Play Field
HPOSP3 equ ^03 (w) Horizontal POSition of Player 3
KOLM3PF equ ^03 (r) KOLlision Missile 3 to Play Field
HPOSM0 equ ^04 (w) Horizontal POSition of Missile 0
KOLP0PF equ ^04 (r) KOLlision Player 0 to Play Field
HPOSM1 equ ^05 (w) Horizontal POSition of Missile 1
KOLP1PF equ ^05 (r) KOLlision Player 1 to Play Field
HPOSM2 equ ^06 (w) Horizontal POSition of Missile 2
KOLP2PF equ ^06 (r) KOLlision Player 2 to Play Field
HPOSM3 equ ^07 (w) Horizontal POSition of Missile 3
KOLP3PF equ ^07 (r) KOLlision Player 3 to Play Field
SIZEP0 equ ^08 (w) SIZE of Player 0
KOLM0P equ ^08 (r) KOLlision Missile 0 to Players
SIZEP1 equ ^09 (w) SIZE of Player 1
KOLM1P equ ^09 (r) KOLlision Missile 1 to Players
SIZEP2 equ ^0a (w) SIZE of Player 2
KOLM2P equ ^0a (r) KOLlision Missile 2 to Players
SIZEP3 equ ^0b (w) SIZE of Player 3
KOLM3P equ ^0b (r) KOLlision Missile 3 to Players
SIZEM equ ^0c (w) SIZE of Missiles
KOLP0P equ ^0c (r) KOLlision Player 0 to Players
GRAFP0 equ ^0d (w) GRAphic oF Player 0
KOLP1P equ ^0d (r) KOLlision Player 1 to Players
GRAFP1 equ ^0e (w) GRAphic oF Player 1
KOLP2P equ ^0e (r) KOLlision Player 2 to Players
GRAFP2 equ ^0f (w) GRAphic oF Player 2
KOLP3P equ ^0f (r) KOLlision Player 3 to Players
GRAFP3 equ ^10 (w) GRAphic oF Player 3
TRIG0 equ ^10 (r) TRIGger 0
GRAFM equ ^11 (w) GRAphic oF Missiles
TRIG1 equ ^11 (r) TRIGger 1
COLPM0 equ ^12 (w) COLor of Player/Missile 0
COLPM1 equ ^13 (w) COLor of Player/Missile 1
TRIG3 equ ^13 (r) TRIGger 3
COLPM2 equ ^14 (w) COLor of Player/Missile 2
PAL equ ^14 (r) PAL flag
COLPM3 equ ^15 (w) COLor of Player/Missile 3
COLPF0 equ ^16 (w) COLor of Play Field 0
COLPF1 equ ^17 (w) COLor of Play Field 1
COLPF2 equ ^18 (w) COLor of Play Field 2
COLPF3 equ ^19 (w) COLor of Play Field 3
COLBAK equ ^1a (w) COLor of BAcKground
GTIACTL equ ^1b (w) GTIA ConTroL
VDELAY equ ^1c (w) Vertical DELAY
PMCNTL equ ^1d (w) Player/Missile CoNTroL
HITCLR equ ^1e (w) HIT CLeaR
CONSOL equ ^1f (r/w) CONSOL
*** POKEY
AUDF1 equ ^20 (w) AUDio Frequency 1
POT0 equ ^20 (r) POTentiometr 0
AUDC1 equ ^21 (w) AUDio Control 1
POT1 equ ^21 (r) POTentiometr 1
AUDF2 equ ^22 (w) AUDio Frequency 2
POT2 equ ^22 (r) POTentiometr 2
AUDC2 equ ^23 (w) AUDio Control 2
POT3 equ ^23 (r) POTentiometr 3
AUDF3 equ ^24 (w) AUDio Frequency 3
AUDC3 equ ^25 (w) AUDio Control 3
AUDF4 equ ^26 (w) AUDio Frequency 4
AUDC4 equ ^27 (w) AUDio Control 4
AUDCTL equ ^28 (w) AUDio ConTroL
POTST equ ^28 (r) POTentiomers STatus
KBCODE equ ^29 (r) KeyBoard CODE
SKTRES equ ^2a (w) Serial and Keyboard RESet
RANDOM equ ^2a (r) RANDOM
POTGO equ ^2b (w) POTentiometr GOes
SEROUT equ ^2d (w) SERial OUT
SERIN equ ^2d (r) SERial IN
IRQEN equ ^2e (w) Interrupt ReQuest ENable
IRQST equ ^2e (r) Interrupt ReQuest STatus
SKCTL equ ^2f (w) Serial and Keyboard ConTroL
SKSTAT equ ^2f (r) Serial and Keyboard STATus
*** PIA
PORTA equ ^30 (r/w) PORT A
PORTB equ ^31 (r/w) PORT B
PACTL equ ^32 (r/w) Port A ConTroL
PBCTL equ ^33 (r/w) Port B ConTroL
*** ANTIC
DMACTL equ ^40 (w) Direct Memory Access ConTroL
CHRCTL equ ^41 (w) CHaRacters ConTroL
DLPTR equ ^42 (w) Display List PoinTeR
HSCROL equ ^44 (w) Horizontal SCROLl
VSCROL equ ^45 (w) Vertical SCROLl
PMBASE equ ^47 (w) Player/Missile BASE
CHBASE equ ^49 (w) CHaracter BASE
WSYNC equ ^4a (w) Wait for SYNChronisation
VCOUNT equ ^4b (r) Vertical COUNT
LPENH equ ^4c (r) Light PEN Horizontal
LPENV equ ^4d (r) Light PEN Vertical
NMIEN equ ^4e (w) Non-Maskable Interrupt ENable
NMIST equ ^4f (r) Non-Maskable Interrupt STatus
*** CPU
NMIVEC equ $fffa Non-Maskable Interrupt VECtor
RESETVC equ $fffc RESET VeCtor
IRQVEC equ $fffe Interrupt ReQuest VECtor
end

View File

@ -1,99 +0,0 @@
X-ASM 2.0 QUICK REFERENCE
=========================
6502 commands
-------------
ADC - add with carry
AND - and
ASL - arithmetic shift left
BCC - branch if carry clear
BCS - branch if carry set
BEQ - branch if equal
BIT - test bits
BMI - branch if minus
BNE - branch if not equal
BPL - branch if plus
BRK - break
BVC - branch if overflow clear
BVS - branch if overflow set
CLC - clear carry
CLD - clear decimal
CLI - clear interrupts
CLV - clear overflow
CMP - compare
CPX - compare with X
CPY - compare with Y
DEC - decrement
DEX - decrement X
DEY - decrement Y
EOR - exclusive or
INC - increment
INX - increment X
INY - increment Y
JMP - jump
JSR - jump to subroutine
LDA - load accumulator
LDX - load X
LDY - load Y
LSR - logical shift right
NOP - no operation
ORA - or accumulator
PHA - push accumulator
PHP - push flags
PLA - pull accumulator
PLP - pull flags
ROL - rotate left
ROR - rotate right
RTI - return from interrupt
RTS - return from subroutine
SBC - subtract with carry
SEC - set carry
SED - set decimal
SEI - set interrupts
STA - store accumulator
STX - store X
STY - store Y
TAX - transfer accumulator to X
TAY - transfer accumulator to Y
TSX - transfer stack pointer to X
TXA - transfer X to accumulator
TXS - transfer X to stack pointer
TYA - transfer Y to accumulator
X-Asm 2.0 pseudo-commands
-------------------------
ADD - add
INW - increment word
JCC - jump if carry clear
JCS - jump if carry set
JEQ - jump if equal
JMI - jump if minus
JNE - jump if not equal
JPL - jump if plus
JVC - jump if overflow clear
JVS - jump if overflow set
MVA - move byte using accumulator
MVX - move byte using X
MVY - move byte using Y
MWA - move word using accumulator
MWX - move word using X
MWY - move word using Y
SUB - subtract
X-Asm 2.0 directives
--------------------
DTA - define data
EIF - end if
ELS - else
END - end
EQU - equal
ERT - error if true
ICL - include
IFT - if true
INI - init
INS - insert
OPT - options
ORG - origin
RUN - run
===

View File

@ -1,75 +0,0 @@
||| X-Assembler version 2.0 for MS-DOS |||
||| A powerful ATARI XL/XE software development tool on PC |||
/ | \ designed and coded by Fox/Taquart / | \
ÜÜÜÜÜÜÜÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÜÜÜÜ
ÜÜÜÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ÜÜÜÛÛÛÛÛÛÛÛÛÛßßßßßß ßßßßßßßÛÛÛÛ
ÜÜÛÛÛÛÛÛÛßßß ÜÛÛÜ ÜÜÜÜ ß
ÜÛÛÛÛÛÛßß ÛÛÛÛ ÛÛÛÛÛÛÛÛÜÜ
ÜÛÛÛÛÛßß ÛÛÛ ÜÜ ßÛÛÛ ßßÛÛÛÛÛÛÛÛÜÜ
ÜÛÛÛÛß ÜÜÜÜÛÛÛÛßßÜÜÜÜÜ ÛÛ ßßßÛÛÛÛÛÜÜ
ÜÛÛÛß ßÛßßßÛÛÛ ÜÛÛ ÜÛ ÛÛ ßßÛÛÛÛÜ
ÜÛÛß ÜÜ ÛÛÜ ÜÜÜ ÛÛÛ ÛÛÜÛß ÛÛ ßÛÛÛÜ
ÛÛß ßß ÛÛÛÛßÛÛÛ ÛÛÛ ÛÛ ÜÜÜ ÛÛÜ ßÛÛÛ
ÛÛß ÛÛÛÜ ÛÛÛ ÛÛÛ ÛÛÛ ßÛÛÛßß ßßß ÜÛÛ ßÛÛÜ
ÛÛß ÛÛÛ ÛÛÛ ßÛÛ ÛÛÛ ÜÜ ÛÛÛ ÜÜÛÛÜ ÛÛÛ
ÛÛ ÛÛÛ ÛÛß ÛÛ ßß ÛÛÛ ÜÜ ßßß ÜÜÛÛÛ ÜÛÛ ÜÛß ÛÛÛ
ÛÛ ÛÛÛ ÜÜÜÜÛÛÛßßßÜÛÛÛ ÛÛÜ ÛÛÛßÛÛÛ ÛÛÜÛß ÛÛß
ÛÛ ßß ßßßßÛÛÛ ÜÛÛßß ÛÛÛ ÛÛÛ ÛÛÛ ÛÛ ÜÜÜ ÛÛß
ÛÛ ÜÜ ÛÛ ÛÛÛ ßÛÛÜ ÛÛÛ ÛÛÛÜÛÛÛÛ ßÛÛÛßß ÛÛß
ßÛÛ ÜÛÛÜÜ ÛÛ ÛÛÜ ÛÛÛ ÛÛÛ ÛÛÛ ßÛÛßßÛÛß ÜÛÛß
ßÛÛÜ ÛÛß ÛÛ ÛÛ ÛÛÛ ÛÛÛ ÜÛÛß ßßß ÜÛÛß
ßÛÛÜÜ ÛÛ ÛÛ ÛÛÜÜÛÛÛ ÛÛÛ ßÛß ÜÛÛÛß
ßÛÛÛÜ ßÛÜÜÛÛß ßÛÛßßßß ÜÜÛÛÛßß
ßßÛÛÛÜÜ ßßßßß ÜÜÜÛÛÛÛßß
ßßÛÛÛÛÛÜÜÜÜ ÜÜÜÜÜÛÛÛÛÛÛÛßß
ßßÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛßßß
ßßßßßßßßßßßßßßßßßßß
ÜÜÛÛÛÛÛÛÜÜ ÛÛÛÛÛÛÛÛÛÛÛÛÛ ÜÜÛÛÛÛÛÛÛÜÜ ÜÜÛÛÛÛÛÛÛÛÜÜ
ÛÛÛÛÛß ßßßßß ÛÛÛÛÛ ÜÛÛÛÛÛß ßÛÛÛÛÛÜ ÛÛÛÛß ÛÛÛÛÛÛ
ÛÛÛÛÛÛÜÜÜÜÜÜÜ ÛÛÛÛÛÛÛÛÛÛÜÜÜ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÜÛÛÛÛÛß
ÛÛÛÛÛÛß ßÛÛÛÛÛÛ ßÛÛÛÛÛÛ ÛÛÛÛÛÛ ÛÛÛÛÛÛ ÜÜÛÛÛÛßß
ßÛÛÛÛÛÜ ÜÛÛÛÛÛÛ ÛÛÛÜ ÜÛÛÛÛÛß ßÛÛÛÛÛÜ ÜÛÛÛÛÛß ÜÜÛÛÛÛÛÜÜÜÜÜÜÜ
ßßÛÛÛÛÛÛÛßß ßßÛÛÛÛÛÛßßß ßßÛÛÛÛÛÛßßß ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
ÜÜÜ ÜÜÜ ÜÜ ÜÜ ÜÜÜ ÜÜ ÜÜ ÜÜ ÜÜÜ
Û Û Û Û Û Û Û ß ÛÜÜ ßÜ ß ßÜ ß Û Û Û Û
Ûßß ÛßßÜ Û Û Û Ü Û Ü ßÜ Ü ßÜ Û Û ÛßßÜ
ß ß ß ßß ßß ßßß ßß ßß ßß ß ß
Copyright
---------
This version of X-Asm is FREEWARE. Feel free to distribute it where you want.
Contests of this package
------------------------
ATARI.PAL Atari palette 256 * RGB * 6 bits
CHANGES.TXT What's new in this version
CPUBUGS.ASX 6502 bugs tester source & bugs description
DLIST.TXT Atari Display List op-codes
FILE_ID.DIZ .DIZ file
HARDWARE.ASX Atari XL/XE hardware addresses
README.TXT This file
QUICKREF.TXT 6502 commands & X-Asm directives quick reference
XASM.COM X-Assembler program
XASM.TXT X-Assembler documentation
XBOOT.COM X-Boot - converts Atari executables into .ATR files
XBOOT.TXT Notes for X-Boot
XBOOTPRO.ASX Source of X-Boot professional loader
XBOOTSTD.ASX Source of X-Boot standard loader
XHEAD.COM X-Head - shows structure of Atari executables
XHEAD.TXT Notes for X-Head
XPAL.COM X-Pal - shows ATARI.PAL
Contact
-------
Author: For swap:
FOX/Taquart SLAVES/Taquart
Piotr Fusik Slawek Sledz
ul. Cicha 9 ul. Pozytywist¢w 2/77
05-300 Minsk Mazowiecki 20-369 Lublin
Poland Poland
e-mail: pfusik@elka.pw.edu.pl e-mail: slaves@pol.pl
===

3061
source/app.d Normal file

File diff suppressed because it is too large Load Diff

924
xasm.1.asciidoc Normal file
View File

@ -0,0 +1,924 @@
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 like 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 signaled 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.
If the string is suffixed with a `*` character, bit 7 in every byte gets inverted.
--
+
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
- command-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[]

2404
xasm.asm

File diff suppressed because it is too large Load Diff

42
xasm.properties Normal file
View File

@ -0,0 +1,42 @@
# 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

452
xasm.txt
View File

@ -1,452 +0,0 @@
X-Assembler version 2.0
=======================
coded by Fox/Taquart
INTRODUCTION
============
The X-Assembler is an assembler, which generates code for the 6502 processor.
It is 99% compatible with Quick Assembler on 8-bit Atari.
System requirements
-------------------
- a PC compatible computer with 386 or better CPU
- a MS-DOS compatible OS
- a numeric coprocessor for generating sinus tables
Your CPU probably has a built-in coprocessor.
Creating a source program
-------------------------
Source file should be standard text file with IBM-style EOLs: CR/LF. You can
use any text editor on PC to prepare your source code.
Single line of source should not be longer than 256 characters.
There is no limitation on the length of the file.
Source may contain tabulators - there are treated as spaces.
Assembler is NOT case-sensitive.
Converting Quick Assembler files
--------------------------------
You must convert Atari text file into PC text file (EOL's from $9b to $0d/$0a),
ATASCII 0-31 and 128-255 characters should be replaced with standard ASCII
characters, using QAsm expressions.
You also have to change all OPT directives, but usually you needn't them
at all.
Assembling a source program
---------------------------
Syntax (parameters in brackets are optional):
XASM source [options]
'source' is name of source file.
If no extension given, the .ASX is added by default.
Options are:
/c
Enable listing false conditionals.
/i
Disable listing included source.
/l[:fname]
Enable generating listing. If no fname given, listing is written to source.lst.
/o:fname
Specify object name. Default is source.obx.
/s
Disable converting spaces to tabs. Using tabs makes listing file shorter.
Tab stops are assumed to be every 8 characters.
/t[:fname]
List label table. If no fname given, table is written at the end of listing.
If source is incorrect, X-Asm displays ONLY FIRST encountered error.
Errorlevels returned by X-Asm:
3 = bad parameters, assembling not started
2 = error occured
1 = warning(s) only
0 = no errors, no warnings
Listing structure
-----------------
Line of listing includes:
- decimal number of line of source file (if source is different than in
previous listed line, appropriate message line is generated)
- hexadecimal origin
- hexadecimal bytes written to object file
Listed are also generated headers. A 'xxxx-yyyy>' in place of origin is
a generated header: $xxxx is the first and $yyyy is the last byte of block.
A 'FFFF>' represents two $ff bytes written as a header prefix.
A plus sign placed after hex numbers stands for more bytes written to object
in this line, not listed through lack of space.
- remaining part of listing line is a copy of source
Label table structure
---------------------
Line of label table includes:
- some info of label:
n - label not used
2 - label value known in pass 2 only (label definition uses forward reference
and thus you can't do forward references to that label)
- hex value of label
- name of label
X-ASM LANGUAGE STRUCTURE
========================
Lines of source code may be:
- empty lines - ignored, of course
- comments - ignored, too
- statements - not ignored :-)
Comment lines must have one of the following characters in the FIRST column
of the line: * ; |
Numbers
-------
Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff.
A number can be:
- a decimal number -12345
- a hexadedecimal number $abcd
- a binary number %10100101
- a character 'a' or "a" (new in 2.0!)
- a hardware register ^31
- an origin counter *
I think only 'a hardware register' should be explained. It is a short way
of accessing Atari hardware registers:
^0x means $d00x
^1x means $d01x
^2x means $d20x
^3x means $d30x
^4x means $d40x
where x is a hexadecimal digit.
Expressions
-----------
Expressions are numbers combined with operators and brackets.
You should use square brackets, because parentheses are reserved
for 6502 indirect addressing. Currently there are 19 operators:
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder
& Bitwise and
| Bitwise or
^ Bitwise xor
<< Arithmetic shift left
>> Arithmetic shift right
= Equal
<> Not equal
!= Not equal (same as <>)
< Less than
> Greater than
<= Less or equal
>= Greater or equal
&& Logical and
|| Logical or
Operator precedence:
first []
* / % & << >>
+ - | ^
= <> != < > <= >=
&&
last ||
Compare and logical operators assume that zero is false and non-zero is true.
They return -1 for true.
When calculating expression, 32-bit arithmetic is used. When range of 32 bits
is exceeded, 'Arithmetic overflow' error is generated.
If result of expression has improper size, 'Value out of range' error occurs.
Note difference beetwen X-Asm 2.0 and QAsm/X-Asm 1.2: in older assemblers,
which used 16-bit arithmetic, a LDA 0-1 was correct (LDA $ffff), but X-Asm 2.0
encounters an error: address can't be negative.
X-Asm recognizes now signed bytes: LDA #-1 is OK.
Statements
----------
A statement is divided into fields: a label field, an operation field,
one or two operand fields, and a comment field. There should be at least
one space between every two fields and there can't be any space within a field
excluding strings.
Label field
~~~~~~~~~~~
This field is optional. It is required only by the EQU directive.
Specyfying this field definies a label. Defined label represents an integer
of range -$ffff..$ffff.
Name of label must begin in column 1 and can contain letters, digits
and underscores (_). Digit can't be label's first character. Name of label
can be as long as you want and all the characters are meaningful.
In Quick Assembler only 6 leading characters were recognized
and some programs may not compile well under X-Asm for this reason.
Defining a label without using EQU makes it equal to current value
of the origin counter. Label can't be redefined.
Operation field
~~~~~~~~~~~~~~~
Operation field is the only field which is always required.
You have to put one or more spaces or tab characters between label
and operation field. If no label is defined, line must start with a blank
character. Operation field is always 3 letters long. It can be:
a. a 6502 processor command
b. a compiler directive
c. a pseudo-command
a. 6502 command
One of 56 well known processor commands.
b. compiler directive
One of the following:
EQU - assign a value of expression to the label
Note that label represents a number, not a text macro.
Examples:
five equ 5
ten equ five+five
OPT - set assembling options
Currently there are two options: listing generating and headers generating.
You can turn any of these on or off.
Examples:
opt l- listing off
opt h- headers off
opt l+h- listing on, headers off
Remember not to put a space between options:
opt l+ h-
is actually
opt l+
because h- is a comment.
Default (if no opt specified) is opt l+h+.
ORG - set new origin counter
Examples:
org $600 code will be located starting from $0600
table org *+100 'table' points to 100 bytes of uninitialized data
New! You can set some options applied to new header (if headers are on):
org $600
rts
org a:$601
'a:' tells X-Asm to always make a header, even it is unnecessary (as in above).
So by default X-Asm 2.0 does not generate unnecessary headers, distinct from
QAsm and X-Asm 1.2.
org f:$700
'f:' works same as 'a:', but additionally tells to generate a $ff,$ff prefix
before header. X-Asm adds it to the first header in file by default, so use
this option only if you want the $ff's somewhere inside.
DTA - define data
You may define:
* numbers
- bytes: b(200)
- words: a(10000)
- low bytes of words: l(511) defines byte 255
- high bytes of words: h(511) defines byte 1
You may enter many expressions in parentheses and combine different types
of data in single line.
You may also define a sinus table. Enter this expression:
sin(centre,amp,size,first,last)
where:
- centre is a number which is added to every value of sinus
- amp is the amplitude of sinus
- size is the period of sinus
- first,last define range of values in the table.
They are optional. Default are 0,size-1.
Example: dta a(sin(0,1000,256,0,63)) defines table of 64 words representing
a quarter of sinus with amplitude of 1000.
- real numbers: r(-1.23456e12)
Real numbers are written in 6-byte Atari Floating-Point format. You can't
combine reals with operators, as you can integers.
* text strings
- ASCII strings: c'Text' or c"Text"
- ANTIC strings: d'Text' or d"It's something new!"
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.
Placing a '*' character after a string inverts bit 7 in every byte of string.
Examples of DTA:
dta b(2,5),a(1000,-1),l(12345,sin(0,127,256))
dta d"ANTIC"*,c'It''s a string',b(155)
ICL - include another source file
Specifies another file to be included in the assembly as if the contests of
the referenced file appeared in place of the ICL statement. The included file
may contain other ICL statements.
Examples:
icl 'macros.asx'
icl 'c:\atari\xasm\fileio.asx'
END - end assembling of file
Remaining part of the file is not assembled. If this statement does not occur,
assembler stops assembling when encounters end of file.
Example:
end
INS - insert contents of file
Copies every byte of specified file into object file and moves origin counter,
as if these bytes were defined with DTA.
Examples:
ins 'picture.raw'
ins 'tables.dat'
New! You may specify range of inserted file. Syntax is:
ins 'file'[,offset[,length]]
First byte in file has offset 0.
If offset is negative, it is counted from the end of file.
ins 'file',-256 inserts last 256 bytes of file
ins 'file',10,10 inserts bytes 10..19 of file
RUN - generate run address
The Atari executable program should have run address specified. Remember that
a program may be loaded in many areas of memory and started from any address.
run addr
is equivalent to:
org $2e0
dta a(addr)
Examples:
run start
run program
INI - generate init address
The Atari executable program may have some routines which are executed during
loading process. There may be many init blocks in one file.
Examples:
ini init
ini showpic
ERT - generate error if expression is true
Examples:
ert *>$c000
ert len1>$ff||len2>$ff
IFT - assemble if expression is true
ELS - else
EIF - end if
Example:
noscr equ 1
ift noscr
lda #0
els
lda #$22
eif
sta $22f
c. pseudo-command
It is something like built-in macro. It replaces two or more standard
processor commands. Note that it is not an illegal instruction and works
on typical 6502.
ADD - addition without carry
If you ever programmed 6502, you must have noticed that you had to use a CLC
before ADC for every simple addition.
X-Asm can do it for you. ADD simply replaces two instructions: CLC and ADC.
SUB - subtraction
It is SEC and SBC.
JNE, JEQ, JCC, JCS, JPL, JMI, JVC, JVS - conditional jumps
They are a kind of 'long' branches. While standard branches (BNE, BEQ) have
range of -128..+127, these jumps have range of all 64 kB.
For example: a JNE DEST is replaced with:
beq *+5
jmp dest
INW - increment word
It is a 16-bit memory increment command. An INW DEST will be replaced by:
inc dest
bne _skip
inc dest+1
_skip equ *
The '_skip' label is not declared of course.
MVA, MVX, MVY - move byte using accumulator, X or Y
These pseudo-commands require two operands.
mva source dest = lda source : sta dest
mvx source dest = ldx source : stx dest
mvy source dest = ldy source : sty dest
MWA, MWX, MWY - move word using accumulator, X or Y
Also require two operands. They are something like combination of two MV*'s:
one to move low byte, and the other to move high byte.
You can't use indirect nor pseudo addressing modes with MW*.
Destination must be absolute address (indexed or not).
When source is also absolute, a MW* SOURCE DEST will be:
mv* source dest
mv* source+1 dest+1
When source is immediate, a MW* #IMMED dest will be
mv* <immed dest
mv* >immed dest+1
but when <IMMED = >IMMED and IMMED is not forward-referenced,
X-Asm uses optimization:
mv* <immed dest
st* dest+1
Operand
~~~~~~~
It depends on the operation field. Some statements don't need an operand
or need two operands.
6502 commands require operand depending on the addressing mode.
Addressing modes should be entered in standard convention except
the accumulator addressing mode, which should be marked with a '@' character
(as in Quick Assembler).
There are two extra immediate addressing modes: < and >, which use low/high
byte of word is used rather than byte value.
In absolute addressing modes, X-Asm examines expression and uses zero-page
addressing mode if it thinks it is possible to do it. You may override it
with 'a:' and 'z:' prefixes.
Examples:
nop
asl @
lda >$1234 assembles to lda #$12
lda $100,x
lda a:0 generates 16-bit address
jmp ($0a)
lda ($80),y
New! X-Asm 2.0 brings pseudo addressing modes. They are similar to
pseudo-commands and you may use them as standard addressing modes
in all 6502 commands and pseudo-commands, excluding MW*:
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
Problems
--------
These notes may help you solve problems:
* No spaces are allowed within a field.
label equ 1 + 2
causes label to be equal 1 ('+ 2' is treated as a comment).
* < and > represent addressing modes rather than LOW and HIGH operators.
You specify 'lda <table', not 'lda #<table' like in most 6502 assemblers.
* Label definition does not include a colon
label: lda ^4b ERROR - colon after label name
* Exactly one run address should be specified
Remember that unlike in other assemblers
end start
does not tell the assembler that 'start' is the run address (it is a comment).
You must specify the run address with RUN directive.
* X-Asm reads source twice (in pass 1 and pass 2)
This allows forward references, but not too complex.
Keep in mind that assembler should know all the values in second pass.
Example:
two equ one+one This value is known in 2nd pass only
one equ 1 This value is known as early as in 1st pass
These values can be fixed in 2 passes.
But if you insert following statement as first line:
three equ one+two
X-Asm will generate an error because it doesn't know the value of 'three' in
second pass.
(sorry for v1.2 users: EQU forward reference didn't work at all).
* X-Asm displays only first error
When you correct one error don't be surpised if you get another one.
* If you encounter X-Asm works improperly, please let me know.
===

197
xboot.asm
View File

@ -1,197 +0,0 @@
; ><-B00T III b. Fox
IDEAL
P386
MODEL TINY
CODESEG
ORG 100h
include 'fox.mak'
blen = 60*1024
start:
db 1024 dup(0) ;for COMpack
print hello
mov di, 81h
movzx cx, [di-1]
jcxz usg
mov al, '?'
repne scasb
jne nousg
usg: mov dx, offset usgtxt
panic: print
dos 4c01h
getfil: mov ch, -1
mov al, ' '
repe scasb
mov dx, offset fname
lea si, [di-1]
cmp [byte si], 0dh
je usg
mov di, dx
movfn1: movsb
cmp [si], al
ja movfn1
mov bx, di
srchex: dec bx
cmp [byte bx], '\'
je addext
cmp [byte bx], '.'
je extexs
cmp bx, dx
ja srchex
addext: xchg eax, ebp
stosd
extexs: mov [byte di], 0
rts: ret
smartdisk
badf: mov dx, offset badtxt
jmp panic
nousg: mov ch, -1
mov di, 81h
mov al, ' '
repe scasb
mov ax, [di-1]
inc di
or ah, 20h
cmp ax, 'p/'
je romsw
dec [romfl]
mov di, 81h
romsw: mov ebp, 'XBO.'
call getfil
push si
fopen
mov cx, blen
fread bufr
mov dx, offset lontxt
cmp ax, blen
jnb panic
mov [len], ax
fclose
mov si, offset bufr
mov di, si
lodsw
cmp ax, -1
jne badf
mov ax, [si]
mov [l1runl], al
mov [l2runl], al
mov [l1runh], ah
mov [l2runh], ah
cutf1: lodsw
cmp ax, -1
je cutf1
stosw
sta bx
lodsw
stosw
sub ax, bx
jb badf
inc ax
sta cx
rep movsb
cutfn: mov ax, si
sub ax, offset bufr
cmp ax, [len]
jb cutf1
mov si, offset endseq1
cmp [romfl], 0
jz stdld
push di
mov si, offset romlod
mov di, offset sect
mov cx, 64
rep movsw
pop di
mov si, offset endseq2
stdld: mov cx, endlen
rep movsb
mov cx, offset sect
sub cx, di
and cx, 7fh
xor al, al
rep stosb
sub di, offset begin
mov [len], di
shr di, 4
dec di
mov [paras], di
pop di
mov ebp, 'RTA.'
call getfil
fcreate
mov cx, [len]
mov dx, offset begin
fwrite
fclose
print oktxt
dos 4c00h
; Poetry
hello db 'X-BOOT 3.2 by Fox/Taquart',eot
usgtxt db 'Converts Atari 8-bit executable into .ATR disk image.',eol
db 'Syntax: XBOOT [/p] obxfile atrfile',eol
db 'Use /p switch to write professional loader rather than standard.',eot
oktxt db 'O.K.',eot
badtxt db 'Bad format of file!',eot
lontxt db 'File too long',eot
smarterr
romfl db 1
; Ending Header for loader #1
endseq1 db 233,7,235,7,108,224,2
; Ending Header for loader #2
endseq2 db 244,4,246,4,108,224,2
endlen = $-endseq2
; Loader #2 (rom)
romlod db 96,1,128,4,119,228,169,0,141,47,2,169,82,141,200,2,165
db 20,197,20,240,252,169
l2runl db 128,141,224,2,169
l2runh db 4,141,225,2,160,254,169
db 128,141,226,2,169,4,141,227,2,162,251,149,72,232,134,67,76,188
db 4,230,68,208,2,230,69,200,16,32,238,10,3,208,3,238,11,3
db 169,255,141,1,211,78,14,212,88,32,83,228,56,48,170,120,160,0
db 140,14,212,206,1,211,185,0,4,166,67,208,200,129,68,165,68,197
db 70,208,200,165,69,197,71,208,194,152,72,32,253,4,104,168,16,165
db 108,226,2
; ATR Header
begin dw 296h
paras dw 0
dw 80h,5 dup(0)
; Atari Boot Sector(s)
sect:
; Loader #1 (std)
db 96,1,128,7,119,228,160,215,185,30,7,145,88,200,192,226,144
db 246,169
l1runl db 128,141,224,2,169
l1runh db 7,141,225,2,169,7,141,5,3,160,255
db 140,1,211,136,169,128,141,226,2,169,7,141,227,2,162,251,149,72
db 232,134,67,76,193,7,230,68,208,2,230,69,200,16,16,238,10,3
db 208,3,238,11,3,32,83,228,56,48,174,160,0,185,0,7,166,67
db 208,216,129,68,165,68,197,70,208,216,165,69,197,71,208,210,152,72
db 32,242,7,104,168,16,181,108,226,2,44,111,97,100,105,110,103,14
db 14,14,0
beglen = $-begin
bufr db blen dup(?)
len dw ?
fname db 128 dup(?)
ENDS
END start

View File

@ -1,16 +0,0 @@
X-Boot 3.2 by Fox/Taquart
Some (un)important notes
=========================
The only change from version 3.1: Now .OBX is default extension of executable.
---
This tool converts Atari executable (.OBX) into Atari disk image (.ATR).
Produced ATR is single density and as short as possible. It has a loader
in one boot sector. You can choose one of two built-in loaders:
standard and professional. Professional loader allows you to load code/data
under ROM and disables ROM and interrupts while starting program.
Both loaders disable Atari Basic. For details, view sources of loaders.
X-Boot does not write your program in ATR as Atari file, you can only run it
by booting.
===

View File

@ -1,70 +0,0 @@
* Boot executable file loader coded by Fox/Taquart
* Version for professionals - can load file under ROM.
* Note interrupts and ROM are disabled when running loaded program.
opt h-
org $480
bufr equ $400
tp equ $43
vc equ $44
* Boot header
boot equ *
rts rts
dta b(1),a(boot,$e477)
* Nice blank screen
mva #0 $22f
mva #$52 $2c8
lda 20
cmp 20
beq *-2
* Init run vector
mwa #rts $2e0
ldy #$fe
* Load header
lhead mwa #rts $2e2
ldx <-5
* Store byte of header
hput sta vc+4,x+
stx tp
jmp get
next inw vc
get iny
bpl getx
inw $30a
mva #$ff ^31
lsr ^4e
cli
jsr $e453
sec
bmi rts
sei
mvy #0 ^4e
dec ^31
getx lda bufr,y
ldx tp
bne hput
sta (vc,x)
lda vc
cmp vc+2
bne next
lda vc+1
cmp vc+3
bne next
endseq tya
pha
jsr init
pla
tay
bpl lhead !
init jmp ($2e2)
* This will be added at the end of loaded file
opt h+
org endseq
jmp ($2e0)
end

View File

@ -1,69 +0,0 @@
* Boot executable file loader coded by Fox/Taquart
* Standard loader - ROM and interrupts enabled.
opt h-
org $780
bufr equ $700
tp equ $43
vc equ $44
* Boot header
boot equ *
rts rts
dta b(1),a(boot,$e477)
* Print text
txtpos equ 215
ldy #txtpos
print mva text-txtpos,y ($58),y+
cpy #txtpos+txtlen
bcc print
* Init run vector
mwa #rts $2e0
mva >bufr $305
mvy #$ff ^31
dey #$fe
* Load header
lhead mwa #rts $2e2
ldx <-5
* Store byte of header
hput sta vc+4,x+
stx tp
jmp get
next inw vc
get iny
bpl getx
inw $30a
jsr $e453
sec
bmi rts
ldy #0
getx lda bufr,y
ldx tp
bne hput
sta (vc,x)
lda vc
cmp vc+2
bne next
lda vc+1
cmp vc+3
bne next
endseq tya
pha
jsr init
pla
tay
bpl lhead !
init jmp ($2e2)
text dta d'Loading... '
txtlen equ *-text
* This will be added at the end of loaded file
opt h+
org endseq
jmp ($2e0)
end

152
xhead.asm
View File

@ -1,152 +0,0 @@
IDEAL
P386
MODEL TINY
CODESEG
ORG 100h
include 'fox.mak'
smartio = 1
start: print hello
mov di, 81h
movzx cx, [di-1]
jcxz usg
mov al, ' '
repe scasb
je usg
push cx di
dec di
inc cx
mov al, '?'
repne scasb
pop di cx
jne nousg
usg: mov dx, offset usgtxt
panic: print
int 20h
smartdisk
read: mov cx, 2
fread addr
cmp ax, 2
mov ax, [addr]
ret
nousg: lea dx, [di-1]
mov al, ' '
repne scasb
jne okend
dec di
okend: mov si, di
mov cx, di
sub cx, dx
adex1: dec si
cmp [byte si], '.'
je adexn
cmp [byte si], '\'
loopne adex1
adex2: mov eax, 'XBO.'
stosd
adexn: mov [byte di], 0
fopen
call read
mov dx, offset notbin
inc ax
jnz panic
head1: inc [mods]
call read
jb eof
cmp ax, 0ffffh
je head1
inc [blox]
dec [mods]
mov [begn], ax
mov dl, ' '
dos 2
mov ax, [begn]
call prword
mov dl, '-'
dos 2
call read
mov dx, ax
sub dx, [begn]
inc dx
call prword
cmp dx, 2
jne skip
cmp [begn], 2e0h
je pexec
cmp [begn], 2e2h
jne skip
inc [inits]
pexec: mov dl, ' '
dos 2
call read
call prword
jmp heade
skip: xor cx, cx
file 4201h
heade: PEOL
jmp head1
eof: xor cx, cx
xor dx, dx
file 4202h
push ax
mov al, dl
call pbyte
pop ax
call prword
print byttxt
mov ax, [blox]
call prword
print blotxt
mov ax, [inits]
call prword
print initxt
mov ax, [mods]
call prword
print modtxt
fclose
ret
prword: push ax
mov al, ah
call pbyte
pop ax
pbyte: ror ax, 4
and al, 0fh
call pdig
shr ax, 12
pdig: d2a
pusha
sta dx
dos 2
popa
ret
hello db 'X-HEAD 1.1 by Fox/Taquart',eot
usgtxt db 'Syntax: XHEAD obxfile',eot
notbin db 'File is not an Atari executable!',eot
smarterr
byttxt db ' bytes',eot
blotxt db ' blocks',eot
initxt db ' inits',eot
modtxt db ' modules',eot
blox dw 0
inits dw 0
mods dw 0
addr dw ?
begn dw ?
ENDS
END start

View File

@ -1,17 +0,0 @@
X-Head 1.1 by Fox/Taquart
Some (un)important notes
=========================
The only change from version 1.0: Now .OBX is default extension.
---
This tool prints headers of Atari executable.
It also shows program init and run addresses.
Other things displayed:
xxx bytes - length of file, including headers
xxx blocks - number of headers
xxx inits - number of init blocks (02e2-02e3)
xxx modules - number of FFFF headers (one at the beginning is required)
You can redirect output to a file, for example:
XHEAD TEST.COM >TEST.HDR
===