Beruflich Dokumente
Kultur Dokumente
5
Thebe / Madteam (02/21/2009)
-------------------------------------------------- -----------------------------
-
INTRODUCTION
Introduction
Compilation
Differences and similarities between XASM and MADS
Similarities
The differences and opportunities
DIRECTIONS
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
Mnemonics
6502
65816
DETECTION CPU
MEMORY BANKS
Virtual
Hardware
CODE RELOKOWALNY
Block relokowalny
External Symbols
Public Symbols
Linking
TYPES
Structural
Declaration of a structured type
Defining the structural data
Enumerated
Enumerated type declaration
Defining the enumeration data
HISTORY
SYNOPSIS
Comments
Combining multiple rows into one row
Combining multiple mnemonics
Expressions
Numbers
Operators
Labels
Local
Global
Temporary
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
Directive
Defining replicates (. REPT)
Defining the symbol SDX (. SYMBOL)
Directive generating code 6502
Define iterations (# WHILE)
Define the decision (# IF)
Tables
Array declaration
Macros
Declaration Macros
Calling macros
Procedures
The declaration procedure
Procedure call
Parameters of the procedure
Local Area
Declaration of local area
-------------------------------------------------- -----------------------------
-
INTRODUCTION
Introduction
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/
Compilation
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.
DIRECTIONS
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:
source.lst
source.obx
source.lab
source.h
source.hea
source.mac
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 *.
H-CC65
/ 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
OCEDURES.
/ 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.
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
MACRO COMMANDS
REQ, RNE, RPL, RMI, RCC, RCS, RVC, RVS
SEQ, SNE, SPL, SMI, SCC, SCS, SVC, SVS
JEQ, jne, JPL, JMI, JCC, JCS, JVC, JVS
ADD, SUB
ADB, SBB
ADW, SBW
PHR, PLR
INW, INL, IND, DEW, DEL, DED
MVA, MVX, MVY
MWA, MWX, MWY
CPB, CPW, CPL, CPD
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.
ADD, SUB
The above macro commands implement appropriate increase / decrease the byte of m
emory without saving it (the result in the accumulator CPU).
ADD -> CLC SUB -> SEC
-> ADC ... -> SBC ...
ADB, SBB
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
-> SRC STA -> STA C
SBB SRC # $ 80 -> LDA SRC SBB A, B, C -> A LDA
-> SEC -> SEC
-> SBC # $ 80 -> SBC B
-> SRC STA -> STA C
ADW, SBW
The above macro commands implement appropriate increase / decrease your memory w
ith saving the result.
ADW SRC # $ 40 -> CLC ADW A B C -> CLC
-> LDA SRC -> LDA A
-> ADC # $ 40 -> ADC B
-> SRC STA -> STA C
-> SCC -> A +1 LDA
-> SRC INC 1 -> ADC B 1
-> STA C +1
ADW SRC SRC # $ 40 -> CLC
-> LDA SRC
-> ADC # $ 40
-> STA SRC
-> LDA SRC 1
-> ADC # $ 00
-> STA SRC 1
SBW SRC # $ 4080 -> SEC SBW A B C -> SEC
-> LDA SRC -> LDA A
-> SBC <$ 4080 -> SBC B
-> SRC STA -> STA C
-> LDA SRC +1 -> A +1 LDA
-> SBC> $ 4080 -> SBC B +1
-> SRC a STA -> STA C +1
PHR, PLR
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.
PHR -> PHA PLR -> PLA
-> TXA -> TAY
-> PHA -> PLA
-> Yeah -> TAX
-> PHA -> PLA
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
DED).
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
BLK
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
XTENDED MAIN
BLK E [mpty] XM [ain] | E [Xtended] - block booking relokowalny X bytes of memo
ry, or EXTENDED MAIN
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
EE)
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
d DOS SPARTA SPARTA DOS Programming X.
: Repeat
Example:
: 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
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
t)
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)
Example:
OPT c + c - l + s +
OPT-h
O + OPT
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
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
Example:
h-opt
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.
Example:
opt + h-f
ORG [a (start), and (over-1)], $ 2000
start
nop
. Ds 128
nop
over
DTA
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 '*
Example:
dta 1, 2, 4
dta a ($ 2320, $ 4444)
dta d'sasasa ', 4, and (200), h ($ 4000)
dta c 'file', $ 9b
dta c'invers' *
DIRECTIVE
. SYMBOL label
. ALIGN N [, fill]
. IF [IFT] expression
. ELSE [ELS]
. ELSEIF [ELI] expression
. ENDIF [EIF]
. LOCAL label
. Endl, [. LEND]
. REPT expression [, parameter1, parameter2, ...]
. Endre [. Rend]
. R
. PAGES [expression]
. ENDPG [. PGEND]
. STRUCT label
. ENDS [. SEND]
. ARRAY index label type [= default_value]
. ENDA, [. AEND]
. PROC label
. ENDP [. PEnd]
. REG. VAR
. MACRO label
. ENDM [. MEND]
:[%%] Parameter
. EXITM [. EXIT]
. VAR var1 [= value], var2 [= value] ... (. BYTE |. WORD. | LONG |. DWORD)
. ZPVAR var1, var2 ... (. BYTE |. WORD. | LONG |. DWORD)
. END
. EN
. ENUM label
. ENDE, [. Eend]
. PRINT [. ECHO] 'string1', 'string2'..., value1, value2, ...
. ERROR [ERT] 'string' ["string"] or. ERROR [ERT] expression
. BYTE
. WORD
. LONG
. DWORD
. OR
. AND
. XOR
. NOT
. 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:
UPDATE BLK NEW LABEL 'LABEL'
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.
Example:
. Align
. Align $ 400
. Align $ 100, $ ff
. 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:
Example:
org $ 4000
. Pages $ 40
...
...
. Endpg
. END
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) [=
address]
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:
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, $
123,344
. 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
LDX b
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
. PRINT [. ECHO]
Prints out on the screen specified as the parameter value of an expression or a
string contained quotes '' or "" for example:
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:
Example:
ert "halt" ERROR: halt
. Error "halt"
ert *> $ 7FFF; ERROR: User error
. Error *> $ 7FFF
. DB
BYTE data type definition, the equivalent of pseudo-B DTA order or directive. BY
TE
. 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
. 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
. 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
rts
. Endp
dta. len wait; = 7
. Ifndef label
Directive. Ifndef condition is shorter counterpart. IF. NOT. DEF LABEL
Example:
. Ifndef label
clc
. Else
sec
. 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
l LABEL_NAME
. 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.
Example:
. Nowarn. Proc temp; not generated warning 'Unreferenced procedure TEMP'
. Endp
. USING [. USE]
Directive. USING (. USE) allows you to specify an additional path to search for
the names of labels.
Example:
. 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
. LO (expression). HI (expression)
The above directive is equivalent operators, respectively '<' (low byte) and '>'
(byte).
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
e:
1
2 org $ 2000
3
4 FFFF> 2000-200D> A9 00 lda # 0
5 2002 EA nop
6
7 0060. Local temp, $ 60
8
9 0060 BD FF FF lda $ ffff, x
0063 BE 10 FF FF LDX $ ffff, y
11
12. Endl
13
14 2009 A5 60 lda temp
200B 15 AD 03 20 lda. Addr temp
16
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.
TYPES
MADS offers the possibility of declarations of two types of data: structural. ST
RUCT and enumerated. ENUM
STRUCTURAL TYPE, STRUCTURE
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.
ENUMERATION, CALCULATION
Calculations to the n / a directive:
name. ENUM
. ENDE [. Eend] [. END]
Example:
. 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
robot.
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
and PORTB
b PORTB
. 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
DONE DIRECTORY_SEARCH = $ ff, INIT_LOADING, LOADING
. Ende
For the above example, the allocation of a variable of type "estate" will be the
size of two bytes (WORD).
TABLES TABLES
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
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 $
FF
[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
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']
. EXITM [. EXIT]
. ENDM [. MEND]
:[%%] 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
rgument.
# 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
parameter).
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
defined).
. EXITM [. EXIT]
Completion of the macro. Causing the absolute termination of the macro.
. ENDM [. MEND]
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"
. ENDIF
IFT%% 0 <2. Or: 0> 5
ERT "Wrong number of arguments"
EIF
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
PROCEDURES. PROC
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
l).
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):
@ PROC_VARS_ADR
@ STACK_ADDRESS
@ STACK_POINTER
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:
@ CALL .. \ EXAMPLES \ MACROS \ @ CALL.MAC
@ PUSH .. \ EXAMPLES \ MACROS \ @ CALL.MAC
@ PULL .. \ EXAMPLES \ MACROS \ @ PULL.MAC
@ EXIT .. \ EXAMPLES \ MACROS \ @ EXIT.MAC
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
. ENDP
. PROC Label2, $ A000 (. Word ax). Reg
. ENDP
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
els
pha
lda @ stack_pointer
sub #: 1
fixed @ stack_pointer
pla
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.
. ENDP
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.
LOCAL AREA
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
SYNOPSIS
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
Comments
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
nts.
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.
EXPRESSIONS
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.
Numbers
decymalny record:
-100
-2437325
1743
write hexadecimal:
$ 100
$ E430
$ 000,001
0x12
0xa000
0xaabbccdd
write binary:
% 0001001010
$ 000000001
$ 001,000
ATASCII write codes:
'A'
'Fds'
'W' *
INTERNAL entry codes:
"B"
"FDSFSD"
"." *
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
Operators
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
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
w
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
le.
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:
EQU
=
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
test
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:
EQU
=
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
gram.
@ CALL. Macro
. Def? @ Stack_offset = 0; definition of a global temporary label? @ Stack_off
set
...
...
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
abels.)
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:
EQU
=
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
syntax.
Example of use of temporary tags:
? Loc = $ 567
? Loc2 =? Loc $ 2000
lda? loc
sta? loc2
? Loc = $ 123
lda? loc
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
eaders:
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:
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.
CODE RELOKOWALNY
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 .. \
EXAMPLES \ TETRIS.ASM
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:
BLK PUBLIC UPDATE
Below the header format in the file with public symbols after the call by BLK UP
DATE PUBLIC:
HEADER WORD ($ FFED)
WORD LENGTH
BYTE TYPE (B-USED, W-ORD, L-ONG, D-WORD)
Label_Type CHAR (C-ONSTANT, V-ARIABLE, P-ROCEDURE, A-RRAY, S-TRUCT)
LABEL_LENGTH WORD
LABEL_NAME ATASCII
WORD ADDRESS
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):
STRUCT_LABEL_TYPE CHAR (B-USED, W-ORD, L-ONG, D-WORD)
STRUCT_LABEL_LENGTH WORD
STRUCT_LABEL_NAME ATASCII
STRUCT_LABEL_REPEAT WORD
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):
ARRAY_MAX_INDEX WORD
ARRAY_TYPE CHAR (B-USED, W-ORD, L-ONG, D-WORD)
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)
PROC_TYPE BYTE (D-EFAULT, R-EGISTRY, V-ARIABLE)
PARAM_COUNT WORD
For the symbols on the procedures. REG are saved now only the types of these par
ameters in an amount PARAM_COUNT:
PARAM_TYPE CHAR (B-USED, W-ORD, L-ONG, D-WORD)
...
...
For the symbols on the procedures. VAR parameter types are saved and their names
. PARAM_COUNT specifies the total length of the data:
PARAM_TYPE CHAR (B-USED, W-ORD, L-ONG, D-WORD)
PARAM_LENGTH WORD
PARAM_NAME ATASCII
...
...
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
Label_Type symbol type: V-ARIABLE, C-ONSTANT, P-ROCEDURE, A-RRAY, S-TRUCT
For P-type saves additional information: PROC_CPU_REG, PROC_TYPE, PARAM_COUNT, P
ARAM_TYPE
For A written additional information: ARRAY_MAX_INDEX, ARRAY_TYPE
For Type-S saves additional information: STRUCT_LABEL_TYPE, STRUCT_LABEL_LENGTH,
STRUCT_LABEL_NAME, STRUCT_LABEL_REPEAT
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
. REG
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.
Mnemonics
Available commands 6502
LDA LDX LDY STA STX STY ADC AND
SBC ASL LSR JSR JMP CMP ORA CPY
CPX INC DEC EOR BRK CLC ROR ROL
CLD CLI CLV PHP PLP PHA PLA RTI
RTS SEC SED SEI ins INX DEY DEX
Yeah TAY TXA TXS TSX NOP TAX BPL
BCC BCS BNE BMI BVC BVS BEQ BIT
It is possible to extend the use of mnemonics by a dot "." for such orders LDA,
LDX, LDY, STA, STX, STY:
. B or. From BYTE
. A or. In or. Q WORD
eg
lda.w $ 80, AD 80 00
lda $ 80; A5 80
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
cpu65816
LDX <text65816
ldy> text65816
$ c642 jsr
rts
cpu6502
LDX <text6502
ldy> text6502
$ c642 jsr
rts
text6502 c'6502 dta ', $ 9b
text65816 c'65816 dta ', $ 9b
MEMORY BANKS
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.)
Banks apply to the n / a pseudo orders:
LMB # value
NMB
RMB
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.
HISTORY
v1.8.5
- 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
AR
- 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
T)
- 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
ELS EIF
- 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
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
DONE DIRECTORY_SEARCH, INIT_LOADING, LOADING
. 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
QUASH
- 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
mory
. 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
ins
bne src
rts
. 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
Friday
Saturday
Sunday
. Ende
ift == dni_tygodnia day: Tuesday
. Print 'Tuesday'
e and f
- Extended functionality of the multi-line comments / * * / about putting them a
nywhere
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
{}
}
v1.8.2
- 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
ting
- 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)
1.8.1
- 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 \
_____________________________________parametr1________________________________
_________________ \
_____________________________________parametr2________________________________
_________________ \
_____________________________________parametr3________________________________
_________________
lda \
#____________________________________ Label___________________________________
_____ \
__________________________________expression_________________________________
__
- 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
CRO
- 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
xample:
# 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
, MWY
- 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
1.7.8
- 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
ols
- 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 <= #
5
...
...
. 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.
Endl
- Was made possible relokowalnosc code generated by the Directive. WHILE and. TE
ST
- 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
mble
- Added a new directive. LEN returns the length of the blocks defined. PROC and.
ARRAY
- 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:
. Nowarn PROCNAME
- Added a new macro commands PHR, PLR, performing deposition and removal of reco
rds with a hardware stack, for example:
PHR -> PHA PLR -> PLA
TXA TAY
PHA PLA
Yeah TAX
PHA PLA
- Added a new macro commands ADB, SBB performing addition and subtraction of the
value type. BYTE, for example:
ADB $ 80 # $ 12 B000 -> lda $ 80
clc
adc # 12
sta $ B000
SBB # 200, $ A000 -> lda # 200
sec
sbc $ A000
sta $ A000
- Added ability to use C syntax for hex numbers, eg:
lda 0x2000
LDX # 0x12
temp = 0x8000
1.7.5
- 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
ses
1.7.4
- 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
rein)
- 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
1.7.3
- 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 ...
TYPE
- 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
E
- Added repeat_counter #, which can be used interchangeably with the Directive.
R
- 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 #
v1.7.2
- Rewritten pseudo Service orders REQ, RNE, RPL, RMI, RCC, RCS, RVC, RVS, SEQ, S
NE, SPL, SMI, SCC, SCS, SVC, SVS
- 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)
v1.7.1
- 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 ':'
v1.7.0
- 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)
v1.6.9
- 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
MADS-
v1.6.8
- Added a new directive. PUT, and extended syntax for the directive. GET (.. / e
xamples / MSX / MPT_PLAYER / MPT_RELOCATOR.MAC, .. / examples / MSX / TMC_PLAYER
/ TMC_RELOCATOR.MAC)
- Added support for pseudo-instruction XASM a REQ, RNE, RPL, RMI, RCC, RCS, RVC,
RVS, SEQ, SNE, SPL, SMI, SCC, SCS, SVC, SVS
- 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.
PROC
- 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
me
- 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
v1.6.5
- Added new switch '-3' incorporating three passes instead of 4-ech for faster a
ssembling
- 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 '\'
v1.6.4
- 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