X-Assembler 2.0 release.

This commit is contained in:
Piotr Fusik 1998-11-22 21:15:00 +01:00
parent cb7461376d
commit 96d3dba2a7
13 changed files with 704 additions and 184 deletions

BIN
atari.pal Normal file

Binary file not shown.

26
changes.txt Normal file
View File

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

102
cpubugs.asx Normal file
View File

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

61
dlist.txt Normal file
View File

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

7
file_id.diz Normal file
View File

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

107
hardware.asx Normal file
View File

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

99
quickref.txt Normal file
View File

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

View File

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

366
xasm.txt
View File

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

View File

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

View File

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

View File

@ -1,6 +1,7 @@
* Boot executable file loader coded by Fox/Taquart
* Standard loader - ROM and interrupts enabled.
opt h-
org $780
bufr equ $700
@ -15,30 +16,19 @@ rts rts
* Print text
txtpos equ 215
ldy #txtpos
print lda text-txtpos,y
sta ($58),y
iny
print mva text-txtpos,y ($58),y+
cpy #txtpos+txtlen
bcc print
* Init run vector
lda <rts
sta $2e0
lda >rts
sta $2e1
lda >bufr
sta $305
ldy #$ff
sty ^31
mwa #rts $2e0
mva >bufr $305
mvy #$ff ^31
dey #$fe
* Load header
lhead lda <rts
sta $2e2
lda >rts
sta $2e3
lhead mwa #rts $2e2
ldx <-5
* Store byte of header
hput sta vc+4,x
inx
hput sta vc+4,x+
stx tp
jmp get
next inw vc
@ -72,6 +62,7 @@ text dta d'Loading... '
txtlen equ *-text
* This will be added at the end of loaded file
opt h+
org endseq
jmp ($2e0)

View File

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