Vous êtes sur la page 1sur 81

Mad-Assembler 1.8.

Thebe / Madteam (02/21/2009)

-------------------------------------------------- -----------------------------
Differences and similarities between XASM and MADS
The differences and opportunities

Switch assembly
Exit codes
File structure. LST
File structure. LAB
File structure. H

Sparta DOS X
Construction of Sparta DOS X-Files, Atari DOS
Programming Sparta DOS X




Block relokowalny
External Symbols
Public Symbols
Declaration of a structured type
Defining the structural data
Enumerated type declaration
Defining the enumeration data

Combining multiple rows into one row
Combining multiple mnemonics
Local style MAE
Control assemble
Change options assemble
Conditional assembling
Interrupt assemble
Assembling at zero
Macro commands
Pseudo orders
Defining block SDX
Defining the symbol SDX
Defining data
Defining replicates (. REPT)
Defining the symbol SDX (. SYMBOL)
Directive generating code 6502
Define iterations (# WHILE)
Define the decision (# IF)
Array declaration
Declaration Macros
Calling macros
The declaration procedure
Procedure call
Parameters of the procedure
Local Area
Declaration of local area

-------------------------------------------------- -----------------------------
Mad-Assembler (MADS) is a 32 bit application, written in Delphi. Most assemblers
written in C, so in order not to repeat I have used Delphi and 7.0).
The assumption of MADS is addressed to users QA XASM, FA. QA has been borrowed f
rom the syntax of XASM some macro commands and syntax changes in FA handling syn
tax Sparta DOS X (SDX). Has made possible the use of additional characters in th
e names of labels. In addition, support has been added CPU 65816, macros, proced
ures, allocation of virtual memory banks, multi-dimensional label names.
The maximum number of labels, and macros is limited amount of memory on a PC. Sp
ecifically, you can make a 2147483647 (INTEGER) array of dynamic entries. I am s
ure that this amount is sufficient:)
Arithmetic operations are performed on the values of type INT64 (signed 64 bit),
the result is represented on the values of type CARDINAL (unsigned 32 bit).
One line can be up to 65535 bytes, this length may be also the name of the label
. But I had no opportunity to check the labels and such long lines:)
With the free compiler Free Pascal Compiler is possible to compile the MADS-and
for other platforms such as Linux, Mac, OS / 2, etc. For more information on com
piling in Chapter Compilation.
If your system is the correct version of Free Pascal, meaning that you can use t
he MADS-a.
Home XASM-a: http://atariarea.krap.pl/x-asm/

To compile the source of the MADS-a, you can use a compiler with Delphi, if some
one has just installed Delphi 7.0 or later.
Alternatively, the platform is more multi-use package, the compiler of the Free
Pascal Compiler (FPC), which can be downloaded from http://www.freepascal.org/
Run the installer, select the directory where you installed FP. It is important
not to use a directory name exclamation mark "!" or other non-standard character
s. If we are unable to compile any file should probably is not the standard path
name. The command line that launches the compilation could look like this (case
is in the names of the parameters is important):
fpc-Mdelphi-v mads.pas
-Mdelphi allows you to compile the file in Delphi
-V displays all error messages and warnings
-O3 optimizes code
Compared with the Delphi compiler, the code generated by the FPC is longer, but
the speed of the MADS-compiled a much larger, even for a few seconds. MADS.EXE a
ttached file is compiled using FPC.


the same syntax
the same exit codes
the same macro commands

The differences and opportunities

little difference in the ORG, eg 'ORG [[expression]] address [, Address2]'
XASM does not like "white space", MADS tolerate them and accept the terms of log
ical, arithmetic, fixed and variable definitions
MADS allows you to embed expressions between the parentheses (), [], XASM only b
etween []
MADS provides definitions of fixed and variable local, global, temporary, XASM o
nly global
MADS does not accept the ORG: ORG address and f: address
MADS provides a record of real numbers by the directive. FL. FL real, through th
e pseudo-command XASM DTA DTA R R (real)
MADS offers a more extensive support for pseudo-ordered INS
MADS does not accept the type of 'lda (203), 0'
MADS allows you to write programs for the Sparta DOS X
MADS allows you to generate code relokowalnego in your own format
if we use when addressing character value, eg
lda # ''
lda # ""

MADS is distinguished single apostrophe (ATASCII code) and a double apostrophe (

code INTERNAL) XASM both types equally treats apostrophes (code ATASCII). Of cou
rse, for the DTA apostrophes are not distinguished by MADS.
index in either a '+' or '-' increase or decrease a register, eg
lda $ 2000, x + -> lda $ 2000, x
but if you put the value of the sign '+' or '-' then change the value of the mai
n argument (it works only in the absolute index), for example:
lda $ 2000, x 2 -> lda $ 2002, x

Switch assembly
Syntax: mads source [switches]
-B: address Generate binary file at specific address
C Label case sensitivity
-D: label = value Define a label
CPU-f command at first column
-Hc [: filename] Header file for CC65
-Hm [: filename] Header file for MADS
-I: Additional include directories path
-L [: filename] Generate listing
-M: filename File with macro definition
-O: Set object filename file name
-P Print a fully qualified file names in a listing
-S Silent mode
-T [: filename] List the label table
-X Exclude unreferenced Procedures
The default file names are:
If you do not specify an extension for the file source, then the default MADS ac
cept the extension. ASM.
Parameters can be administered in any order previously by adding a '/' or '-' ca
se does not matter. Parameters can be combined with each other, except for those
parameters that require a new file name (separated by a colon:), it must be pla
ced at the end of a string such as:
mads-lptd: label = value-d: Label2 = value source.asm
mads-l-p-t source
mads source.asm-lpt
mads.exe% 1-ltpi: "d: \! atari \ macro \"
mads-i: "c: \ atari \ macros \" / c source.asm-lpt

/ B: address
Using the / b allows you to give your new address to assemble the file in which
no address specified assemble (assemble define the address using a pseudo comman
d ORG).

/ C
Use the / c switch causes a case-sensitive names labels, variables, constants. A
ssembler directive and orders the CPU 6502, 65816 will always be identified with
out regard to case.

/ D: label = value
Use the / d switch allows you to enter a new label to the memory of the MADS-a c
ommand line. Switch can be used repeatedly during a single call to the MADS-a, c
an be useful when assembles using batch files (BAT).

/ F
Using the / f command allows you to put the CPU in the first column of a row and
their proper recognition by the assembler as commands and not just as a label.

/ Hc [: filename]
Switch / hc includes saving a file with headers for the compiler CC65. Also lets
you specify a new name for the file. The default name for the header file is *.

/ Hm [: filename]
Switch / hm includes saving a file with headers for the MADS-a. Also lets you sp
ecify a new name for the file. The default file name for the MADS-header and it
*. HEA. Such a file contains information about the bank assigned the labels and
their values. In addition, the labels are sorted by type CONSTANS, VARIABLES, PR

/ I: path
/ I is used to determine search paths for ICL and INS operations. Switch can be
used repeatedly during a single call to the MADS-a, for example:
/ I: "c: \ program files" / i: c: \ temp / i: "d: \ atari project"

/ L: filename
The / l includes recording the listing file. Also lets you specify a new name fo
r the file.

/ M: filename
The / m switch to specify a file with the declarations of macros. In the case of
the use of MADS assembles the file before the main file. ASM

/ O: filename
/ O switch to specify a new name for the executable file for DOS and Atari Atari
Sparta DOS X, which arises after the process of assembling.

/ P
The / p switch is useful in conjunction with the Code Genie. When an error occur
s during assembling, in the Output window editor Bar Code Genie prompted MADS ge
nerated by, for example:
D: \! Delphi \ MASM \ test.asm (29) ERROR: Missing. PROC
Now, just double-click the message line and the cursor moves to the editor in li
ne with an error.

