🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #8302

Re: Short assembler program to determine CPU type (and a plea for help)

#8302
From: Bryce Nesbitt
Date: Tue, 15 Mar 1988 20:24
46 lines
2067 bytes
[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
Technical Details
Message-ID: <7701@agate.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!dogie!uwmcsd1!ig!agate!eris!bryce
References: <8271@tut.cis.ohio-state.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!uwvax!dogie!uwmcsd1!ig!agate!eris!bryce
From: bryce@eris (Bryce Nesbitt)
Newsgroups: comp.sys.amiga.tech,comp.sys.amiga
Subject: Re: Short assembler program to determine CPU type (and a plea for help)
Message-ID: <7701@agate.BERKELEY.EDU>
Date: 15 Mar 88 20:24:21 GMT
References: <8271@tut.cis.ohio-state.edu>
Sender: usenet@agate.BERKELEY.EDU
Organization: University of California, Berkeley
Lines: 46
Keywords: assembler tiny