[comp.sys.amiga.tech] Short assembler program to determine CPU type

bryce@eris (Bryce Nesbitt) (03/16/88)

[This is a perfect example of a comp.sys.amiga.tech-type topic]

In a comp.sys.amiga article, erd@tut.cis.ohio-state.edu (Ethan R. Dicks) writes:
>
>This is my first attempt at assembler and I know it is
>crude...efficient, but crude.  I would apreciate [comments]...
>[I need help with] Amiga include files - structures in C are easy to use,
>how do you use them (or their equvalents) in assembler?

Structures work nearly the same in assembler as in C, thanks to some
include file macros provided by C-A.  You will need to have a copy of
those (with comments).  They should have come with your assembler, and you
should have identified just what assembler that is.

Here is an example that gets the processor AttnFlags word....

	INCLUDE "exec/types.i"		;Macro file, always include it
	INCLUDE "exec/execbase.i"	;We want to use execbase

	move.l	4,a6			;Get the location of ExecBase
	move.w	AttnFlags(a6),d0	;Get the word that is "AttnFlags"
					; past a6.
	rts
	

>		btst	#1,297(a6)		;check Afb_68020

Remember, this is really "btst.b".  It only looks at a byte at a time.
To examine a word or long fully, you must fiddle with pointing at
the proper part of the bigger picture.


This is best written:

		btst.b	#AFB_68020,AttnFlags+1(a6)
					     ^ Address second half of word



Again, read the commented include files to figgure out what is what.
This goes for C programming also.

|\_/|  . ACK!, NAK!, EOT!, SOH!
{O_o} .     Bryce Nesbitt
 (")        BIX: mleeds (temporarily)
  U	    USENET: bryce@eris.berkeley.EDU -or- ucbvax!eris!bryce