Mad-Assembler 1.8.5 Thebe / Madteam
Total Page:16
File Type:pdf, Size:1020Kb
MadAssembler 1.8.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 XFiles, 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 MadAssembler (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, multidimensional 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 MADSand 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 MADSa. Home XASMa: http://atariarea.krap.pl/xasm/ Compilation To compile the source of the MADSa, you can use a compiler with Delphi, if some one has just installed Delphi 7.0 or later. Alternatively, the platform is more multiuse 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 nonstandard 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): fpcMdelphiv 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 MADScompiled a much larger, even for a few seconds. MADS.EXE a ttached file is compiled using FPC. DIFFERENCES AND SIMILARITIES BETWEEN XASM I MADS Similarities the same syntax the same exit codes the same macro commands The differences and opportunities little difference in the ORG, eg 'ORG [[expression]] address [, Address2]' XASM does not like "white space", MADS tolerate them and accept the terms of log ical, arithmetic, fixed and variable definitions MADS allows you to embed expressions between the parentheses (), [], XASM only b etween [] MADS provides definitions of fixed and variable local, global, temporary, XASM o nly global MADS does not accept the ORG: ORG address and f: address MADS provides a record of real numbers by the directive. FL. FL real, through th e pseudocommand XASM DTA DTA R R (real) MADS offers a more extensive support for pseudoordered INS MADS does not accept the type of 'lda (203), 0' MADS allows you to write programs for the Sparta DOS X MADS allows you to generate code relokowalnego in your own format if we use when addressing character value, eg lda # '' lda # "" MADS is distinguished single apostrophe (ATASCII code) and a double apostrophe ( code INTERNAL) XASM both types equally treats apostrophes (code ATASCII). Of cou rse, for the DTA apostrophes are not distinguished by MADS. index in either a '+' or '' increase or decrease a register, eg lda $ 2000, x + > lda $ 2000, x inx but if you put the value of the sign '+' or '' then change the value of the mai n argument (it works only in the absolute index), for example: lda $ 2000, x 2 > lda $ 2002, x 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 CPUf 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: madslptd: label = valued: Label2 = value source.asm madslpt source mads source.asmlpt mads.exe% 1ltpi: "d: \! atari \ macro \" madsi: "c: \ atari \ macros \" / c source.asmlpt / 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 casesensitive 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 MADSa c ommand line. Switch can be used repeatedly during a single call to the MADSa, 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 *. HCC65 / Hm [: filename] Switch / hm includes saving a file with headers for the MADSa. Also lets you sp ecify a new name for the file. The default file name for the MADSheader 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 MADSa, 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 doubleclick the message line and the cursor moves to the editor in li ne with an error. / S Using the / s switch will activate the socalled. mode 'Silent mode', ie no mess ages are not displayed, at most, the error messages (ERROR) and warning (WARNING ). / T [: filename] If / t include saving a file with used definitions of labels. Also lets you spec ify a new name for the file. / X / X switch allows you to skip the process of assembling procedures declared Dire ctive. PROC for which there was no reference in the program. Exit codes 3 = bad parameters, not started assembling 2 = error occurred 0 = no errors Warning messages do not change the value of the output code. LST file structure Listing format is no different from that known to XASM, the only change is the a ddition of the address, the number of virtual memory bank (provided that the ban k number <> 0).