help! (much shorter)

John Gilmore gnu at sun.uucp
Wed Mar 21 19:58:36 AEST 1984


You can't assign an absolute address to a piece of text or data that
comes out of the C compiler.  You can make an absolute address look
like a struct (or other variable), then do a structure assignment
at runtime to initialize it if you want.  For example:

#define	DISKCTLR	(*(struct diskregs *)0xFFF304)
struct diskregs diskinit = {...};

	DISKCTLR = diskinit;
	DISKCTLR.command = DISK_RESET;
	...

Note that in the structure assignment, you can't control the ordering
of the storage references, so if it's an I/O device (not real memory),
you're probably better off doing it by hand.  Most devices are finicky
about what registers you write in what order anyway.



More information about the Comp.lang.c mailing list