28.12.2012 Views

Your Commodore - Commodore Is Awesome

Your Commodore - Commodore Is Awesome

Your Commodore - Commodore Is Awesome

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1 C 6 4 PROGRAMMING<br />

MACRO<br />

ASSEMBLER<br />

Be the master of your<br />

machine code program<br />

with this extensive 3<br />

pass macro assembler<br />

By I. Goffe<br />

have been available for the<br />

M <strong>Commodore</strong> 64 since the<br />

arrival a of the machine, but sadly many<br />

such n pieces of software are scarce in<br />

the y shop today. I have noticed a steady<br />

revival a of assemblers, thanks largely<br />

to s magazine such as this, it is especially<br />

true of the 6510+ assembler in the<br />

May/June<br />

s<br />

issue of its sister magazine<br />

<strong>Commodore</strong> e Disk User, which offers<br />

many m more facilities than its commercial<br />

b counterparts. My Macro assembler<br />

l is intended to be yet another<br />

valuable<br />

e<br />

tool to the machine code<br />

programmer, with the added bonus of<br />

r<br />

macro, and conditional assembly; this<br />

allows<br />

p<br />

much more structure to be<br />

implemented a into your own machine<br />

code c programs.<br />

k Presented here is a sophisticated 3pass<br />

a 6502/6510 Macro Assembler that<br />

supports g many advanced features,<br />

including:<br />

e<br />

Full<br />

s<br />

macro assembly with parameter<br />

passing;<br />

Linkable source files;<br />

Including directly from disk;<br />

Symbol table/ buffer space memory<br />

configure;<br />

Conditional assembly (IF, THEN,<br />

ELSE);<br />

Symbol table cross-referencing;<br />

Selective assembly output;<br />

Full DOS support;<br />

Extendable capabilities.<br />

The assembler can be configured<br />

to work with either disk, or cassette<br />

filing.<br />

The Assembler - Getting<br />

Started<br />

The assembler code runs from S6E00-<br />

SA000. To initialise the assembler from<br />

a cold start type: SYS 28160, this redirects<br />

the RESTORE key to allow<br />

you to enter the assembler command<br />

mode with a single stroke key press.<br />

If you should change the RESTORE<br />

key vector use SYS 28160, which will<br />

re-initialise once more, The use of a<br />

cold start also clears the current<br />

symbol, macro directory, and macro<br />

library areas.<br />

Once a cold start has been issued<br />

as above, the program title will be<br />

displayed, at this point as Basic wedge<br />

was to be used to enter the assembler<br />

command mode, but I wanted the<br />

system to be able to run alongside an<br />

extended Basic if there are no memory<br />

conflicts. I opted for the idea of being<br />

able to call up the main assembler<br />

command mode by pressing a single<br />

key which emulate the Basic command<br />

'SYS 28215' which calls up the<br />

assembler command mode via a warm<br />

start.<br />

To summarise, pressing RES-<br />

TORE whilst in the basic editor will<br />

automatically do the Basic command<br />

'S YS 28215' to jump into the assembler<br />

via a warm start.<br />

Extra Note on Compatability<br />

with Action Replay<br />

Some ROM routines which are called<br />

inside the assembler seem to corrupt<br />

Nv he n the assembler is first run, to get<br />

around this problem follows these<br />

steps...<br />

11. Type SYS 64738 to jump into a<br />

normal reset<br />

2. Press the reset button on the back<br />

of the cartridge to exit back to the<br />

'FASTLOAD' interpreter which will<br />

allow the assembler to operate. In this<br />

case all FASTLOAD/ Warp loading<br />

can be used in conjunction with the<br />

assembler, making source file 110<br />

extremely fast and effective,<br />

The RESTORE key does not work<br />

correctly with TASILOAD' installed,<br />

so a manual 'SYS 28125' needed to<br />

be typed to jump into the assembler<br />

command mode.<br />

Entering Source Files<br />

The source files are maintained in the<br />

standard Basic editor, so you will not<br />

need the assembler present for actually<br />

entering the source. As in Basic only<br />

lines 0-63999 are valid.<br />

The source must follow a set<br />

format, however, true field-tabulation<br />

is not required for LABEL, OPCODE,<br />

OPERAND but some form of correct<br />

syntax needs to be followed. In general<br />

the syntax would be one of:<br />

LABEL OPCODE OPERAND;<br />

LABEL<br />

OPCODE;<br />

OPCODE OPERAND,<br />

Note that if a label is not followed<br />

by an opcode then a comment (1) is<br />

expected. A comment can be used in<br />

any available field. A space is needed<br />

in between the 'fields', and where<br />

applicable quotes must be set out in<br />

the text correctly,<br />

eg):<br />

10 LDA 1 0 ! space between LDA<br />

and 10<br />

20 LABEL ! a comment is needed if<br />

no following opcode<br />

30 DINCLUDE "name" ! opening and<br />

closing quotes needed,<br />

Thirty Two Y O U R COMMODORE

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!