Apple II+: Mini-Assembler (1 of 2)

The attached listing is a relocated version of the mini-assembler for the Apple II+ with instructions for the Apple II version. This version can be BRUN from the disk or BLOADed and start with CALL 2048 from Applesoft.
To restart use CAll 2051. From machine language the start is 800G and the restart is 803G. Users who have Integer Basic available need only enter that language and use the instructions in part one of this note.

Please note that the mini-assembler performs a NEW command, so it will wipe out any resident Applesoft program. Also note that the mini-assembler loads from $800 to $947. Don't try to assemble anything into those locations.

This note covers the operation of the mini-assembler only. It is not a course in assembly language programming. For a reference on programming the 6502 microprocessor, refer to the Synertek Programming manual or any of the tutorials available. This note assumes the user has a working knowledge of 6502 programming and mnemonics.

The mini-assembler is a programming aid aimed at reducing the amount of time required to convert a handwritten program to object code. The mini-assembler is basically a look-up table for opcodes. With it, you can type mnemonics with their absolute addresses, and the assembler will convert it to the correct object code and store it in memory.

Typing "F666G" puts the user in mini-assembler mode. While in this mode, any line typed in will be interpreted as an assembly language instruction, assembled, and stored in binary form unless the first character on the command line is a "$".

If the first character of a command line is a "$", the remainder of the line will be interpreted as a normal monitor command, executed, and control returned to the mini-assembler. To get out of the mini-assembler, press RESET.

If the first character on the line is blank, the assembled instruction will be stored starting at the address immediately following the previously assembled instruction. If the first character is not a blank nor a "$", the line is assumed to contain an assembly language instruction preceded by the instruction address (a hex number followed by a ":"). In either case, the instruction will be retyped over the line just entered in dis-assembler format to provide a visual check of what has been assembled.

The counter that keeps track of where the next instruction will be stored is the pseudo PC (Program Counter) and it can be changed by many monitor commands (eg. 'L', 'T', . . .). Therefore, it is advisable to use the explicit instruction address mode after every monitor command and, of course, when the mini-assembler is first entered.

Errors (unrecognized mnemonic, illegal format, etc.) are signalled by a "beep" and a caret ("^") will be printed beneath the last character read from the input line by the mini-assembler.

The mnemonics and formats accepted by the mini assembler are the same as those listed by the 6502 Programmers Manual, with the following exceptions and differences:

1. All imbedded blanks are ignored, except inside addresses.

2. All addresses typed in are assumed to be in hex (rather than decimal or symbolic). A preceding "$" (indicating hex rather than decimal or symbolic) is therefore optional, except that it should not precede the instruction address).

3. Instructions that operate on the accumulator have a blank operand field instead of "A".

4. When entering a branch instruction, the argument of the branch mnemonic should be the address of the target of the branch. If the destination address is not known at the time the instruction is entered, simply enter an address that is in the neighborhood, and later re-enter the branch instruction with the correct target address.

NOTE: If a branch target is specified that is out of range, the mini-assembler will flag the address as being in error.

5. The operand field of an instruction can only be followed by a comment field, which starts with a semicolon (";"). Obviously, the mini-assembler ignores the field and in fact will type over it when the line is typed over in disassembler format.

6. Any page zero references will generate page zero instruction formats if such a mode exists. There is no way to force a page zero address to be two bytes, even if the address has leading zeroes.

In general, to specify an addressing type, simply enter it as it would be listed in the disassembly. For information on the disassembler, see page 49 of the Apple II Reference Manual.

0000:                           **************************
0000:                           *                        *
0000:                           *       APPLE II         *
0000:                           *   MINI-ASSEMBLER       *
0000:                           *                        *
0000:                           **************************

002E:           FORMAT  EQU     $2E
002F:           LENGTH  EQU     $2F
0031:           MODE    EQU     $31
0033:           PROMPT  EQU     $33
0034:           YSAV    EQU     $34
0035:           L       EQU     $35
003A:           PCL     EQU     $3A
003B:           PLH     EQU     $3B
003D:           A1H     EQU     $3D
003E:           A2L     EQU     $3E
003F:           A2H     EQU     $3F
0042:           A4L     EQU     $42
0043:           A4H     EQU     $43
0044:           FMT     EQU     $44
0200:           IN      EQU     $200
D64B:           NEW     EQU     $D64B
F88E:           INSDS2  EQU     $F88E
F8D0:           INSTDSP EQU     $F8D0
F94A:           PRBL2   EQU     $F94A
F953:           PCADJ   EQU     $F953
F9B4:           CHAR1   EQU     $F9B4
F9BA:           CHAR2   EQU     $F9BA
F9C0:           MNEML   EQU     $F9C0
FA00:           MNEMR   EQU     $FA00
FC1A:           CURSUP  EQU     $FC1A
FD67:           GETLNZ  EQU     $FD67
FDED:           COUT    EQU     $FDED
FE00:           BL1     EQU     $FE00

FE78:           A1PCLP  EQU     $FE78
FF3A:           BELL    EQU     $FF3A
FFA7:           GETNUM  EQU     $FFA7
FFBE:           TOSUB   EQU     $FFBE
FFC7:           ZMODE   EQU     $FFC7
FFCC:           CHRTBL  EQU     $FFCC

Published Date: Feb 18, 2012