---------------------------------------------------------------------- Copyright (C) 1990 by Natrlich! This file is copyrighted! Refer to the documentation for details. ---------------------------------------------------------------------- NASM65 --- an Atari 8-Bit Crossassembler for the Atari ST (et al.) Manual v1.9* for NASM65 Currently not quite up to date Copyright ½ 1992 by Natrlich! on sources, binaries and manuals ¯¯ Bang that Bit that doesn't Bang ®® I n t r o d u c t i o n NASM65 is a single-pass cross-assembler that produces 6502 code. NASM65 currently runs on 680x0 Ataris under TOS, on the AMIGA and apparently under UNIX. It its conceivably portable to MSDOS. The assembler produces two kinds of output, directly executable code for the Atari 8-Bit computer (FF FF headers and all that...) or linkable modules to be used with NLINK65. Instantly executable code (furtheron referred to as "runnable") is non-relocatable and non-linkable. The other kind of output are relocatable and linkable object files. That production mode is further on referred to as "relocatable". NASM65 is closely compatible to MAC65 from OSS (now ICD), but not 100%. The differences will be noted later on. Compatibility worsens somewhat when relocatable output is produced. (Apple and C64 users, have a peek at XTRCTBIN) U s a g e nasm65 [-{rwbqx}][-{tn}][-e number][-o binary][-h includedir] -t TOS switch, wait for a keypress after running -w The "what the ...." switch, even though errors occured an output file is generated. -r The runnable switch. NASM65 will create an Atari 8-Bit binary file for direct execution -h Supply alternate header directory (Default is taken from the Environment variable >INCLUDE<) -e Limit the number of errors: 0 = show all -o Specify alternate output file pathname (or filename) -b Don't emulate MAC/65 too closely (will improve output in the runnable mode) -x List all global variables. Defined globals appear with a '*' in front. -q Quiet flag, probably turns up the volume -n Noisy tokenization. Try it on your ST. There is no order in which switches or the source file have to appear. C r e a t i n g r u n n a b l e A T A R I 8 - B i t f i l e s Type from a shell: nasm65 -r That will create a output file {source}.COM Transfer this file (with NASTY for instance) to a 8-Bit Atari computer and execute it there. C r e a t i n g l i n k a b l e m o d u l e s Type from a shell nasm65 That will create a output file {source}.o65, that can then be linked together with other relocatable output files. H o w N A S M 6 5 f i n d s i t s f i l e s Source files: NASM65 first looks in the current directory for the file you specified on the command line. After that it tries again by replacing the filename extension with .S65. If that doesn't work either, NASM65 signals an error. This means if you type "nasm65 foo" and you have a file FOO and a file FOO.S65, the file "FOO" will be loaded. Include files: If the extension has been omitted and it looks like a filename, not a pathname, NASM65 will append the default extension .H65 and insert the default header path at the front. Else NASM65 looks first in the current directory for the include file. Afterwards NASM65 replaces the extension with .H65 and it will look in the directory given either by the environment variable INCLUDE or by the command option '-h'. If NASM65 fails again, it will try last to open the file without the .H65 extension. S o u r c e c o d e f o r N A S M 6 5 Generally speaking MAC65 style code w i l l work with NASM65. Other assemblers' source (like SYNASM or MAE) might need to be converted to NASM65 syntax before assembly [a SED script might be helpful...]. Problems may appear because of the single-pass structure of the assembler. Conventional assemblers use two passes, one pass collects all the symbols and if possible assigns values to them. The second pass actually produces the code. NASM65 tries to do it all in one pass. Of course there is the problem with forward references f.e.: ... bne bar inx bar clc ... When the assembler encounters "bne bar" it doesn't yet know, what value "bar" has and so can't produce proper code for that branch yet. Only when the bar label is encountered is generation possible. Therefore NASM65 has some limitations on the code that it can produce. You will find out about it... A f e w g o l d e n r u l e s [Take those marked with a ! really seriously] 1! Don't produce code for zeropage ($00-$FF), be careful of wraparounds $FFFF-$00 if you assemble ROM-code. 2! Define macros and equates EARLY! the sooner the better. 3. The fewer forward references you use, the less trouble you and NASM65 will have. Forward references are neccessary only for ¯Branches®, ¯Subroutines® and ¯Data®. Coding like this lda #$40 sta nmien nmien = $D40E is not only in bad style, it's screamingly inefficient and doesn't work with NASM65 in the module mode. 4! In the "relocatable" mode, all label settings that are not PC- relative (f.e. `FOO=$D4' but not `FOO: LDA #2') must be done before the label is used.