[comp.sys.atari.st] alcyon question

rosenkra@Alliant.COM (Bill Rosenkranz) (03/09/88)

does anyone know if it is possible to write inline assembler with
alcyon? seems like i've tried all the ways i can think of but none
seem to work. it's really not a big deal, just curious....

-bill

apratt@atari.UUCP (Allan Pratt) (03/12/88)

From article <1374@alliant.Alliant.COM>, 
by rosenkra@Alliant.COM (Bill Rosenkranz):
> does anyone know if it is possible to write inline assembler with
> alcyon? seems like i've tried all the ways i can think of but none
> seem to work. it's really not a big deal, just curious....
> 
> -bill

Yes: say asm("foo") where foo is an as68-compatible line of assembly code.
For instance...

#include <osbind.h>

main()
{
	long oldssp = Super(0L);
	asm("move.l #$0,$420");		/* set _memvalid to 0 (invalid) */
	asm("move.l $4f2,a0");		/* a0 -> system header */
	asm("move.l 2(a0),a0");		/* 2(a0) is reset vector */
	asm("jmp (a0)");
}

will cause a COLD system reset (as opposed to the normal warm one). 
Equivalent C code is left as an exercise to the reader -- this is just
an example.  (JMPing indirect through 4 would work, but JMPing directly
to FC0000 or FC0030 wouldn't be right because new STs might have ROM
starting at a different location.)


============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt