mirror of https://github.com/pfusik/xasm.git
Compare commits
92 Commits
xasm-2.5.1
...
master
Author | SHA1 | Date |
---|---|---|
Piotr Fusik | 9732817a0b | |
Piotr Fusik | 70c907bae6 | |
Piotr Fusik | 7a666799ac | |
Piotr Skamruk | 95136d1546 | |
Piotr Fusik | ca5e88950f | |
Piotr Fusik | 138331193a | |
Piotr Fusik | 30c96357bc | |
Jakub Husak | 83d2f8ff1d | |
Adrian Matoga | 9aae1ad4c4 | |
Piotr Fusik | f33c112ac6 | |
Piotr Fusik | 57661276c2 | |
Piotr Fusik | a4225b6128 | |
Piotr Fusik | 1da9f77458 | |
Piotr Fusik | 2b7d21ae43 | |
Adrian Matoga | 2f67b3bab4 | |
Piotr Fusik | afb9f7830e | |
Piotr Fusik | 95cb5ae592 | |
Piotr Fusik | 8f6621f079 | |
Piotr Fusik | 52982169df | |
Piotr Fusik | 8c7ef1a922 | |
Piotr Fusik | 1a90ca04d3 | |
Piotr Fusik | 73b382f9b7 | |
Piotr Fusik | 7ba3f9f597 | |
Piotr Fusik | b815a448cd | |
Piotr Fusik | 274dda9dd2 | |
Piotr Fusik | da58ad7950 | |
Piotr Fusik | 52ef8c05d6 | |
Piotr Fusik | 6f25038d95 | |
Adrian Matoga | 57ef9b5c83 | |
Adrian Matoga | 8f06fec50c | |
Piotr Fusik | d50d484e1f | |
Piotr Fusik | 65a2c1fbdd | |
Piotr Fusik | d3908ec95e | |
Piotr Fusik | 647cf9f3cf | |
Piotr Fusik | 819701b9be | |
Piotr Fusik | 301b904f60 | |
Piotr Fusik | 420a83a897 | |
Piotr Fusik | 2f8e97499d | |
Piotr Fusik | 7ad066fc6f | |
Piotr Fusik | a0bfe1366d | |
Piotr Fusik | 384643ab84 | |
Piotr Fusik | 177ece15fc | |
Piotr Fusik | 99099938b5 | |
Piotr Fusik | cb92f715a9 | |
Piotr Fusik | 110d2c4dad | |
Piotr Fusik | ce134af833 | |
Piotr Fusik | 92eac212cc | |
Piotr Fusik | 90276dbe86 | |
maraflush | 2e43507088 | |
Piotr Fusik | cc0eaf0e48 | |
Piotr Fusik | 2dad630a75 | |
Piotr Fusik | 36a4853b54 | |
Piotr Fusik | c4fc8ef51a | |
Piotr Fusik | ef297a78c7 | |
Piotr Fusik | 061088aa62 | |
Piotr Fusik | dd3466a947 | |
peterdell | d2bd24a128 | |
peterdell | 8d0870d1a1 | |
Piotr Fusik | d7c22cec84 | |
Piotr Fusik | b42f9dc2bf | |
Piotr Fusik | 5680efc7f5 | |
Piotr Fusik | 8c6ff185af | |
Piotr Fusik | 5970a93423 | |
Piotr Fusik | 389f7446e0 | |
Piotr Fusik | 3cec1c8ee8 | |
Piotr Fusik | 60d28a5c24 | |
Piotr Fusik | de22438740 | |
Piotr Fusik | cc5568795e | |
Piotr Fusik | d1276f3d97 | |
Piotr Fusik | 2d8b3cde17 | |
Piotr Fusik | c357fba52c | |
Piotr Fusik | 61327c8e5b | |
Piotr Fusik | 167c441fed | |
Piotr Fusik | 3a845f9a4f | |
Piotr Fusik | 50bae061f7 | |
Piotr Fusik | 520145268a | |
Piotr Fusik | 059b631aab | |
Piotr Fusik | f2e7796c87 | |
Piotr Fusik | 61bffbb8ec | |
Piotr Fusik | a2d6f9c864 | |
Piotr Fusik | 3fc9b5c0f5 | |
Piotr Fusik | 406354e06c | |
Adrian Matoga | 6992795f55 | |
Piotr Fusik | 034b95ea83 | |
Piotr Fusik | fa25272ccd | |
Piotr Fusik | 66501ef2fd | |
Piotr Fusik | 7c81897091 | |
Piotr Fusik | f288e64747 | |
Piotr Fusik | aa5efc560f | |
Piotr Fusik | 10c0c534ea | |
Piotr Fusik | a8f3501164 | |
Piotr Fusik | b32bd4a6ad |
|
@ -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
|
|
@ -0,0 +1,10 @@
|
|||
/xasm
|
||||
/xasm.exe
|
||||
/xasm.obj
|
||||
/xasm.html
|
||||
/xasm.1
|
||||
/xasm-test-*
|
||||
/MANIFEST
|
||||
/.dub
|
||||
/.project
|
||||
/signed
|
|
@ -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:
|
|
@ -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
|
274
compack.asm
274
compack.asm
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
10
|
|
@ -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.
|
|
@ -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
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
||||
$(MAKE) DESTDIR=$$(pwd)/debian/tmp prefix=/usr install install-scite
|
|
@ -0,0 +1 @@
|
|||
usr/share/scite/xasm.properties
|
|
@ -0,0 +1,2 @@
|
|||
usr/bin/xasm
|
||||
usr/share/man/man1/xasm.1
|
BIN
doc/6502proc.gif
BIN
doc/6502proc.gif
Binary file not shown.
Before Width: | Height: | Size: 586 B |
|
@ -1,66 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Configuring editors for X-Assembler</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<H2>How to configure a text editor for convenient use of X-Assembler</H2>
|
||||
This document describes, how to setup a text editor to:
|
||||
<UL>
|
||||
<LI> highlight X-Assembler mnemonics
|
||||
<LI> invoke the assembler with a single keystroke
|
||||
<LI> place the cursor where an assembly error occured
|
||||
</UL>
|
||||
Of course these features are not available in <I>Windows Notepad</I>, so you must
|
||||
pick another text editor. Fortunately there are many general-purpose text
|
||||
editors for Windows. I'll fucus on three:
|
||||
<UL>
|
||||
<LI> <I>EditPlus</I> (<A HREF="http://www.editplus.com">www.editplus.com</A>)
|
||||
<LI> <I>ConTEXT</I> (<A HREF="http://www.fixedsys.com/context">www.fixedsys.com/context</A>)
|
||||
<LI> <I>Code-Genie</I> (<A HREF="http://www.code-genie.com">www.code-genie.com</A>)
|
||||
</UL>
|
||||
All of these have similar features. <I>EditPlus</I> is very good, unfortunately it is
|
||||
shareware (you have to pay $30). The other editors are freeware. Personally
|
||||
I prefer <I>Code-Genie</I>, which offers unique feature of editing binary files.<P>
|
||||
<H3>Highlighting X-Assembler mnemonics</H3>
|
||||
In the <TT>syntax</TT> subdirectory you'll find X-Assembler syntax definitions for all
|
||||
these editors.
|
||||
<UL>
|
||||
<LI> Installation for <I>EditPlus</I>:
|
||||
Select <B>Tools/Preferences</B>, then <B>Files/Settings & syntax</B>,
|
||||
then <B>Add</B>. Type <B>Description</B> (<TT>X-Assembler</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> Installation for <I>ConTEXT</I>: Just copy <TT>X-Assembler.chl</TT>
|
||||
to <TT>Highlighters</TT> subdirectory in the <I>ConTEXT</I> directory.
|
||||
<LI> Installation for <I>Code-Genie</I>:
|
||||
Copy <TT>X-Assembler.cgsyn</TT> to <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>
|
||||
<NOBR><TT>DefaultSyntax x-assembler asx</TT></NOBR><BR>
|
||||
near other <TT>DefaultSyntax</TT> lines.
|
||||
</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> <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> <I>Code-Genie</I>: Select <B>View/Settings</B>, type:<BR>
|
||||
<NOBR><TT>AddUserTool xasm xasm.exe /p\s$FP CaptureOutput $FD</TT></NOBR><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).
|
||||
</UL>
|
||||
<H3>Placing the cursor where an assembly error occured</H3>
|
||||
This works same for all these three editors: just double-click the line
|
||||
with the error message.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
30
doc/faq.htm
30
doc/faq.htm
|
@ -1,30 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm FAQ</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<H2>Frequently Asked Questions</H2>
|
||||
<B>What is xasm?</B><BR>
|
||||
xasm is a set of a few tools for developing software for 8-bit Atari
|
||||
computers using a PC computer. It is mainly for people who are familiar
|
||||
with Quick Assembler, which runs directly on Atari.
|
||||
<P><B>I want to run xasm on my Amiga / Atari ST / Mac / ...</B><BR>
|
||||
Unfortunately xasm is written in x86 assembly language, so it is
|
||||
not portable.
|
||||
<P><B>Why xasm, not X-ASM as in previous versions?</B><BR>
|
||||
It's easier to pronounce. ;-)
|
||||
<P><B>Why 'second final edition'?</B><BR>
|
||||
<I>Quote from FAQ in version 2.4, regarding 'final edition':</I><BR>
|
||||
Because I don't plan adding any new features. xasm is already a very
|
||||
sophisticated tool, much more powerful than Quick Assembler.
|
||||
Of course, it does not mean there won't be any new releases.
|
||||
Very likely there will be bug fixes.<BR>
|
||||
<I>Comment to 'second':</I><BR>
|
||||
I found that new features are quite useful and easy to implement. :-)
|
||||
<P><B>What about supporting other 6502-based machines, other processors (65816 etc.) ?</B><BR>
|
||||
xasm is not a universal 6502 cross-assembler. If you need a portable
|
||||
cross-assembler (and maybe even an excellent C compiler), then visit
|
||||
<A HREF="http://www.cc65.org">www.cc65.org</A>.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,46 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm 2.5.1 second final edition</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR=black TEXT=white LINK="#c0c0ff" VLINK="#c040c0" ALINK="#d06060">
|
||||
<TABLE ALIGN=center WIDTH=70%><TR><TD>
|
||||
<CENTER>
|
||||
<IMG SRC="6502proc.gif" ALT="intel outside - 6502 processor">
|
||||
<BR CLEAR=all>
|
||||
<H1>xasm 2.5.1 second final edition</H1>
|
||||
Copyright (c) 1998-2002 by <A HREF="mailto:fox@scene.pl">Piotr Fusik</A>
|
||||
</CENTER>
|
||||
<P>
|
||||
<HR>
|
||||
<P>this package contains following utilities (click program name for documentation):
|
||||
<P>
|
||||
<TABLE ALIGN=center BGCOLOR=white>
|
||||
<TR><TD><FONT COLOR=black><B>Name</B></FONT></TD>
|
||||
<TD><FONT COLOR=black><B>Description</B></FONT></TD></TR>
|
||||
<TR><TD BGCOLOR=black><NOBR><A HREF="xasm.htm">X-Assembler</A></NOBR></TD>
|
||||
<TD BGCOLOR=black>6502 cross-assembler</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xboot.htm">X-BOOT</A></TD>
|
||||
<TD BGCOLOR=black>Converts Atari executables to disk images</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xhead.htm">X-HEAD</A></TD>
|
||||
<TD BGCOLOR=black>Prints headers of an Atari executable file</TD></TR>
|
||||
<TR><TD BGCOLOR=black><A HREF="xload.htm">X-LOAD</A></TD>
|
||||
<TD BGCOLOR=black>Loads an executable file to an Atari computer via the SIO2PC interface</TD></TR>
|
||||
</TABLE>
|
||||
<P>other documents:
|
||||
<UL>
|
||||
<LI> <A HREF="editors.htm">How to configure a text editor for convenient use of X-Assembler</A><BR>
|
||||
<LI> <A HREF="faq.htm">Frequently Asked Questions</A><P>
|
||||
</UL>
|
||||
<P>
|
||||
xasm home page:
|
||||
<A HREF="http://xasm.atari.org">http://xasm.atari.org</A>
|
||||
<P>
|
||||
<HR>
|
||||
<P>Permission is granted to anyone to use this software and its documentation
|
||||
for any purpose, including commercial applications, and redistribute it
|
||||
freely in its original form. The author makes no representations about
|
||||
the suitability of this software for any purpose. It is provided "as is"
|
||||
without express or implied warranty.
|
||||
</TD></TR></TABLE>
|
||||
</BODY>
|
||||
</HTML>
|
898
doc/xasm.htm
898
doc/xasm.htm
|
@ -1,898 +0,0 @@
|
|||
<HTML><HEAD><TITLE>X-Assembler 2.5.1</TITLE></HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-Assembler version 2.5.1</H1>
|
||||
<HR>
|
||||
<H2>TABLE OF CONTENTS</H2>
|
||||
<TABLE><TR><TD VALIGN=top>
|
||||
<UL><LI><A HREF="#intro">INTRODUCTION</A>
|
||||
<UL><LI><A HREF="#changes">Changes</A>
|
||||
<UL><LI><A HREF="#ver251">Version 2.5.1</A>
|
||||
<LI><A HREF="#ver25">Version 2.5</A>
|
||||
<LI><A HREF="#ver241">Version 2.4.1</A>
|
||||
<LI><A HREF="#ver24">Version 2.4</A>
|
||||
<LI><A HREF="#ver23">Version 2.3</A>
|
||||
<LI><A HREF="#ver22">Version 2.2</A>
|
||||
<LI><A HREF="#ver20">Version 2.0</A>
|
||||
<LI><A HREF="#ver12">Version 1.2</A>
|
||||
</UL></UL><LI><A HREF="#usage">USAGE</A>
|
||||
<UL><LI><A HREF="#sysreq">System requirements</A>
|
||||
<LI><A HREF="#srcreq">Source code requirements</A>
|
||||
<LI><A HREF="#convqa">Converting Quick Assembler files</A>
|
||||
<LI><A HREF="#asm">Assembling a source program</A>
|
||||
<LI><A HREF="#opts">Assembling options</A>
|
||||
<LI><A HREF="#exitcod">Exit codes</A>
|
||||
<LI><A HREF="#listing">Listing structure</A>
|
||||
<LI><A HREF="#labtab">Label table structure</A>
|
||||
</UL>
|
||||
</TD><TD VALIGN=top>
|
||||
<UL><LI><A HREF="#syntax">SYNTAX</A>
|
||||
<UL><LI><A HREF="#fields">Fields</A>
|
||||
<UL><LI><A HREF="#label">Label field</A>
|
||||
<LI><A HREF="#repeat">Repeat count</A>
|
||||
<LI><A HREF="#instr">Instruction field</A>
|
||||
<LI><A HREF="#operand">Operand field</A>
|
||||
<LI><A HREF="#comment">Comment</A>
|
||||
</UL><LI><A HREF="#expr">Expressions</A>
|
||||
<UL><LI><A HREF="#numbers">Numbers</A>
|
||||
<LI><A HREF="#operators">Operators</A>
|
||||
</UL><LI><A HREF="#directives">Directives</A>
|
||||
<LI><A HREF="#pseudocom">Pseudo-commands</A>
|
||||
<LI><A HREF="#adrmod">Addressing modes</A>
|
||||
</UL><LI><A HREF="#faq">FAQ</A>
|
||||
</UL>
|
||||
</TD></TR></TABLE></CENTER>
|
||||
<P><HR>
|
||||
<A NAME="intro"><H2>INTRODUCTION</H2>
|
||||
The X-Assembler is a cross-assembler, which generates code for the 6502 processor.
|
||||
It has been designed to be easy to use for Quick Assembler programmers,
|
||||
therefore its syntax is an extension of QA's.<BR>
|
||||
<A NAME="changes"><H3>Changes</H3>
|
||||
<A NAME="ver251"><H4>Version 2.5.1</H4>
|
||||
<UL>
|
||||
<LI> fixed assembling sources with Atari EOLs ($9b)
|
||||
<LI> blank/comment/label lines in false conditionals are now correctly omitted in listing
|
||||
</UL>
|
||||
<A NAME="ver25"><H4>Version 2.5</H4>
|
||||
<UL>
|
||||
<LI> fixed another bug, very similar to previous one, e.g.
|
||||
<PRE> ift 0
|
||||
:label nop
|
||||
eif
|
||||
</PRE>
|
||||
reported <TT>Label not defined before</TT> error for the repeat count.
|
||||
<LI> <A HREF="#new_opt"><TT>OPT F+</TT> causes <TT>ORG</TT>s to fill the space between old and new
|
||||
location with <TT>$FF</TT>s</A>
|
||||
<LI> <A HREF="#new_opt"><TT>OPT G+</TT> enables Atari 5200 mode for hardware register abbreviations</A>
|
||||
</UL>
|
||||
<A NAME="ver241"><H4>Version 2.4.1</H4>
|
||||
<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.
|
||||
</UL>
|
||||
<A NAME="ver24"><H4>Version 2.4</H4>
|
||||
<UL>
|
||||
<LI> fixed a bug causing incorrect unary operator precedence
|
||||
<LI> fixed wrong label value after a skip pseudo-command
|
||||
<LI> the assembler is .EXE (.COM caused problems with DJGPP make due
|
||||
to a bug in DJGPP runtime)
|
||||
<LI> the assembler is not compressed (so it occupies less space in the ZIP)
|
||||
<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 directory
|
||||
separator (Unix convention)
|
||||
<LI> error and warning messages are written to stderr, not stdout
|
||||
<LI> added <TT>==</TT> (equal) operator, which is equivalent to <TT>=</TT>
|
||||
(but is more natural for C/C++/Java programmers)
|
||||
<LI> <A HREF="#new_deflabel">added <TT>/d:label=value</TT> option: define a label</A>
|
||||
<LI> <A HREF="#new_fullpaths">added <TT>/p</TT> option: print full paths in listing and error messages</A>
|
||||
<LI> <A HREF="#new_quiet">added <TT>/q</TT> option: quiet mode</A>
|
||||
<LI> <A HREF="#new_unlabels">added <TT>/u</TT> option: warn of unused labels</A>
|
||||
<LI> <A HREF="#new_opt">writing to the object file may be suppressed with <TT>OPT O-</TT></A>
|
||||
<LI> <A HREF="#new_eli">added <TT>ELI</TT> (else if) directive</A>
|
||||
<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>
|
||||
</UL>
|
||||
<A NAME="ver23"><H4>Version 2.3</H4>
|
||||
<UL>
|
||||
<LI> double skip (e.g. <TT>SCC:SNE</TT>) bug fixed
|
||||
<LI> real number two-digit exponent bug fixed
|
||||
<LI> truncating line trailing spaces in listing
|
||||
<LI> <A HREF="#new_labdef">label definitions allowed in blank,
|
||||
comment and repeated lines</A>
|
||||
<LI> <A HREF="#new_unary">unary operators</A>
|
||||
<LI> <A HREF="#new_dta"><TT>DTA</TT> implied byte mode</A>
|
||||
<LI> <A HREF="#new_op_op">operand can be skipped for some op-codes</A>
|
||||
</UL>
|
||||
<A NAME="ver22"><H4>Version 2.2</H4>
|
||||
<UL>
|
||||
<LI> invalid absolute <TT>CPX</TT> and <TT>CPY</TT> op-codes bug fixed
|
||||
<LI> branch addressing mode not checking bug fixed
|
||||
<LI> <TT>ICL</TT> in last line bug fixed
|
||||
<LI> <TT>OPT H-H+</TT> bug fixed
|
||||
<LI> first <TT>ORG *</TT> bug fixed
|
||||
<LI> origin setting not required until not used
|
||||
<LI> Unix ($0a), Macintosh ($0d) and Atari ($9b) EOLs allowed in source
|
||||
<LI> value of 'true' changed to 1
|
||||
<LI> <A HREF="#new_environment">
|
||||
setting environment variables on error option</A>
|
||||
<LI> <A HREF="#new_newer">
|
||||
assembling only if source newer than object option</A>
|
||||
<LI> <A HREF="#new_opcode">op-code extracting</A>
|
||||
<LI> <A HREF="#new_linerep">line repeating</A>
|
||||
<LI> <A HREF="#new_pairing">instructions pairing</A>
|
||||
<LI> <A HREF="#new_repskip">conditional repeat and skip pseudo commands</A>
|
||||
<LI> <A HREF="#new_adrmodes">
|
||||
<TT>(),0+</TT> and <TT>(),0-</TT> pseudo addressing modes</A>
|
||||
</UL>
|
||||
<A NAME="ver20"><H4>Version 2.0</H4>
|
||||
<UL>
|
||||
<LI> truncating name of object bug fixed
|
||||
<LI> <TT>EQU</TT> and <TT>DTA</TT> forward reference bugs fixed
|
||||
<LI> hex number recognizing bug fixed
|
||||
<LI> now <TT>.OBX</TT> is default extension for Atari executables
|
||||
<LI> assembling options (switches and <TT>OPT</TT> directive)
|
||||
<LI> listing generation
|
||||
<LI> label table generation
|
||||
<LI> conditional assembling
|
||||
<LI> user errors
|
||||
<LI> warnings
|
||||
<LI> improved headers generation
|
||||
<LI> improved expressions - 19 operators and brackets, 32-bit arithmetic
|
||||
<LI> improved signed numbers
|
||||
<LI> 6 new pseudo commands (memory-to-memory move)
|
||||
<LI> 8 pseudo addressing modes
|
||||
<LI> indirect conditional jumps
|
||||
<LI> Atari floating-point numbers generation
|
||||
<LI> improved <TT>INS</TT>: inserting specified part of file
|
||||
</UL>
|
||||
<A NAME="ver12"><H4>Version 1.2</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<A NAME="usage"><H2>USAGE</H2>
|
||||
<A NAME="sysreq"><H3>System requirements</H3>
|
||||
<UL>
|
||||
<LI> a PC compatible computer with 386 or better CPU
|
||||
(a numeric coprocessor is required for generating sine lookup tables)
|
||||
<LI> a MS-DOS compatible OS
|
||||
</UL>
|
||||
<A NAME="srcreq"><H3>Source code requirements</H3>
|
||||
<UL>
|
||||
<LI> Source file should be plain ASCII file.
|
||||
Although different EOLs are supported,
|
||||
CR/LF is recommended because it is standard for text files on PC.
|
||||
<LI> No line of source can be longer than 256 characters.
|
||||
<LI> There is no limitation on the length of the source file.
|
||||
<LI> Tabulators can be used in place of spaces.
|
||||
<LI> The assembler is not case-sensitive.
|
||||
</UL>
|
||||
<A NAME="convqa"><H3>Converting Quick Assembler files</H3>
|
||||
Because of possible editor-associated problems you had better convert
|
||||
an Atari text file to a regular PC text file, i.e. EOLs from $9b to $0d/$0a
|
||||
and ATASCII specific characters to their integer representation.<BR>
|
||||
You have to change all <TT>OPT</TT> directives,
|
||||
but usually you only need to remove them.<BR>
|
||||
<A NAME="asm"><H3>Assembling a source program</H3>
|
||||
The common syntax of invoking command line is following:<BR>
|
||||
<PRE>XASM source [options]
|
||||
</PRE><TT>source</TT> is the name of source file.
|
||||
If no extension is given, the .ASX is implied.<P>
|
||||
Default action on invoking without options is to compile
|
||||
writing to a file with the .OBX extension.<P>
|
||||
<A NAME="opts"><H3>Assembling options</H3>
|
||||
Following options are supported:
|
||||
<DL>
|
||||
<DT><TT>/c</TT>
|
||||
<DD>Enable listing false conditionals.<BR>
|
||||
By default lines skipped due to false condition are not listed.<P>
|
||||
<A NAME="new_deflabel">
|
||||
<DT><TT>/d:label=value</TT>
|
||||
<DD>Define a label.<BR>
|
||||
<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.<P>
|
||||
<A NAME="new_environment">
|
||||
<DT><TT>/e</TT>
|
||||
<DD>Enable setting environment variables pointing to the error location.<BR>
|
||||
With this option, X-Asm sets two environment variables:
|
||||
ERRFILE and ERRLINE.
|
||||
They may be used in a batch file to locate error and set editor's
|
||||
insertion point on it. For example, you may create following batch file:
|
||||
<PRE>XASM %1 /e
|
||||
IF NOT ERRORLEVEL 1 GOTO ok
|
||||
NCE +%ERRLINE% %ERRFILE%
|
||||
:ok
|
||||
</PRE>
|
||||
NCE stands for Norton Classic Editor.<P>
|
||||
If there was no error, variables point to the last issued warning.
|
||||
If no warning occured, they are removed from the environment.<P>
|
||||
<B>Note:</B> NCE is an old editor for DOS. To learn about integration with
|
||||
modern text editors for Windows <A HREF="editors.htm">read this</A>.
|
||||
<P>
|
||||
<DT><TT>/i</TT>
|
||||
<DD>Disable listing included source. Only main source file will be listed.<P>
|
||||
<DT><TT>/l[:filename]</TT>
|
||||
<DD>Enable generating listing.
|
||||
If no <TT>filename</TT> given, listing is written to <TT>source.lst</TT>
|
||||
(where <TT>source</TT> is the name of the source file (without extension).<P>
|
||||
<A NAME="new_newer">
|
||||
<DT><TT>/n</TT>
|
||||
<DD>Check source and object file modification time and assemble only
|
||||
if source is newer than object file. X-Asm does NOT check included
|
||||
nor inserted files but only main source, so be careful with this option.<P>
|
||||
<B>Note:</B> Much more powerful for this purpose is GNU make utility.
|
||||
In DOS and Windows you may use its DJGPP port (available from
|
||||
<A HREF="http://www.delorie.com/djgpp">http://www.delorie.com/djgpp</A>).<P>
|
||||
<DT><TT>/o:filename</TT>
|
||||
<DD>Specify object file name. Default is <TT>source.obx</TT>.
|
||||
You may use the null device (<TT>/o:nul</TT>) to generate no object file.<P>
|
||||
<A NAME="new_fullpaths">
|
||||
<DT><TT>/p</TT>
|
||||
<DD>Print fully qualified file names in listing and error messages.<BR>
|
||||
This option is useful for the Code-Genie editor (see
|
||||
<A HREF="editors.htm">here</A>), which can jump to the error location
|
||||
only if full path is given.<P>
|
||||
<A NAME="new_quiet">
|
||||
<DT><TT>/q</TT>
|
||||
<DD>Suppress info messages.<BR>
|
||||
Prevents X-Asm from printing "<TT>X-Assembler 2.5.1 by Fox/Taquart</TT>"
|
||||
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.<P>
|
||||
<DT><TT>/s</TT>
|
||||
<DD>Disable converting spaces to tabs in listing.<BR>
|
||||
Using tabs makes listing file shorter.
|
||||
Tab stops are assumed to be every 8 characters.<P>
|
||||
<DT><TT>/t[:filename]</TT>
|
||||
<DD>List label table.<BR>
|
||||
If no <TT>filename</TT> given, the table is written at the end of listing
|
||||
or to <TT>source.tab</TT>.<P>
|
||||
<A NAME="new_unlabels">
|
||||
<DT><TT>/u</TT>
|
||||
<DD>Warn of unused labels.<BR>
|
||||
A warning message will be issued for each label, which value is never
|
||||
used.<P>
|
||||
</DL>
|
||||
If source is incorrect, X-Asm stops on first encountered error.<P>
|
||||
<A NAME="exitcod"><H3>Exit codes</H3>
|
||||
Meaning of exit codes returned by X-Asm:<BR>
|
||||
3 = bad parameters, assembling not started<BR>
|
||||
2 = error occured<BR>
|
||||
1 = warning(s) only<BR>
|
||||
0 = no errors, no warnings<BR>
|
||||
<A NAME="listing"><H3>Listing structure</H3>
|
||||
A line of listing contains:
|
||||
<UL>
|
||||
<LI> decimal number of line of source file (if source is different than in
|
||||
previous listed line, appropriate message line is issued)
|
||||
<LI> hexadecimal origin counter value
|
||||
<LI> hexadecimal values of bytes written to object file<BR>
|
||||
Listed are also generated headers. A <TT>xxxx-yyyy></TT> in place of origin
|
||||
counter represents generated header: <TT>$xxxx</TT> is the first and
|
||||
<TT>$yyyy</TT> is the last byte of the block.
|
||||
A <TT>FFFF></TT> represents two $ff bytes written as a header prefix.<BR>
|
||||
A plus sign placed after hex numbers stands for more bytes written to object
|
||||
in this line, not listed through lack of space.
|
||||
<LI> remaining part of listing line is verbatim copy of source line
|
||||
</UL>
|
||||
<A NAME="labtab"><H3>Label table structure</H3>
|
||||
A line of label table contains:
|
||||
<UL>
|
||||
<LI> some label attributes:<BR>
|
||||
<TT>n</TT> - label defined but not used elsewhere<BR>
|
||||
<TT>2</TT> - label value known in pass 2 only (label definition uses forward
|
||||
reference and thus you can't make forward references to that label)
|
||||
<LI> hexadecimal value of the label
|
||||
<LI> name of the label
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<A NAME="syntax"><H2>SYNTAX</H2>
|
||||
|
||||
<A NAME="fields"><H3>Fields</H3>
|
||||
Source code is line-oriented. Every line of source consists of <I>fields</I>.
|
||||
Same sequence of characters used in different fields has completely different meaning.
|
||||
Fields are separated with one or more blank characters.
|
||||
There can't be any space within a field, except for strings and comments.<P>
|
||||
There are following types of fields:
|
||||
<UL>
|
||||
<LI> <A HREF="#label">label field</A>
|
||||
<LI> <A HREF="#repeat">repeat count</A>
|
||||
<LI> <A HREF="#instr">instruction field</A>
|
||||
<LI> <A HREF="#operand">operand</A>
|
||||
<LI> <A HREF="#comment">comment</A>
|
||||
</UL>
|
||||
<A NAME="new_labdef">Every line of source must match one of two general forms:
|
||||
<UL>
|
||||
<LI> <TT>LABEL *COMMENT</TT>
|
||||
<LI> <TT>LABEL :COUNT CMD:CMD OP1 OP2 COMMENT</TT>
|
||||
</UL>
|
||||
In the first form, both fields are optional. Blank lines are ignored of course.
|
||||
Comment must here start with one of these characters: <TT>; |</TT> or <TT>*</TT>
|
||||
(semicolon, pipe or asterisk). Any information in the line following
|
||||
such character is ignored.<P>
|
||||
In the latter form, you must use a minimum of an instruction field.
|
||||
It depends on the instruction, how many operands it takes.
|
||||
Every instruction takes constant number of operands, therefore
|
||||
there's no need to use a special character at the start of a comment, because after
|
||||
succesfully taking operands, X-Asm discards the remaining part of line.
|
||||
However, <A HREF="editors.htm">general purpose text editors</A> may highlight
|
||||
the comments only if a special delimiter is used, and for that reason,
|
||||
the semicolon is recommended to start a comment.<P>
|
||||
|
||||
<A NAME="label"><H4>Label field</H4>
|
||||
This field is optional. It must start at first character in line, without
|
||||
any blank characters before. The purpose of using label field is to define a label.<BR>
|
||||
Label is a symbol representing an integer of range -$ffff..$ffff.<BR>
|
||||
Name of a label may contain letters, digits and underscores (<TT>_</TT>).
|
||||
Digit can not be label's first character.
|
||||
Name of a label may be as long as you want and all the characters
|
||||
are meaningful. In Quick Assembler only 6 leading characters were recognized
|
||||
and some sources may not compile under X-Asm for this reason.<BR>
|
||||
Defining a label without using <TT>EQU</TT> makes it equal to current value
|
||||
of the origin counter.<BR>
|
||||
Labels can't be redefined.<P>
|
||||
|
||||
<A NAME="new_linerep"><A NAME="repeat"><H4>Repeat count</H4>
|
||||
Repeating means here assembling single line several times as if
|
||||
there were several identical lines. Note it is not just duplicating
|
||||
bytes written to the object file.<BR>
|
||||
Repeat count, which can be any valid expression, has to be preceded
|
||||
with a colon.<BR>
|
||||
Examples:
|
||||
<PRE>:4 asl @
|
||||
:2 dta a(*)
|
||||
</PRE>
|
||||
In the latter example each <TT>DTA</TT> has different operand value.<BR>
|
||||
If repeat count equals zero, remaining part of line is not assembled.
|
||||
This allows compact single-line conditional assembly.
|
||||
|
||||
<A NAME="new_pairing"><A NAME="instr"><H4>Instruction field</H4>
|
||||
If this is the first field in a line, the line must start with at least
|
||||
one blank character. Instruction field consists of one or two instructions.
|
||||
The latter case is called instructions pairing, because a pair
|
||||
of instructions have shared operand. You separate instructions
|
||||
with a colon.<BR>
|
||||
Example:
|
||||
<PRE> adc:sta $80
|
||||
</PRE>is equivalent to
|
||||
<PRE> adc $80
|
||||
sta $80
|
||||
</PRE>
|
||||
Note that
|
||||
<PRE> lda:tax $80
|
||||
</PRE>is correct, because <TT>$80</TT> is a comment for <TT>TAX</TT>.<P>
|
||||
Single instruction always consists of 3 letters. It may be:
|
||||
<OL TYPE=a>
|
||||
<LI> a 6502 command - standard mnemonics are used
|
||||
<LI> <A HREF="#directives">a directive</A>
|
||||
<LI> <A HREF="#pseudocom">a pseudo-command</A>
|
||||
</OL>
|
||||
|
||||
<A NAME="operand"><H4>Operand field</H4>
|
||||
Some instructions don't need any operand,
|
||||
other need two operands.<BR>
|
||||
6502 commands require operand with proper
|
||||
<A HREF="#adrmod">addressing mode</A>.<P>
|
||||
|
||||
<A NAME="comment"><H4>Comment</H4>
|
||||
Comment in a statement does not start from any special character
|
||||
like <TT>;</TT> for example. Comment field is implied when appropriate
|
||||
number of operands was taken.<P>
|
||||
|
||||
<P><HR><P>
|
||||
<A NAME="expr"><H3>Expressions</H3>
|
||||
Expressions are numbers combined with operators and brackets.
|
||||
You should use square brackets, because parentheses are reserved
|
||||
for 6502 indirect addressing.
|
||||
|
||||
<A NAME="numbers"><H4>Numbers</H4>
|
||||
Numbers are 32-bit signed integers, in the range of -$7fffffff..$7fffffff.
|
||||
A number may be:<P>
|
||||
<TABLE>
|
||||
<TR><TD WIDTH=300><UL><LI> a decimal number</TD><TD><TT>-12345</TT></TD></TR>
|
||||
<TR><TD><UL><LI> a hexadecimal number</TD><TD><TT>$abcd</TT></TD></TR>
|
||||
<TR><TD><UL><LI> a binary number</TD><TD><TT>%10100101</TT></TD></TR>
|
||||
<TR><TD><UL><LI> an ASCII character</TD><TD><TT>'a'</TT> or <TT>"a"</TT></TD></TR>
|
||||
<TR><TD><UL><LI> the origin counter value</TD><TD><TT>*</TT></TD></TR>
|
||||
<TR><TD><UL><LI> a hardware register</TD><TD><TT>^4e</TT></TD></TR>
|
||||
</UL></TABLE>
|
||||
<BLOCKQUOTE>
|
||||
An abbreviation of Atari hardware register is provided to save you trouble of typing
|
||||
two extra characters (<TT>^4e</TT> vs <TT>$d40e</TT>) and to support porting software
|
||||
between Atari 8-bit computers and Atari 5200 console. These are very similar machines,
|
||||
one of biggest differences is different location of hardware registers.<P>
|
||||
<TABLE>
|
||||
<TR><TD><B>Syntax </B></TD><TD><B>Chip </B></TD>
|
||||
<TD><B>Value in Atari 8-bit<BR>computer mode (<TT>OPT G-</TT>) </B></TD>
|
||||
<TD><B>Value in Atari 5200<BR>game console mode (<TT>OPT G+</TT>) </B></TD>
|
||||
</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><I>error</I> (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>
|
||||
(<TT>x</TT> is a hexadecimal digit).
|
||||
</BLOCKQUOTE>
|
||||
<A NAME="new_opcode">
|
||||
<TABLE>
|
||||
<TR><TD WIDTH=300><UL><LI> an op-code</TD><TD><TT>{lda #0}</TT></TD></TR>
|
||||
</UL></TABLE>
|
||||
<BLOCKQUOTE>
|
||||
Single-byte op-code of the instruction inside braces (e.g. value of <TT>{nop}</TT> is <TT>$ea</TT>).
|
||||
Operand is discarded and is necessary only for identifying addressing mode.
|
||||
Instruction should begin just after the left brace and the right brace should
|
||||
immediately follow the operand or the command.<BR>
|
||||
<A NAME="new_op_op">You can skip the operand, if the addressing mode is fixed.
|
||||
Examples:<BR>
|
||||
<TT>{lda #}</TT>, <TT>{jsr}</TT>, <TT>{bne}</TT>, <TT>{jmp ()}</TT>,
|
||||
<TT>{sta a:,x}</TT>.
|
||||
</BLOCKQUOTE>
|
||||
<P>
|
||||
|
||||
<A NAME="operators"><H4>Operators</H4>
|
||||
<I>Binary operators:</I><P>
|
||||
<TABLE>
|
||||
<TR><TD><TT>+ </TT></TD><TD>Addition</TD></TR>
|
||||
<TR><TD><TT>- </TT></TD><TD>Subtraction</TD></TR>
|
||||
<TR><TD><TT>* </TT></TD><TD>Multiplication</TD></TR>
|
||||
<TR><TD><TT>/ </TT></TD><TD>Division</TD></TR>
|
||||
<TR><TD><TT>% </TT></TD><TD>Remainder</TD></TR>
|
||||
<TR><TD><TT>& </TT></TD><TD>Bitwise and</TD></TR>
|
||||
<TR><TD><TT>| </TT></TD><TD>Bitwise or</TD></TR>
|
||||
<TR><TD><TT>^ </TT></TD><TD>Bitwise xor</TD></TR>
|
||||
<TR><TD><TT><< </TT></TD><TD>Arithmetic shift left</TD></TR>
|
||||
<TR><TD><TT>>> </TT></TD><TD>Arithmetic shift right</TD></TR>
|
||||
<TR><TD><TT>= </TT></TD><TD>Equal</TD></TR>
|
||||
<TR><TD><TT>== </TT></TD><TD>Equal (same as <TT>=</TT>)</TD></TR>
|
||||
<TR><TD><TT><> </TT></TD><TD>Not equal</TD></TR>
|
||||
<TR><TD><TT>!= </TT></TD><TD>Not equal (same as <TT><></TT>)</TD></TR>
|
||||
<TR><TD><TT>< </TT></TD><TD>Less than</TD></TR>
|
||||
<TR><TD><TT>> </TT></TD><TD>Greater than</TD></TR>
|
||||
<TR><TD><TT><= </TT></TD><TD>Less or equal</TD></TR>
|
||||
<TR><TD><TT>>= </TT></TD><TD>Greater or equal</TD></TR>
|
||||
<TR><TD><TT>&& </TT></TD><TD>Logical and</TD></TR>
|
||||
<TR><TD><TT>|| </TT></TD><TD>Logical or</TD></TR>
|
||||
</TABLE><P>
|
||||
<A NAME="new_unary">
|
||||
<I>Unary operators:</I><P>
|
||||
<TABLE>
|
||||
<TR><TD><TT>+</TT></TD><TD>Plus (does nothing)</TD></TR>
|
||||
<TR><TD><TT>-</TT></TD><TD>Minus (changes sign)</TD></TR>
|
||||
<TR><TD><TT>~</TT></TD><TD>Bitwise not (complements all bits)</TD></TR>
|
||||
<TR><TD><TT>!</TT></TD><TD>Logical not (changes true to false and vice versa)</TD></TR>
|
||||
<TR><TD><TT><</TT></TD><TD>Low (extracts low byte)</TD></TR>
|
||||
<TR><TD><TT>></TT></TD><TD>High (extracts high byte)</TD></TR>
|
||||
</TABLE><P>
|
||||
<I>Operator precedence:</I><P>
|
||||
<TABLE>
|
||||
<TR><TD>first</TD><TD><TT>[]</TT><TD>(brackets)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>+ - ~ < ></TT><TD>(unary)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>* / % & << >></TT><TD>(binary)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>+ - | ^</TT><TD>(binary)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>= == <> != < > <= >=</TT><TD>(binary)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>!</TT><TD>(unary)</TD></TR>
|
||||
<TR><TD> </TD><TD><TT>&&</TT><TD>(binary)</TD></TR>
|
||||
<TR><TD>last </TD><TD><TT>||</TT><TD>(binary)</TD></TR>
|
||||
</TABLE><P>
|
||||
Note that although the operators are similar to these used in C, C++ and Java,
|
||||
their priorities are different than in these languages.<P>
|
||||
Compare and logical operators assume that zero is false and a non-zero is true.
|
||||
They return 1 for true.<P>
|
||||
While calculating expression, signed 32-bit arithmetic is used. When range of 32 bits
|
||||
is exceeded, <TT>'Arithmetic overflow'</TT> error is generated.<P>
|
||||
|
||||
<P><HR><P>
|
||||
<A NAME="directives"><H3>Directives</H3>
|
||||
<DL>
|
||||
<DT><TT><B>EQU</B></TT> - assign a value of an expression to the label
|
||||
<DD>Note that label represents a number, not a text macro.<BR>
|
||||
Examples:
|
||||
<PRE>five equ 5
|
||||
here equ *
|
||||
</PRE>
|
||||
|
||||
<A NAME="new_opt">
|
||||
<DT><TT><B>OPT</B></TT> - set assembly options
|
||||
<DD>Five options are available:
|
||||
<UL>
|
||||
<LI> <TT>F</TT> - fill space between <TT>ORG</TT>s
|
||||
(details <A HREF="#org_fill">here</A>)
|
||||
<LI> <TT>G</TT> - Atari 5200 mode for hardware register abbreviations
|
||||
(details <A HREF="#numbers">here</A>)
|
||||
<LI> <TT>H</TT> - generate Atari executable headers
|
||||
<LI> <TT>L</TT> - generate listing
|
||||
<LI> <TT>O</TT> - generate object file
|
||||
</UL>
|
||||
You can turn any of these on or off.<BR>
|
||||
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>
|
||||
|
||||
<A NAME="org_fill">
|
||||
<DT><TT><B>ORG</B></TT> - change value of the origin counter
|
||||
<DD>
|
||||
<!-- Option '<TT>F</TT> affects all <TT>ORG</TT> directives except for the first one. -->
|
||||
You can set some options applied to the new header (if headers are
|
||||
enabled):
|
||||
<UL>
|
||||
<LI> <TT>a:</TT> tells X-Asm to always make a header, even it is unnecessary,
|
||||
like in <TT>ORG *</TT>.
|
||||
<LI> <TT>f:</TT> works same as <TT>a:</TT>, but additionally tells to generate
|
||||
a $ff,$ff prefix before the header. X-Asm adds it at the beginning of the file
|
||||
by default, so use this option only if you want the $ff's somewhere inside.<BR>
|
||||
</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 <TT>ORG</TT> directive is executed).<P>
|
||||
|
||||
<A NAME="new_dta">
|
||||
<DT><TT><B>DTA</B></TT> - define data
|
||||
<DD>There are various data types:
|
||||
<UL>
|
||||
<LI> integers
|
||||
<UL>
|
||||
<LI> bytes: <TT>b(200)</TT> or simply <TT>200</TT>
|
||||
<LI> words: <TT>a(10000)</TT>
|
||||
<LI> low bytes of words: <TT>l(511)</TT> defines byte 255
|
||||
<LI> high bytes of words: <TT>h(511)</TT> defines byte 1
|
||||
</UL>
|
||||
You may enter many expressions in parentheses and combine different types
|
||||
of data in single line, separating things with commas.<BR>
|
||||
You may also define a sine lookup table. Syntax is:<BR>
|
||||
<TT>sin(centre,amp,size,first,last)</TT><BR>
|
||||
where:
|
||||
<UL>
|
||||
<LI> <TT>centre</TT> is a number which is added to every sine value
|
||||
<LI> <TT>amp</TT> is the sine amplitude
|
||||
<LI> <TT>size</TT> is the sine period
|
||||
<LI> <TT>first,last</TT> define range of values in the table.
|
||||
They are optional. Default are <TT>0,size-1</TT>.
|
||||
</UL>
|
||||
Example: <TT>dta a(sin(0,1000,256,0,63))</TT> defines table of 64 words
|
||||
representing a quarter of sine with amplitude of 1000.<P>
|
||||
<LI> real numbers: <TT>r(-1.23456e12)</TT><BR>
|
||||
Real numbers are written in 6-byte Atari Floating-Point format. You can't
|
||||
combine reals with operators, as you can integers.<P>
|
||||
<LI> text strings
|
||||
<UL>
|
||||
<LI> ASCII strings: <TT>c'Text'</TT> or <TT>c"Text"</TT>
|
||||
<LI> ANTIC strings: <TT>d'Text'</TT> or <TT>d"Text"</TT>
|
||||
</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
|
||||
high bit in every byte of string.<P>
|
||||
</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>
|
||||
|
||||
<DT><TT><B>ICL</B></TT> - include another source file
|
||||
<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.<P>
|
||||
Examples:
|
||||
<PRE>
|
||||
icl 'macros.asx'
|
||||
icl 'c:\atari\xasm\fileio'
|
||||
</PRE>
|
||||
|
||||
<DT><TT><B>END</B></TT> - end assembling file
|
||||
<DD>Remaining part of the file is not assembled. If this statement does
|
||||
not occur, assembler stops assembling when encounters end of file.<BR>
|
||||
Example:
|
||||
<PRE>
|
||||
end
|
||||
</PRE>
|
||||
|
||||
<DT><TT><B>INS</B></TT> - insert contents of file
|
||||
<DD>Copies every byte of 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 range of inserted file. Syntax is following:
|
||||
<PRE>
|
||||
ins 'file'[,offset[,length]]
|
||||
</PRE>
|
||||
First byte in file has offset 0.<BR>
|
||||
If offset is negative, it is counted from the end of 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>
|
||||
|
||||
<DT><TT><B>RUN</B></TT> - generate run address
|
||||
<DD>The Atari executable program should have a run address specified.
|
||||
A program may be loaded in many areas of memory and started from any address.
|
||||
<PRE> run addr
|
||||
</PRE>
|
||||
is equivalent to:
|
||||
<PRE> org $2e0
|
||||
dta a(addr)
|
||||
</PRE>
|
||||
Examples:
|
||||
<PRE> run start
|
||||
run main
|
||||
</PRE>
|
||||
|
||||
<DT><TT><B>INI</B></TT> - generate init address
|
||||
<DD>The Atari executable program may have some routines which are executed
|
||||
during loading process. There may be many init blocks in one file.<BR>
|
||||
Examples:
|
||||
<PRE> ini init
|
||||
ini showpic
|
||||
</PRE>
|
||||
|
||||
<DT><TT><B>ERT</B></TT> - generate error if expression is true
|
||||
<DD>Examples:
|
||||
<PRE> ert *>$c000
|
||||
ert len1>$ff||len2>$ff
|
||||
</PRE>
|
||||
|
||||
<A NAME="new_eli">
|
||||
<DT><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<BR>
|
||||
<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>
|
||||
Above example can be rewritten using line repeating feature:
|
||||
<PRE>noscr equ 1
|
||||
widescr equ 1
|
||||
:noscr lda #0
|
||||
:!noscr&&widescr lda #$23
|
||||
:!noscr&&!widescr lda #$22
|
||||
sta $22f
|
||||
</PRE>
|
||||
|
||||
</DL>
|
||||
<HR>
|
||||
<A NAME="pseudocom"><H3>Pseudo-commands</H3>
|
||||
Pseudo-commands are built-in macros.
|
||||
They are not unofficial instructions, so they work on typical 6502.<P>
|
||||
<DL>
|
||||
<DT><TT><B>ADD</B></TT> - addition without carry
|
||||
<DD>If you have ever programmed 6502, you must have noticed that you had
|
||||
to use a <TT>CLC</TT> before <TT>ADC</TT> for every simple addition.<BR>
|
||||
X-Asm can do it for you. <TT>ADD</TT> replaces two instructions:
|
||||
<TT>CLC</TT> and <TT>ADC</TT>.<P>
|
||||
|
||||
<DT><TT><B>SUB</B></TT> - subtraction
|
||||
<DD>It is <TT>SEC</TT> and <TT>SBC</TT>.<P>
|
||||
|
||||
<A NAME="new_repskip">
|
||||
<DT><TT><B>RCC, RCS, REQ, RMI, RNE, RPL, RVC, RVS</B></TT> - conditional repeat
|
||||
<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>
|
||||
|
||||
<DT><TT><B>SCC, SCS, SEQ, SMI, SNE, SPL, SVC, SVS</B></TT> - conditional skip
|
||||
<DD>These are branches over the next instructions. No operand is required,
|
||||
because the target is the address of instruction following
|
||||
the next instruction.<BR>
|
||||
Example:
|
||||
<PRE> lda #40
|
||||
add:sta $80
|
||||
scc:inc $81
|
||||
</PRE>
|
||||
In the above example word-size variable $80 is incremented by 40.<BR>
|
||||
Nor conditional repeat nor skip pseudo-commands require operand,
|
||||
thus they can be paired with any other command.<P>
|
||||
|
||||
<DT><TT><B>JCC, JCS, JEQ, JMI, JNE, JPL, JVC, JVS</B></TT> - conditional jumps
|
||||
<DD>These are a kind of 'long' branches. While standard branches
|
||||
(<TT>BNE, BEQ</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>
|
||||
|
||||
<DT><TT><B>INW</B></TT> - increment word
|
||||
<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>
|
||||
|
||||
<DT><TT><B>MVA, MVX, MVY</B></TT> - move byte using accumulator, X or Y
|
||||
<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>
|
||||
|
||||
<A NAME="new_mwinde">
|
||||
<DT><TT><B>MWA, MWX, MWY</B></TT> - move word using accumulator, X or Y
|
||||
<DD>These pseudo-commands require two operands
|
||||
and are combinations of two <TT>MV*</TT>'s:
|
||||
one to move low byte, and the other to move high byte.<BR>
|
||||
You can't use indirect nor pseudo addressing mode with <TT>MW*</TT>.
|
||||
Destination must be absolute address (optionally indexed).<BR>
|
||||
When source is also absolute, a <TT>mw* source dest</TT> will be:
|
||||
<PRE> mv* source dest
|
||||
mv* source+1 dest+1
|
||||
</PRE>
|
||||
When source is an immediate, a <TT>mw* #immed dest</TT> will be:
|
||||
<PRE> mv* <immed dest
|
||||
mv* >immed dest+1
|
||||
</PRE>
|
||||
When <TT><immed</TT> equals <TT>>immed</TT> and <TT>immed</TT>
|
||||
is not forward-referenced, X-Asm uses optimization:
|
||||
<PRE> mv* <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> mvx #1 dest
|
||||
dex
|
||||
stx dest+1
|
||||
</DL>
|
||||
</OL>
|
||||
|
||||
<HR>
|
||||
<A NAME="adrmod"><H3>Addressing modes</H3>
|
||||
All addressing modes are entered in standard convention except
|
||||
the accumulator addressing mode, which should be marked with a
|
||||
<TT>@</TT> character (as in Quick Assembler).<P>
|
||||
|
||||
There are two extra immediate addressing modes:
|
||||
<TT><</TT> and <TT>></TT>,
|
||||
which use low/high byte of 16-bit word constant.
|
||||
They are for Quick Assembler compatibility.
|
||||
You can use traditional <TT>#<</TT> and <TT>#></TT>.
|
||||
Note <NOBR><TT>lda >$ff+5</TT></NOBR> loads 1 (<TT>>$104</TT>),
|
||||
while <NOBR><TT>lda #>$ff+5</TT></NOBR>
|
||||
loads 5 (<TT>0+5</TT>) to accumulator, because unary operator <TT>></TT>
|
||||
has higher priority than the binary plus.<P>
|
||||
|
||||
In absolute addressing modes, X-Asm examines the expression and uses zero-page
|
||||
addressing mode if it supposes it's possible. You may override it with
|
||||
<TT>a:</TT> and <TT>z:</TT> prefixes.<P>
|
||||
|
||||
Examples:
|
||||
<PRE>
|
||||
nop
|
||||
asl @
|
||||
lda >$1234 assembles to lda #$12
|
||||
lda $100,x
|
||||
lda a:0 generates 16-bit address
|
||||
jmp ($0a)
|
||||
lda ($80),y
|
||||
</PRE>
|
||||
|
||||
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>:
|
||||
<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>
|
||||
|
||||
<HR>
|
||||
<A NAME="faq"><H2>FAQ</H2>
|
||||
<B>Note:</B> All the following things, which may be odd for you,
|
||||
are familiar to Quick Assembler users.
|
||||
<UL>
|
||||
<LI><B>Q:</B> Why does X-Asm ignore <TT>+2</TT> in the following line?
|
||||
<PRE>label equ 1 +2
|
||||
</PRE>
|
||||
<B>A:</B> X-Asm treats space as operand terminator. Remaining part of line
|
||||
is a comment. You should write <TT>1+2</TT> without any spaces.<P>
|
||||
|
||||
<LI><B>Q:</B> Why does <TT>lda >$abcd</TT> assemble to
|
||||
<TT>lda #$ab</TT>?<P>
|
||||
<B>A:</B> <TT><</TT> and <TT>></TT> are not only 'low' and 'high'
|
||||
operators, but also 'low of immediate' and 'high of immediate'
|
||||
addressing modes indicators.
|
||||
In order to get <TT>lda $ab</TT>, write <TT>lda +>$abcd</TT><P>
|
||||
|
||||
<LI><B>Q:</B> What's wrong with <TT>asl a</TT> or just <TT>asl</TT> ?<P>
|
||||
<B>A:</B> You must use <TT>@</TT> for accumulator addressing mode.<P>
|
||||
|
||||
<LI><B>Q:</B> What's wrong in following line?
|
||||
<PRE>label: lda #0
|
||||
</PRE>
|
||||
<B>A:</B> Label definition can not include a colon.<P>
|
||||
|
||||
<LI><B>Q:</B> I wrote <TT>end start</TT>, where <TT>start</TT> points
|
||||
to program beginning, but program seems not to start there. Why?<P>
|
||||
<B>A:</B> You should have explicit run address specified.
|
||||
Use <TT>run start</TT> directive. <TT>end</TT> takes no operand.<P>
|
||||
|
||||
<LI><B>Q:</B> Why this construction does not work:
|
||||
<PRE>three equ one+two
|
||||
two equ one+one
|
||||
one equ 1
|
||||
</PRE>
|
||||
while this does:
|
||||
<PRE>
|
||||
two equ one+one
|
||||
one equ 1
|
||||
</PRE>
|
||||
<B>A:</B> X-Asm reads source twice (in pass 1 and pass 2)
|
||||
from the beginning until the end.<BR>
|
||||
This allows forward references, but not too complex.<BR>
|
||||
Keep in mind that the assembler must know all the values in the second
|
||||
pass.<P>
|
||||
Example:
|
||||
<PRE>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
|
||||
</PRE>
|
||||
These values can be fixed in two passes.<BR>
|
||||
If you insert following statement as first line:
|
||||
<PRE>three equ one+two
|
||||
</PRE>
|
||||
X-Asm will generate an error because it can't fix
|
||||
the value of <TT>three</TT> in second pass.<P>
|
||||
|
||||
<LI><B>Q:</B> X-Asm displayed single error while assembling my program.
|
||||
When I fixed it, another error appeared. Why?<P>
|
||||
<B>A:</B> X-Asm displays only first error.<BR>
|
||||
When you were assembling for the first time, both errors might exist,
|
||||
but X-Asm stopped on the first one.<P>
|
||||
|
||||
</UL>
|
||||
If you have other questions/problems,
|
||||
<A HREF=mailto:fox@scene.pl>contact me</A>.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY></HTML>
|
|
@ -1,98 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-BOOT 5.0</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-BOOT version 5.0</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool converts Atari executable files to disk images (ATR).
|
||||
Since its first version, X-BOOT lost significance, because now you
|
||||
can load an executable directly to Atari (e.g. using
|
||||
<A HREF="xload.htm">X-LOAD</A>), and the emulators (e.g.
|
||||
<A HREF="http://www.a800win.atari-area.prv.pl">Atari800Win PLus</A>).
|
||||
However, X-BOOT may still be useful, especially when using
|
||||
professional loader.
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 5.0</H4>
|
||||
<UL>
|
||||
<LI> long file names support
|
||||
<LI> more flexible syntax: both <TT>obxmask atrfile</TT>
|
||||
and <TT>obxfile atrpath</TT> can be used
|
||||
<LI> internal write protection flag (supported by APE and Atari800)
|
||||
set in generated disk images
|
||||
<LI> headers with end address less than start allowed
|
||||
<LI> Unix-like <TT>-p</TT> option allowed
|
||||
</UL>
|
||||
<H4>Version 4.0</H4>
|
||||
<UL>
|
||||
<LI> wildcards support - now you can convert a set of files
|
||||
<LI> .ATR name not required - name can be taken from executable
|
||||
<LI> no length limit - files longer than 60k allowed
|
||||
<LI> truncated executables are supported
|
||||
<LI> checking for memory conflicts
|
||||
<LI> better errors handling
|
||||
</UL>
|
||||
<H4>Version 3.2</H4>
|
||||
<UL>
|
||||
<LI> .OBX is default extension of Atari executable
|
||||
</UL>
|
||||
<H4>Version 3.1</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
Syntax for invoking X-BOOT is following:<P>
|
||||
<TT>XBOOT [/p] obxfiles [atrpath][atrfile]</TT><P>
|
||||
Parameters in brackets are optional.<P>
|
||||
If file name extension is omitted, the default .OBX or .ATR is added.
|
||||
If no <TT>atrpath</TT> is given, disk images are written by default in
|
||||
the directory where executables are.<P>
|
||||
If file name contains spaces, you should enclose it in quotation marks.<P>
|
||||
<TT>/p</TT> switch (or equivalent <TT>-p</TT>) forces writing 'professional
|
||||
loader', which allows you to load code/data intro the RAM under ROM and starts
|
||||
the program with disabled ROM and interrupts. By default, standard loader is
|
||||
used, which can load any Atari executable not demanding DOS nor any special
|
||||
loader.<P>
|
||||
Both loaders disable Atari Basic, so you don't need to hold the OPTION key
|
||||
while booting.<P>
|
||||
Below are some examples:<P>
|
||||
<DL>
|
||||
<DT><TT>XBOOT -p test</TT>
|
||||
<DD>Converts <TT>test.obx</TT> to <TT>test.atr</TT> in current directory
|
||||
using professional loader.
|
||||
<DT><TT>XBOOT d:\games\*.xex \atrs\</TT>
|
||||
<DD>Converts all files in <TT>d:\games</TT> with <TT>.xex</TT> extension
|
||||
and writes disk images to directory <TT>\atrs</TT> on current drive
|
||||
using standard loader.
|
||||
<DT><TT>XBOOT "c:\test\Very Long File Name.AtariExecutable" /p</TT>
|
||||
<DD>Converts <NOBR><TT>c:\test\Very Long File Name.AtariExecutable</TT></NOBR> to
|
||||
<NOBR><TT>c:\test\Very Long File Name.atr</TT></NOBR> using professional loader.
|
||||
<DT><TT>XBOOT d:* /p .</TT>
|
||||
<DD>Converts all .OBX files in current directory on <TT>d:</TT>
|
||||
to current directory on current drive using professional loader.
|
||||
</DL>
|
||||
<HR>
|
||||
<H2>DETAILS</H2>
|
||||
Produced ATR is single density and as short as possible.
|
||||
Loader occupies one boot sector.<P>
|
||||
X-BOOT does not store the executable file in ATR as an Atari file.
|
||||
You can't read it from an Atari DOS nor extract it somehow or other.
|
||||
You can only run it by booting.<P>
|
||||
For more details, read source files of the loaders:
|
||||
<UL>
|
||||
<LI>Standard: <A HREF="xbootstd.asx">XBOOTSTD.ASX</A>
|
||||
<LI>Professional: <A HREF="xbootpro.asx">XBOOTPRO.ASX</A>
|
||||
</UL>
|
||||
Loaders are so simple that they even do not detect end of file. Instead,
|
||||
they are modified when end of file is reached. The disk image contains one
|
||||
additional block, which doesn't belong to the executable file, but alters
|
||||
the loader to run the program instead of initializing.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,64 +0,0 @@
|
|||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Reads file from ATR prepared with X-BOOT.
|
||||
* Professional version - can load file under ROM.
|
||||
* Interrupts and ROM are disabled when running loaded program.
|
||||
|
||||
opt h-
|
||||
org $480
|
||||
|
||||
bufr equ $400 128-byte buffer
|
||||
|
||||
tp equ $43 Temporary byte
|
||||
vc equ $44 Start and end vectors (4 bytes)
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot,$e477) Boot header
|
||||
mva #0 $22f Make screen blank...
|
||||
mva #$52 $2c8 ... and pink ;)
|
||||
lda 20 Wait for VBLK
|
||||
cmp:req 20
|
||||
mwa #rts $2e0 Set default run vector
|
||||
dta b({lda a:0}) Skip two bytes
|
||||
secrts sec Return with error
|
||||
rts rts
|
||||
mva:pha >rts $2e3 Set init address...
|
||||
mva:pha <rts $2e2 ... and put return address on stack
|
||||
ldx #-5 Load header
|
||||
hput sta vc+4,x+ Store byte of header
|
||||
stx tp
|
||||
next inc bufx Increment buffer index
|
||||
bpl getx Branch if within buffer
|
||||
inw $30a Increment sector number
|
||||
mva #$ff ^31 Turn ROM on
|
||||
lsr ^4e Enable NMI interrupts
|
||||
cli Enable IRQ interrupts
|
||||
jsr $e453 Read sector
|
||||
bmi secrts Exit on error
|
||||
sei Disable IRQ interrupts
|
||||
inc ^4e Disable NMI interrupts
|
||||
dec ^31 Turn ROM off
|
||||
asl bufx Change $80 to $00
|
||||
getx lda bufr+$7f Get byte from buffer
|
||||
bufx equ *-2 Buffer index
|
||||
ldx tp Check if header or block data
|
||||
bne hput Branch to store header
|
||||
sta (vc,x) Store block data
|
||||
inw vc Increment vector
|
||||
lda vc+2 Check if end of block reached
|
||||
cmp vc
|
||||
lda vc+3
|
||||
sbc vc+1
|
||||
bcs next No: read next byte
|
||||
mva #3 ^2f Yes: Reset POKEY...
|
||||
init jmp ($2e2) ... and call init routine
|
||||
|
||||
dta c'5.0p' Unused boot sector space
|
||||
ert *<>boot+$80 Exactly 128 bytes should be used
|
||||
|
||||
* X-BOOT adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
|
@ -1,63 +0,0 @@
|
|||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Reads file from ATR prepared with X-BOOT.
|
||||
* Standard loader - ROM and interrupts enabled.
|
||||
|
||||
opt h-
|
||||
org $780
|
||||
|
||||
bufr equ $700 128-byte buffer
|
||||
|
||||
tp equ $43 Temporary byte
|
||||
vc equ $44 Start and end vectors (4 bytes)
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot,$e477) Boot header
|
||||
txtpos equ 215
|
||||
ldy #txtpos Print text
|
||||
print mva text-txtpos,y ($58),y+
|
||||
cpy #txtpos+txtlen
|
||||
bcc print
|
||||
mwa #rts $2e0 Set default run vector
|
||||
mva >bufr $305 Set buffer address
|
||||
mva #$ff ^31 Turn BASIC off
|
||||
dta b({lda a:0}) Skip two bytes
|
||||
secrts sec Return with error
|
||||
rts rts
|
||||
mva:pha >rts $2e3 Set init address...
|
||||
mva:pha <rts $2e2 ... and put return address on stack
|
||||
ldx #-5 Load header
|
||||
hput sta vc+4,x+ Store byte of header
|
||||
stx tp
|
||||
next inc bufx Increment buffer index
|
||||
bpl getx Branch if within buffer
|
||||
inw $30a Increment sector number
|
||||
jsr $e453 Read sector
|
||||
bmi secrts Exit on error
|
||||
asl bufx Change $80 to $00
|
||||
getx lda bufr+$7f Get byte from buffer
|
||||
bufx equ *-2 Buffer index
|
||||
ldx tp Check if header or block data
|
||||
bne hput Branch to store header
|
||||
sta (vc,x) Store block data
|
||||
inw vc Increment vector
|
||||
lda vc+2 Check if end of block reached
|
||||
cmp vc
|
||||
lda vc+3
|
||||
sbc vc+1
|
||||
bcs next No: read next byte
|
||||
mva #3 ^2f Yes: Reset POKEY...
|
||||
init jmp ($2e2) ... and call init routine
|
||||
|
||||
text dta d'Loading... '
|
||||
txtlen equ *-text
|
||||
|
||||
dta c'5.0' Unused boot sector space
|
||||
ert *<>boot+$80 Exactly 128 bytes should be used
|
||||
|
||||
* X-BOOT adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
|
@ -1,45 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-HEAD 1.1</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-HEAD version 1.1</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool prints headers of an Atari executable file.
|
||||
It shows, into which memory areas the file loads,
|
||||
and what are init and run addresses.<P>
|
||||
<B>Important note:</B> X-HEAD is an extremely simple tool. Jindrich Kubec
|
||||
wrote a tool with similar purpose, but much more features (disassembly
|
||||
in different formats, including X-Assembler), called ChkExe.
|
||||
You can find it on
|
||||
<A HREF="http://jindroush.atari.org">http://jindroush.atari.org</A>.
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 1.1</H4>
|
||||
<UL>
|
||||
<LI> .OBX is default extension of Atari executable
|
||||
</UL>
|
||||
<H4>Version 1.0</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
Simply run X-HEAD with executable filename. No options are supported.<P>
|
||||
X-HEAD will read the file and display its headers in following format:
|
||||
<PRE> bbbb-eeee xxxx</PRE>
|
||||
where <TT>bbbb</TT> is the begin, <TT>eeee</TT> - the end of the block,
|
||||
and <TT>xxxx</TT> is the execution (init or run) address.<P>
|
||||
The summary includes:<BR>
|
||||
<TT>xxxx bytes</TT> - length of file, including headers<BR>
|
||||
<TT>xxxx blocks</TT> - number of headers<BR>
|
||||
<TT>xxxx inits</TT> - number of init blocks (<TT>02e2-02e3</TT>)<BR>
|
||||
<TT>xxxx modules</TT> - number of <TT>FFFF</TT> headers (one at the beginning is required)<P>
|
||||
All displayed numbers are hexadecimal, of course.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,85 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>X-LOAD 1.1</TITLE>
|
||||
</HEAD>
|
||||
<BODY BACKGROUND="6502proc.gif">
|
||||
<CENTER>
|
||||
<H1>X-LOAD version 1.1</H1>
|
||||
<HR>
|
||||
</CENTER>
|
||||
|
||||
<H2>INTRODUCTION</H2>
|
||||
This tool may be used to load an Atari executable file, stored on the PC,
|
||||
into a real Atari computer, via the SIO2PC interface.
|
||||
Only data input and data output lines are used, so X-LOAD should work
|
||||
with all types of the interface.<P>
|
||||
It is experimental version. I'm not sure if it will work
|
||||
with every hardware. I've noticed it is not stable and sometimes
|
||||
transmission can hang or distortions in loaded data may appear.
|
||||
The reason is that there is no error-checking, while transmission is
|
||||
fast (57.6 kbits/sec).<P>
|
||||
<H3>CHANGES</H3>
|
||||
<H4>Version 1.1</H4>
|
||||
<UL>
|
||||
<LI> files with no explicit run address are started from the beginning
|
||||
of the first block
|
||||
</UL>
|
||||
<H4>Version 1.0</H4>
|
||||
<UL>
|
||||
<LI> first release
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<H2>USAGE</H2>
|
||||
You should pass as the parameters the executable file name and optionally
|
||||
the options:<P>
|
||||
<DL>
|
||||
<DT><TT>/1</TT> - <TT>/4</TT>
|
||||
<DD>Serial port number. Default is 2.<P>
|
||||
<DT><TT>/p</TT>
|
||||
<DD>Force using 'professional loader', which allows you to load code/data
|
||||
into the RAM under ROM ($c000-$ffff) and starts the program with disabled
|
||||
ROM and interrupts. By default, standard loader is used, which can load
|
||||
any Atari executable not demanding DOS or any special loader.<P>
|
||||
</DL>
|
||||
After you run X-LOAD, you only have to boot your Atari and the program
|
||||
will be loaded and run.<P>
|
||||
While loading, PC prints memory locations, which the program loads into.<P>
|
||||
After the program is loaded and run, X-LOAD terminates. You may exit it
|
||||
earlier at any time by pressing the ESC key.<P>
|
||||
|
||||
<HR>
|
||||
<H2>DETAILS</H2>
|
||||
First, X-LOAD sends a byte to Atari and then waits until the Atari is booted.
|
||||
The byte can be used to detect from Atari, that PC is ready for transmission.
|
||||
When you are testing your program, you may code periodic checking
|
||||
if a byte was received, and performing cold reset in that case.
|
||||
So you don't need to touch your Atari to run your program on it.<P>
|
||||
While booting, X-LOAD accepts two commands for disk drive 1:<P>
|
||||
<UL>
|
||||
<LI> <TT>'S'</TT> - read status. Used by the Atari OS to check presence
|
||||
of a disk drive.
|
||||
<LI> <TT>'R'</TT> - read sector (only first). Used to transfer the loader.
|
||||
</UL>
|
||||
After the Atari receives and runs the loader, the transmission runs at 57600
|
||||
bits/sec.<P>
|
||||
The transmission protocol is very simple: Atari sends a byte to inform that
|
||||
it is ready for receiving data. Then PC sends a 3-byte header and a block
|
||||
of data. First two bytes of the header are the high and the low byte of the
|
||||
address of the last byte in the block minus $ff. Third byte equals low byte
|
||||
of ($100-block_length). Then come block data, which are loaded directly
|
||||
into their memory locations.
|
||||
For more details, view source files of the loaders:
|
||||
<UL>
|
||||
<LI>Standard: <A HREF="xloadstd.asx">XLOADSTD.ASX</A>
|
||||
<LI>Professional: <A HREF="xloadpro.asx">XLOADPRO.ASX</A>
|
||||
</UL>
|
||||
You may have noticed that X-LOAD is somehow similar to X-BOOT, which also
|
||||
has two loaders. The main difference is that X-BOOT loaders use system
|
||||
routines to get sectors at regular speed of 19200 bits/sec.
|
||||
They use sector buffer and require some low memory locations not to be altered
|
||||
because of Atari operating system. In this respect X-LOAD loaders are better,
|
||||
because they allow loading into whole memory except for the loader code.
|
||||
<P><HR><P><A HREF="index.htm">Back</A>
|
||||
</BODY>
|
||||
</HTML>
|
|
@ -1,60 +0,0 @@
|
|||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Receives file from X-LOAD via SIO2PC interface.
|
||||
* Professional version - can load file under ROM.
|
||||
* Interrupts and ROM are disabled when running loaded program.
|
||||
|
||||
opt h-
|
||||
org $400
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot) Boot header
|
||||
arts dta a(rts)
|
||||
|
||||
dta b({lda #$60}) Skip rts
|
||||
rts rts
|
||||
|
||||
sei Disable interrupts
|
||||
inc ^4e
|
||||
inc ^40 Make screen blank
|
||||
mva #$08 ^24 Set transmission speed
|
||||
mva #$00 ^26
|
||||
mva #$28 ^28
|
||||
sta ^29 Reset counters
|
||||
mva #$23 ^2f Send enable
|
||||
sta ^2d Send a byte
|
||||
wait sta ^4a Wait until sent
|
||||
asl @
|
||||
bcc wait
|
||||
mva #$13 ^2f Receive enable
|
||||
ldy #2
|
||||
head jsr get Receive address (high/low byte)
|
||||
sta stor,y
|
||||
mva arts-1,y $2e2-1,y Set init address
|
||||
pha Put return address on stack
|
||||
dey
|
||||
bne head
|
||||
jsr get Receive length (one byte)
|
||||
tax
|
||||
load jsr get Receive data
|
||||
stor sta a:0,x+ Store in memory
|
||||
bne load
|
||||
mva $10 ^2e Reset POKEY
|
||||
mva #3 ^2f
|
||||
init jmp ($2e2) Call init routine
|
||||
|
||||
get lda #$20 Function: Receive one byte
|
||||
sta ^2e Enable receive interrupt
|
||||
bit:rne ^2e Wait for interrupt request
|
||||
sty ^2e Disable receive interrupt
|
||||
lda ^2d Get byte
|
||||
rts
|
||||
|
||||
:boot+$80-* dta b(0) Padd with zeros to full sector
|
||||
|
||||
* X-LOAD adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
|
@ -1,60 +0,0 @@
|
|||
* Boot executable file loader coded by Fox/Taquart
|
||||
* Receives file from X-LOAD via SIO2PC interface.
|
||||
* Standard loader - ROM and interrupts enabled while running loaded program.
|
||||
|
||||
opt h-
|
||||
org $700
|
||||
|
||||
* Boot code
|
||||
boot dta b(0,1),a(boot) Boot header
|
||||
arts dta a(rts)
|
||||
|
||||
dta b({lda #$60}) Skip rts
|
||||
rts rts
|
||||
|
||||
sei Disable interrupts
|
||||
inc ^4e
|
||||
mva #$08 ^24 Set transmission speed
|
||||
mva #$00 ^26
|
||||
mva #$28 ^28
|
||||
sta ^29 Reset counters
|
||||
mva #$23 ^2f Send enable
|
||||
sta ^2d Send a byte
|
||||
wait sta ^4a Wait until sent
|
||||
asl @
|
||||
bcc wait
|
||||
mva #$13 ^2f Receive enable
|
||||
ldy #2
|
||||
head jsr get Receive address (high/low byte)
|
||||
sta stor,y
|
||||
mva arts-1,y $2e2-1,y Set init address
|
||||
pha Put return address on stack
|
||||
dey
|
||||
bne head
|
||||
jsr get Receive length (one byte)
|
||||
tax
|
||||
load jsr get Receive data
|
||||
stor sta a:0,x+ Store in memory
|
||||
bne load
|
||||
mva $10 ^2e Reset POKEY
|
||||
mva #3 ^2f
|
||||
lsr ^4e Enable interrupts
|
||||
cli
|
||||
init jmp ($2e2) Call init routine
|
||||
|
||||
get lda #$20 Function: Receive one byte
|
||||
sta ^2e Enable receive interrupt
|
||||
bit:rne ^2e Wait for interrupt request
|
||||
sty ^2e Disable receive interrupt
|
||||
lda ^2d Get byte
|
||||
rts
|
||||
|
||||
:boot+$80-* dta b(0) Padd with zeros to full sector
|
||||
|
||||
* X-LOAD adds this block at the end of loaded file
|
||||
* It changes jmp ($2e2) to jmp ($2e0)
|
||||
opt h+
|
||||
org init+1
|
||||
dta l($2e0)
|
||||
|
||||
end
|
|
@ -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"
|
|
@ -1,5 +0,0 @@
|
|||
--== xasm 2.5.1: second final edition ==--
|
||||
interactive visual development environment
|
||||
only for 8-bit Atari programming gurus
|
||||
|
||||
requirements: 386 + DOS or Windows
|
248
fox.mak
248
fox.mak
|
@ -1,248 +0,0 @@
|
|||
;b. Fox/Tqa
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ;shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
;±±±±±±± DOS / FILE I/O ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO dos _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
IFDEF smartio
|
||||
call xdisk
|
||||
ELSE
|
||||
int 21h
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO smartdisk
|
||||
smartio = 1
|
||||
xdisk: dos
|
||||
IFDEF rts
|
||||
jnc rts
|
||||
ELSE
|
||||
jc _derr
|
||||
ret
|
||||
_derr:
|
||||
ENDIF
|
||||
mov dx, offset errtxt
|
||||
jmp panic
|
||||
ENDM
|
||||
|
||||
MACRO smarterr
|
||||
errtxt db 'Disk error!',eot
|
||||
ENDM
|
||||
|
||||
MACRO fcreate _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
xor cx, cx
|
||||
file 3ch
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fopen _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
file 3d00h
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fupdate _fname ; ENTRY: DS:_fname|dx = ASCIIZ fname, RETURN: bx = handle
|
||||
IFNB <_fname>
|
||||
mov dx, offset _fname
|
||||
ENDIF
|
||||
file 3d02h
|
||||
sta bx
|
||||
ENDM
|
||||
|
||||
MACRO fclose ; ENTRY: bx = handle
|
||||
file 3eh
|
||||
ENDM
|
||||
|
||||
MACRO fread _fbufr ; ENTRY: DS:_fbufr = buffer, cx = no. of bytes
|
||||
IFNB <_fbufr>
|
||||
mov dx, offset _fbufr
|
||||
ENDIF
|
||||
file 3fh
|
||||
ENDM
|
||||
|
||||
MACRO fwrite _fbufr ; ENTRY: DS:_fbufr = buffer, cx = no. of bytes
|
||||
IFNB <_fbufr>
|
||||
mov dx, offset _fbufr
|
||||
ENDIF
|
||||
file 40h
|
||||
ENDM
|
||||
|
||||
;±±±±±±± PRINT ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO print _text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
MACRO PEOL
|
||||
mov dl, 13
|
||||
dos 2
|
||||
mov dl, 10
|
||||
dos 2
|
||||
ENDM
|
||||
|
||||
MACRO PrintAXdec
|
||||
LOCAL _outn1,_outn2,_dectxt,_cont
|
||||
mov di, offset _dectxt+4
|
||||
mov bx, 10
|
||||
_outn1: xor dx, dx
|
||||
div bx
|
||||
add dl, '0'
|
||||
_outn2: mov [di], dl
|
||||
dec di
|
||||
test ax, ax
|
||||
jnz _outn1
|
||||
mov dl, ' '
|
||||
cmp di, offset _dectxt
|
||||
jnb _outn2
|
||||
print _dectxt
|
||||
jmp _cont
|
||||
_dectxt db 5 dup(' '),eot
|
||||
_cont:
|
||||
ENDM
|
||||
|
||||
MACRO PrintEAXdec
|
||||
LOCAL _outn1,_outn2,_dectxt,_cont
|
||||
mov di, offset _dectxt+9
|
||||
mov ebx, 10
|
||||
_outn1: xor edx, edx
|
||||
div ebx
|
||||
add dl, '0'
|
||||
_outn2: mov [di], dl
|
||||
dec di
|
||||
test eax, eax
|
||||
jnz _outn1
|
||||
mov dl, ' '
|
||||
cmp di, offset _dectxt
|
||||
jnb _outn2
|
||||
print _dectxt
|
||||
jmp _cont
|
||||
_dectxt db 10 dup(' '),eot
|
||||
_cont:
|
||||
ENDM
|
||||
|
||||
MACRO D2A
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
ENDM
|
||||
|
||||
MACRO Printdig
|
||||
d2a
|
||||
sta dx
|
||||
dos 2
|
||||
ENDM
|
||||
|
||||
MACRO PrintAL
|
||||
push ax
|
||||
shr al, 4
|
||||
PrintDig
|
||||
pop ax
|
||||
and al, 0fh
|
||||
PrintDig
|
||||
ENDM
|
||||
|
||||
MACRO PrintAX
|
||||
push ax
|
||||
mov al, ah
|
||||
PrintAL
|
||||
pop ax
|
||||
PrintAL
|
||||
ENDM
|
||||
|
||||
MACRO PrintEAX
|
||||
push ax
|
||||
shr eax, 16
|
||||
PrintAX
|
||||
pop ax
|
||||
PrintAX
|
||||
ENDM
|
||||
|
||||
;±±±±±±± GFX ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
|
||||
MACRO setgfx _gmode
|
||||
mov ax, _gmode
|
||||
int 10h
|
||||
ENDM
|
||||
|
||||
MACRO bar _jaki
|
||||
IFDEF bars
|
||||
mov dx, 3c8h
|
||||
mov al, 0
|
||||
out dx, al
|
||||
inc dx
|
||||
mov al, _jaki
|
||||
out dx, al
|
||||
out dx, al
|
||||
out dx, al
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO EndVBl
|
||||
LOCAL w1,w2
|
||||
mov dx, 3dah
|
||||
w1: in al, dx
|
||||
test al, 8
|
||||
jz w1
|
||||
w2: in al, dx
|
||||
test al, 8
|
||||
jnz w2
|
||||
ENDM
|
||||
|
||||
MACRO StartVBL
|
||||
LOCAL w1,w2
|
||||
mov dx, 3dah
|
||||
w1: in al, dx
|
||||
test al, 8
|
||||
jnz w1
|
||||
w2: in al, dx
|
||||
test al, 8
|
||||
jz w2
|
||||
ENDM
|
File diff suppressed because it is too large
Load Diff
|
@ -1,56 +0,0 @@
|
|||
# X-Assembler 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
|
|
@ -1,55 +0,0 @@
|
|||
// X-Assembler highlighter for ConTEXT v0.97.1 (www.fixedsys.com/context)
|
||||
// written by Piotr Fusik <fox@scene.pl>
|
||||
|
||||
Language: X-Assembler
|
||||
Filter: X-Assembler 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
|
133
syntax/xasm.stx
133
syntax/xasm.stx
|
@ -1,133 +0,0 @@
|
|||
#TITLE=X-Assembler
|
||||
; X-Assembler 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
|
||||
#
|
BIN
www/cgenie.gif
BIN
www/cgenie.gif
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
BIN
www/gbak.gif
BIN
www/gbak.gif
Binary file not shown.
Before Width: | Height: | Size: 69 B |
BIN
www/green64.gif
BIN
www/green64.gif
Binary file not shown.
Before Width: | Height: | Size: 477 B |
|
@ -1,49 +0,0 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>xasm home page</TITLE>
|
||||
<META NAME="Description" CONTENT="xasm is a set of a few tools for developing software
|
||||
for Atari 8-bit computers on a PC with MS-DOS or Windows.">
|
||||
<META NAME="Keywords" CONTENT="xasm,6502,cross-assembler,atari,fox,taquart">
|
||||
<META NAME="Author" CONTENT="Piotr Fusik">
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#000000" BACKGROUND="gbak.gif" TEXT="#ffffff" LINK="#00c0ff" VLINK="#ff80ff" ALINK="#d06060">
|
||||
<TABLE WIDTH=100% CELLSPACING=0 CELLPADDING=0><TR>
|
||||
<TD WIDTH=10% BGCOLOR=#008080><FONT SIZE=6><B>
|
||||
<NOBR> xasm home page</NOBR></B></FONT></TD>
|
||||
<TD BGCOLOR=#008080><IMG SRC="green64.gif" WIDTH=100% HEIGHT=50></TD></TR></TABLE>
|
||||
<CENTER><P>
|
||||
<B>xasm</B> is a set of a few tools for developing software for Atari 8-bit computers
|
||||
on a PC with MS-DOS or Windows.<P>
|
||||
<A HREF="xasm251.zip">Download (38 KB)</A> |
|
||||
<A HREF="doc/index.htm">Browse documentation on-line</A> |
|
||||
<A HREF="mailto:fox@scene.pl">E-mail me</A>
|
||||
<P>
|
||||
<TABLE><TR>
|
||||
<TD><IMG SRC="cgenie.gif" WIDTH=489 HEIGHT=461 ALT="Some 6502 code in Code-Genie"></TD>
|
||||
<TD>
|
||||
<HR><P>
|
||||
<B>News:</B>
|
||||
<UL>
|
||||
<LI> 21-08-2002: released version 2.5.1 (a small bug fix)
|
||||
<LI> 08-07-2002: released version 2.5
|
||||
<LI> 27-06-2002: released version 2.4.1 (a small bug fix)
|
||||
<LI> 22-05-2002: released version 2.4
|
||||
</UL>
|
||||
<P><HR><P>
|
||||
<B>Features of the assembler:</B>
|
||||
<UL>
|
||||
<LI> backward compatibility with Quick Assembler
|
||||
<LI> pseudo instructions (<TT>add</TT>, <TT>sub</TT>, <TT>inw</TT>, <TT>mva</TT> etc.)
|
||||
<LI> pseudo addressing modes (e.g. indexing with autoincrementation)
|
||||
<LI> two instructions with same operand may be written in single line
|
||||
<LI> full set of arithmetic and logical operators
|
||||
<LI> 6502 opcodes may be used in expressions
|
||||
<LI> conditional assembly
|
||||
<LI> sine lookup-table generator
|
||||
<LI> Atari floating-point numbers
|
||||
<LI> Atari executable and raw output formats
|
||||
</UL>
|
||||
</TD>
|
||||
</TR></TABLE>
|
||||
</CENTER>
|
||||
</BODY></HTML>
|
|
@ -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[]
|
|
@ -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
|
|
@ -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
|
631
xboot.asm
631
xboot.asm
|
@ -1,631 +0,0 @@
|
|||
; ><-B00T V b. Fox
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
zero db 100h dup(?)
|
||||
|
||||
blen = 59*1024
|
||||
|
||||
m_pro = 1 ; /p switch
|
||||
m_errs = 2 ; error/warning occured while current file
|
||||
m_file = 4 ; single file (atr name for one file given)
|
||||
m_lfn = 8 ; LFN search
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
struc finddata16
|
||||
db 21 dup(?)
|
||||
attr db ?
|
||||
time dw ?
|
||||
date dw ?
|
||||
fsize dd ?
|
||||
fname db 13 dup(?)
|
||||
ends
|
||||
|
||||
struc filetime32
|
||||
dd ?,?
|
||||
ends
|
||||
|
||||
struc finddata32
|
||||
attr dd ?
|
||||
creat filetime32 ?
|
||||
acces filetime32 ?
|
||||
write filetime32 ?
|
||||
fsizeh dd ?
|
||||
fsizel dd ?
|
||||
dd ?,?
|
||||
fname db 260 dup(?)
|
||||
aname db 14 dup(?)
|
||||
ends
|
||||
|
||||
MACRO lda _rg ; shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ; shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO dos _func ; call DOS function
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
call xdisk
|
||||
ENDM
|
||||
|
||||
MACRO jfile _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
jmp xdisk
|
||||
ENDM
|
||||
|
||||
MACRO print _text ; print ascii$ text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
|
||||
start:
|
||||
db 1536 dup(0) ; COMpack sux
|
||||
mov [spt], sp
|
||||
print hello
|
||||
|
||||
; Get arguments: obxnam, atrnam & /p switch
|
||||
; Set onam & anam to end of filenames
|
||||
mov si, 81h
|
||||
mov bx, offset onam
|
||||
|
||||
arg1: lodsb
|
||||
cmp al, ' '
|
||||
je arg1 ; skip spaces
|
||||
cmp al, '-'
|
||||
je swit
|
||||
cmp al, '/'
|
||||
jne nswit
|
||||
; Switch
|
||||
swit: lodsb
|
||||
and al, 0dfh
|
||||
cmp al, 'P'
|
||||
jne usg
|
||||
or [flags], m_pro ; '/P'
|
||||
jmp arg1
|
||||
|
||||
nswit: cmp al, 0dh
|
||||
je argx
|
||||
; Filename
|
||||
cmp bx, offset enam
|
||||
jae usg ; two names already parsed
|
||||
mov di, [bx]
|
||||
mov ah, '"'
|
||||
cmp al, ah
|
||||
je qname ; "file name with spaces"
|
||||
mov ah, ' '
|
||||
gname: stosb ; copy name
|
||||
qname: lodsb
|
||||
cmp al, ah ; space/'"', eol and '/' terminate name
|
||||
je xname
|
||||
cmp al, 0dh
|
||||
je bname
|
||||
cmp al, '/'
|
||||
jne gname
|
||||
bname: dec si
|
||||
xname: mov [bx], di ; save end of name ptr
|
||||
inc bx
|
||||
inc bx
|
||||
mov [byte di], 0
|
||||
jmp arg1
|
||||
|
||||
; Usage
|
||||
usg: print usgtxt
|
||||
dos 4c03h
|
||||
|
||||
; End of arguments
|
||||
argx: cmp bx, offset anam
|
||||
jb usg ; no obxnam given
|
||||
|
||||
; Find where obx FILE name begins
|
||||
mov di, [onam]
|
||||
lea cx, [di+1+zero-obxnam]
|
||||
fofna1: dec di
|
||||
cmp [byte di], '\'
|
||||
je fofnax
|
||||
cmp [byte di], ':'
|
||||
loopne fofna1
|
||||
fofnax: inc di
|
||||
mov [ofna], di
|
||||
|
||||
; Is atr given?
|
||||
cmp bx, offset anam
|
||||
ja atrgvn ; atr given
|
||||
|
||||
; Only obx given
|
||||
; Move path of obx to atrnam
|
||||
mov si, offset obxnam
|
||||
mov di, offset atrnam
|
||||
mobat1: lodsb
|
||||
stosb
|
||||
cmp al, '\'
|
||||
je mobat2
|
||||
cmp al, ':'
|
||||
jne mobat3
|
||||
mobat2: mov [anam], di
|
||||
mobat3: test al, al
|
||||
jnz mobat1
|
||||
mov di, [anam]
|
||||
mov [byte di], 0
|
||||
jmp srvobx
|
||||
|
||||
; Atr given
|
||||
; Delete trailing '\' if not "\" or "C:\"
|
||||
atrgvn: mov di, [anam]
|
||||
dec di
|
||||
cmp [byte di], '\'
|
||||
jne atrg1
|
||||
mov [anam], di
|
||||
cmp di, offset atrnam
|
||||
jbe atrg1
|
||||
cmp [byte di-1], ':'
|
||||
je atrg1
|
||||
mov [byte di], 0
|
||||
atrg1:
|
||||
; Check if it is file or dir
|
||||
mov dx, offset atrnam
|
||||
xor bx, bx ; try LFN function
|
||||
stc
|
||||
dos 7143h
|
||||
jnc chkafd
|
||||
cmp ax, 7100h ; LFN not supported
|
||||
jne afile ; possibly file/dir doesn't exist -> file
|
||||
dos 43h ; call MS-DOS function 4300h
|
||||
jc afile ; failed -> file
|
||||
chkafd: test cl, 10h
|
||||
jnz adir
|
||||
; It is file
|
||||
; Add .atr extension, if none
|
||||
afile: or [flags], m_file
|
||||
mov di, [anam]
|
||||
lea cx, [di+zero-atrnam]
|
||||
mov eax, 'rta.'
|
||||
call adext
|
||||
jmp srvobx
|
||||
; It is dir
|
||||
; Add trailing '\'
|
||||
adir: mov di, [anam]
|
||||
mov [byte di], '\'
|
||||
inc [anam]
|
||||
|
||||
; Serve obx
|
||||
; Add .obx extension, if none
|
||||
srvobx: mov di, [onam]
|
||||
lea cx, [di+zero-obxnam]
|
||||
mov eax, 'xbo.'
|
||||
call adext
|
||||
|
||||
; Find first file
|
||||
mov dx, offset obxnam
|
||||
mov cx, 7 ; try LFN
|
||||
mov si, 1
|
||||
mov di, offset f32
|
||||
stc
|
||||
dos 714eh
|
||||
jnc flfn
|
||||
cmp ax, 7100h ; LFN not supported
|
||||
jne nofil
|
||||
xor cx, cx ; call MS-DOS function 4Eh
|
||||
dos 4eh
|
||||
jnc main1
|
||||
nofil: print e_nofil ; "No file found"
|
||||
dos 4c02h
|
||||
|
||||
flfn: or [flags], m_lfn ; LFN successfull
|
||||
mov [fhand], ax
|
||||
|
||||
; Main loop - convert found file
|
||||
main1: and [flags], not m_errs
|
||||
mov [ohand], 0
|
||||
mov [ahand], 0
|
||||
mov [len], lodlen+endlen
|
||||
|
||||
; Move name from finddata to obxnam
|
||||
mov si, offset (finddata16 80h).fname
|
||||
test [flags], m_lfn
|
||||
jz nolfn1
|
||||
mov si, offset f32.fname
|
||||
nolfn1: mov di, [ofna]
|
||||
mona1: lodsb
|
||||
stosb
|
||||
test al, al
|
||||
jnz mona1
|
||||
|
||||
; Print "file.obx"
|
||||
mov si, offset obxnam
|
||||
call printz
|
||||
|
||||
; Open obx for reading
|
||||
mov bp, offset e_open
|
||||
mov dx, offset obxnam ; MS-DOS
|
||||
mov ax, 3d00h
|
||||
test [flags], m_lfn
|
||||
jz nolfn2
|
||||
mov si, dx ; LFN
|
||||
xor bx, bx
|
||||
mov dx, 1
|
||||
mov ax, 716ch
|
||||
nolfn2: file
|
||||
mov [ohand], ax
|
||||
|
||||
; Check if Atari executable
|
||||
call xreadh
|
||||
jb enate
|
||||
cmp [head], -1
|
||||
jne enate
|
||||
|
||||
mov dx, offset head
|
||||
mov cx, 4
|
||||
call xread
|
||||
jnb nenate
|
||||
enate: mov dx, offset e_nota
|
||||
jmp error
|
||||
nenate:
|
||||
|
||||
; Set default run address at first block
|
||||
mov ax, [head]
|
||||
mov [l1runl], al
|
||||
mov [l2runl], al
|
||||
mov [l1runh], ah
|
||||
mov [l2runh], ah
|
||||
|
||||
; Print "->"
|
||||
print arrow
|
||||
|
||||
; Atr FILE name given?
|
||||
test [flags], m_file
|
||||
jnz sfile
|
||||
; No: move name from obx, replacing extension with ".atr"
|
||||
mov si, [ofna]
|
||||
mov di, [anam]
|
||||
mona2: lodsb
|
||||
stosb
|
||||
cmp al, '.'
|
||||
jne mona2
|
||||
mov eax, 'rta'
|
||||
stosd
|
||||
sfile:
|
||||
|
||||
; Print "file.atr"
|
||||
mov si, offset atrnam
|
||||
call printz ; file.atr
|
||||
|
||||
; Create atr file
|
||||
mov bp, offset e_creat
|
||||
mov dx, offset atrnam
|
||||
xor cx, cx
|
||||
mov ax, 3c00h
|
||||
test [flags], m_lfn
|
||||
jz nolfn3
|
||||
mov si, dx
|
||||
mov bx, 1
|
||||
mov dx, 12h ; create or truncate
|
||||
mov ax, 716ch
|
||||
nolfn3: file
|
||||
mov [ahand], ax
|
||||
|
||||
; Print "..."
|
||||
print kropki
|
||||
|
||||
; Write atr header
|
||||
mov cx, beglen
|
||||
mov dx, offset begin
|
||||
call xwrite
|
||||
; Write loader in boot sector
|
||||
mov cx, lodlen
|
||||
mov dx, offset stdlod
|
||||
test [flags], m_pro
|
||||
jz stlo
|
||||
mov dx, offset prolod
|
||||
stlo: call xwrite
|
||||
jmp firs
|
||||
|
||||
; Converting
|
||||
; Read obx header
|
||||
skff: call xreadh
|
||||
jb chtrun
|
||||
cmp [head], -1
|
||||
je skff
|
||||
mov dx, offset head+2
|
||||
call xread2
|
||||
jb trunca
|
||||
|
||||
; Read block
|
||||
firs: mov cx, [head+2]
|
||||
sub cx, [head]
|
||||
inc cx
|
||||
cmp cx, blen
|
||||
jbe okhead
|
||||
mov cx, blen
|
||||
okhead: mov dx, offset blok
|
||||
call xread
|
||||
jb trunc
|
||||
; Write
|
||||
call xwrihd
|
||||
jmp skff
|
||||
|
||||
; Check if block is truncated
|
||||
chtrun: test ax, ax
|
||||
jnz trunca
|
||||
jmp finfil
|
||||
|
||||
trunc: test ax, ax
|
||||
jz finfil
|
||||
dec ax
|
||||
push ax
|
||||
add ax, [head]
|
||||
mov [head+2], ax
|
||||
pop ax
|
||||
call xwrihd
|
||||
|
||||
trunca: mov dx, offset w_trunc
|
||||
; Warning
|
||||
warfin: call warni
|
||||
|
||||
; End of file
|
||||
; Write endsequence
|
||||
finfil: mov dx, offset endseq1
|
||||
test [flags], m_pro
|
||||
jz endst
|
||||
mov dx, offset endseq2
|
||||
endst: mov cx, endlen
|
||||
call xwrite
|
||||
mov cx, 40h
|
||||
xor ax, ax
|
||||
mov di, offset head
|
||||
rep stosw
|
||||
sta cx
|
||||
sub cl, [byte len]
|
||||
and ecx, 7fh
|
||||
jz fuls
|
||||
call xwrith
|
||||
fuls:
|
||||
|
||||
; Write number of paragraphs (para=16 bytes) to atr
|
||||
xor cx, cx ; seek back to para's atr header field
|
||||
mov dx, 2
|
||||
mov bp, offset e_write
|
||||
file 4200h
|
||||
shr [len], 4
|
||||
mov cx, 2
|
||||
mov dx, offset len
|
||||
call xwrite
|
||||
|
||||
; Close files
|
||||
shut: mov bx, [ahand]
|
||||
mov bp, offset e_write
|
||||
call xclose
|
||||
mov bx, [ohand]
|
||||
mov bp, offset e_read
|
||||
call xclose
|
||||
|
||||
test [flags], m_errs
|
||||
jnz nook
|
||||
print oktxt
|
||||
nook: print eoltxt
|
||||
|
||||
; Find next file
|
||||
test [flags], m_lfn
|
||||
jnz lfnnx
|
||||
|
||||
dos 4fh ; MS-DOS function
|
||||
jc fin
|
||||
nexfil: test [flags], m_file
|
||||
jnz singl
|
||||
jmp main1
|
||||
|
||||
lfnnx: mov bx, [fhand] ; LFN function
|
||||
mov si, 1
|
||||
mov di, offset f32
|
||||
dos 714fh
|
||||
jnc nexfil
|
||||
|
||||
dos 71a1h ; LFN search close
|
||||
|
||||
fin: mov ax, [exitcod]
|
||||
dos
|
||||
|
||||
singl: print e_singl
|
||||
dos 4c02h
|
||||
|
||||
; Add extension if none (di=end of name, cx=len, eax=ext)
|
||||
adext: mov bx, di
|
||||
adext1: dec bx
|
||||
cmp [byte bx], '.'
|
||||
je adextr
|
||||
cmp [byte bx], '\'
|
||||
loopne adext1
|
||||
stosd
|
||||
adextr: mov [byte di], 0
|
||||
ret
|
||||
|
||||
xdisk: push bp
|
||||
dos
|
||||
pop dx
|
||||
jnc rts
|
||||
error: mov sp, [spt]
|
||||
mov [byte exitcod], 2
|
||||
or [flags], m_errs
|
||||
print
|
||||
jmp shut
|
||||
|
||||
warni: cmp [byte exitcod], 1
|
||||
jae nwacod
|
||||
mov [byte exitcod], 1
|
||||
nwacod: or [flags], m_errs
|
||||
print
|
||||
ret
|
||||
|
||||
xreadh: mov dx, offset head
|
||||
xread2: mov cx, 2
|
||||
xread: mov bx, [ohand]
|
||||
mov bp, offset e_read
|
||||
file 3fh
|
||||
cmp ax, cx
|
||||
rts: ret
|
||||
|
||||
xwrihd: add ax, 4
|
||||
movzx ecx, ax
|
||||
mov ax, [head]
|
||||
mov dx, [head+2]
|
||||
test [flags], m_pro
|
||||
jnz chkpro
|
||||
cmp ah, 8
|
||||
jae chkst1
|
||||
cmp dh, 7
|
||||
jae ememc
|
||||
chkst1: cmp dh, 0c0h
|
||||
jb xwrith
|
||||
cmp dh, 0d0h
|
||||
jb eproc
|
||||
cmp ah, 0d8h
|
||||
jb xwrith
|
||||
eproc: mov dx, offset w_prof
|
||||
jmp xwwarn
|
||||
|
||||
chkpro: cmp ah, 5
|
||||
jae xwrith
|
||||
cmp dh, 4
|
||||
jb xwrith
|
||||
|
||||
ememc: mov dx, offset w_mem
|
||||
xwwarn: push ecx
|
||||
call warni
|
||||
pop ecx
|
||||
|
||||
xwrith: mov dx, offset head
|
||||
xwritl: add [len], ecx
|
||||
xwrite: mov bx, [ahand]
|
||||
mov bp, offset e_write
|
||||
jfile 40h
|
||||
|
||||
xclose: test bx, bx
|
||||
jz rts
|
||||
jfile 3eh
|
||||
|
||||
pnam1: sta dx
|
||||
dos 2
|
||||
printz: lodsb
|
||||
test al, al
|
||||
jnz pnam1
|
||||
ret
|
||||
|
||||
hello db 'X-BOOT 5.0 by Fox/Taquart',eot
|
||||
usgtxt db 'Converts Atari 8-bit executables to .ATR disk images.',eol
|
||||
db 'Syntax: XBOOT [/p] obxfiles [atrpath][atrfile]',eol
|
||||
db '/p Write professional loader rather than standard.'
|
||||
eoltxt db eot
|
||||
arrow db ' -> $'
|
||||
kropki db ' ... $'
|
||||
oktxt db 'OK$'
|
||||
w_mem db eol,' WARNING: Memory conflict$'
|
||||
w_prof db eol,' WARNING: Professional loader needed$'
|
||||
w_trunc db eol,' WARNING: File is truncated$'
|
||||
e_nofil db 'ERROR: File not found',eot
|
||||
e_singl db 'ERROR: Single target for many files',eot
|
||||
e_nota db eol,' ERROR: Not Atari executable$'
|
||||
e_open db eol,' ERROR: Can''t open file$'
|
||||
e_read db eol,' ERROR: Disk read error$'
|
||||
e_creat db eol,' ERROR: Can''t create file$'
|
||||
e_write db eol,' ERROR: Disk write error$'
|
||||
|
||||
; ATR Header
|
||||
begin dw 296h,0,80h,4 dup(0)
|
||||
db 0,1
|
||||
beglen = $-begin
|
||||
|
||||
; Loader #1 (std)
|
||||
stdlod db 0,1,128,7,119,228,160,215,185,27,7,145,88,200,192,226,144
|
||||
db 246,169
|
||||
l1runl db 168,141,224,2,169
|
||||
l1runh db 7,141,225,2,169,7,141,5,3,169,255
|
||||
db 141,1,211,173,56,96,169,7,141,227,2,72,169,168,141,226,2,72
|
||||
db 162,251,149,72,232,134,67,238,210,7,16,16,238,10,3,208,3,238
|
||||
db 11,3,32,83,228,48,217,14,210,7,173,127,7,166,67,208,223,129
|
||||
db 68,230,68,208,2,230,69,165,70,197,68,165,71,229,69,176,210,169
|
||||
db 3,141,15,210,108,226,2,44,111,97,100,105,110,103,14,14,14,0
|
||||
db 53,46,48
|
||||
lodlen = $-stdlod
|
||||
|
||||
; Ending Header for loader #1
|
||||
endseq1 db 240,7,240,7,224
|
||||
endlen = $-endseq1
|
||||
|
||||
; Loader #2 (rom)
|
||||
prolod db 0,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 162,141,224,2,169
|
||||
l2runh db 4,141,225,2,173,56,96
|
||||
db 169,4,141,227,2,72,169,162,141,226,2,72,162,251,149,72,232,134
|
||||
db 67,238,220,4,16,32,238,10,3,208,3,238,11,3,169,255,141,1
|
||||
db 211,78,14,212,88,32,83,228,48,208,120,238,14,212,206,1,211,14
|
||||
db 220,4,173,127,4,166,67,208,207,129,68,230,68,208,2,230,69,165
|
||||
db 70,197,68,165,71,229,69,176,194,169,3,141,15,210,108,226,2,53
|
||||
db 46,48,112
|
||||
|
||||
; Ending Header for loader #2
|
||||
endseq2 db 250,4,250,4,224
|
||||
|
||||
exitcod dw 4c00h
|
||||
flags db 0
|
||||
len dd lodlen+endlen
|
||||
onam dw obxnam
|
||||
anam dw atrnam
|
||||
enam:
|
||||
fhand dw ?
|
||||
ohand dw ?
|
||||
ahand dw ?
|
||||
ofna dw ?
|
||||
spt dw ?
|
||||
|
||||
obxnam db 100h dup(?)
|
||||
atrnam db 100h dup(?)
|
||||
|
||||
f32 finddata32 ?
|
||||
|
||||
head dw ?,?
|
||||
blok db blen dup(?)
|
||||
|
||||
ENDS
|
||||
END start
|
152
xhead.asm
152
xhead.asm
|
@ -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
|
452
xload.asm
452
xload.asm
|
@ -1,452 +0,0 @@
|
|||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
zero db 100h dup(?)
|
||||
|
||||
ratio equ 671/1000
|
||||
timeAnswer = 2500*ratio
|
||||
timeChecksum = 1500*ratio
|
||||
timeSending = 600*ratio
|
||||
timeNormal = 900*ratio
|
||||
timeBefore = 1500*ratio
|
||||
timeBetween = 600*ratio
|
||||
timeUltra = 310*ratio
|
||||
|
||||
eol equ 13,10
|
||||
eot equ 13,10,'$'
|
||||
|
||||
MACRO lda _rg ;shorter than 'mov (e)ax, _rg'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg eax, _rg
|
||||
ELSE
|
||||
xchg ax, _rg
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO sta _rg ;shorter than 'mov _rg, (e)ax'
|
||||
_rge SUBSTR <_rg>, 1, 1
|
||||
IFIDNI _rge, <e>
|
||||
xchg _rg, eax
|
||||
ELSE
|
||||
xchg _rg, ax
|
||||
ENDIF
|
||||
ENDM
|
||||
|
||||
MACRO dos _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
int 21h
|
||||
ENDM
|
||||
|
||||
MACRO file _func
|
||||
IFNB <_func>
|
||||
IF _func and 0ff00h
|
||||
mov ax, _func
|
||||
ELSE
|
||||
mov ah, _func
|
||||
ENDIF
|
||||
ENDIF
|
||||
call xdisk
|
||||
ENDM
|
||||
|
||||
MACRO fread _fbufr
|
||||
mov dx, offset _fbufr
|
||||
call xread
|
||||
ENDM
|
||||
|
||||
MACRO print _text
|
||||
IFNB <_text>
|
||||
mov dx, offset _text
|
||||
ENDIF
|
||||
dos 9
|
||||
ENDM
|
||||
|
||||
|
||||
start:
|
||||
db 1536 dup(0) ;compack
|
||||
print hello
|
||||
|
||||
mov si, 81h
|
||||
mov di, offset obxnam
|
||||
|
||||
arg1: lodsb
|
||||
cmp al, ' '
|
||||
je arg1
|
||||
cmp al, '/'
|
||||
jne nswit
|
||||
lodsb
|
||||
cmp al, '4'
|
||||
ja ndigt
|
||||
sub al, '1'
|
||||
jb usg
|
||||
mov [byte port], al
|
||||
jmp arg1
|
||||
ndigt: and al, 0dfh
|
||||
cmp al, 'P'
|
||||
jne usg
|
||||
mov [prof], al
|
||||
jmp arg1
|
||||
nswit: cmp al, 0dh
|
||||
je argx
|
||||
cmp di, offset obxnam
|
||||
ja usg
|
||||
mnam1: stosb
|
||||
lodsb
|
||||
cmp al, ' '
|
||||
je mnam2
|
||||
cmp al, '/'
|
||||
je mnam2
|
||||
cmp al, 0dh
|
||||
jne mnam1
|
||||
mnam2: dec si
|
||||
mov bx, di
|
||||
lea cx, [di+zero-obxnam]
|
||||
adex1: dec bx
|
||||
cmp [byte bx], '.'
|
||||
je adexn
|
||||
cmp [byte bx], '\'
|
||||
loopne adex1
|
||||
mov eax, 'XBO.'
|
||||
stosd
|
||||
adexn: mov [byte di], 0
|
||||
jmp arg1
|
||||
|
||||
usg: print usgtxt
|
||||
dos 4c03h
|
||||
|
||||
noport: mov dx, offset nocom
|
||||
jmp panic
|
||||
nobin: mov dx, offset e_nota
|
||||
jmp panic
|
||||
|
||||
xdisk: push bp
|
||||
dos
|
||||
pop dx
|
||||
jnc xdret
|
||||
panic: print
|
||||
dos 4c02h
|
||||
|
||||
xread: mov bp, offset e_read
|
||||
file 3fh
|
||||
cmp ax, cx
|
||||
xdret: ret
|
||||
|
||||
argx: cmp di, offset obxnam
|
||||
jbe usg
|
||||
mov bx, [port]
|
||||
add [comnum1], bl
|
||||
add [comnum2], bl
|
||||
add bx, bx
|
||||
push ds
|
||||
push 40h
|
||||
pop ds
|
||||
mov cx, [bx]
|
||||
pop ds
|
||||
jcxz noport
|
||||
mov [port], cx
|
||||
|
||||
mov dx, offset obxnam
|
||||
mov bp, offset e_open
|
||||
file 3d00h ; open for reading
|
||||
sta bx
|
||||
mov cx, 2
|
||||
fread dcb
|
||||
cmp [word dcb], 0ffffh
|
||||
jne nobin
|
||||
|
||||
mov dx, [port]
|
||||
mov al, 3
|
||||
add dl, al
|
||||
out dx, al
|
||||
and dl, 0feh
|
||||
xor al, al
|
||||
out dx, al
|
||||
|
||||
print rboot
|
||||
|
||||
mov dx, [port]
|
||||
mov cx, 6
|
||||
call speed
|
||||
and dl, 0f8h
|
||||
mov al, 5
|
||||
out dx, al
|
||||
in al, dx
|
||||
|
||||
mov di, offset dcb
|
||||
|
||||
main: mov dx, [port]
|
||||
in al, 60h
|
||||
cmp al, 1 ; ESC key
|
||||
je byebye
|
||||
|
||||
add dl, 5
|
||||
in al, dx
|
||||
test al, 1
|
||||
jz main
|
||||
|
||||
and dl, 0f8h
|
||||
in al, dx
|
||||
mov [di+5], al
|
||||
stosb
|
||||
cmp di, offset dcb+5
|
||||
jb sk1
|
||||
mov di, offset dcb
|
||||
sk1: cmp [byte di], 31h
|
||||
jne main
|
||||
|
||||
cmp [byte di+1], 'R'
|
||||
je xcom_r
|
||||
cmp [byte di+1], 'S'
|
||||
jne main
|
||||
|
||||
xcom_s: call ack
|
||||
mov si, offset statdat
|
||||
mov cx, 5
|
||||
call send
|
||||
print booting
|
||||
jmp main
|
||||
|
||||
xcom_r: cmp [word di+2], 1
|
||||
jne main
|
||||
call ack
|
||||
mov si, offset bootstd
|
||||
test [prof], 0ffh
|
||||
jz sk3
|
||||
mov si, offset bootpro
|
||||
sk3: mov cx, 129
|
||||
call send
|
||||
call wate
|
||||
|
||||
mov cx, 2
|
||||
call speed
|
||||
mov [trtime], timeUltra
|
||||
|
||||
test [prof], 0ffh
|
||||
jz nodrom
|
||||
call wtblok
|
||||
mov si, offset bankdat
|
||||
mov cx, 4
|
||||
call send
|
||||
nodrom:
|
||||
|
||||
call wtblok
|
||||
|
||||
ffff: mov cx, 2
|
||||
fread head
|
||||
jb kpliq
|
||||
cmp [head], 0ffffh
|
||||
je ffff
|
||||
mov cx, 2
|
||||
fread head+2
|
||||
jb kpliq
|
||||
shr [sdefrun], 1
|
||||
jnc nodefr
|
||||
mov si, offset defrun
|
||||
mov cx, 5
|
||||
call send
|
||||
call wtblok
|
||||
nodefr: mov di, offset hexnum
|
||||
mov ax, [head]
|
||||
call hexw
|
||||
inc di
|
||||
mov ax, [head+2]
|
||||
call hexw
|
||||
print loading
|
||||
mov ax, [head]
|
||||
dec ax
|
||||
sub [head+2], ax
|
||||
|
||||
dalej: mov ax, [head+2]
|
||||
cmp ax, 100h
|
||||
jbe sk2
|
||||
mov ax, 100h
|
||||
sk2: sub [head+2], ax
|
||||
sta cx
|
||||
fread buf+3
|
||||
mov cx, ax
|
||||
jcxz kpliq
|
||||
mov si, offset buf
|
||||
add ax, [head]
|
||||
dec ah
|
||||
xchg al, ah
|
||||
mov [si], ax
|
||||
mov al, cl
|
||||
neg al
|
||||
mov [si+2], al
|
||||
add cx, 3
|
||||
call send
|
||||
|
||||
inc [byte high head]
|
||||
call wtblok
|
||||
cmp [head+2], 0
|
||||
jnz dalej
|
||||
jmp ffff
|
||||
|
||||
kpliq:
|
||||
mov si, offset runstd
|
||||
test [prof], 0ffh
|
||||
jz sk4
|
||||
mov si, offset runpro
|
||||
sk4: mov cx, 4
|
||||
call send
|
||||
|
||||
mov bp, offset e_read
|
||||
file 3eh ; close file
|
||||
print done
|
||||
byebye: dos 4c00h
|
||||
|
||||
wtblok: in al, 60h
|
||||
cmp al, 1
|
||||
je byebye
|
||||
and dl, 0f8h
|
||||
add dl, 5
|
||||
in al, dx
|
||||
test al, 1
|
||||
jz wtblok
|
||||
and dl, 0f8h
|
||||
in al, dx
|
||||
mov si, offset bttime
|
||||
jmp wate
|
||||
|
||||
speed: and dl, 0f8h
|
||||
add dl, 3
|
||||
in al, dx
|
||||
push ax
|
||||
or al, 80h
|
||||
out dx, al
|
||||
and dl, 0f8h
|
||||
mov ax, cx
|
||||
out dx, ax
|
||||
add dl, 3
|
||||
pop ax
|
||||
out dx, al
|
||||
ret
|
||||
|
||||
send: push si
|
||||
mov si, offset trtime
|
||||
call wate
|
||||
pop si
|
||||
mov dx, [port]
|
||||
outsb
|
||||
loop send
|
||||
ret
|
||||
|
||||
ack: mov si, offset ackdat
|
||||
call wate
|
||||
outsb
|
||||
call wate
|
||||
outsb
|
||||
wate: in al, 61h
|
||||
and al, 0fch
|
||||
out 61h, al
|
||||
mov ah, al
|
||||
mov al, 0b0h
|
||||
out 43h, al
|
||||
lodsb
|
||||
out 42h, al
|
||||
lodsb
|
||||
out 42h, al
|
||||
mov al, 1
|
||||
or al, ah
|
||||
out 61h, al
|
||||
mov al, 080h
|
||||
out 43h, al
|
||||
wate1: in al, 42h
|
||||
in al, 42h
|
||||
cmp al, 255
|
||||
je wate1
|
||||
wate2: in al, 42h
|
||||
in al, 42h
|
||||
cmp al, 255
|
||||
jne wate2
|
||||
mov al, ah
|
||||
out 61h, al
|
||||
ret
|
||||
|
||||
hexw: push ax
|
||||
mov al, ah
|
||||
call hexb
|
||||
pop ax
|
||||
hexb: aam 10h
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
xchg al, ah
|
||||
cmp al, 10
|
||||
sbb al, 69h
|
||||
das
|
||||
stosw
|
||||
ret
|
||||
|
||||
ackdat: dw timeAnswer
|
||||
db 'A'
|
||||
dw timeChecksum
|
||||
db 'A'
|
||||
dw timeSending
|
||||
|
||||
statdat db 098h,0FFh,001h,000h,099h
|
||||
|
||||
bankdat db 0D2h,002h,0FFh,0FEh
|
||||
runstd db 006h,060h,0FFh,0E0h
|
||||
runpro db 003h,05Fh,0FFh,0E0h
|
||||
|
||||
bootstd:
|
||||
db 000h,001h,000h,007h,007h,007h,0A9h,060h,078h,0EEh,00Eh,0D4h,0A9h,008h,08Dh,004h
|
||||
db 0D2h,0A9h,000h,08Dh,006h,0D2h,0A9h,028h,08Dh,008h,0D2h,08Dh,009h,0D2h,0A9h,023h
|
||||
db 08Dh,00Fh,0D2h,08Dh,00Dh,0D2h,08Dh,00Ah,0D4h,00Ah,090h,0FAh,0A9h,013h,08Dh,00Fh
|
||||
db 0D2h,0A0h,002h,020h,061h,007h,099h,04Ah,007h,0B9h,003h,007h,099h,0E1h,002h,048h
|
||||
db 088h,0D0h,0F0h,020h,061h,007h,0AAh,020h,061h,007h,09Dh,000h,000h,0E8h,0D0h,0F7h
|
||||
db 0A5h,010h,08Dh,00Eh,0D2h,0A9h,003h,08Dh,00Fh,0D2h,04Eh,00Eh,0D4h,058h,06Ch,0E2h
|
||||
db 002h,0A9h,020h,08Dh,00Eh,0D2h,02Ch,00Eh,0D2h,0D0h,0FBh,08Ch,00Eh,0D2h,0ADh,00Dh
|
||||
db 0D2h,060h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
|
||||
db 089h
|
||||
dw timeBefore
|
||||
|
||||
bootpro:
|
||||
db 000h,001h,000h,004h,007h,004h,0A9h,060h,078h,0EEh,00Eh,0D4h,0EEh,000h,0D4h,0A9h
|
||||
db 008h,08Dh,004h,0D2h,0A9h,000h,08Dh,006h,0D2h,0A9h,028h,08Dh,008h,0D2h,08Dh,009h
|
||||
db 0D2h,0A9h,023h,08Dh,00Fh,0D2h,08Dh,00Dh,0D2h,08Dh,00Ah,0D4h,00Ah,090h,0FAh,0A9h
|
||||
db 013h,08Dh,00Fh,0D2h,0A0h,002h,020h,060h,004h,099h,04Dh,004h,0B9h,003h,004h,099h
|
||||
db 0E1h,002h,048h,088h,0D0h,0F0h,020h,060h,004h,0AAh,020h,060h,004h,09Dh,000h,000h
|
||||
db 0E8h,0D0h,0F7h,0A5h,010h,08Dh,00Eh,0D2h,0A9h,003h,08Dh,00Fh,0D2h,06Ch,0E2h,002h
|
||||
db 0A9h,020h,08Dh,00Eh,0D2h,02Ch,00Eh,0D2h,0D0h,0FBh,08Ch,00Eh,0D2h,0ADh,00Dh,0D2h
|
||||
db 060h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h,000h
|
||||
db 0AEh
|
||||
dw timeBefore
|
||||
|
||||
hello db 'X-LOAD 1.1 by Fox/Taquart',eot
|
||||
usgtxt db 'Syntax: XLOAD obxfile [options]',eol
|
||||
db '/1 - /4 Specify COM port (default COM2)',eol
|
||||
db '/p Professional loader',eot
|
||||
nocom db 'COM'
|
||||
comnum1 db '1 not found!',eot
|
||||
rboot db 'Ready for booting Atari at COM'
|
||||
comnum2 db '1...',eot
|
||||
booting db 'Booting...',eot
|
||||
loading db 'Loading '
|
||||
hexnum db ' - ',eot
|
||||
done db 'Done.',eot
|
||||
e_nota db 'ERROR: Not Atari executable',eot
|
||||
e_open db 'ERROR: Can''t open file',eot
|
||||
e_read db 'ERROR: Disk read error',eot
|
||||
|
||||
prof db 0
|
||||
sdefrun db 1 ; send default run address
|
||||
port dw 1
|
||||
trtime dw timeNormal
|
||||
bttime dw timeBetween
|
||||
dcb db 5 dup(0),5 dup(?)
|
||||
defrun db 1,0e2h,0feh ; head is next !!!
|
||||
head dw ?,?
|
||||
buf db 103h dup(?)
|
||||
obxnam:
|
||||
|
||||
ENDS
|
||||
END start
|
92
xloadcnv.asm
92
xloadcnv.asm
|
@ -1,92 +0,0 @@
|
|||
IDEAL
|
||||
P386
|
||||
MODEL TINY
|
||||
CODESEG
|
||||
ORG 100h
|
||||
include 'fox.mak'
|
||||
|
||||
start: mov [csum], 0
|
||||
fopen inpfile
|
||||
mov [ihand], bx
|
||||
fcreate outfile
|
||||
mov [ohand], bx
|
||||
|
||||
mov cx, 8
|
||||
main: push cx
|
||||
mov bx, [ihand]
|
||||
mov cx, 16
|
||||
fread buf
|
||||
|
||||
mov si, offset buf
|
||||
mov di, offset data
|
||||
mov cx, 16
|
||||
jmp c0
|
||||
c1: mov al, ','
|
||||
stosb
|
||||
c0: mov al, '0'
|
||||
stosb
|
||||
mov al, [si]
|
||||
add [csum], al
|
||||
adc [csum], 0
|
||||
shr al, 4
|
||||
d2a
|
||||
stosb
|
||||
lodsb
|
||||
and al, 0fh
|
||||
d2a
|
||||
stosb
|
||||
mov al, 'h'
|
||||
stosb
|
||||
loop c1
|
||||
mov ax, 0a0dh
|
||||
stosw
|
||||
|
||||
mov bx, [ohand]
|
||||
mov cx, 85
|
||||
fwrite line
|
||||
|
||||
pop cx
|
||||
loop main
|
||||
|
||||
mov bx, [ihand]
|
||||
fclose
|
||||
mov bx, [ohand]
|
||||
mov di, offset data+1
|
||||
mov al, [csum]
|
||||
shr al, 4
|
||||
d2a
|
||||
stosb
|
||||
mov al, [csum]
|
||||
and al, 0fh
|
||||
d2a
|
||||
stosb
|
||||
mov al, 'h'
|
||||
stosb
|
||||
mov ax, 0a0dh
|
||||
stosw
|
||||
mov cx, 10
|
||||
fwrite line
|
||||
fclose
|
||||
|
||||
mov eax, '.orp'
|
||||
cmp eax, [dword typ1]
|
||||
je wroc
|
||||
mov [dword typ1], eax
|
||||
mov [dword typ2], eax
|
||||
jmp start
|
||||
wroc: ret
|
||||
|
||||
inpfile db '\atari\xasm\xload'
|
||||
typ1 db 'std.obx',0
|
||||
outfile db 'xload'
|
||||
typ2 db 'std.db',0
|
||||
|
||||
line db ' db '
|
||||
data db 81 dup(?)
|
||||
ihand dw ?
|
||||
ohand dw ?
|
||||
buf db 16 dup(?)
|
||||
csum db ?
|
||||
|
||||
ENDS
|
||||
END start
|
Loading…
Reference in New Issue