home *** CD-ROM | disk | FTP | other *** search
/ The Grim Reaper 11B / Grim_Reaper_The_Issue_11_1993___Side_B_BASIC.atr / ass.doc next >
Text File  |  2023-02-26  |  10KB  |  1 lines

  1. TURBO ASSEMBLER - Version II¢----------------------------¢¢Written by John Foskett¢¢¢¢The Turbo Assembler was written as a convenient means of producing machine code routines to interface with BASIC, such as DLIs, VBIs and USR called routines. It writes its output directly to disk as basic data together with a loading routine in two forms. The first routine being written as absolute code (memory dependent) whilst the second is written as a relocatable machine code string. Both routines are completely self contained which can be ENTERed directly into any basic program.¢ The Turbo Assembler is designed to use the public domain word processor 'Textpro' as its text editor, it works equally well with the 'Page 6 Writer' word processor which was published in issue 50 (June/July '91) of the New Atari User magazine. Unfortunately the Mini-Office II word processor is not suitable for this purpose since it causes the Turbo Assembler to error.¢ The Turbo Assembler can assemble a source code listing comprising of upto 5000 bytes (over 19 pages), upto 100 labels and upto 200 label references. All forms of addressing are supported with the exception of indirection.¢ Version I of the Turbo Assembler was smaller in size and was compiled to increase its speed. Version II is more user friendly, has more features and some errors found in Version I have been corrected. It is now too large to compile.¢*¢WRITING THE SOURCE CODE¢¢¢LABELS¢¢All labels are typed with no preceeding spaces and must be a maximum length of eight characters. A label must consist of uppercase letters and numbers only, but it must begin with a letter. No spaces must follow a label and RETURN must terminate it.¢¢¢INSTRUCTIONS¢¢All instructions are typed with a single preceeding space and another space between it and any associated value, address or label. Unless IMPLIED addressing is being used, in which case the instruction is used alone, without any value, address or label.¢ Only the usual 56 instructions may be used, each of which consisting of 3 upper case characters. All numerals, no matter whether they are a value or an address, must be in decimal, a positive integer and be within the required range. The hash symbol (#) is used to indicate that the numerals which follow it represent a value which must be in the range of 0 to 255 inclusive. Hence numerals without a preceeding hash are assumed to be an address which must be in the range of 0 to 65535 inclusive.¢ All branching instructions must only be followed by a label name and not by a value or an address. The only instruction which may be used with an address or a label name is "JMP" (which stands for JuMP). It can therefore be used to jump to an absolute address or to a relocatable address via the use of a label.¢ Indexed addressing may be used by following an address with a comma and then by following the comma with either an X or a Y. There must be no spaces on either side of the comma.¢ No matter how the instructions are configured, they must have no spaces following them. All instructions must be used with the correct syntax and must be configured exactly as described otherwise an error will result during assembly.¢¢¢ILLEGAL LABEL NAMES¢¢Label names whose first three characters are exactly the same as one of the 56 instructions cannot be used, they will result in an error during assembly. Several examples of illegal label names together with the matching instructions follow...¢¢     DECIMAL - DEC¢     INCOME -- INC¢     NOPLAY -- NOP¢     ORANGE -- ORA¢     PHASE --- PHA¢     PLAY ---- PLA¢     SECOND -- SEC¢     START --- STA¢¢¢SEMI-COLON REM¢¢The semi-colon (;) is used in a similar way to BASICs REM statement, it can be used to begin a line or used to follow and instruction. A maximum of 3 lines may be used (which includes the instruction if it is following one), more than 3 lines will cause the Turbo Assembler to lock up. There must be no spaces preceeding the semi-colon. Any characters that follow the semi-colon are ignored by the Turbo Assembler.¢¢¢BLANK LINES¢¢Blank lines created by pressing the RETURN key alone may be used to separate the various sections of a listing to make the listing clearer to read. Blank lines are ignored by the Turbo Assembler.¢¢¢END MARKER¢¢A special instruction called the "End Marker" must be used as the final instruction to terminate a source code text file. It must be typed thus- <END> and be terminated by pressing RETURN. It may be placed anywhere on the final line, but positioned like a label is clearest. If required, the end marker may be followed by a semi-colon REM as described above.¢¢¢EXAMPLE SOURCE CODE LISTING¢¢This small example listing can be used as a VBI routine to ensure the key board is locked into the uppercase mode when location 203 contains a zero. When it contains a non-zero value the VBI is bypassed. In this example, BYPASS is a label name.¢¢¢ PHA¢ LDA 203¢ BNE BYPASS¢ STA 694¢ LDA #64¢ STA 702¢BYPASS¢ PLA¢ JMP 49802¢<END>¢¢¢USING THE TURBO ASSEMBLER¢¢After creating a source code text file using either 'Textpro' or 'Page 6 Writer', reboot with Turbo Basic, run the program and proceed as follows...¢¢1. Insert into drive number 1, the disk containing the source code text file to be assembled. The disk must not be write protected and must contain enough free space to receive the output files.¢¢2. Enter the file name of the source code text file at the prompt. Only the usual legal characters can be used. A default file name of "MACODE.TXT" is available by pressing the RETURN key alone.¢¢3. Enter the required assembly address at the prompt in decimal. This is the address where the code will eventually be stored. If the address is out of range, an error will result. A default address of 1536 ($0600 or page 6) is available by pressing the RETURN key alone. For information, the address is also displayed in hexadecimal alongside the decimal entry.¢¢4. Enter the first BASIC line number to be used for the output routines at the prompt. If the line number is greater than 30000 or is not a multiple of ten then an error will result. A default line number of 10000 is available again by pressing the RETURN key alone.¢¢ If no errors are detected whilst entering the above information, the Turbo Assembler will proceed to read the source code text file, assuming of course that it is on the disk otherwise an error will result. Only labels and instructions are displayed on screen as the source code is read, all the other legal information is ignored. As each line of the source code is read, it is thoroughly checked and any errors found in its configuration or syntax will be reported.¢ If no errors were encountered as the source code text file was read, the Turbo Assembler will then proceed to write the output files.¢ After writing the output files, the Turbo Assembler then proceeds to construct the assembly table displaying the source code labels and instructions together with their relevant addresses and codes in "Hexadecimal". The message "No errors" is next displayed together with the total number of bytes and labels used and finally the menu (see below) is displayed.¢¢¢ERROR MESSAGES¢¢All errors are displayed upon a special 2 line error bar at the top of the screen in English, together with an invitation to press SELECT to display the menu. The actual statement within the listing that caused the error is indicated by the marker thus- <<<.¢ Generally all errors fall into one of four catagories each using different background colours, thus...¢¢     Grey    Disk errors¢     Red     Syntax errors¢     Yellow  Possible errors¢     Green   Programming errors¢¢¢THE MENU¢¢The menu comprises of a single line which is displayed at the bottom of the screen upon a green background, thus...¢¢OPTION-REBOOT  SELECT-RUN  START-DIR¢¢Pressing the START key will display the directory of the disk currently in drive number one and then re-display the menu.¢¢¢POSSIBLE ERRORS¢¢After a source code listing has been read by the Turbo Assembler, a special test is carried out looking for "Instruction mismatch". If for example, the instruction TXA is used, then a matching TAX instruction would normally be required somewhere in the listing.¢ From the "Possible Error" error bar, a modified menu is available so that the possible error can be bypassed if required. The modified menu is as follows.... ¢¢OPTION-REBOOT  SELECT-RUN  START-CONT¢¢Pressing the START key will allow the Turbo Assembler to continue as if the possible error had not been found. The OPTION and SELECT functions remain as before.¢¢¢THE OUTPUT FILES¢¢The two output files are written directly into BASIC data together with a FOR...NEXT loop loading routine and a REM statement. The first BASIC line number entered at the beginning before assembly commences is the line that contains the loading routine. All data statements follow on lines with line numbers incrementing in tens, placing as much data onto each basic line as possible. A REM statement will appear on a line number of one less than the loading routine.¢ Usually only one of the two output files will be required, the other file being simply ignored.¢¢¢THE FILE NAMES¢¢The two output files use the same file name as the source code text file, but use different extensions. "ABS" is used for the absolute code file and "REL" is used for the relocatable code file. For example if the default file name of "MACODE.TXT" is used for the source code text file then the absolute code file will be named "MACODE.ABS" and the relocatable code file named "MACODE.REL". The above example applies even if the source code text file did not use a file name extension and was simply named "MACODE".¢