/ S
Using the / s switch will activate the so-called. mode 'Silent mode', ie no mess
ages are not displayed, at most, the error messages (ERROR) and warning (WARNING

/ T [: filename]
If / t include saving a file with used definitions of labels. Also lets you spec
ify a new name for the file.

/ X
/ X switch allows you to skip the process of assembling procedures declared Dire
ctive. PROC for which there was no reference in the program.

Exit codes
3 = bad parameters, not started assembling
2 = error occurred
0 = no errors
Warning messages do not change the value of the output code.

LST file structure

Listing format is no different from that known to XASM, the only change is the a
ddition of the address, the number of virtual memory bank (provided that the ban
k number <> 0). More about virtual banks in the memory banks section.
4 = 01.9033 painting equ $ 9033
5 = 01.00 scr1 A0 equ $ a0
8 01.2000 EA main nop

File Structure Lab

As in the case XASM, in the *. LAB stores information about the labels that have
occurred in the program.
In total, there are three columns:
The first column is a virtual bank number assigned to the label (if the bank <>
The second column is the value of the label.
The third column is the name of the label.
The numbers assigned to the virtual banks labels with values> = $ FFF9 have spec
ial meanings:
$ FFF9 label parameter in the procedure defined by the Directive. PROC
$ FFFA label array defined by the Directive. ARRAY
$ FFFB label structural data as defined by the pseudo-command DTA STRUCT_LABEL
$ FFFC label symbol Sparta DOS X - SMB
$ FFFD label macros defined by the Directive. MACRO
$ FFFE label structure defined by the Directive. STRUCT
$ FFFF label procedure defined by the Directive. PROC
Special meaning in the names of the labels are characters:

label defined in a macro (two colons):

dot "." separates the name of the structure (. MACRO. PROC. LOCAL. STRUCT) from
the field name in the structure
The numeric value that occurs when:: is the number of macro call.
Mad-Assembler v1.4.2beta by Thebe / Madteam
Label table:
2000 2000 MAIN
2019 LOOP 00
00 201C LOOP:: 1
00 201C LHEX
2000 0080 LHEX.HLP
00 HEX 205C
00 2079 HEX. @ GETPAR1.LOOP

File structure H
I'm not sure if all of the file is OK, but Eru wanted to do something like this
was so is:) It is to be useful when combining ASM with CC65, a small port C for
Atari. Its contents might look like this (sample file TEST.ASM):
# Ifndef _TEST_ASM_H_
# Define _TEST_ASM_H_
# Define TEST_CPU65816 0x200F
0x2017 # define TEST_CPU6502
# Define TEST_TEXT6502 0x201F
0x2024 # define TEST_TEXT65816
# Endif
The task of macro commands is to shorten the time of writing the program and the
same listing. Macro commands replace the group of frequent mnemonics.


The above macro commands refer to the names of their respective mnemonics 6502,
respectively BEQ, BNE, BPL, BMI, BCC, BCS, BVC, BVS. They have an additional pro
perty which is a jump to the previously asemblowanej instructions, for example:
lda: cmp: req 20 -> 20 lda
-> Wait 20 cmp
-> BEQ wait
LDX # 0 -> LDX # 0
mva: AD $ 500, $ 600 x, x + -> loop lda $ 500, x
-> Sta $ 600, x
-> Inx
-> Bne loop


The above macro commands refer to the names of their respective mnemonics 6502,
respectively BEQ, BNE, BPL, BMI, BCC, BCS, BVC, BVS. They have an additional pro
perty which is a jump to the next asemblowanej instructions, for example:
lda # 40 -> lda # 40
add: sta $ 80 -> clc
scc: inc $ 81 -> adc $ 80
-> Sta $ 80
-> Bcc skip
-> Inc $ 81
-> Skip
The above macro commands refer to the names of their respective mnemonics 6502,
respectively BEQ, BNE, BPL, BMI, BCC, BCS, BVC, BVS. Have the additional propert
y that is the conditional jump to a specified address, with their help, we can n
ot just jump in -128 .. 127 bytes but in the whole range of 64kB example:
jne dest -> BEQ * 4
-> Jmp dest
If the pitch is short (range -128 .. +127) MADS then use a short jump, respectiv

The above macro commands implement appropriate increase / decrease the byte of m
emory without saving it (the result in the accumulator CPU).
-> ADC ... -> SBC ...

The above macro commands implement appropriate increase / decrease the byte of m
emory with saving the result.
ADB SRC # $ 40 -> LDA SRC ADB A B C -> A LDA
-> CLC -> CLC
-> ADC # $ 40 -> ADC B
SBB SRC # $ 80 -> LDA SRC SBB A, B, C -> A LDA
-> SEC -> SEC
-> SBC # $ 80 -> SBC B

The above macro commands implement appropriate increase / decrease your memory w
ith saving the result.
ADW SRC # $ 40 -> CLC ADW A B C -> CLC
-> ADC # $ 40 -> ADC B
-> SCC -> A +1 LDA
-> SRC INC 1 -> ADC B 1
-> STA C +1
ADW SRC SRC # $ 40 -> CLC
-> ADC # $ 40
-> LDA SRC 1
-> ADC # $ 00
-> STA SRC 1
SBW SRC # $ 4080 -> SEC SBW A B C -> SEC
-> SBC <$ 4080 -> SBC B
-> LDA SRC +1 -> A +1 LDA
-> SBC> $ 4080 -> SBC B +1
-> SRC a STA -> STA C +1

The above macro commands refer to the names of their respective mnemonics 6502,
respectively PHA, PLA, are in the deposition on the stack and remove from the st
ack the registers A, X, Y.
-> TXA -> TAY
-> PHA -> PLA
-> Yeah -> TAX
-> PHA -> PLA


Macro commands INW, INL, IND implement more appropriate words of memory (. WORD)
, a long word memory (. LONG), a double word memory (. DWORD).

Macro commands DEW, DEL, DED perform adequately reduce the memory word (. WORD),
a long word memory (. LONG), a double word memory (. DWORD) and use the battery
in the CPU (the accumulator remains unchanged after the macro commands DEW, DEL
inv dest -> inc dest -> dest inc
-> Bne skip -> sne
-> Inc dest +1 -> 1 dest inc
-> Skip ->
dew dest -> lda dest -> dest lda
-> Bne skip -> sne
-> Dest dec 1 -> dest dec 1
-> Skip dec dest -> dest dec


Macro commands MVA, MVX, MVY used to transfer bytes (. BYTE) memory by the CPU r
egisters respectively, A, X, Y. If you use OPT + R allows you to potentially red
uce the object code for successive macro commands MVA, MVX, MVY.
lda src -> dst src mva
sta dst ->
ldy $ 10, x -> MVY $ 10, $ a0 x, x
January $ a0, x ->
LDX # $ 10 -> MVX # $ 10 dst
stx dst ->


Macro commands MWA, MWX, MWY words are used to transfer (. WORD) memory by the C
PU registers respectively, A, X, Y. If you use OPT + R allows you to potentially
reduce the object code for the following macro commands the MWA, MWX, MWY.
LDX <adr -> MWX # addr dst
stx dst ->
LDX> addr ->
dst stx 1 ->
mwa # 0 $ 80 -> lda # 0 mwy # $ 3040 $ 1980 -> ldy <$ 3040
-> Sta $ 80 -> $ 80 in January
-> Sta $ 81 -> ldy> $ 3040
-> January $ 81
mwa ($ 80), y $ A000, x -> lda ($ 80), y
-> Sta $ A000, x
-> Ins
-> Lda ($ 80), y
-> Sta $ A001, x


Macro commands CPB, CPW, CPL, CPD perform comparison of the respective types, re
spectively. BYTE. WORD. LONG. DWORD.
CPW temp # $ 4080
skip bcc
cpd v0 v1
BEQ skip
IFT [. IF] expression
ELI [. ELSEIF] expression
ERT ERT 'string' ["string"] | ERT expression
address label EQU
label = address
EXT address label
OPT [bcfhlmorst ][+-]
ORG [[expression]] address [, address2]
INS 'filename' ['filename "][*][+- value ][,+- offset [, length]]
ICL 'filename' ['filename']
DTA [abfghltv] (value1, value2 ...)[( value1, value2 ...)]
DTA [cd] 'string' ["string"]
RUN address
INI address
END [. EN]
SIN (center, amp, size [, first, last])
RND (min, max, length)
: Repeat
BLK N [t] X
BLK D [os] X
BLK S [pushes] X
BLK R [Eloc] M [ain] | E [Xtended]
BLK E [mpty] X M [ain] | E [Xtended]
BLK U [PDATE] S [ymbols]
BLK U [PDATE] E [xternal]
BLK U [PDATE] A [dress]
BLK U [PDATE] N [ew] X 'string'
SMB label 'string'
LMB # value
So most of the same, although few changes had taken place. In the case of quotes
you can use '' or "." Both types of quotation marks are treated equally with th
e exception of addressing (the''value will be calculated ATASCII mark for "" wil
l be calculated the value INTERNAL sign).

BLK N [t] X - block without headers, the program counter set to X
BLK D [os] X - DOS block with a header, or $ FFFF if no header
preceding the same, the program counter set t
o X
BLK S [pushes] X - solid block of addresses with a header charging $ FFFA,
program counter set to X
BLK R [Eloc] M [ain] | E [Xtended] - relokowalny block is placed in memory or E
BLK E [mpty] XM [ain] | E [Xtended] - block booking relokowalny X bytes of memo
NOTE: The program counter is immediately incr
emented by X bytes
BLK U [PDATE] S [ymbols] - block updating in the previous blocks, or SPARTA
Reloc addresses of symbols SDX
BLK U [PDATE] E [xternal] - block updater addresses external label (header $ FF
NOTE: Not applicable Sparta DOS X, is an exte
nsion to the MADS-and
BLK U [PDATE] A [dress] - block update addresses in blocks reloc
BLK U [PDATE] N [ew] X 'string' - block containing the declaration of a new sym
bol 'string' in the block reloc
X. When the address of the symbol name is pre
ceded by an @,
and the address is the primary memory is such
a symbol may be
called from command.com
More information about the blocks in Sparta DOS X-Files Building in Chapter X an

SMB label 'string'

Declaration of the label as a symbol SDX. A symbol can have a maximum length of
8-and in characters. So, when you use UPDATE SYMBOLS BLK assembler will generate
the correct symbols of a block upgrade. For example:
pf smb 'printf'
jsr pf
that after the user makes JSR SDX system inserts the address of the symbol.
Note: This declaration is not transitive, it means that this example will result
in errors during compilation:
cm smb 'COMTAB'
wp equ cm-1 (error!)
constant wp
Instead, use:
cm smb 'COMTAB'
hundred cm-1 (ok!)
Note: All declarations of symbols should be used before the label declarations a
s well as the right program!

: Repeat
: 4 @ asl
: 2 dta a (*)
256 dta # / 8
Mark ':' specifies the number of repetitions of the line (in case the parameter
indicates the number of macros provided that the numerical value is stored in th
e system decymalnym). The number of repetitions should be in the range <0 .21474
83647>. In repeating the line ': repeat' it is possible to use the loop counter
- a hash sign '#'.
If we use the character ':' in a macro in the sense of the number of repetitions
of lines, for example:
. Macro test
: 2 @ lsr
. Endm
Then for the above example, the character ':' is interpreted as the second param
eter to the macro. To prevent such an interpretation of the MADS, it should be a
fter the colon character ':' to put a sign that does nothing, for example, the p
lus sign '+'.
. Macro test
: 2 @ lsr
. Endm
Now, a colon ':' is correctly interpreted as: repeat

OPT pseudo command allows you to enable / disable options when assembling.
b + bank on sensitive
b-sensitive bank off (default)
c + includes support for CPU 65816 (16bit)
c-enables support for the CPU 6502 (8bit) (default)
f + output file as a single block (useful for carta)
f-file output in the form of a block (default)
h + saves the header file for DOS (default)
h-does not save the header file for DOS
l + writes to a file listing (LST)
l-not recorded Listing (LST) (default)
m + saves all the macros in Listing
m-record in the listing only that part of the macro that is executed (default)
o + saves the result to assemble the output file (OBX) (default)
o-assemble as a result does not save the output file (OBX)
r + optimized code length for the MVA, MVX, MVY, MWA, MWX, MWY
r-length code without optimization for the MVA, MVX, MVY, MWA, MWX, MWY (defaul
s + prints a listing on screen
s-listing does not print on the screen (default)
t + REP SEP track on (65816 CPU)
t-track off SEP REP (65816 CPU) (default)
? + Labels with a '? " at the beginning of are local (style MAE)
? - A label with a '? " at the beginning are temporary (default)
OPT c + c - l + s +
All options OPT can use anywhere in the listing, eg, we can turn a record listin
g in line 12 and line 20 off, etc., then the listing file will contain only the
lines of the 12th .20.
If you want to use the 65816 addressing modes, we need to inform the assembler b
y the 'OPT C +'.
If you are using Codega we can use the 'OPT S +', thus we do not have to go to t
he listing file, because the listing was printed in the lower pane (Output Bar).

ORG pseudo-ordered sets new address assemble, and therefore the location of zase
mblowanych data in RAM.
Assemble web address from the address ADR, set the address in the header file f
or ADR
adr, adr2 Assemble at address ADR, set the address in the header file ADR2
[B ($ ff, $ fe)], change the header at $ FFFE (2 bytes are generated)
[$ Ff, $ fe], addr change the header at $ FFFE, set the address in the header f
ile for ADR
[$ D0, $ fe], adr, adr2 change the header at $ D0FE, Assemble at address ADR, s
et the address in the header file ADR2
[A ($ FFFA)], adr SpartaDOS $ faff header, set the address in the header file f
or ADR
ORG [a ($ ffff), d'atari 'c'ble', 20,30,40], adr, adr2
The square brackets [] are designing a new header, which may be of any length. O
ther values for the closing bracket ']', separated by a comma ',' mean, respecti
vely, assemble the address, the address in the header file.
Example header for the file in a single block, asemblowanego from address $ 2000
, in the header starting address and end address block.
opt + h-f
ORG [a (start), and (over-1)], $ 2000
. Ds 128

INS 'filename' ['filename "][*][+- value ][,+- offset [, length]]

Pseudo ordered INS allows adding a binary file. Included file does not need to b
e in the same directory as the main assemble the file. Just be pointed out that
the MADS-search those paths using the / i (see switch assembly).
Additionally, you can perform on the attached binary file operations:
* INVERS byte binary
+-VALUE increase / decrease the byte binary value of the expression of VALUE
+ Offset bytes from offset to bypass the beginning of a binary file (SEEK offset
Read-offset binary file from its end (SEEK FileLength-offset)
LENGTH LENGTH bytes to read binary file
If the value of LENGTH is not specified, the default binary file will be read un
til the end.

ICL 'filename' ['filename']

Pseudo order ICL allows for adding a source file and its assembly. Included file
does not need to be in the same directory as the main assemble the file. Just b
e pointed out that the MADS-search those paths using the / i (see switch assembl

Pseudo order DTA is the definition of a specific type. If the type is not specif
ied then the default is set to BYTE type (b).
b value of type BYTE
and the value of WORD
v value of type WORD, relokowalna
l byte value (BYTE)
h byte value (BYTE)
t value of type LONG (24bit)
e value of type LONG (24bit)
f the value of a DWORD (32bit)
g value DWORD (32bit) in reverse order
c string ATASCII limited quotes''or "" character * at the end will
INVERS string value, for example, dta c'abecadlo '*
d string INTERNAL limited quotes''or "" character * at the end will
INVERS string value, for example, dta d'Alphabet '*
dta 1, 2, 4
dta a ($ 2320, $ 4444)
dta d'sasasa ', 4, and (200), h ($ 4000)
dta c 'file', $ 9b
dta c'invers' *

SIN (center, amp, size [, first, last])

center is a number Which is added to every sine value
amp is the sine amplitude
size is the sine period
first, last define range of values in the table. They are optional.
Default are 0, size-1.
Example: dta a (sin (0,1000,256,0,63))
defines table of 64 words Representing a quarter of a sine with
amplitude of the 1000th

RND (min, max, length)

This command allows you to generate pseudo random LENGTH values between <MIN..MA
Example: dta b (rnd (0,33,256))


IFT [. IF] expression
ELI [. ELSEIF] expression
The above pseudo orders and directives affect the course of assembling (you can
use them interchangeably.)

. SYMBOL label
. ALIGN N [, fill]
. IF [IFT] expression
. ELSEIF [ELI] expression
. LOCAL label
. Endl, [. LEND]
. REPT expression [, parameter1, parameter2, ...]
. Endre [. Rend]
. R
. PAGES [expression]
. STRUCT label
. ARRAY index label type [= default_value]
. ENDA, [. AEND]
. PROC label
. ENDP [. PEnd]
. MACRO label
:[%%] Parameter
. VAR var1 [= value], var2 [= value] ... (. BYTE |. WORD. | LONG |. DWORD)
. ZPVAR var1, var2 ... (. BYTE |. WORD. | LONG |. DWORD)
. EN
. ENUM label
. ENDE, [. Eend]
. PRINT [. ECHO] 'string1', 'string2'..., value1, value2, ...
. ERROR [ERT] 'string' ["string"] or. ERROR [ERT] expression
. OR
. LO (expression)
. HI (expression)
. DB
. DW
. DS expression
. BY [+ byte] bytes and / or ASCII
. WO words
. HE hex bytes
. SB [+ byte] bytes and / or ASCII
. FL floating point numbers
. ADR label
. LEN label
. DEF label [= expression]
. Ifdef label
. Ifndef label
. USING [. USE] proc_name, local_name
. Nowarn
. GET [index] 'filename' ['filename "][*][+- value ][,+- offset [, length]]
. PUT [index] = value
. SAV [index] ['filename'] length
. EXTRN label [, Label2 type ,...]
. PUBLIC [. GLOBAL], [. GLOBL] label [, ,...] Label2
. Reloc [. BYTE |. WORD]
. LINK 'filename'

. SYMBOL label
Directive. SYMBOL command is equivalent to the pseudo-SMB with the difference th
at it does not need to specify a symbol, a symbol of the label to label. Directi
ve. SYMBOL can be placed anywhere on the block relokowalnego SDX (BLK Reloc) in
contrast to the SMB.
If the directive appeared. SYMBOL will be generated on the block updates:
More on the declaration of the symbols of SDX in chapter Defining Symbol SMB.

. ALIGN N [, fill]
Directive. ALIGN allows you to align the address to assemble a given value of N.
N defaults to $ 0100th It is possible to assemble an address alignment code rel
okowalnego provided that we give the value of FILL.
. Align
. Align $ 400
. Align $ 100, $ ff

. REPT expression [, parameter1, parameter2, ...]

The Directive is a development REPT: repeat with the difference that no one line
is repeated, only the selected program block. Beginning of a block is defined d
irective. REPT, it must occur after the value or arithmetic expression specifyin
g the number of repetitions <0 .2147483647>, the number of repetitions can occur
optional parameters. In contrast to the macro parameters. REPT are always calcu
lated first, and only the result is substituted (this property can be used to de
fine new labels). The parameters in the block. REPT use as parameters in the blo
ck. MACRO. The end of the block. REPT directive defines. Endre, against which th
ere should be no label.
In addition, the area designated by the block. REPT and. Endre we are able to ta
ke advantage of a hash sign '#' (or directive. R), which returns the current val
ue of the counter loop. REPT (as well as for repeat).
. REPT 12, # * 2 # * 3; blocks. REPT can be combined with: REPT
4 dta: 1
4 dta: 2
. Endre
. REPT 9, #, 9-label define label0 label8 ..
Label: 1 mva # 0 + # $ D012
. Endre

. PAGES [expression]
Directive. PAGES allows you to specify the number of pages of memory which shoul
d fit into our piece of code delimited by <. .. PAGES . ENDPG> (the default is s
et to 1). If the code exceeds the declared number of memory pages if an error is
generated at Page Error ????.
They may help us when we want to part of the program ranged from one memory page
, or when we write a program housed in an extra memory bank (64 pages of memory)
, for example:
org $ 4000
. Pages $ 40
. Endpg

Directive. END may be used interchangeably with the directives. ENDP. ENDM. ENDS
. ENDA. Endl. Endre. ENDPG. ENDW. ENDT

. VAR var1 [= value1], var2 [= value2] ... (. BYTE |. WORD. | LONG |. DWORD) [=
Directive. VAR is used for declaration and initialization of variables in the ma
in program block and the blocks. PROC and. LOCAL. MADS does not use the informat
ion on these variables in further operations involving the pseudo-and macro comm
ands. Acceptable types of variables is. BYTE. WORD. LONG. DWORD and their multip
les, as well as the type declared by. STRUCT and. ENUM for example:
. Var a, b, c, d. Word; 4 variables type. WORD
. Var a, b, f: 256. Byte; 3 variables each having a size of 256 bytes
. Var c = 5, d = 2, f = $ 123,344. Dword; 3 variables. DWORD values of 5, 2, $
. Var. Byte i = 1, j = 3, 2 variables type. BYTE with values 1, 3
. Var a, b, c, d. Byte = $ A000; 4 variables type. Byte of the address sequence
$ A000, $ A001, $ A002, $ A003
. Var. Byte a, b, c, d = $ a0, 4 variables of type byte, last zmiennna 'D' with
a value of $ A0
;! for such recording is not possible to specif
y an allocation of variables
. Proc name
. Var. Word p1, p2, p3; declaration of three variables. WORD
. Endp
. Local
. Var a, b, c. Byte
lda and
ldy c
. Endl
. Struct Point, a new type of structured data POINT
x. byte
y. byte
. Ends
. Var a, b Point; Declaration of structural variables
. Var Point c, d, equivalent to the syntax 'label DTA POINT'
So declared the variables are physically allocated until the end of the block in
which they are declared after the directive. ENDP. Endl (. END). The exception
is the block. PROC where the variables declared by. VARs are always allocated in
the Directive. ENDP whether the procedure occurred in a block of any additional
units. LOCAL variables declared by. VAR

. ZPVAR var1, var2 ... (. BYTE |. WORD. | LONG |. DWORD) [= address]

Directive. ZPVAR used to zero the variable declarations in the main program bloc
k and the blocks. PROC and. LOCAL. Trying to assign values (initiation of this f
ire), this variable will generate a warning message uninitialized variable. MADS
does not use the information on these variables in further operations involving
the pseudo-and macro commands. Acceptable types of variables is. BYTE. WORD. LO
NG. DWORD and their multiples, as well as the type declared by. STRUCT and. ENUM
for example:
. Zpvar abcd. Word = $ 80; 4 variables type. WORD of the address of the initial
$ 0080
. Zpvar ij. Byte, two additional variables from the address $ 0080 8
. Zpvar. Word a, b, 2 type variables. WORD
;! for this syntax is not possible to determine
the address variables
. Struct Point, a new type of structured data POINT
x. byte
y. byte
. Ends
. Zpvar a, b Point; Declaration of structural variables
. Zpvar Point c, d, equivalent to the syntax 'label DTA POINT'
So declared the variable of zero will be assigned addresses only at the end of t
he block in which they are declared after the directive. ENDP. Endl (. END). The
exception is the block. PROC where alternating declared by. ZPVAR addresses are
assigned to the Directive. ENDP whether the procedure occurred in a block of an
y additional units. LOCAL variables declared by. ZPVAR.
At the first use of the Directive. ZPVAR zaincjowac address is what will be assi
gned to another variable (default address is $ 0000). With each variable, this a
ddress is automatically incremented by the MADS-and, if the addresses of variabl
es to be repeated a warning message is generated Access Violations at address $
xxxx. In case of exceeding the scope of the zero is generated error message Valu
e out of range.

Prints out on the screen specified as the parameter value of an expression or a
string contained quotes '' or "" for example:
. Print "End: ",*,'..','$ 8000 -*
. ERROR [ERT] 'string' ["string"] |. ERROR [ERT] expression
Directive. ERROR ERT and pseudo orders have the same meaning. Stop assembling th
e program and displays the message given as parameter, limited quotes '' or "."
If the parameter is a boolean expression, the assembling will be stopped when th
e Boolean expression is true (User error message), eg:
ert "halt" ERROR: halt
. Error "halt"
ert *> $ 7FFF; ERROR: User error
. Error *> $ 7FFF


The above-mentioned directive are used to determine the acceptable parameter typ
es in the declaration of parameters in the procedure (. BYTE. WORD. LONG. DWORD)
. It is also possible to use them for data definitions, in place of pseudo-comma
nd DTA.
. Proc test (. Word tmp, a, b. Byte value)
. Byte "atari", 5.22
. Word 1912, $ FFFF
. Long $ 34518F
. Dword $ 11223344

. DB
BYTE data type definition, the equivalent of pseudo-B DTA order or directive. BY

. DW
The definition of data type WORD, the equivalent of a pseudo-DTA command or dire
ctive. WORD

. DS expression
This directive has been borrowed from MAC'65, allows you to reserve memory witho
ut prior initialization. This is equivalent to a pseudo command ORG * + expressi
on. Directive. DS can not be used in code like relokowalnym ORG-a.
purpose: Reserves space for data space without initializing it then any Particul
ar value (s).
usage: [label]. DS expression
Using. "DS expression" is exactly equivalent of using "ORG * + expression." That
is, the label
(If it is given) is set to EQUAL the current value of the location counter. Then
then value
of the expression is then added the location counter.
Example: BUFFERLEN. DS 1; reserve a single byte
BUFFER. DS 256; reserve 256 bytes

. BY [+ byte] bytes and / or ASCII

Store byte values in memory. ASCII strings can be Specified by enclosing the str
ing in single or double Either quotes.
If the first character of the operand field is a '+', then the byte Following Wi
ll Be used as a constant and added to all Remaining bytes of the instruction.
. BY + $ 80 1 $ 10 10 'Hello' $ 9B
will generate:
8A 81 90 C8 E5 EF EC EC 1B
Values in. BY statements May Also Be separated with commas for compatibility wit
h other Assemblers. Spaces are allowed since They Are easier to type.

. WO words
Stores words in memory. Multiple words can be Entered.

. HE hex bytes
Store hex bytes in memory. This is a convenient method to enter strings of hex b
ytes, since it does not require the use of the '$' character. The bytes are stil
l separated by spaces however, Which I feel makes a much more readable layout Th
an the 'all run together' form of hex That statement Assemblers some other use.
Example:. HE 0 55 AA FF

. SB [+ byte] bytes and / or ASCII

This is in the same format as the. BY pseudo-op, Except That It Will convert all
bytes into ATASCII screen codes before Storing Them. The conversion is done ATA
SCII before any constant is added with the '+' modifier.

. FL floating point numbers

Stores 6-byte BCD floating point numbers for use with the OS FP ROM routines.

. EN
Directive. EN command is equivalent to Pseudo END marks the end of the block ase
mblowanego program.
This is an optional pseudo-op to mark the end of assembly. It Can Be Placed befo
re the end of your source file to Prevent a portion of it from being assembled.

. ADR label
Directive. ADR LABEL returns before the change of address, assemble (it is possi
ble to put a name LABEL between parentheses or square), for example:
org $ 2000
. Tb percent, $ 1000
tmp lda # 0
. Endp
lda. tb.tmp addr; = $ 2000
lda tb.tmp; = $ 1000

. LEN label
Directive. LEN returns the length (in bytes) of the block. PROC. ARRAY. LOCAL. S
TRUCT. LABEL label is the name of the block. PROC. ARRAY. LOCAL or. STRUCT (it i
s possible to put a name LABEL between parentheses or square), for example:
label. array [255]. dword
. Enda
dta a (. len label) = $ 400
. Proc wait
lda: cmp: req 20
. Endp
dta. len wait; = 7

. DEF label [= expression]

Directive. DEF allows you to check the presence of the definition of LABEL, or d
efine it. If the label is defined returns a value of 1 means TRUE, otherwise it
returns 0 or FALSE. It is possible to put a name LABEL between parentheses or sq
uare, for example:
ift. Notes (. def label)
. Def label
e and f
This unary operator tests Following Whether the label has been defined yet, retu
rning TRUE or FALSE as appropriate.
CAUTION: Defining a label AFTER the use of a. DEF Which references it can be dan
gerous, particularly if the. DEF is used in a. IF directive.
. Ifdef label
Directive. Ifdef condition is shorter counterpart. IF. DEF LABEL
. Ifdef label
jsr proc1
. Else
jsr proc2
. Endif

. Ifndef label
Directive. Ifndef condition is shorter counterpart. IF. NOT. DEF LABEL
. Ifndef label
. Else
. Endif
For n / assembling unit in the example. Ifndef (. IF) will take place only in th
e first pass, if you put in that block any program code certainly will not be ge
nerated to a file, definitions of the labels will be carried out only in the fir
st pass, if there are any errors associated with their defining we learn about t
hem only when you try to appeal to such labels, it will be error Undeclared labe
. Ifndef label
. Def label
lda # 0; this order will not be zasemblowany, only the last course of assemblin
g generates code
temp = 100; label TEMP is defined in only one course of assembling
. Endif

. Nowarn
Directive. Nowarn off warning message for the current row asemblowanego program.
. Nowarn. Proc temp; not generated warning 'Unreferenced procedure TEMP'
. Endp

Directive. USING (. USE) allows you to specify an additional path to search for
the names of labels.
. Local move
tmp lda # 0
hlp sta $ A000
. Local move2
tmp2 LDX # 0
hlp2 stx $ B000
. Endl
. Endl
. Local main
. Move.move2 use
lda tmp2
. Use move
lda tmp
. Endl

. GET [index] 'filename' ... [. BYTE. WORD. LONG. DWORD]

This is equivalent to a pseudo command INS (similar syntax), except that the fil
e is not attached to asemblowanego file loaded into memory only the MADS-a. This
directive allows you to load a specific file to the memory of the MADS-and I re
fer to the bytes of the file as a one-dimensional array.
. Get 'file'; load the file into an array and the MADS-
. Get [5], 'file', to load the file into an array and the MADS-index = 5
. Get 'file', 0.3, load the array MADS-and 3-echoes of
lda #. get [7] 7 byte read from the array and the MADS-
address =. get [2] +. get [3] <<8, 2 and 3 of byte in the file header contains
information about the DOS boot address
By means of directives. GET. PUT can be read like Theta Music Composer module (T
MC) and make his relocation. This implements attached to the MADS-and macro in t
he directory .. / examples / MSX / TMC_PLAYER / tmc_relocator.mac.
The permissible range of values for the INDEX = <0 .65535>. Values read by. Are
of type GET BYTE.

. PUT [index] = value

Directive. PUT allows you to refer to a vector in the memory of the MADS-and I w
rite in it a value of type BYTE. This is the same array to which the Directive.
GET save the file.
The permissible range of values for the INDEX = <0 .65535>.
. Put [5] = 12; save the value 12 in the MADS-talicy and at 5 o'clock
. SAV [index] ['filename'] length
Directive. SAV allows you to write the buffer used by the Directive. GET. PUT to
an external file, or join the currently asemblowanego.
. Sav? Length; join asemblowanego content file buffer [0.? Length-1]
. Sav [200] 256; join asemblowanego content file buffer [200th +256-1 .200]
. Sav [6] 'filename', 32, FILENAME write to the buffer [6th .6 +32-1]
The permissible range of values for the INDEX = <0 .65535>.


The above directive is equivalent to the logical operators | | (. OR) & & (. AND
), ^ (. XOR),! (. NOT.)

. LO (expression). HI (expression)
The above directive is equivalent operators, respectively '<' (low byte) and '>'


. IF [IFT] expression
. ELSEIF [ELI] expression
The above directives and pseudo orders affect the course of assembling (you can
use them interchangeably), for example:
. IF [. NOT. LABEL_NAME DEF]. AND [. NOT. Label_name2 DEF]
label_name2 = 2
In the above example, parentheses (square or round) are a necessity, they would
not have that for the first Directive. DEF parameter name of the label would lab
el_name.AND.NOT.DEFlabel_name2 (spaces are ignored, a dot accepted in the name o
f the label).


# IF type expression [. OR type expression] [. AND type expression]
# WHILE type expression [. OR type expression] [. AND type expression]

# IF type expression [. OR type expression] [. AND type expression]

The # IF is a modest equivalent of IF statements with higher-level languages (C,
Directive # IF, # ELSE and # END allow to generate machine code the CPU 6502 IF
conditional statement for a designated block of the program, they may be nesting
. All types are acceptable. BYTE. WORD. LONG. DWORD, it is possible to combine m
ore of the conditions by means of directives. OR and. AND, it is not possible to
determine the order of evaluation by parentheses.

Implementation of the Directive # IF begins with the calculation of the value th

at is such a simple expression that consists of two operands and one operator (a
n expression we can combine directives. OR or. AND).
If the expression is non-zero value (TRUE), it will be executed the program bloc
k that follows the # IF. Block such a program is automatically terminated instru
ction 'JMP' executing the jump to the next instruction program for the directive
# END block if there is a # ELSE.
If the expression is zero (FALSE), then the code is executing the program occurr
ing after the # ELSE, # ELSE directive when there is no control is transferred t
o the next instruction of the program # END directive, eg:
# If. Byte label> # 10. Or. Byte label <# 5
# End
# If. Byte label> # 100
# Else
# If. Byte label <# 200
# End
# End
# If. Byte label> # 100. And. Byte label <# 200. Or. Word lab = temp
# End
# If. Byte @
# End

# WHILE type expression [. OR type expression] [. AND type expression]

The # WHILE WHILE the user is equivalent to higher-level languages (C, Pascal).
Directive # # END WHILE and allow the CPU to generate machine code 6502 for the
designated block of the loop of the program, they may be nesting. All types are
acceptable. BYTE. WORD. LONG. DWORD, it is possible to combine more of the condi
tions by means of directives. OR and. AND, it is not possible to determine the o
rder of evaluation by parentheses.
The sequence of actions to implement Directive # WHILE statement is as follows:
1. Calculate the value of the expression and make sure it is equal to zero (FALS
if so, skip step 2;
if not (TRUE), go to step 2
2. Follow the program block bounded directives # # END WHILE and then go to Step
If the first valuation of the expression shows that it is zero, the program bloc
k is never executed and control passes to the next instruction program for the d
irective # END
# While. Byte label> # 10. Or. Byte label <# 5
# End
# While. Byte label> # 100
# While. Byte Label2 <# 200
# End
# End
# While. Byte label> # 100. And. Byte label <# 200. Or. Word lab = temp
# End

Assembling at zero
In contrast to the two-pass assemblers, such as QA and XASM, MADS is a multi-pat
h. What gives?
Take the example that:
org $ 00
lda tmp 1
tmp lda # $ 00
Two-pass mode without knowing the value of the assembler label TMP accept implic
itly that its value will double-byte, a type WORD and generate orders LDA W.
However, MADS kindly generates the zero-order LDA Z. And it's actually the main
and simplest to explain the jurisdiction of more runs.
Now someone will say that the will of the order referring to the zero is in the
form of LDA W. No problem, just that it will extend the mnemonic:
org $ 00
lda.w tmp 1
tmp lda # $ 00
They are allowed three extensions mnemonics
. B [. Z]
. In [. A] [. Q]
. L [. T]
namely in BYTE, WORD, LONG (TRIPLE). Of which latter generates 24 bit value and
relates to 65816 and the memory of contiguous space (I doubt if ever you cast su
ch an order.) For more information on mnemonics CPU 6502, 65816 and their allowa
ble extensions in Chapter mnemonics.
Another way to enforce a zero-order page is to use curly braces {}, eg
dta {} lda $ 00, $ 80, $ 80 lda
The MADS we can do the same, but what, the last course do the trick for us:) The
problem is now to place such a piece of code in computer memory. We can try to
load a program directly to the page blank, and if the target area is within the
limit $ 80. $ FF OS is probably going to survive, below this area will be harder
Therefore, MADS allows such a thing:
org $ 20, $ 3080
lda tmp 1
tmp lda # $ 00
So Assemble at address $ 0020, but load the address $ 3080th Of course, the subs
equent transfer of code to the right place (in our example $ 0020) should have t
he responsibility of the programmer.
In summary:
org adres1, Address2
Assemble the adres1 address, put the address in memory Address2. ORG This will a
lways create a new block in the file, which will be saved to an additional four
bytes of the header of the new unit.
If you do not care about your new address location in memory, the address of the
location data has to be current address then you can use the properties of the
blocks. LOCAL and. PROC, header bytes are not written in such a case, for exampl
2 org $ 2000
4 FFFF> 2000-200D> A9 00 lda # 0
5 2002 EA nop
7 0060. Local temp, $ 60
9 0060 BD FF FF lda $ ffff, x
0063 BE 10 FF FF LDX $ ffff, y
12. Endl
14 2009 A5 60 lda temp
200B 15 AD 03 20 lda. Addr temp
For the above example, the TEMP will block zasemblowany with your new address =
$ 60 and placed in memory at $ 2003. After the closing block of the directive (.
Endl. ENDP. END) is to resume pre-assemble the block address plus the length ye
t so zasemblowanego block, in our example, the address from which to continue as
sembling the end of the block. LOCAL address will be $ 2009.
Then, using the directive. And ADR. LEN can make a copy of this block to the rig
ht place, for example:
ldy # 0
mva copy. adr (temp), temp y, y
CpY #. len temp
bne copy
For more information on the operation of the directives. And ADR. LEN.
MADS offers the possibility of declarations of two types of data: structural. ST
RUCT and enumerated. ENUM
If programowaliscie in C, you probably already have met with the structures. In
general, MADS defines the structure of the virtual array, a one-dimensional fiel
ds of different types. BYTE. WORD. LONG. DWORD and their multiples. Virtual beca
use it exists as yet only in the memory assembly.
The fields of the structure contain information about ofsecie the beginning of t
he structure.

Declaration of structure (. STRUCT)

Structures of the n / a directive:
name. STRUCT
. STRUCT name
. ENDS [. SEND] [. END]
name. STRUCT
Declaration of the structure name with the Directive. STRUCT. The name of the st
ructure is required and necessary, its absence will generate an error. To the na
mes of the structures can not use the names of mnemonics and pseudo orders. If t
he name is reserved for an error occurs Reserved word.
Example of structure declaration:
. STRUCT name
x. word; lda # name.x = 0
y. word; lda # name.y = 2
with. long; lda # name.z = 4
v. dword; lda # name.v = 7
q: 3. byte; lda # name.q = 11
. ENDS; lda # name = 14 (length)
Fields are defined by the structure name and field type (. BYTE. WORD. LONG. DWO
RD). The field name may be preceded by white space. " The area bounded by the di
rectives. STRUCT and. ENDS can not use mnemonics CPU if you use them or we use o
ther illegal characters with an error message syntax Improper or Illegal instruc
In summary, the label name contains information on the total length of the struc
ture (in bytes). Other labels describing the fields contain information about of
secie to the beginning of the structure.
Declaration of structures can not be nested, you can nest has declared the struc
ture (the order of the program is not important), for example:
. STRUCT temp
x. word
y. word
v. byte
with. word
. STRUCT test
tmp temp
lda # temp.v
lda # test.tmp.x
lda # test.tmp.z
What can the structure?
Suppose we have an array of different types of fields, such fields can be read u
sing an array of pre-defined values of offsets. But when we add an extra field t
o the plate, or modify it in any way, you will need to improve the program code
that used a pre-specified values offsets. When you define this array with the st
ructure we will be able to read the field using the offsets stored in the struct
ure declaration, which is always we check the appropriate box regardless of the
changes that have occurred in the array.
Another example of the structures was described in chapter external symbols, suc
h as use of external symbols and structures. STRUCT.

Defining the structural data, the appeal

Defining the structural data is based on assigning a new label with a specific s
tructure of the pseudo command DTA or without this pseudo-command. The result of
this assignment is reserved memory, it is no longer a virtual creature.
DTA struct_name label [count] (data1, data2, data3 ...) (data1, data2, data3 ...
) ...
label struct_name
COUNT specifies the number in the range & lt0 COUNT ..>, which defines the maxim
um value of the index of a vector, and thus also the number of delayed-type data
in a structured memory.
Example of structure declaration and definition of structural data:
; Declaration of the structure;
. STRUCT temp
x. word
y. word
v. byte
with. word
; Defining data;
dta data temp [12] (1,20,200,32000) (19,2,122,42700)
date2 dta temp [0]
data3 temp / / shorter counterpart data2
After the name of the structure in square brackets must be a value between & lt0
.. 2147483647>, which defines the maximum value of the index of a vector, while
the number of delayed-type data in a structured memory.
After the square brackets may optionally list the initial values (limited parent
heses), though there is no default values of the structure fields are zero. On t
he other hand, if the list of initial values is less than the declared number of
fields, then the remaining fields are initialized to the values that have been
recently given, for example,
dta data temp [12] (1,20,200,32000)
Such a declaration will result in all the fields will be ignited 1,20,200,32000
values, not just the first field data [0].
If the list of initial values will be greater or less than the number of fields
of the structure, then there is an error Constant expression violates subrange b
To refer to this emerging field of data should provide their name, be the index
in square brackets and the name of the field after the dot, for example:
lda date [4]. y
LDX # data [0]. v
There are no square brackets with an index label [index] end up with an error me
ssage Undeclared label.

Calculations to the n / a directive:
name. ENUM
. ENDE [. Eend] [. END]
. Enum PORTB
rom_off = $ fe
rom_on = $ ff
. Ende
. Enum test
a, a = 0
b, b = 1
c = 5 c = 5
d, d = 6
. Ende
Declaration of the calculation is done by using directives. ENUM and. ENDE. Name
of the calculation is required and necessary, its absence will generate an erro
r. Calculations of the names can not use the names of mnemonics and pseudo order
s. If the name is reserved for an error occurs Reserved word.
The values of successive labels are automatically incremented by 1 starting from
the default value of 0, the value labels you can define yourself, or leave the
Refer to the labels of calculation using the two characters colon '::' or a dot
'.', For example:
lda # PORTB: rom_off
dta portb.rom_on, portb.rom_off
Calculations we can use to declare the field structure. STRUCT, to allocate vari
able directive. VAR, for example:
PORTB Bank / Bank of variable allocation size 1 byte
. PORTB bank var / / variable allocation BANK size 1 byte
. Struct test
. Ends
Variable size of the enumerated type is dependent on the maximum value of the la
bel they adopt further calculations, such as:
. Enum Estate
. Ende
For the above example, the allocation of a variable of type "estate" will be the
size of two bytes (WORD).

Declaration of a vector (. ARRAY)
Tablets of the n / a directive:
name. ARRAY index type [= default_value]
. ARRAY name count type [= default_value]
. ENDA [. AEND] [. END]
Available data types are. BYTE. WORD. LONG. DWORD.
INDEX specifies the maximum value of the index array [0. INDEX], this value may
be constant or expression, should be in the range & lt0 .. 65535>. The absence o
f INDEX-in will be determined based on the number entered values.
The area bounded by the directives. ARRAY and. ENDA is not possible to use mnemo
nics CPU if you use them or we use other illegal characters, then there is an er
ror Improper syntax.
It is permissible to define an index from which you enter values for other field
s of the array. New value of this index, we define by putting at the beginning o
f a new line in square brackets expression [expression]. You can specify more in
dices, including the further breakdown of indices by a colon ':'. Then enter val
ues for the array after the equal sign '=', eg:
. Array tab. Byte, an array of indeterminate TAB to advance the number of fields
1.3, [0] = 1, [1] = 3
5, [2] = 5
[12] = 1; [12] = 1
[3]: [7]: [11] = 9.11, [3] = 9, [4] = 11, [7] = 9, [8] = 11, [11] = 9, [12] = 1
. Enda
This solution may seem strange, and its use limited, but there are occasions whe
n it might be useful, for example, an array which translates the code of the pre
ssed key code ATASCII or INTERNAL.
. Array TAB [255]. Byte = $ ff; allocate 256 bytes [0 .255] with initial value $
[63]: [127] = "A" to assign a new value TAB [63] = 'A' TAB [127] = 'A'
[21] [85] = "B"
[18] [82] = "C"
[58]: [122] = "D"
[42]: [106] = "E"
[56]: [120] = "F"
[61]: [125] = "G"
[57]: [121] = "H"
[13] [77] = "I"
[1]: [65] = "J"
[5]: [69] = "K"
[0]: [64] = "L"
[37]: [101] = "M"
[35] [99] = "N"
[8] [72] = "O"
[10] [74] = 'P'
[47]: [111] = "Q"
[40]: [104] = "R"
[62]: [126] = "S"
[45]: [109] = 'T'
[11] [75] = 'U'
[16] [80] = "V"
[46]: [110] = "W"
[22] [86] = "X"
[43]: [107] = "Y"
[23] [87] = "Z"
[33] [97] = ""
[52]: [180] = $ 7e
[12] [76] = $ 9b
. Enda
In the above example, we created an array of size 256 TAB bytes [0 .255], the ty
pe of data. BYTE and filled the field value = $ FF, also recorded the value of l
etter codes INTERNAL positions (array index) equal to the code key is pressed (w
ithout SHIFT and from the Shift-and-I, namely large and small letters).
Colon ':' separates the individual indices of the array.
Another example might be to keep the string centered, for example:
org $ bc40
. Array txt 39. Byte
[17] = "ATARI"
. Enda
In summary, the directive. ARRAY allows you to create and fill one-dimensional a
rray of values of the declared type.
To such a table referenced as follows:
lda table, y
lda tab [23], x
LDX tab [200]
If we give in square brackets in excess of the declared value of the index for t
he table, then there is an error Constant expression violates subrange bounds.

Macros help us perform repetitive, automate them. There are only a memory assemb
ly, only when calls are assemble. With their help, MADS can put on and take off
from the software stack parameters for the procedures declared Directive. PROC a
nd switch banks expanded memory mode SENSITIVE BANK (OPT B +).

Declaration Macros
Macro to the n / a pseudo orders and directives:
name. MACRO ['separator'] ['separator']
. MACRO name ['separator'] ['separator']
:[%%] Parameter
name. MACRO ['separator'] ['separator']
Declaration of the macro named name with the directive. MACRO. Macro name is req
uired and necessary, its absence will generate an error. To the names of macros
can not use the name of mnemonics and pseudo commands (bug Reserved word).
At the end of a macro declaration may occur at the same time the declaration of
the separator and the mode of passing parameters to the macro (single apostrophe
with no changes, a double apostrophe from shattering performance and addressing
mode argument).
The default separator for separating the parameters passed to the macro characte
r is a comma ',' and space ''.
name. MACRO 'separator'
Between the single quotes''we can put a separator, which will be used to separat
e parameters when calling a macro (only for that single quotes can be used.)
name. MACRO "separator"
Between the double quotes "" We can also put a separator character that will be
used to separate parameters when calling the macro. In addition, use a double ap
ostrophe indicates the MADS-are those that spread the parameters passed into two
elements and the mode of addressing an argument, eg:
Test # 12 200 <30
test. macro ""
. Endm
Macro Test is declared separator-space by using the apostrophe ', ie after calli
ng the macro parameters are distributed into two elements, and addressing mode a
# 12 -> addressing mode '#' argument 12
200 -> addressing mode '' argument 200
& Lt30 -> addressing mode '#' argument 0 (the calculated value of the expressio
n "<30")
test '#' 12 '' 200 '#' 0
UAWAGA # 1: The parameters of the sign operator '<', '>' are calculated and only
the result is passed to the macro (the parameter is substituted.)
UAWAGA # 2: If a macro parameter is the loop counter '#', '. R' (! Single charac
ter '#' or directive. 'R' and not an expression involving this character, this d
irective!) Then the macro is passed the loop counter value (substituted for the
This property can be used to create a "samopiszacego" the code you need to creat
e new labels like "label0", "label1", "Label2", "Label3" ... etc., for example:
: 32 # find
find. macro
ift. def label: 1
dta a (label: 1)
e and f
. Endm
The above example writes the address label provided that such a label exists (is

Completion of the macro. Causing the absolute termination of the macro.

With the help of the Directive. ENDM or. MEND finish the declaration of the curr
ent macro. It is not possible to use the directive. END as is the case for other
areas declared by the Directive. LOCAL. PROC. ARRAY. STRUCT. REPT
:[%%] Parameter
The parameter is the number of decimal positive (> = 0), followed by a colon ':'
or two percentage symbols '%%'. If the macro you want to sign ':' defined numbe
r of repetitions and not just the parameter that the next character after the co
lon will not be in the range '0 '.. '9', just for example:
$ 2 nop
: +2 Nop
:% 10 nop
Parameter: 0 (%% 0) has a special meaning, includes a number of parameters passe
d. With his help, we can check whether the required number of parameters was pas
sed to the macro, for example:
. IF: 0 <2 | |: 0> 5
. ERROR "Wrong number of arguments"
IFT%% 0 <2. Or: 0> 5
ERT "Wrong number of arguments"
Example macros:
. Load_word macro
lda <: 1
sta: 2
lda>: 1
sta: 2 +1
. Endm
ne test
eq test
. Macro test
b%% a skip
. Endm

Calling macros
Macro call by its name, it may occur after the macro parameters, separated by a
separator which is the default is a comma ',' or spaces ''. The number of parame
ters depends on the memory PC. If a given number of parameters is less than the
number of parameters used in the macro, then the missing parameters will be subs
tituted with the value -1 ($ FFFFFFFF). This property can be used to check if th
e parameter is passed or not, but easier to do this via the parameter zero%% 0th

macro_name [Par1, PAR2, Par3, 'Par4', "string1" "string2" ...]

Parameter can be a value expression or a string limited''single apostrophe or do
uble "."
Single quotes '' will be passed to the macro together all of the characters betw
een them
double quotes "" means string and is only a string from between quotes will be p
assed to the macro
All definitions of the labels within macros are local.
If you wanted by the assembler label did not occur in the macro, then it will lo
ok in a local area (if requested Directive. LOCAL), then in the procedure (if a
procedure is currently being processed), at the end of the main program.
Example of macro call:
macro_name 'a', a,> $ A000, cmp, the default separator ','
macro_name 'a'_a_> $ a000_cmp; to the stated separator' _ '
macro_name 'a' a> $ A000 cmp; for the default separator ''
It is possible to call macros with the macro level, and the recursive call macro
s. In the latter case you should be careful because it can cause a stack overflo
w MADS-a. MADS is protected by the recursion of macros without end, and stops wh
en the number of assembling macro requests exceeds 4,095 (Infinite recursion err
An example of a macro that causes stack overflow MADS-a:
jump. macro
. Endm
An example of a program that passes parameters to a pseudo procedures .. \ EXAMP
org $ 2000
putchar percent, 'a'-64; PROC macro call as a parameter
putchar percent, 'a'-64; name of the procedure which will be called by the JSR
putchar percent, 'R'-64, and an argument (character code INTERNAL)
putchar percent, 'E'-64
putchar percent, 'a'-64
percent Color, $ 23; calling any procedurki changing background color
; ---
jmp loop loop, loop endlessly to see the effect of
; ---
percent. macro, macros, PROC statement
push = 1, 2, 3, 4, calling the macro PUSH odkladajacego arguments on the stack
; = 1 calculates the memory bank
jsr: 1; jump to the procedure (procedure name in the first parameter)
lmb # 0; Load Memory Bank, the bank sets the value of 0
. Endm; the end of the macro PROC
; ---
push. macro, the macro declaration PUSH
lmb #: 1; sets up a virtual memory bank
. F: 2 <= $ FFFF, if passed argument is less than equal to $ FFFF is
lda <: 2; set it on the stack
sta stack
lda>: 2
stack a hundred
. Endif
. F: 3 <= $ FFFF
lda <: 3
sta stack 2
lda>: 3
sta stack 3
. Endif
. F: 4 <= $ FFFF
lda <: 4
sta stack 4
lda>: 4
sta Stack 5
. Endif
. Endm

* ------------ *; Procedure COLOR

* PROC * Color
* ------------ *
lmb # 1, set the port to a virtual bank
And all definitions of the labels will now belong to
the bank
org * 256 stack, the stack for the procedure COLOR
color stack equ
Color, COLOR procedure code
lda color
sta 712

* -------------- *; Procedure putchar

PROC * putchar *
* -------------- *
lmb # 2, set the virtual bank number to 2
And all definitions of the labels will now belong to
the bank
org * 256 stack, the stack for the procedure putchar
char stack equ
Putchar; procedure code putchar
lda char
sta $ bc40
scr equ *- 2
scr inc
Of course, the stack in this example is a software program. For 65,816 you could
use the hardware stack. With the defined variables are assigned to a specific n
umber of the bank, you can create a structure or function of the procedure call
is similar to those of higher-level languages.
However, simpler and more efficient use of the declaration procedure. PROC which
allows MADS. More about the declaration of its procedures and operations relati
ng to the Chapter Procedures.

MADS introduces new opportunities to use the procedures of the parameters. New p
ossibilities of this mechanism to resemble those familiar with high-level langua
ges, and are just as easy for the programmer.
Currently attached to the declarations of the MADS-and macro (@ CALL.MAC, @ PULL
.MAC, @ EXIT.MAC) can enable software stack size of 256 bytes, which is the same
size as a stack of hardware, provide a mechanism for removing the software stac
k and the deposition of software stack parameters needed when calling procedures
and exit from such procedures. MADS take into account the possibility of recurs
ion such procedures.
The developer is not involved in this mechanism, it can focus on your program. I
t must only remember the need to define appropriate labels and attach the approp
riate macros when assembling the program.
Additionally, you can forget the "mechanism" software stack MADS-and I use the c
lassical method of transmission, using the CPU registers (the Directive. REG) or
variable (the Directive. VAR).
Another feature of the procedures. PROC is the ability to override them when ass
embling if there has been no appeal to them, which have been defined but not use
d. He will then prompt Unreferenced procedure?? . The absence of such procedures
when it is possible to assemble by specifying a parameter to the MADS-a command
line-x 'Exclude unreferenced Procedures. "

All labels defined in the procedure. PROC are local coverage, it can also be def
ined as global labels locally defined random access because you can refer to the
m what is not normal in other programming languages.
Under the procedure. PROC is possible to define a global label (see Labels globa
If you want to get to the labels defined in the procedure from outside the proce
dure, then we address with a dot '.', For example:
lda test.pole
. Proc test
Golf nop
. Endp
If you wanted by the assembler label did not occur in the procedure. PROC, the M
ADS will look it up under the lower reaches of the global area. To read the labe
l value output immediately from the procedure. PROC (or other local area) is pre
ceded by the label name with a colon ':'.
MADS required for procedures using a software stack, the three global definition
of labels with specific names (the address of the stack, the stack pointer, the
address parameters in the procedure):
No definition of the above labels and try to use the block. PROC uses a software
stack that will MADS adopt its default value of these labels: @ PROC_VARS_ADR =
$ 0500, @ STACK_ADDRESS = $ 0600, @ STACK_POINTER = $ FE
MADS for procedures using a software stack requires a declaration of macros for
specific titles. Attached to the MADS-and declarations of these macros can be fo
und in the files:
The above macro implement the transfer and deposition of the software stack para
meters, and the removal and deposition parameters for the procedures using a sof
tware stack and triggered from other procedures using a software stack.
The declaration procedure. PROC
Procedures for the n / a directive:
name. PROC [(. TYPE PAR1. ...)] PAR2 TYPE [. REG] [. VAR]
. PROC name [, address] [(. TYPE PAR1. ...)] PAR2 TYPE [. REG] [. VAR]
. ENDP [. PEnd] [. END]

name. PROC [(. TYPE Par1, PAR2. Par3 ...)] TYPE [. REG] [. VAR]
The declaration procedure name by using the directive. PROC. Name of the procedu
re is required and necessary, its absence will generate an error. For the names
of procedures can not use the names of mnemonics and pseudo orders. If the name
is reserved for an error occurs Reserved word.
If you want to use one of the mechanisms of MADS-and to pass parameters to proce
dures, we must declare them first. Declaration of parameters in the procedure is
between parentheses (). There are four types of parameters:
. BYTE (8-bit) relokowalne
. WORD (16-bit) relokowalne
. LONG (24-bit) nierelokowalne
. DWORD (32-bit) nierelokowalne
The current version of the MADS-and there is no possibility of passing parameter
s by using structures. STRUCT.
Immediately after the declaration of the type, separated by a minimum of one spa
ce, followed by the name of the parameter. If you declare more parameters of the
same type, we can separate the names by commas ','.
An example of the declaration procedure using a software stack:
name. PROC (. WORD PAR1. par2 BYTE)
name. PROC (. BYTE PAR1, par2. par3 LONG)
name. PROC (. DWORD p1, p2, p3, p4, p5, p6, p7, p8)
In addition, by using the directives. REG or. VAR, we can determine the manner a
nd method of passing parameters to procedures MADS-a. By the CPU registers (. RE
G) or variable (. VAR). Directive specifying how transmission parameters inserte
d at the end of our declaration of the procedure. PROC
An example of the declaration procedure using CPU registers:
name. PROC (. BYTE x, y, and. BYTE.) REG
name. PROC (. WORD xa. BYTE y). REG
name. PROC (. LONG axy). REG
Directive. REG requires that the parameter names consist of letters 'A', 'X', 'Y
' or a combination thereof. The letters correspond to the names and CPU register
s affect how the use of registers. A limitation in the number of parameters pass
ed is the number of CPU registers, which can pass to the procedure for a total m
aximum of 3 bytes. The advantage of this method jes the speed and low consumptio
n of RAM.
Example procedure using variable declarations:
name. PROC (. BYTE x1, x2, y1, y2). VAR
name. PROC (. inputPointer WORD, outputPointer). VAR
name. PROC (. WORD src +1, dst +1). VAR
For. VAR parameter names, variable names to indicate which parameters passed wil
l be loaded. This method is slower. REG but still faster than the method with a
stack of software.
The procedure we leave in the usual way, ie using the RTS command. The addition
of the RTS command in the body of the procedure at the exit of each track is the
responsibility of programming, not the assembler.
As in the case of the block. LOCAL, we can assemble to define a new address for
the block. PROC, for example:
. PROC label, $ 8000
. PROC Label2, $ A000 (. Word ax). Reg
In the case of procedures using a software stack at the end of the procedure. EN
DP MADS invokes the macro @ EXIT, whose task is to modify the software stack poi
nter @ STACK_POINTER, it is necessary for the proper functioning of the software
stack. The user can design their own macro @ EXIT, or use the attached to the M
ADS-a (file .. \ EXAMPLES \ MACROS \ @ EXIT.MAC), it now looks like this:
. Macro @ EXIT
ift: 1 <> 0
ift: 1 = 1
dec @ stack_pointer
where: 1 = 2
dec @ stack_pointer
dec @ stack_pointer
lda @ stack_pointer
sub #: 1
fixed @ stack_pointer
e and f
e and f
. Endm
EXIT @ macro should not alter the contents of CPU registers if you want to have
the option of paying a result of the procedure. PROC through CPU registers.

Directive. ENDP statement block ends the procedure.
Procedure call
The procedure call by its name (same as macro), followed by the parameters may o
ccur, separated by a separator in the form of a comma ',' or spaces '' (it is no
t possible to declare the other separators).
If the parameter type does not agree with the type declared in the declaration p
rocedure, there is an error Incompatible types.
If a given number of parameters differs from the number of parameters declared i
n the declaration process is to perform error Improper number of actual paramete
rs. The exception is the procedure to which the parameters are reported by the C
PU registers (. REG) or variable (. VAR), in such cases we omit the parameters,
in default they are already loaded into the appropriate registers and variables.

There are three ways to transfer the parameter:

'#' By value
'' By the value from the address (without the preceding character)
'@' By a battery (type parameters. BYTE)
"String" of string, eg "label, x"
An example of the procedure call:
name @, #, $ 166, $ A400; for the software stack
name, @, # $ 3f; for. REG or. VAR
name "(hlp), y" 'tab-y "for. VAR or software stack (a stack of software uses re
MADS after encountering the procedure call that uses the software stack forces t
he execution of the macro @ CALL. However, if the procedure does not use the sof
tware stack, instead of macro @ CALL will wynegerowany plain JSR PROCEDURE comma
To the macro @ CALL MADS passes parameters calculated on the basis of the declar
ation procedure (breaking each parameter into three components: addressing mode,
parameter type, parameter value).
CALL_INIT @ 3 \ @ PUSH_INIT 3 \ @ CALL'@',' B ', 0 \ @ CALL'#',' W', 358 \ @ CAL
L '' W, '$ A400 "\ @ CALL_END PROC_NAME
Macro @ CALL postpone the accumulator onto the stack, then the value of $ 166 (3
58 dec), then the value from IP address $ A400. For more information on how to p
ass parameters to macro (meaning single quotes''and "") in Chapter call the macr
The parameter passed by the battery '@' should be always the first parameter pas
sed to the procedure if used in a different place the accumulator is modified (d
efault macro @ CALL impose such a restriction.) Of course you can change this by
writing his version of the macro @ CALL. In the case of the procedures. REG or.
VAR order of the parameter '@' does not matter.
Output from the procedure. PROC followed by the RTS command. After returning fro
m the procedure invokes the macro MADS @ EXIT that contains the program modifies
the stack pointer value @ STACK_POINTER, it is necessary for the proper operati
on of the software stack. Since the stack pointer is subtracted from the number
of bytes that were transferred for the procedure, the number of bytes is passed
as a parameter to the macro.
The addition of the RTS command in the body of the procedure at the exit of each
track is the responsibility of programming, not the assembler.

Parameters of the procedure, the appeal

References to the parameters in the procedure from the procedure does not requir
e any additional operation by the programmer, for example:
@ Stack_address equ $ 400
@ Stack_pointer equ $ ff
@ Proc_vars_adr equ $ 80
name. PROC (. WORD PAR1, par2)
lda PAR1
clc clc
adc par2
sta PAR1
lda 1 PAR1
adc 1 par2
a constant PAR1
. Endp
icl '@ call.mac'
icl '@ pull.mac'
icl '@ exit.mac'
MADS at the time the declaration. PROC with the parameters, makes an automatic d
efinition of these parameters by assigning values to them based on @ PROC_VARS_A
DR. In the above example, MADS will automatically defined parameters = @ PROC_VA
The developer refers to these parameters after the name of which was attributed
to them in the declaration of the procedure, which is similar to that in higher-
level languages. The MADS is possible to access the parameters in the procedure
from outside the procedure, which is no longer normal in higher-level languages.
We can read the above mentioned example of the contents of PAR1, for example:
lda name.par1
sta $ A000
lda name.par1 1
sta $ A000 a
The value of PAR1 has been rewritten to the address $ A000, the value of a PAR1
to the address $ A000 1. Of course we can only do this immediately after the end
of this particular procedure. It must be remembered that the parameters of such
procedures are postponed under a common address @ PROC_VARS_ADR, so with each n
ew procedure call stack using programowowy content area <@ PROC_VARS_ADR .. @ PR
OC_VARS_ADR + $ FF> changing.
If the procedure is no declared type parameters. REG programmer should take care
of it to remember them or properly use before they are modified by procedure co
de. In the case of type parameters. VARs do not have to worry about anything bec
ause the parameters are saved to a specific memory cells from which we can alway
s read them.

The main task of the local area in MADS is to create a new namespace for labels.

All labels defined in the local area. LOCAL is the local scale, it can also be d
efined as global labels locally defined random access because you can refer to t
hem what is not normal in other programming languages.
In the local area. LOCAL is possible to define a global label (see Labels global
If you wanted by the assembler label did not occur in the local area. LOCAL, the
n the MADS will look it up under the lower reaches of the global area.
Declaration by the local area. LOCAL
Local areas to the n / a directive:
[Name]. LOCAL [, address]
. LOCAL [name] [, address]
. Endl [. LEND] [. END]
[Name]. LOCAL [, address]
Declaration of a local area called name with the directive. LOCAL. Name of the a
rea is not required and is not necessary. For names of local areas can not use t
he names of mnemonics and pseudo orders. If the name is reserved for an error oc
curs Reserved word.
After the name of the local area (or the Directive. LOCAL), we can assemble your
new address of the local block. Upon completion of this block (. Endl) is retur
ned to the previous address assemble block length increased by a local.
label. local, $ 4000
. Endl
. Local Label2, $ 8000
. Endl
. Local
. Endl
. Local Label3
. Endl
All definitions of the labels in the area. LOCAL is the local type. To refer to
the global label of the same name as the label it must be preceded by local colo
n ':', eg:
lab equ 1
. Local
lab equ 2
lda # lab
LDX #: lab
. Endl
In the above example, the register A value of 2 is loaded, while the X register
value 1
If you wanted by the assembler label did not occur in the area. LOCAL, then it w
ill look in the macro (if it is currently being processed), then the procedure (
if a procedure is currently being processed), at the end of the main program.
In the local area declared all of the definitions of labels are distinguished by
the name of the local area. To reach the defined label in the local area outsid
e the local area we need to know the name and label it occurring, eg:
lda # name.lab1
LDX # name.lab2
. Local name
lab1 = 1
lab2 = 2
. Endl
So we use a dot "." in addressing such a structure. LOCAL.
Local areas can be nested, they can be placed in the body of the procedures decl
ared by the Directive. PROC. Local areas are additive, ie, there may be many loc
al areas of the same name, all the symbols in these fields will belong to a comm
on namespace.
. Endl
Directive. Endl declaration ends local area.
Example declaration of a local area:
org $ 2000
tmp LDX # 0 <------------- label in the global
lda obszar.pole <--- | reference to the local area
| |
. Local area | | Declaration of local area
| |
lda tmp <--- | |
| | |
lda: tmp | | <--- a reference to the global
| |
tmp nop <--- | definition in the local area
Golf lda # 0 <--- <--- definition of the local area
lda field <----------------- be appealed in a local area
. Endl end of the declaration of local area

MADS accepts a similar syntax as QA, XASM. However, it is less tolerant of the c
omments appearing at the end of the line (comments should be preceded by the app
ropriate sign) or a more tolerant in the case of white space and in cases of lac
k of argument to the command mnemonics CPU, for example:
asl -> asl @
lda # -> lda # 0

MADS accepts no white space separating the mnemonic and argument, provided that
the characters do not start an argument with a '@' is used in the names of label
s or signs '%', ':' used to determine the parameter number in macros (%% number:
number) , for example:
lda $ 44
lda #
lda (80), y

Signs of a single-line comment should be preceded by a ',' or '*'. For determina
tion of single-line comment, however, the safest way is to use a semicolon ';' b
ecause the '*' has other meanings, may mean an operation of multiplication, and
current address when you assemble. The semicolon and is dedicated only for comme
To determine the single-line comment is also possible to use characters'//', and
for a multi-character '/ * * /'.
* This is a comment
, This is a comment
lda # 0; this is a comment
dta 1, 3 * BAD COMMENTS WILL BE misinterpreted
org $ 2000 + 1 BAD COMMENTS WILL BE misinterpreted
nop / / this is a comment
/ / This is a comment
dta 1.2, / * comment * / 3.4
lda / * comment * / # 0
/ *
This is a multi-line comment
* /
This comment is also a multi
Signs indicating a multiline comment "/ * * / 'and the signs a one-line comment'
/ / 'can be used without restrictions.

Merge / Split multiple lines on one line listing

Any number of lines of code listing, we can combine (split) in a row using the c
haracter '\', eg:
lda 20 \ cmp 20 \ BEQ *- 2
lda 20 \ cmp 20 \ BEQ *- 2
lda # 0 \ lop sta $ A000, y \ ins \ bne lop; comment only at the end of this l
If the character '\' does not put a space, then the mnemonic or another, a strin
g may be interpreted as a label, it must be remembered that the character '\' me
ans the beginning of a new line.
MADS process finishes a poem, until it encounters a comment or you encounter the
end of the string, so we can post comments only at the end of such a multi-line
WARNING! Placing the character '\' at the end of the line means for the MADS-a d
esire to continue the current line on the next line, for example:
lda \
# \
For the above example, we get an order 'LDA # 12'.

Combining multiple mnemonics

The possibility of combining two mnemonics using the colon character ':' is alre
ady known XASM-a. The MADS this opportunity was extended to linking any number o
f known MADS-those mnemonics, such as:
lda: cmp: req 20
lda: ins: sta: ins $ 600, y

The term expression is the sequence of operators and operands (arguments), which
specifies the operations, ie the nature and sequence of calculations. Compound
expression is called a phrase, which occurs two or more operators. Operators tha
t affect only one operand, called the jednoargumentowymi (unarnymi). Binary oper
ators are called binary.
Evaluating the expression goes in order, set the priority of operators in the di
rection specified by direction of the bond operators.

decymalny record:
write hexadecimal:
$ 100
$ E430
$ 000,001
write binary:
% 0001001010
$ 000000001
$ 001,000
ATASCII write codes:
'W' *
INTERNAL entry codes:
"." *
Only the first character ATASCII, INTERNAL is significant. The '*' for the apost
rophe causes INVERS closing mark.
In addition, there are still two operations '+' and '-' for strings, which incre
ase / decrease in restricted character codes quotes.
"FDttrteSFSD" -12
'FDSFdsldksla' 2

Binary operators:
+ 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 (the same as <>)
<Less than
> Greater Than
<= Less or Equal
> = Greater or Equal
& & Logical And
| | Logical or

Unary operators:
Plus + (does nothing)
- Minus (changes sign)
~ Bitwise not (complements all bits)
! Logical not (true, false changes and vice versa)
<Low (extracts low byte)
> High (extracts high byte)
^ High 24bit (extracts high byte)
= Extracts memory bank
: Extracts global variable value

Operator precedence:
first [] (brackets)
+ - ~ <> (Unary)
* /% & <<>> (Binary)
+ - | ^ (Binary)
= == <>: = <> <=> = (Binary)
! (Unary)
& & (Binary)
last | | (binary)

Labels defined in the program may have a range of local or global, depending on
the location in which they were defined. In addition, you can define a temporary
label, which may also have local or global scope.

Global label indicates that it is visible from anywhere in the program, regardle
ss of whether it is a macro. MACRO procedure. PROC or local area. LOCAL.

Reach local labels means that it is visible only in specifically defined area, s
uch as the directive:. MACRO. PROC. LOCAL.
Labels must start with a ['A' .. 'Z', 'a' .. 'from','_','?','@']
Other acceptable characters are labels ['A' .. 'Z', 'a' .. 'z', '0 '.. '9','_','
Labels always appear at the beginning of the line
preceded by the label "white space" should end with a ':' to avoid any misinterp
retation of such a label as a macro
in addressing the label may be preceded by a ':' This informs the assembler that
we refer to the labels in the main block of the program (refer to label output)
Example definitions of the labels:
? Name EQU $ A000; definition of a temporary global label
name = *, the definition of a global label
name2 = 12; the definition of a global label
@? Name EQU 'a' 32, the definition of a global label
name: equ 12; no global definition of the label starts with the first trade ro
name: = 'v', the definition of global labels are not starting with the
first trade row
Compared to the QA / XASM came the ability to use a question mark '? " and "monk
eys" '@' in the names of labels.
Use a dot "." in the name of the label is acceptable, but not recommended. The d
ot is reserved for the determination of the extension mnemonics, assembler direc
tives to determine the addressing of new structures of the MADS-a.
The dot "." at the beginning of the name of the label suggests that this is the
assembler directive, but a question mark '? " at the beginning of the label mean
s a label a temporary, so the value of which may change frequently during assemb

Local Labels
Any definition of the label within the macro. MACRO procedure. PROC or local are
a. LOCAL default is the local scale, in other words, it is local. Such labels yo
u do not need extra mean.
Local labels are defined using the n / a pseudo-equivalent commands:
To have access to the labels on a global scale (ie defined outside the macro. MA
CRO procedure. PROC, the local area. LOCAL) and the same names as local, use the
operator ':', eg:
lp LDX # 0; definition of a global label LP
test. macro
lda: lp; character ':' before the label will read the label value of globa
l LP
became an item, a reference to a local label LP in the macro
lp lda # 0; definition of local label LP in the macro
. Endm
In the above example would be the definitions of the labels of the same name (LP
), but each has a different value and other coverage.

Global Labels
Any definition of the label made in the main block of the program outside the ma
cro. MACRO procedure. PROC or local area. LOCAL is global coverage, in other wor
ds, is global.
Labels are defined using the global n / a pseudo-equivalent commands:
or directive. DEF syntax is:
. DEF: label [= expression]
Directive. DEF to define labels in the current local area, the character ':' on
the label indicates the beginning of a global label. Use the directive syntax. D
EF: label allows you to define a global label without the current level of local
Colon ':' at the beginning of the label has a special meaning, informed that we
refer to the global label, or labels from the main program block ignoring all le
vels of local.
For more information on using the directive. DEF directive in the chapter. DEF
An example of a global definition of the label:
lab equ *
lab2 equ $ 4000
? Tmp = 0
? Tmp + = 40
. Proc name
. Def:? Name = $ A000
. Def name = 20
. Local lok1
. Def: @? Name = 'a' 32
. Endl
. Endp
An example of the definition of a global temporary labels, among others CALL @ m
acro file (.. \ EXAMPLES \ MACROS \ @ CALL.MAC), in which there is a definition
of temporary tags? @ STACK_OFFSET. It is later used by other macros, called from
the macro @ CALL, and to optimize the parameters on the stack odkladajacego pro
@ CALL. Macro
. Def? @ Stack_offset = 0; definition of a global temporary label? @ Stack_off

CALL_ @ @. Macro
fixed @ stack_address +? @ stack_offset, x
. Def? @ Stack_offset =? @ Stack_offset + 1; modified labels? @ Stack_offset
. Endm
Labels temporary
The definition of temporary labels have the property that its value may change f
requently, even during the course of assembling one. Normally, an attempt to re-
definition of the label ends with the message Label Declared twice. There will b
e no such a message if it is a temporary label.
The range of temporary labels is dependent on the area in which the label has be
en defined. Labels can have temporary in scope (local label) or global (global l
Temporary label defines the user by placing a label name at the beginning of a q
uestion mark '?', Eg:
? Label
Temporary labels should not be used to the names of the procedures. PROC, macro.
MACRO, local areas. LOCAL, structures. STRUCT, tables. ARRAY.
Define a temporary label with n / a pseudo-equivalent commands:
In addition, they can be modified using familiar with C operators:
-= Expression
= Expression

The above applies only to operators that modify the temporary labels, trying to
use them for any other type of label will end up with an error message Improper
Example of use of temporary tags:
? Loc = $ 567
? Loc2 =? Loc $ 2000
lda? loc
sta? loc2
? Loc = $ 123
lda? loc

Local labels in the style of the IEA

Option OPT? MADS to inform the labels that begin with '? " interpreted as a loca
l label, as does the IEA. By default, the labels that begin with '? " are treate
d by MADS as a temporary label Labels temporary.
Example of use of local labels in the style of the IEA:
org $ 2000
local1 LDX # 7
? Lop sta $ A000, x
bpl? lop
local2 LDX # 7
? Lop sta $ B000, x
bpl? lop

Sparta DOS X
Construction of Sparta DOS X-Files, Atari DOS
Reprinted from Serious Magazine, author Qcyk / Dial.
File itself is only a few notable collection of bytes. Lots of numbers, which ca
n mean anything and yet nothing if you do not know how to interpret them. Most o
f the files to fit on the ground in a variety of headings, which are stored info
rmation about what the file contains, possibly as he was then taken for the read
ing. They include the executable binary, or simply intended to be loaded from th
e DOS'u. Indeed, it is a DOS program and like everyone else has a right to expec
t of a particular, known structure to it.
Traditional binary files, which are recognized by all DOS'y for Atari XL / XE, a
re building block, where each block has its own header. There are two types of h
1. dta a ($ ffff), and (str_adr) and (end_adr)
2. dta a (str_adr) and (end_adr)
str_adr - the address that will be loaded first byte of data
end_adr - the address that will be loaded the last byte

The first block in the header file must have a $ ffff, any other blocks. With th
e heading, of course, should be included in the amount of data:
(End_adr-str_adr) 1
So much by way of reminder. The creators of Sparta DOS X retain the above standa
rd, while adding several new types of headers. So we are still dealing with a fi
le divided into blocks, except that the types of units are now much more. Here t
hey are:

1. Block nierelokowalny (loaded into permanent address in memory):

dta a ($ fffa) and (str_adr) and (end_adr)
This is the same as a block of $ ffff - no matter which will be used. $ Fffa wil
l, however, clearly indicate that the program is designed for SDX - another DOS
can not read the file.

2. Block relokowalny (MEMLO loaded into the memory of that type):

dta a ($ FFFE), b (blk_num), b (blk_id)
dta a (blk_off) and (blk_len)
blk_num - block number in the file. Relokowalny Each block should have its own n
umber. Since the addresses of the charging units are not known, the blocks are i
dentified just by their numbers. They may be in the range 0-7, except that in pr
actice it is usual numbered from 1 upwards.
blk_id - bits 1-5 are the index of the memory block which is to be loaded. I met
with two values:
$ 00 - Base Memory
$ 02 - Extended memory
Setting bit 7 also means that no data block. SDX nothing if not loads, but reser
ves the memory.
blk_off - so called. offset addresses in the block, which is simply the address
that was assembly code. This is needed when updating the address referring to th
e contents of the block.
blk_len - the length of the block. So much data should be in the header, unless
it is reserving a block of memory if the data does not exist.
Writing code relokowalny keep in mind a few restrictions imposed by the idea of
"przemieszczalnego" code. All addresses that refer to an area of such a program
must be updated during charging, therefore, can not use sequences such as:
lda something
something equ *
Instead, it remains for example:
lda _cos
LDX _cos 1
_cos dta a (something)
something equ *

3. Block update addresses relating to the block relokowalnego:

dta a ($ fffd), b (blk_num) and (blk_len)
blk_num - block number, to which the updated addresses.
blk_len - update block length (without header). It is ignored.
Addresses are updated by adding to address the existing gap between the address
at which the block was loaded relokowalny indicated, and the value blk_off (asse
mble at) this block. This can be represented by the formula:
ADR = ADR (blk_adr-blk_off)

"Body" are indicators of a block upgrade to poprawianych addresses, and special

orders. The index is a number between $ 00 - $ fb and is offset from the place o
f the previous update. This place is remembered by the loader as a direct addres
s, let's call him the meter upgrade. This counter can be initiated by means of s
pecial functions, which are of greater than $ fb:
$ Fc marks the end of the block update
$ Fd, a (ADDR) is updated directly by the designated address ADDR. Thus, the val
ue of ADDR is entered in a counter update and it will be counted from the next s
$ Fe, b (blk_num) to update the counter is inserted to block the address indicat
ed by blk_num, that subsequent updates will apply to the code in this block,
$ Ff update counter is incremented by $ fa (without updating the address).

4. Block update addresses the procedures defined by the following symbols:

dta a ($ fffb) c'SMB_NAME ', and (blk_len)
SMB_NAME - symbolic name of the procedure (or an array, the system registry, etc
.) The eight characters in the code ATASCII,
blk_len - as in a block of $ fffd.

After the header is a string of indicators for the position to update the addres
s - just like in a block of $ fffd. Addresses are changed by adding to an existi
ng address, the procedure specified symbol. This allows you to use the procedure
s in the programs, whose addresses do not know, for example, procedures added by
other programs in an SDX. Also, system procedures should be used in this way, y
et they may have different addresses in different versions of Sparta.

5. The block definition of new symbols:

dta a ($ fffc), b (blk_num) and (smb_off)
dta c'SMB_NAME '
blk_num - block number, which is a defined procedure. It follows that the proced
ure must be loaded as a block relokowalny.
smb_off - moving the procedure address in the block, which is offset procedure,
the beginning of the block (first byte is 0) plus the value of blk_off this bloc
k. Otherwise, the address at which the procedure was zassemblowana, SMB_NAME - a
symbolic name defined procedure.
Blocks of type $ fffb, $ fffc, $ fffd are not permanently retained in memory. Th
e system uses them only when the program loads.

Programming Sparta DOS X (SDX)

Syntax for handling Sparta DOS X, is taken from FastAssemblera by Mark Goderskie
go below quote from the manual that came with the FA. Source Files *. FAS can no
w assemble without any major problems MADS-I. Relokowalne orders are always two
byte argument, it is not possible relokowania 3 byte arguments (65,816).
The most important novelty in the SDX is possible for a programmer to write simp
le programs relocatable. Since the MOS 6502 processor does not have a relative a
ddressing, (except short conditional jump), developers of the ICD used a special
program blocks charging mechanisms. The whole process is based on the block, an
d then special block the update addresses. All addresses in the block of the pro
gram are at zero. Just so add to them the value of memlo to get the address righ
t. Which is to increase and which to leave? That is what the update is a special
block that contains pointers (specially coded) to those addresses. So after a b
lock or blocks reloc is obligatory UPDATE ADDRESS for proper operation of the pr
ogram. SPARTA Also, the blocks in which the orders (or vectors) refer to the blo
cks or EMPTY reloc is obligatory UPDATE ADDRESS.
Another innovation is the introduction of symbols. Well, some procedures have be
en defined SDX service by name! These names are always 8 characters (like file n
ames). Instead of using an array of vectors or strokes (as in OS) we use the sym
bols defined SMB. After loading the block or blocks of the SDX update loads a bl
ock of symbols in a similar fashion to replace relocatable address blocks in the
program. Symbols can be used for blocks reloc and SPARTA.
The programmer can define your own symbols replacing SDX or completely new for u
se by other programs. This is done through a block of NEW UPDATE. However, know
that the new symbol must be included in the block Reloc.
Number of blocks reloc and EMPTY is limited to 7 by the SDX.
Such blocks can be combined in chains such as:
blk $ 600 sparta
blk main reloc
$ 100 blk empty main
blk reloc extended
blk empty $ 200 Extended
This means that orders in these blocks can refer to all the blocks in the chain.
Such a chain is not interrupted by the update addresses, or symbols but is destr
oyed by the definition of a new symbol, and the other blocks (ie: dos).
Note: A string is meaningful only if all its blocks are loaded into the same mem
ory, or when the program switches to the appropriate appeals memory.
Note: Commands and vectors in blocks EMPTY reloc and should not refer to the blo
cks SPARTA! This can cause confusion when the user loads the program LOAD comman
d, and use it after a long time. While the blocks reloc and EMPTY are safe is yo
u never know what is in memory of where he was last block SPARTA!
Equally dangerous is the use of appeals to block the reloc and EMPTY blocks SPAR
TA (reason as above), but when you install the overlays (*. sys), using the INST
ALL it is sometimes necessary, hence it is acceptable. You can also initiate a b
lock of Sparta (porzez $ 2E2), then it will be always running, and then becomes
Note: Between blocks SPARTA, and reloc and EMPTY occur between the addresses! FA
recognize references to other blocks through the addresses, assuming the PC for
the reloc and EMPTY from $ 1000, so when you mix these blocks should be confide
nt of SPARTA is below $ 1000 (eg $ 600) or above the last block relokowalnego, $
4,000 is usually sufficient This error is not detected by the compiler!

Relokowalny code is the code that does not have a predetermined address to the c
omputer's memory load, such a code has to work regardless of the load address. T
he Atari XE / XL provides a system of code relokowalny Sparta DOS X (SDX), more
on this subject can be read in the chapter Programming Sparta DOS X
Relokowalny code for the SDX has a fundamental limitation which is relocated add
resses only WORD, and there is no instruction manual CPU 65816th MADS provides t
he ability to generate code relokowalnego SDX format and its own incompatible wi
th the SDX, which abolishes the previously mentioned limitations.
Recording format code file relokowalnym MADS-a is similar to that known from SDX
, as there is here the main block and blocks with additional information on the
addresses to be subjected to relocation. MADS uses a simpler update record block
s, with no "compression" that applies SDX.
Advantages of code relokowalnego MADS-a:
take into account the size of the arguments for the CPU 6502, 65816
You can use all the commands the CPU, without restrictions
allows the relocation of young and old address bytes
Code limitation relokowalnego MADS-a:
EQU statement labels make the block. Reloc
if you want to define a new label in the block. Reloc have its name preceded by
a space or a tab (global label)
You can not use pseudo orders ORG, RMB, LMB, NMB, and the directive. DS
You can not relocate the oldest byte of 24bit words, eg lda ^ $ 121,416
An example of how easy it is to create a code file is relokowalny .. \ EXAMPLES
\ TETRIS_RELOC.ASM, which from the list of commands used and the CPU pseudo-inst
ruction defining the data does not differ from the version nierelokowalnej .. \

Block relokowalny. Reloc

Block relokowalny MADS-a is generated by using the directive:
. Reloc [. BYTE |. WORD]
Block for block updates relokowalnego MADS-a call using a pseudo-command BLK:
After the directive. Reloc can specify a block relokowalnego (. BYTE. WORD), the
default is type. WORD. Type. BYTE block applies only intended to be placed at z
ero (the orders will include the zero), MADS will asemblowal a block from the ad
dress $ 0000th Type. WORD means that the MADS will asemblowal relokowalny block
from address $ 0100 and will be designed to be placed in any area of memory (not
orders will include the zero).
Header block. Reloc resembles the one known from DOS, in addition, it has been e
xtended to 10 new bytes for a total occupies 16 bytes, for example:
MADS_RELOC_HEADER always a value of $ 524D corresponding characters 'MR' (M-ADS
FILE_LENGTH relokowalnego block length is not 16 byte header
CONFIG is currently used only bit0 of a byte, bit0 = 0 means block relokowalny a
ssemble from address $ 0000, bit0 = 1 block relokowalny assemble from address $
Last 6 bytes contain information about the values of labels needed for the opera
tion software stack STACK_POINTER @ @ STACK_ADDRESS, @ PROC_VARS_ADR if used dur
ing the assembling of relocatable blocks. If the individual blocks. Reloc were z
asemblowane with different values of these labels and they are linked if there i
s a warning message to Incompatible stack parameters. If the software stack has
not been used values for these labels are zero.
Pseudo order. Reloc MADS-switches and code-generation mode relokowalnego from co
nsidering the size of the command arguments CPU 6502, 65816th Under such a code
is impossible to use the pseudo-instruction ORG, LMB, NMB, RMB, and the directiv
e. DS. It is impossible to return a MADS-mode code generation relokowalnego not,
it is possible to generate more than one block. Reloc.
Use of the Directive. Reloc will also increase the counter of virtual banks MADS
-a, so that area becomes a local and visible to other blocks. For more informati
on on virtual banks in section Virtual memory banks (B-OPT).
At the end of the block. Reloc is required to generate a block update, implement
a pseudo-BLK command syntax with the same block as the SDX relokowalnego (BLK U
PDATE ADDRESS "). Recording format of such a block update is not identical with
the SDX, is as follows:
HEADER always worth $ FFEF
TYPE type of data is saved on the 0th bits of this byte .6 and specifies the typ
e of modified addresses, "<" character is an address byte, a ">" means a byte ad
DATA_LENGTH is the number of 2-byte data (addresses) to modify
DATE is the correct string of data for the modification of the main block reloko
walnego. At the address specified here should read a value of type TYPE and then
modify it under the new loading address.
The exception is the block update for the older byte address ">", for that block
is still DATA save the extra byte BYTE (modified byte address). To update the o
ld bytes, we must read the byte from the address in the DATA WORD, add it to you
r current address for the relocation and add the lower byte of the WORD in DATA.
So the newly calculated byte placed at the DATA WORD.
External Symbols
External Symbols indicate that the variables and procedures that represent will
be located somewhere on the outside, beyond the current program. We need not spe
cify where. We just need to give their names and types. Depending on the type of
data that represents a symbol of assembler instructions are translated into the
appropriate machine code, assembler needs to know the size of used data.
Currently there is no option to manipulate external symbols such as '^' (the old
est byte).
External Symbols can be used in relocatable blocks. Reloc blocks as well as ordi
nary DOS.
External Symbols (external) declare the EXT command using a pseudo or directive.
EXT label type
label. EXTRN type
. EXTRN label1, Label2, Label3 ... type
Block Update for calling external symbols using a pseudo command BLK:
NOTE: You will be saved symbols that were used in the program.
External symbols are not only defined value type (. BYTE. WORD. LONG. DWORD), fo
r example:
EXT name. BYTE
wait EXT. PROC (. BYTE Delay)
External symbol of the declaration procedure. PROC adopt default type. WORD, an
attempt to appeal to the name of such a label will be interpreted as an attempt
by the MADS procedure call, more about procedure calls. PROC Chapter Procedures.
In the process of assembling after encountering references to external symbols a
re always substituted for zero.
External symbols can be useful to us when we zasemblowac program separately from
the rest of the actual program. In this program, there are often references to
the procedures, variables that are defined elsewhere, outside, and we do not kno
w their value only type. At this point, with the assistance of external symbols
come, which allow assembling of such a program despite the lack of proper proced
ures or variables.
Another use of external symbols can be called. "Plugins" external programs combi
ned with the main program and implementing additional actions. These are specifi
c types of libraries that use the procedure for the main program, extending its
functionality. To create such a plugin would be to determine which procedure pro
vides the main program (the name and type parameters) and a procedure for readin
g a file from the external symbols, this procedure would implement a plug to att
ach to the main program.
Below the header format in the file with external symbols of a B-USED, W-ORD, L-
ONG and D-WORD after the call by BLK EXTERNAL UPDATE:
DATA WORD .. .. ..
HEADER always worth $ FFEE
TYPE type of data is saved on the 0th bits of this byte .6 and specifies the typ
e of modified addresses
DATA_LENGTH is the number of 2-byte data (addresses) to modify
LABEL_LENGTH a symbol name length in bytes
LABEL_NAME is the name of the symbol in the codes ATASCII
DATE proper sequence data for the modification of the main block relokowalnego.
At the address specified here should read a value of type TYPE and then modify i
t based on the new value of the symbol.
An example of the application of external symbols and structures. STRUCT is a sa
mple collection of graphical primitives (PLOT, LINE, CIRCLE) from the directory
.. \ EXAMPLES \ LIBRARIES \ GRAPHICS \ LIB. Individual modules here use quite a
large number of variables at zero, if we want to address these variables were re
lokowalne each of them separately would have to declare a variable as an externa
l symbol of the EXT (or. EXTRN). This can be simplified by using only one symbol
and an external data structure. STRUCT. Using the structures we define a "map"
variables ZP, then an external symbol ZPAGE type. BYTE variables because we want
to be at zero. Now, referring to a variable we write it in such a way that forc
es relokowalnosc ZPAGE ZP.DX, and so was completely relokowalny module with the
possibility of change of address variables in the zero space.

Public Symbols
Public symbols available variables and procedures occurring in the remainder of
the block relokowalnym asemblowanego program. With public symbols can refer to v
ariables and procedures "sewn" such as libraries.
Public symbols can be used in relocatable blocks. Reloc as well as the usual blo
cks of DOS.
MADS automatically detects whether the publicity given to the label is a variabl
e, constant or zadeklarowna the procedure. PROC, do not require any additional i
nformation as the external symbols.
Declare public symbols with n / w directives:
. PUBLIC label [, ,...] Label2
. GLOBAL label [, ,...] Label2
. GLOBL label [, ,...] Label2
Directive. GLOBAL and. GLOBL were added with a view to compatibility with other
assemblerami, their meaning is identical with the Directive. PUBLIC.
Block renovation of public call for symbols using a pseudo command BLK:
Below the header format in the file with public symbols after the call by BLK UP
MADS automatically selects the appropriate type for upublicznianej label:
C-ONSTANT label uncontrolled relocation
V-ARIABLE label uncontrolled relocation
P-ROCEDURE declared by the procedure. PROC, subject to relocation
A-RRAY declared by the board. ARRAY, subject to relocation
S-TRUCT declared by the structure. STRUCT, is not subject to relocation
If the symbol relates to the structure. STRUCT be saved for additional informati
on (field type structure, the name of the field structure, the number of repetit
ions of a field structure):
If the symbol relates to the array. ARRAY if additional information is saved (th
e maximum declared array index, type, declared an array of fields):
If the symbol relates to the procedure. PROC if additional information is record
ed, regardless of whether the procedure was or was not declared parameters:
PROC_CPU_REG byte (bits 00 - Rega, 01 - regX, 10 - Regy)
For the symbols on the procedures. REG are saved now only the types of these par
ameters in an amount PARAM_COUNT:
For the symbols on the procedures. VAR parameter types are saved and their names
. PARAM_COUNT specifies the total length of the data:
HEADER always worth $ FFED
LENGTH is the number of symbols stored in the block update
TYPE symbolized the type of B-USED, W-ORD, L-ONG, D-WORD
For P-type saves additional information: PROC_CPU_REG, PROC_TYPE, PARAM_COUNT, P
For A written additional information: ARRAY_MAX_INDEX, ARRAY_TYPE
For Type-S saves additional information: STRUCT_LABEL_TYPE, STRUCT_LABEL_LENGTH,
LABEL_LENGTH public symbol of the label length in bytes
LABEL_NAME label symbol codes stored in the public ATASCII
ADDRESS address assigned to the symbol in the block relokowalnym. Reloc. This va
lue is subject to relocation by adding to its current address assemble.
PROC_CPU_REG information on the order of use of CPU registers for procedure type
PROC_TYPE type of procedure:
D-EFAULT default type to pass parameters using a software stack of a MADS-
R-EGISTRY parameters for the procedure are reported by the CPU registers (. REG)
V-ARIABLE parameters for the procedure are reported by the variables (. VAR)
PARAM_COUNT information on the number of parameters in the procedure (. REG) or
the total length of data containing information about the type of parameters and
their names (. VAR)
PARAM_TYPE type of parameters recorded by the characters 'B', 'W', 'L', 'D'
PARAM_LENGTH length of the name of the parameter (. VAR)
PARAM_NAME parameter name, the codes ATASCII (. VAR)

Linking. LINK
. LINK 'filename'
Directive. LINK requires a filename as a parameter to the relocation. Acceptable
files are only DOS Atari, SDX files are not accepted.
If the file load address is different than $ 0000, this means that the file does
not contain code relokowalnego, but may include blocks updates for external and
public symbols. Directive. LINK accepts files of any load address, but are subj
ect to relocation of the address only charging $ 0000, for more details on the c
onstruction of such a file is contained in Chapter block relokowalny. Reloc.
Directive. LINK allows you to connect with nierelokowalnym relokowalnego code. M
ADS on the basis of block updates are made automatically relocate the file. Incl
udes all three types of update blocks (ADDRESS, EXTERNAL, PUBLIC).
There is no limit to the address at which the file is placed relokowalny.
If you block the action requires relokowalny software stack and the MADS-label S
TACK_POINTER @ @ STACK_ADDRESS, @ PROC_VARS_ADR will be updated automatically fr
om the header block. Reloc. It is required that the blocks. Reloc and the main p
rogram operated on the same software stack if it is necessary.

Available commands 6502
It is possible to extend the use of mnemonics by a dot "." for such orders LDA,
. B or. From BYTE
. A or. In or. Q WORD
lda.w $ 80, AD 80 00
lda $ 80; A5 80

Available commands 65,816

Of course, there are orders to 6502, and apart from them:
It is possible to extend the use of mnemonics by a dot "." for such orders LDA,
. B or. From BYTE
. A or. In or. Q WORD
. T or. L TRIPLE, LONG (24bit)
lda.w # $ 00; A9 00 00
lda # $ 80; A9 80
Exceptions are the commands n / a, which can not resize the absolute register ad
dressing (some assemblers do not require these commands provide a '#', but this
requires MADS)
# $ Xx
# $ Xxxx
Another exception is the long indirect addressing mode, which is represented by
square brackets []. As we know, this type of braces are also used to calculate e
xpressions, but if the assembler encounters the first character '[' considers it
a long indirect addressing mode, and if not signaled willingness to use 65816 w
ith an error message Illegal Addressing Mode. To "cheat" assembler enough to giv
e the square opening bracket '[' character ''.
lda [2 4], lda [6]
lda [2 4], lda 6
Detection of CPU6502, CPU65816
An example taken from the http://www.s-direktnet.de/homepages/k_nadj/cputest.htm
l. The program is able to diagnose the presence of one of the microprocessors: 6
502, 65C02, 65816th
/ *
How to detect CPU on Which the assembler code is running
(This information is from Draco, the author of SysInfo 2.0)
You can test it plain 6502-Code if there is a 65c816 CPU, the 16-bit processor a
In some XLS as a turbo-board, avaible. Draco told me how to do this:
First we make sure, Whether we are running on NMOS-CPU (6502) or CMOS (65c02, 65
I will just show the "official" way Which doesn `t uses 'illegal opcodes':
* /
org $ 2000
c opt
lda # $ 99
adc # $ 01
LDX # <_6502
ldy #> _6502
$ c642 jsr
lda # 0
lda # 0
rep #%00000010 ;wyzerowanie bitu Z
bne DetectCPU_C816
LDX # <_65c02
ldy #> _65c02
$ c642 jsr
lda # 1
LDX <_65816
ldy> _65816
$ c642 jsr
lda # $ 80
Dta c'6502 _6502 ', $ 9b
_65c02 C'65c02 dta ', $ 9b
Dta c'65816 _65816 ', $ 9b

The next example of detection of the CPU is limited to determining the presence
of the microprocessor 6502 or 65816th Program after disasemblacji different look
for 6502, contrary to the 65816th 6502 orders 'inc @' deems 'nop' command 'xba'
deems 'sbc #'. Through such "transparency" we can be confident that the program
will not perform any illegal operations and honestly recognize the right CPU. T
he originator of this concise and very clever test is Bassewitz von Ullrich.
org $ 2000
opt c; 65816 enabled
lda # 0
inc @; increment accumulator
cmp # 1
bcc cpu6502
, The ultimate test for the presence of 65,816
xba; put $ 01 in B accu
dec @ A = $ 00 if 65C02
xba; get $ 01 back if 65816
inc @; make $ 01 / $ 02
cmp # 2
bne cpu6502
LDX <text65816
ldy> text65816
$ c642 jsr
LDX <text6502
ldy> text6502
$ c642 jsr
text6502 c'6502 dta ', $ 9b
text65816 c'65816 dta ', $ 9b

Probably everyone who had anything to do with the architecture of a small Atari,
the term "memory bank" is associated with enhanced memory, divided into the siz
e of 16kb banks, switched in the area <$ 4000. $ 7FFF>.
MADS can also be understood in this way (optional OPT B Hardware memory banks),
but by default it is understood in a more virtual (Option B-OPT, Virtual memory
Banks apply to the n / a pseudo orders:
LMB # value

LMB # (Load Memory Bank)

Set the timer MADS-banks and on the specific value of <$ 00. $ FF> (BANK = value
), eg
lmb # 0
lmb # bank
lmb # 5, $ 6500; only when the OPT B

NMB (Next Memory Bank)

Increase by 1 meter banks MADS-a (BANK = BANK 1).
NMB $ 6500, and only when the OPT B
RMB (Reset Memory Bank)
Resets the MADS-a bank (BANK = 0).
RMB $ 3500, only the OPT B
RMB $ 8500, only the OPT B

MADS during assemble, each newly defined label assigns the current count value o
f the banks. The developer can have an impact on the counter value of banks by t
he aforementioned pseudo-command.
Labels assigned the bank counter MADS-a = 0 are global coverage.
Labels assigned the bank counter MADS-a> 0 is the local coverage.

Virtual memory banks (B-OPT)

The MADS by the term "virtual memory bank" is understood any area designated by
the newly defined label assigned to the counter current value of the banks (bank
s default counter is reset). Or virtual memory bank is not necessarily the memor
y area <$ 4000. $ 7FFF>, but each label represents an area code, which has been
assigned the code (the counter value of banks) from the <$ 00. $ FF> using the a
ppropriate pseudo-first orders for use by the programmer (NMB, RMB, LMB).
Exceptions are blocks. Reloc where you can not independently change the bank cou
nter, it automatically performs the MADS, which increases the counter each time
you call the directive. Reloc. Counter bank in which case the value of <$ 0,001t
h. $ FFF7>.
The programmer can read the counter value of banks, which has been assigned the
label using the '=' example:
LDX # = label
In the above example, the register of the CPU regX saved value of the counter me
mory banks and the MADS-assigned label LABEL.
Another useful operator may be a colon ':' on the beginning of the name of the l
abel. This will cause the value of the MADS read the label apart from the limite
d range, which introduces the counter-a MADS banks. Sometimes it can cause compl
ications, such as if there have been more labels with the same name but differen
t local areas or in areas with different values of the counter of virtual banks.
lmb # 5
lmb # 6
lda: label5
For the above example, no operator ':' at the beginning of a label name in the o
rder 'lda: label5' ends with an error message ERROR: Undeclared label LABEL5 (BA
NK = 6).
Virtual memory banks can be used to index an array containing the values for POR
TB. This is what they use if you choose B OPT.

Hardware memory banks (OPT B)

This mode of operation and the MADS-described as "sensitive to the banks" (BANK
Hardware memory banks are an extension of virtual banks. They are the MADS as ba
nks expanded memory, included in the area <$ 4000. $ 7FFF>. Action pseudo orders
NMB, RMB, LMB is extended by a call @ BANK_ADD macros that can be found in the
directory .. \ EXAMPLES \ MACROS \.
In this mode of operation needs a declaration of MADS specific macros:
and requires the definition of labels with names:
@ TAB_MEM_BANKS label specifies the address of the array from which values will
be transcribed in the register of PORTB is responsible for switching banks expan
ded memory. We can help realize and take advantage of the ready detection proced
ure, extended memory banks attached to the MADS-a, file .. \ EXAMPLES \ PROCEDUR
@ PROC_ADD_BANK label is used by the macro @ BANK_ADD and defines the address at
which program code will be extended memory bank switching.
The programmer can read the counter value of banks, which has been assigned the
label using the '=', eg:
ldy # = label
In the above example, the register counter value saved Regy memory banks and the
MADS-assigned label LABEL.
If the counter of banks MADS-a = 0 is:
program code must be placed outside the <$ 4000. $ 7FFF>
the newly defined labels in this area are global
can be appealed to all defined labels without limitations, regardless of the num
ber of bank
jump in the area of the bank's possible using a macro @ BANK_JMP (.. \ EXAMPLES
\ MACROS \ @ BANK_JMP.MAC), a parameter for this macro need not be preceded by a
n operator ':'
If the counter of banks MADS-a> 0 is:
program code must be placed in the <$ 4000. $ 7FFF>
the newly defined labels in this area are local
can be appealed only to the global labels and those defined in the current bank
pseudo order LMB, NMB executes a macro @ BANK_ADD, which includes a new bank und
er the expanded memory banks of the MADS-counter and sets the new address and as
semble (by default on $ 4000)
pseudo order of RMB will reset the counter MADS-memory banks, and setting a new
address assemble outside the bank (by default on $ 8000)
jump in the area of another bank can use a macro @ BANK_JMP (.. \ EXAMPLES \ MAC
ROS \ @ BANK_JMP), a parameter for this macro must be preceded by the operator '
An example of this mode of operation is a MADS-file .. \ EXAMPLES \ XMS_BANKS.AS
M. In this example, the program code is located in two different banks, expanded
memory and perform as if it were a single entity.

- Added macro relokujace RMT modules ... \ EXAMPLES \ MSX \ RMT_PLAYER_RELOCATOR
- Added a test for the syntax does not asemblowanych procedures. PROC is activat
ed when the switch-x "Exclude unreferenced Procedures"
- Fixed the switch "-d: label [= value]", specifying the value for the label is
now optional, defaults to assign the value of a mads
- Directive. DS. ALIGN will not cause the allocation of the variables defined. V
- Allocation of variables. VAR for the new block will not occur if the ORG ORG b
lock is located in the block. LOCAL or. PROC
- Fixed breaking line character '\' in strings limited by brackets ()
- Removed bug causing the relocated address for the express directive. ERROR (ER
- Removed bugs when parsing command line parameters
- Removed bugs relating to optimize the length of the macro code instruction MVA
, MWA, etc.
- Revised code of pursuing nesting blocks. PROC
- Improved performance of pseudo code for executing the orders IFT condition ELI
- Added the message "'#' is allowed only in repeated lines" for use cases the lo
op counter # (. R) outside the loop
- Removed bug causing incorrect allocation of variables declared in the directiv
e. VAR during the execution of a macro
- In order to unify the syntax reference to the enumerated types of labels are p
ossible only through a full stop '.', Previously also by the '::'
- Possibly less appeal to the enumerated types enum_label (fields), for example:
. Enum type
val0 = 1
val1 = 5
val2 = 9
. Ende
lda # type (val0 | val2) == "lda # typ.val0 | typ.val2"
- Extended syntax of the directive. SAV, for example:
. Sav 'filename', offset, length
. Sav 'filenema' length
. Sav [offset] 'filename', offset2, length
. Sav length
. Sav offset, length
- Extended syntax of the directive. ARRAY, in the absence of administration of t
he maximum array index will be calculated on the basis of the quantity of elemen
ts, the elements can be introduced without the need to precede the index [expres
sion], for example:
. Array temp. Byte
1,4,6, [0 .2] = 1,4,6
[12] = 9.3; [12th .13] = 9.3
[5]: [8] = 10.16; [5 .6] = 10.16, [8th .9] = 10.16
0,0, \; [14th .17] = 0,0,1,1
. Enda, 18 elements, TEMP [0 .17]
- Added possibility to allocate a variable of type structured by means of direct
ives. VAR and. ZPVAR, for example:
. Struct Point
x. byte
y. byte
. Ends
. Var a, b, c Point
. Zpvar Point f, g, and
- Added possibility to allocate a variable of type enumeration by means of direc
tives. VAR and. ZPVAR, for example:
. Enum Boolean
false = 0
True = 1
. Ende
. Var Boolean test
. Zpvar Boolean test
- Added the possibility of declarations of the structure of fields with enumerat
ed types, such as:
. Enum Estate
. Ende
. SLoader struct
m_file_start. word
m_file_length. word
m_state Estate
. Ends

v1.8.3 - 1.8.4
- New engine spirits with the minimum requirements of program memory, no additio
nal memory buffers image ... EXAMPLES \ SPRITES \ CHARS_NG
- New version of packer Huffman (compatible with Free Pascal Compiler-em, "fpc-M
Delphi sqz15.pas") and Huffman decompressor SQZ15 ... EXAMPLES \ COMPRESSION \ S
- Fixed the code generated for orders MVP, MVN, PEA, BRA (65816 CPU)
- Added new orders BRL, JSL, JML (65816 CPU), equivalent to the orders of long j
umps BRA, JSR, JMP
- Block updates the labels outside (external) has been expanded to save younger
and byte address of such a label
- Fixed effect of the directive. USE (. USING), operates independently of the na
mespace in which it is used
- Removed bug that in certain situations, skipping assemble block # IF, # WHILE
- Added ability to define variables by the directive. DS or pseudo-ORG command b
efore the block. Reloc
- Added an additional form of syntax for the directive. VAR, except that for suc
h a case it is not possible to determine the address location of variables in me
. VAR. TYPE lab1 lab2 lab3. TYPE lab4. Lab5 TYPE lab6 ...
. Var. Byte a, b, c. Dword and j
- Added the possibility of definition of individual variables in a less structur
ed way than before the DTA
. @ Struct Point
x. byte
y. byte
. Ends
point @ point; point dta @ point [0] <=> Point dta @ point
pointB @ point; pointB dta @ point [0] <=> @ dta pointB point
dta points @ point [100]
- Added a new directive. ZPVAR to automatically allocate space variable at zero
. ZPVAR TYPE label1, Label2 Label3 = $ 80, $ 80 = Label1, Label2 Label1 = TYPE,
Label3 = Label2 Type
. ZPVAR Label4, label5 TYPE; Label4 = Label3 TYPE, LABEL5 = Label4 TYPE
. Print. Zpvar
- Fixed effect of the directive. ERROR order and pseudo ERT, it is possible to p
lace additional information in line just like for. PRINT (. ECHO), for example:
ERT *> $ 6000, 'buuu exceeded the scope of memory', *- $ 6000, 'bytes'
- Added the possibility of nesting blocks procedures. PROC, the same code can be
invoked with different parameters such as:
. CopySrc percent (. Word src 1). Var
. ToDst percent (. Word src 1, dst 1). Var
. Endp
ldy # 0
src lda $ ffff, y
dst sta $ ffff, y
bne src
. Endp
copySrc.ToDst # # $ a080 $ B000
copySrc # $ A360
- Added a new directive. ENUM and. ENDE (. Eend)
. Dni_tygodnia enum
Monday = 1
Tuesday, Wednesday = 5, Sunday = 7
. Ende
ift == dni_tygodnia day: Tuesday
. Print 'Tuesday'
e and f
- Extended functionality of the multi-line comments / * * / about putting them a
lda # 12 / * comment * / 23
- Made possible relocation of addresses defined by Directive. DEF
. Reloc
. Def label =*
lda label
- Added ability to use characters {} to denote the block (except block. MACRO),
a sign'{','}' is recognized at the beginning of a new line, for example:
# While. Word ad 1 <= # $ 39 bc40
ad sta $ bc40
ad 1 inv
. Percent lab
. Local temp2
. Array tab [255]. Long
- Removed the file length limit for pseudo command INS (formerly the length of t
he target file was limited to 65536 bytes)
- Added an error message "The referenced label ... Previously has not been defin
ed Properly 'in the case of labels that are not defined until the end, for examp
le, only a first pass an indeterminate value
- Added a new directive. ECHO as a counterpart to the directive. PRINT, generate
d by the additional information. PRINT (. ECHO) are now also saved in *. LST Lis
- Added a new directive. ALIGN allows for compensation to a specified range of m
emory, plus you can specify how to fill memory
[Label]. ALIGN N [, fill]
- Added new switch-U (Warn of unused labels)
- Enhanced performance of a backslash '\', placing it at the end of the line is
a continuation of the current line from the new line, for example:
macro_temp \
_________________ \
_________________ \
lda \
#____________________________________ Label___________________________________
_____ \
- Changed the endless testing of the macro call after which an error occurs 'Inf
inite loop'
- Fixed a record label to *. LAB, an error was made after adding the areas of ad
ditivity LOCAL
- Improved performance of pseudo command SIN (code borrowed from XASM)
- Improved recognition of directives that have the switch-C (Case sensitive)
- Improved reading blocks. REPT (indicating the correct line with error) and. MA
- Locked for use. VAR block. REPT
- Enabled nested and multiple gearing (via macros) loop. REPT i: repeat (previou
sly occurred the message 'Use. REPT directive')
- Opened to pass parameters to the block. REPT, eg
. REPT 10, #
Label: 1; LABEL0, Label1, Label2 ... LABEL9
. Endre
. REPT 5, $ 12, $ 33, $ 44, $ 55, $ 66
dta: 1, 2, 3, 4, 5, $ 12, $ 33, $ 44, $ 55, $ 66
dta: 5,: 4, 3, 2, 1, $ 66, $ 55, $ 44, $ 33, $ 12
. Endre
1.7.9 - 1.8.0
- Fixed error in the description of switch-F, previously 'Label at first column'
, the correct description is 'CPU command at first column'
- Rewritten from scratch Service Directive. DS and options OPT F (added the abil
ity to use blocks and RUN INI)
- Rewritten from scratch OPT service options? (Local labels in the standard IEA)
- Added the possibility of publicity in the blocks declared by the PUBLIC arrays
. ARRAY structures and declarations. STRUCT
- Directive 6502 generates the code for the decision. TEST has been replaced by
Directive # IF directive. ENDT by # END, plus you can use the directive # ELSE e
# If. Byte and> # 8. And. Byte and <# 200
# Else
# If. Word j = # 12
# End
# End
- Directive generates code for the 6502 iteration. WHILE it was replaced by Dire
ctive # WHILE, the Directive. ENDW by # END, for example:
lda 20 -> 20 lda
# While. Byte @ = 20 -> wait 20 cmp
# End -> sne
-> Jmp wait
- Directive # # IF and WHILE accept two additional operators '==' and '! ='
- Added the directive. EXITM as a counterpart. EXIT
- Added the directive. IFs as a counterpart. ENDIF
- Added the directive. Ifdef directives as less equivalent. IF. DEF
- Added the directive. Ifndef directives as less equivalent. IF. NOT. DEF
- Was made possible to define macros in the procedure. PROC, summarizing the cur
rent limit is to define macros in the area. LOCAL and. PROC
- The occurrence of any warning when you assemble the output code will not chang
e (exit_code = 0), a change dictated by the need for compatibility with the Linu
x makefile
- Unified way to label declarations of local and global, "white space" before th
e name of the label does not define such a label will require a global, this wil
l allow only the directive. DEF: LABEL
- Fixed makra@CALL.MAC i@CALL_2.MAC, global temporary variable? @ Stack_offset i
s now modified by the Directive. DEF
- The resignation of the option-E (Eat White spaces), this option is currently a
lways on
- Fixed display line number with an error in a macro is currently being executed
- Abbreviated names of the labels created during the macro execution (easier to
identify them in the *. LAB)
- Fixed option action of H-OPT
- Added a new macro commands INL (increse LONG), IND (increse DWORD), DEL (decre
se LONG), DED (decrese DWORD)
- Added a new macro commands CPB (compare BYTE), CPW (compare WORD), CPL (compar
e LONG), CPD (compare DWORD)
- Improved and extended action directives and # # TEST WHILE based on the code g
enerated by macro commands CPB, CPW, CPL, CPD, directives and # # TEST WHILE the
expression '= # 0' and '<> # 0' generates the shortest code resultant
- Added to optimize the length of the generated code for macro commands MWA, MWX
- Added new option to optimize R OPT macro code instruction MWA, MWX, MWY, MVA,
MVX, MVY because of the contents of the registers, for example:
opt opt r-r
mva # 0 $ 80 -> lda # $ 00 -> lda # 0
mva # 0 $ 81 -> sta $ 80 -> $ 80 sta
lda # $ 00 -> $ 81 sta
sta $ 81 ->
- Extended functionality of the Directive. DEF about the possibility of assignin
g the value of the newly declared the label, such as:
. Def label = 1
- Extended functionality of the Directive. DEF a global option to define a label
regardless of aktulnego local area, for example:
. Def: label
- Was made possible additivity of areas. LOCAL, ie, there may be many local area
s of the same name, the symbols contained in such areas will belong to a common
namespace, for example:
. Local namespace
. Proc1 percent
. Endp
. Endl
. Local namespace
. Proc2 percent
. Endp
. Endl
- Added the directive. MEND. PGEND. Rend as equivalents. ENDM. ENDPG. Endre
- Out of a macro declaration must end with the directive. ENDM or. MEND (previou
sly it was permissible to use the directive. END)
- Improved way of making macros so was made possible implementation. Endl execut
ed from a macro
- Fixed bugs on older relokowanego byte block address and update the public symb
- Added a new directive. USING (. USE) to specify a path to search for the names
of labels
- Fixed action directives. LOCAL. DEF, whose malfunction is manifested in specif
ic cases
- Fixed effects strokes macro commands (SNE, RNE, etc.), whose malfunction is ma
nifested in specific cases
- Extended syntax of the directive. TEST (code 6502 for the condition) for any n
umber of expressions connected by. OR or. AND (no possibility to change piorytet
u evaluation using parentheses), for example:
. Test. Byte k> # 10 1. Or. Word j> # 100. And. Word j <# 105. Or. Byte k <= #
. Endt
- Extended syntax of the directive. WHILE (code 6502 for a loop) for any number
of expressions connected by. OR or. AND (no possibility to change piorytetu eval
uation using parentheses), for example:
. While. Byte k> # 4. And. Byte k <# 39
. Endw
1.7.6 - 1.7.7
- Added new switch-B: ADDRESS allows assembling the requested address
- Added new option OPT F - allows you to create blocks of contiguous memory (use
ful for cartów)
- Added support for type parameters. LONG and. DWORD passed to procedures. PROC
type. VAR (previously accepted types of the parameters was only. BYTE and. WORD)
- Added a new directive. FL realizing a record of real numbers REAL Atari FP for
mat, eg:
pi. 3.1415926535897932384626433832795 fl; 40 03 14 15 92 65
tb. fl 12.34 0.5 -2.30 0.00002
tb. fl 0.5, 12.34, -2.30, 0.00002
- Has made possible a record of other types than just. Byte in the block. ARRAY
- Added support for multiple types. STRUCT, these types have been previously acc
epted, however, the memory was not properly reserved for them, for example:
. Struct test
x: 200. byte
y: 999. long
. Ends
dta test buf [0]
- Fixed bugs in the code generation relokowalnego Laoo observed by, for example:
. Reloc
lda temp
temp. long $ aabbcc
- Error 'Address relocation overload' occurs now only when the expression will i
nvolve more than one label relokowalnej, before any expression involving relokow
alnej labels would show this error message
- Block updates plublicznych symbols was extended to the possibility of providin
g different types of solid B-USED, W-ORD, L-ONG, D-WORD, which was previously tr
ansmitted to the type was the only W-ORD
- Modified operation of the Directive. VAR blocks. LOCAL located in the block. P
ROC, such variables are always postponed to the end of the block before the Dire
ctive. ENDP, in other cases at the end of the block. LOCAL before the Directive.
- Was made possible relokowalnosc code generated by the Directive. WHILE and. TE
- Fixed effect of test type. WORD in the code generated by the Directive. WHILE
and. TEST
- Added a new directive. ADR returns the address label before changing your asse
- Added a new directive. LEN returns the length of the blocks defined. PROC and.
- Improved performance of operations division, multiplication and modulo, had pr
eviously been incorrectly interpreted piority for these operations
- Comments from the end of the line is not preceded by a comment that will cause
an error "Unexpected end of line '
- Added ability to assign a variable fields defined by the structure, such as:
@ Point. Struct
x. byte
y. byte
. Ends
and @ Point
b @ point
c @ point
- Extended syntax. STRUCT of opportunity to add new fields without specifying th
e field name, eg:
. Struct @ id
id. word
. Ends
. Struct @ mem
@ Id
adr. word
. Ends
- Extended syntax of a macro command MWA possibility of using the indirect addre
ssing zero postindeksowanego Y, for example:
mwa ($ 80), y $ A000, x
mwa $ bc40, y ($ f0), y
mwa ($ 80), y ($ 82), y
- Extended syntax of the directive. EXTRN, it is now possible is the announcemen
t of more different types of labels in a row, the announcement of the procedure.
PROC in this line must be on the end, such as:
. Extrn a, b, c, d. Byte xyz. Word line. Percent (. Byte x, y). Reg
- Extended syntax of the directive. VAR, it is now possible to declare a larger
number of labels of various types in one line and assign them to the address fro
m which will be set aside in memory, such as:
. Var x, y with. Byte bit 2. Dword = $ 80
- Extended syntax for the parameters of the procedures provided by the variables
. VAR, it is possible to provide such transfers:
move. percent (. word src 1, dst 1). var
src lda $ ffff
dst sta $ ffff
. Endp
- Added a new directive. Nowarn excluding displays a warning for the current ase
mblowanego line, for example:
- Added a new macro commands PHR, PLR, performing deposition and removal of reco
rds with a hardware stack, for example:
Yeah TAX
- Added a new macro commands ADB, SBB performing addition and subtraction of the
value type. BYTE, for example:
ADB $ 80 # $ 12 B000 -> lda $ 80
adc # 12
sta $ B000
SBB # 200, $ A000 -> lda # 200
sbc $ A000
sta $ A000
- Added ability to use C syntax for hex numbers, eg:
lda 0x2000
LDX # 0x12
temp = 0x8000
- Directive. DS relocatable blocks SDX MADS reloc reloc and declares a block fro
m the now empty
- Added new switch-F, which allows you to place orders and pseudo CPU orders fro
m the first column in row
- Rewritten from scratch the reading blocks. MACRO. REPT and implements a proced
ure to share the line with the character '\'
- Added new pseudo orders ADW, SBW performing addition and subtraction of WORD f
or CPU6502, for example:
hlp adw # 40; hlp = hlp 40
hlp adw # 20 pom, pom = hlp 20
- Enhanced effect of the directive. DEF about the possibility of defining a labe
l, for example. DEF label
- Increased number of passes for the EQU statement labels for certain special ca

- Fixed effect of the directive. PRINT, yet could not see the value of the label
that starts with the letter 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', ' L ',' T '
,' V '
- Blocked the action of the Directive. DS blocks. Reloc and SDX, and repaired it
s action with conditional instructions. IF (IFT)
- Improved search-and paths: path (you can refer to subdirectories contained the
- If errors are displayed when you assemble them all and not just the first of t
he errors
- Fixed bugs, including the use of macros in the file. Reloc could result in cer
tain situations, an incorrect entry of information on addresses relokownych
- Simplified procedures for the termination was as a software stack using the MA
DS-a, there is no need to use the directive. EXIT, and the Directive. ENDP no lo
nger causes additional action on the software stack
- Added a new directive. SYMBOL as the equivalent of a block upgrade UPDATE NEW
SYMBOL BLK 'SYMBOL' directive. SYMBOL can be used anywhere in the program
- Added automatic call block update (ADDRESS, EXTERNAL, PUBLIC, SYMBOL) for. Rel
oc and SDX
- Added a new directive. BY. WO. HE. EN. SB (borrowed from the IEA)
- Added new switch OPT? - (Default) label with a question mark (? Labels) are tr
eated as temporary labels, OPT? label with a question mark (? labels) are treate
d as local and temporary name of a local label has recently been used without a
question mark
- Added the directive. LEND. PEnd. AEND. WEND. TENDA. SEND equivalent to the dir
ectives. Endl. ENDP. ENDW, ENDW. ENDT. ENDS
- Added a new directive. And GLOBAL. GLOBL as the equivalent of (replacement) of
the Directive. PUBLIC
- Added optimize conditional jumps JEQ, jne, JPL, JMI, JCC, JCS, JVC, JVS, if en
abled, is elected a short jump BEQ, BNE, BPL, BMI, BCC, BCS, BVC, BVS
- Added new default separator character space for the parameters passed to. PROC
. MACRO, yet it was only a sign of a comma
- Improvement of the transmission parameters to macros and procedures, for examp
le, macros may be paramatrem directive returns an expression or symbol of the co
unter loop '#'
: 12 # macro
- Added ability to use a space as a separator for. VAR. EXTRN, eg
. EXTRN a b c d. Word
. VAR i = 1 j = 2. Byte
. VAR a b c d. Byte
- Extended syntax for. VAR allows ignited variables constant, for example:
. Var i = 10 j = 12. Byte
. Var a, b = 2. Byte
- Added a new directive. WHILE. ENDW allow you to automatically generate code fo
r a WHILE loop, for example:
LDX # $ ff
. While. Word addr <# $ bc40 40 * 24
stx $ bc40
adr: equ *- 2
inv addr
. Endw
- Added a new directive. TEST. ENDT allow you to automatically generate the code
for the condition, for example:
. Test. Byte (@>=#' a ')
. Test. (@<=#' Byte z ')
. Endt
. Endt
- Added possibility to change the address assemble. PROC or. LOCAL without a cha
nge of address charge
- Removed code optimization for macro commands MWA, etc., which could result in
specific cases, the MADS-loop and
- Added the directive. REG. VAR order to determine the way of passing parameters
to procedures (. REG CPU registers. VAR of variables)
- Added the directive. VAR allows for the declaration of variables in blocks. PR
OC. LOCAL, declared zmiennne are physically postponed to the end of this block
- Extended syntax for the directive. EXTRN such EXTRN label1, Label2, Label3 ...
- If no declaration of labels for a software stack MADS-a, default values are ac
cepted @ PROC_VARS_ADR = $ 0500, @ STACK_ADDRESS = $ 0600, @ STACK_POINTER = $ F
- Added repeat_counter #, which can be used interchangeably with the Directive.
- An error occurs '^ not relocatable' when you try to relocate the command '^ ld
a label'
- Added support for regular public symbols (C-ONSTANT) in blocks PUBLIC
- Revised relokowalnosc for arrays. ARRAY, the data created by. STRUCT, paramete
rs passed to procedures by the constant #
- Rewritten pseudo Service orders REQ, RNE, RPL, RMI, RCC, RCS, RVC, RVS, SEQ, S
- Fixed effect of the directive. LINK for blocks with a fixed address
- Improved testing of reserved words (you can use names reserved for use only wh
en 65816 6502)
- Changes in the listing, it displays information about the number of the bank o
nly when the bank> 0
- Added support for macro commands MWA, MWX, MWY, MVA, MVX, MVY, ADD, SUB, INW,
DEW (to support them are no longer needed macros)
- Added ability to use mnemonic names of 65,816 in 6502 mode, the mode has an er
ror occurs 65816 Reserved word
- Fixed effects strokes SCC pseudo commands, macros, etc. in RNE
- Improved performance of many macros separated by a colon ':'
- Removed a bug that caused too small number of passes assemble
- Added support for pseudo-instruction JEQ, jne, JPL, JMI, JCC, JCS, JVC, JVS (m
acros are no longer needed for their operation)
- Extended syntax for. ARRAY. PUT
- Added pseudo-EXT command allows the external label declarations
- Added macro JEQ, jne, JPL, JMI, JCC, JCS
- Added the directive. PAGES and. ENDPG
- Added the directive. END replacing other directive. END?
- Switch-H has been replaced by a-HC (generates a header file for CC65)
- Added new switch-HM generating header file for the MADS-and sorting out the ty
pe of label constants, VARIABLES, PROCEDURES
- Added a new directive. Reloc relokowalny generates code in the format and the
- Added a new directive. PUT, and extended syntax for the directive. GET (.. / e
xamples / MSX / MPT_PLAYER / MPT_RELOCATOR.MAC, .. / examples / MSX / TMC_PLAYER
- Added support for pseudo-instruction XASM a REQ, RNE, RPL, RMI, RCC, RCS, RVC,
- Added possibility of joining any number of known MADS-mnemonics those using th
e mark ':' (style XASM-a), for example:
lda: cmp: req 20
LDX: ldy: lda: ins label
v1.6.6 - 1.6.7
- The source of the MADS-and compatible with Free Pascal Compiler, the compilati
on is possible to use it on other platforms such as Linux, Mac OS, OS / 2, etc.
- Now MADS chooses the appropriate number of passes assemble, switch '/ 3' is no
longer needed
- Improved and developed a mechanism of passing parameters to the MADS-a (Sectio
n 'relay assembler')
- Has been corrected in the line calling the macro-delimited with a '\' and impr
oved recognition and enforcement of line characters separated by '\'
- Fixed bug where the wrong MADS Directive. ENDM of pseudorozkazem IFT
- Fixed effect conditional statements. ELSEIF. ELSE
- Fixed test the correctness of conditional statements in macros
- Handling procedures. PROC has been expanded with new macros, and mechanisms th
rough which is similar in operation and ease of use to the procedures of the hig
her-level languages
- For procedures. PROC with the declared parameters is now required additional d
eclaration @ PROC_VARS_ADR
- No limits on the number of parameters passed to procedures, limited only by av
ailable memory
- Added new switch / d: label = value which allows to define a new label MADS-a
command line
- Added new switch / x "Exclude unreferenced Procedures" allows you miss when yo
u do not assemble the procedures used in the program declared to the Directive.
- New option OPT (T sep track, rep), tracing changes in the size of the register
s A, X, Y orders made by the SEP, REP (65816 CPU)
- A new library in the directory .. \ EXAMPLES \ LIBRARIES
- The declaration of the local area. LOCAL is not required to enter the realm na
- New operators'-=', '=', '', '-' which reduce / increase the value of the tempo
rary labels, such as:
? Label - ->? Label =? Label-1
? Lab ->? Lab =? Lab 1
? Temp = 3 ->? Temp =? Temp 3
? Offset -= 5 ->? Offset =? Offset-5
- Extended the syntax of the comma character parameter declaration procedures, s
uch as:
. Proc name (. Byte a, b, c. Word d, e)
. Endp
- Added new switch '-3' incorporating three passes instead of 4-ech for faster a
- Improved processing of structures declared in the memory of the MADS-a, the or
der of the listing is no longer relevant
- Added ability to connect any number of lines listing in one line using the cha
racter '\'

- Added the directive. R, returns the counter value of the loop. REPT <0. Max>
- Added possibility to use space in the declaration of the type of data such as
dta a (...
- Removed bugs