home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
_
/
6502xass
/
!6502-XAss
/
Docs
/
!Instruct
next >
Wrap
Text File
|
1995-12-24
|
11KB
|
382 lines
6502/6510 Cross Assembler System
Version 0.72ß (24 Dec 1995)
©1995 Skoe of Expression
The 6502/6510 Cross Assembler System (XAss) was made for comfortable
programming of these 8 bit processors. The object code can be found in
the file "scrap.object" or transfered directly to the 8 bit computer.
XAss has a lot of functions developed for the Commodore 64.
This file will not explain programming assembler, only the use of XAss.
I offer you to read this text carefully to avoid problems!
STARTING XASS
~~~~~~~~~~~~~
Double click the 6502-XAss icon or drag it onto the iconbar.
TRANSFER
~~~~~~~~
You will need a cable (not too long) from Archimedes/RiscPC parallel
printer port to a parallel port of the 6502/6510 computer, e.g. the C64
user port (see the file "C64-Cable"). The format of transfered datas is
explained in chapter "SCRAP/Object".
The destination machine will need a small program for receiving. For C64
you can find the files "Transfer" and "Trans-Run" in the Sources directory.
I suppose that you are a coder so I do not explain the usage. You must
type it into a C-64 assembler or assemble it using XAss and transfer it
in hex dump.
If you use another computer, I'll explain the link:
You have 8 data wires (0V = low, 5V = high), one for ground (0V) and the
"^ACK" wire. To order the next byte the destination computer must pull
this one down to 0V, normally it's 5V. The parallel link uses only one way
handshaking, so the destination computer must read slower than the Arc can
send. If the Arc is slower it will happen that the destination reads one
byte two times, e.g. if you write the receiving routine in assembler
without waiting loops.
SYMBOLS
~~~~~~~
Symbols can contain all letters, numbers and the '_'. They must not start
with a number. Symbol names can be very long, the assembler uses only the
first 39 characters. Symbols are case sensitiv, i.e. "my_label_1" and
"My_Label_1" are not the same!
You can use intern and extern symbols. Intern symbols are labels inside your
program. You define one in a seperate line beginning with a dot:
sei ; set IRQ flag
.my_nice_label ; here is my label
nop ; do nothing
dex ; decrement X reg
bne my_nice_label ; if not zero branch to my label
Extern symbols can contain any number from 0 to $FFFF. You can define one in
a seperate line beginning with a '!':
!letter_A = 65 ; 65 is a capital 'A'
!screen = $0400 ; this is the address of screen mem
lda #65 ; load akku with #65
sta screen ; store it into $0400
To generate a program you must define a base address. To do this, simply
define the extern symbol "base" (not "Base" or "BASE"!) at the top of your
source code:
; -----------------------------------
; This is a complete program for C-64
; It prints 256 letters onto screen
!base = $c000 ; start this program with "SYS 49152"
!screen = $0400
!letter = 65
sei
lda #letter
ldx #0
.loop
sta screen,x
dex
bne loop
rts
; -----------------------------------
As you can see you can use symbols like normal numbers or addresses.
TERMS
~~~~~
Every parameter can contain simple calculations, i.e.
;-----------------------------------
!base = $C000
!label_2 = 3
jmp base + label_2 - 3 ; jumps to $C000+3-3 = $C000
;-----------------------------------
;-----------------------------------
!one = 1
!two = 2
lda #3 * (one + two) ; loads akku with #9
;-----------------------------------
You can use decimal and hexadecimal numbers. Hex can begin with '&' (like on
Acorn computers) or with '$' (like on C64).
If an term starts with '<' or '>' you'll get the low or high byte of an
expression:
!base = $C000
lda #<base ;load akku with #$00
lda #>base ;load akku with #$C0
Note: The parser has a bug recognizing brackets. E.g. you want to get "lda 20"
and write "lda (2+3)*4". The assembler answers with a "missing ')'
error". Use "lda 4*(2+3)" instead!
ADRESS MODES
~~~~~~~~~~~~
Explained in a very short form:
(By the way: you can use "LDA $0ca0", "lda $0Ca0" or "Lda $0CA0"...
not case sensitive)
examples length
-------- ------
asl
nop ;1 byte (akku or single command)
ldx #symbol+1
lda #3 ;2 bytes (direct)
lda z,100 ;2 bytes (zeropage) \
\ if you forget "z,"
lda z,$a1,x ;2 bytes (zeropage,x) \ the assembler will
/ use "absolute[,x|,y]"
ldx z,5,y ;2 bytes (zeropage,y) /
ldy $400 ;3 bytes (absolute)
lda $0400,x ;3 bytes (absolute,x)
ldx $04C0,y ;3 bytes (absolute,y)
bcc label ;2 bytes (relative)
adc ($10,x) ;2 bytes (indirect,x)
; it's the same as "adc z,($10,x)"
adc (1),y ;2 bytes (indirect,y)
; or "adc z,(1),y"
jmp ($200) ;3 bytes (absolute indirect)
Note: a command like "lda 1" will assembled as absolute command (3 bytes),
if you want a zeropage command (2 bytes) you MUST use "lda z,1" !
So you or the assembler will have no problems with these address modes
in future (knowing the used address mode is important e.g. for self
changing code or difficult timing e.g. "bit z,0").
The XAss is the only assembler I know that uses this "z," method.
ASSEMBLER COMMANDS
~~~~~~~~~~~~~~~~~~
/align
is sometimes a very useful command. It fills the object file with NOPs until
the program counter is $xx00. The meaning is, that branches (B?? mnemonics)
are one cycle faster if they do not overjump a memory page. It could be very
important for routines with difficult timing.
example:
;---------------------
!base = $5aff
dex
bne base
;---------------------
is slower than
;---------------------
!base = $5aff
/align
.loop
dex
bne loop
;---------------------
/by
puts some bytes into memory, e.g.:
/by 0,3+3,<label
/tx "Some text"
puts a ASCII text into memory. The table for translating Acorn to C-64 ASCII
you can find in the file "<6502-XAss$Dir>.c.TextTable", it's a part of the
source code of XAss, you mustn't change it!
Some specials:
Arc CHR$
° 0 e.g. for string ends
ä 27 [
ö 28 £
ü 29 ]
ß 30 ^
Ä 91
Ö 92
Ü 93
_ 13 enter
~ clr/home
“ "
/sc "Text"
puts the screen codes into memory (C-64 POKE codes). Useful for scrollers...
Note: if you use set 1 at C64, small letters on Arc will be capital letters
on C64, capital letters on Arc will be graphic characters on C64.
PRECOMPILER
~~~~~~~~~~~
Precompiler commands start allways with an '#' as first (!) char at a line.
#include
Big sources can be splitted into several text files. At the line containing
this command the precompiler includes this file. At the moment included
files mustn't contain "#include".
An example:
File "IDEFS::4.$.Main