.TA     Target Address

Syntax:

         .TA  expression

See also:

.BS   .DU   .ED   .EP   .NO   .OR   .PH   .SM  

Function:

In Version 2 of the SB-Assembler this is an obsolete directive, originating from the Apple version of the SB-Assembler.
In Version 3 of the SB-Assembler this directive is used to set the target address in the formatted output file.

Boundary Sync:

In Version 3 of the SB-Assembler this directive will perform a boundary sync.

Explanation:

This directive was used on the Apple ][ version of the SB-Assembler to send generated code directly to memory, where it could be started directly. This is never possible on a modern PC however.

In Version 2 of the SB-Assembler this directive will always report the Not implemented in MS-DOS version error message.

In Version 3 of the SB-Assembler this directive is reinstated and will set the target address of the formatted target file. Normally the current program counter is equal to the addresses in the target file. Some processors however don't start their programs at address $0000. For the 6502 for instance ROM memory is mapped somewhere at the end of the address space. Thus the program may start at $C000 for instance. However the EPROM address spaces always start at address $0000.
Up until Version 2 of the SB-Assembler this could be solved by using the .PH directive following the .OR directive. Thus there the program counter was set to $0000, and an offset of $C000 was added to that to let the processor think the ROM started at $C000. This was the only way to solve the above mentioned problem in Version 2 of the SB-Assembler.

In Version 3 of the SB-Assembler you may now solve the above problem in a more natural way. Simply set the .OR to the real starting address of your program ($C000 in the example above), and then change the target address to $0000. Now the assembler will still generate code for the intended address range, while the target file is correctly written from address $0000 and upwards.

Each time a byte is written to the target file, the target address is incremented. Therefore the program counter and the target address counter will remain in sync with each other.
Some processors store 2 bytes per program instruction. Others may even store 3 or more bytes per program instruction. In these cases the target counter will still be incremented with every byte written to the target file. However the program counter is incremented only once per instruction. In these cases the target file will grow twice as fast as the program counter (or even 3 times faster, or more on some processors). Be aware of this when you set the target address! When a processor stores 2 bytes per instruction always set the target address 2x higher than the program counter. The SB-Assembler simply obeys your orders, and will not complain if you mess up the target addresses!

The .OR directive will set the target address to the new program counter multiplied with the number of bytes stored per instruction. This is normally exactly what you want, unless you want to change the target address to reflect proper ROM alignment.

Please note that the .TA directive can only be used on code memory segments. Executing it any other memory segment will result in a Only allowed in Code memory error.

Example:

; Setting the proper ROM address the old way
        .OR     $0000      ROM space starts here
        .PH     $C000      Program starts here
LABEL   ;                  The label gets the value $C000
        NOP                However byte is stored at $0000

; Setting the proper ROM address the new way
        .OR     $C000      The program starts here
        .TA     $0000      ROM space starts here
LABEL   ;                  The label gets the value $C000
        NOP                The byte is stored at $0000