[comp.sys.apple2] Assembly + Macros = HLL

meekins@cis.ohio-state.edu (Tim Meekins) (04/30/91)

This debate over HLLs versus assembly has stirred up quite a debate. I'm
for both languages, but base my decision on what to use based upon the
platform I'm using. I would never touch assembly on a SparcStation, yet
rarely touch a HLL on my IIgs.

Most arguments against assembly tend to state that it is too difficult to
get something easy done. The problem is that many people try to recreate
the wheel and write from scratch too much. Apple's Toolbox alleviates
many of these problems. A simply tool call will write a string to the
text screen or open a file.

Too many people, even the task of making a tool call is just too hard in
assembly or too cumbersome. The same with other chores such as looping
and comparisons and so forth. The problem with this is that very few
people use any sort of powerful macros. About the only macros I see
used are very simple push and pull macros and some simple tool macros.
Too help make assembly programming as seemless as possible, I have been
working on a project for over 3 years now, which I call the Zavtra
Macros Disk, which I have just posted to comp.binaries.apple2. This
disk containes over 1,000 macros. It includes extremely powerful macros
for pushing and pulling. Here are some samples of what can be done:

	PH2	abc	  ;push what's at abc
	PH2	#$1234	  ;Push the immediate value $1234
	PH2	@x	  ;push the x register
	PH4	#abc	  ;push the address of abc
	PH4	@ax	  ;psuh the values in the accumulator and x register

I also have defined Pascal-like macros for all tool calls. These macros
invoke the above push statements and similar pull statements, for example:

	sub2	end,start,@a	;Accumulator = size of buffer needed
	ldx	#0
	NewHandle (@xa,UserID,#$C018,#0),handle
	Deref	handle,pointer

the above code calculates the amount of space needed then gets a pointer
to the needed buffer from the memory manager.

The macros also include control structures such as if/then

	ReadChar #1,@a
	if2	@a,eq,#ESC,exit	    ;If the key pressed was ESC then exit
	if2	@a,cc,#$20,ignore   ;ignore all other control characters

Also included are subroutines macros for setting of stack frames.

There also numerous other macros which I'm not going to mention here.

So, if you want to do fast assembly programming without the pain, check
out my macro library. They are shareware, so if you find yourself using
them a lot in your endeavours, feel free to send me the registration
fee.

--
+---------------------------S-U-P-P-O-R-T-----------------------------------+
|/ Tim Meekins                  <<>> Snail Mail:           <<>>  Apple II  \|
|>   meekins@cis.ohio-state.edu <<>>   8372 Morris Rd.     <<>>  Forever!  <|
|\   timm@pro-tcc.cts.com       <<>>   Hilliard, OH 43026  <<>>            /|