[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Silly MiNT utility




Silly utility of the day. This program boots a floppy disk with an
executable bootsector. I ran Epic and Cybercon III today, under MiNT.
Since the programs run exclusively in Supervisor mode there's no
multitasking. And they never terminate, so MiNT and the scheduler never
regains control.

If (and it's a big if) the program ever goes to user mode, then
(theoretically) the MiNT scheduler should take over. If (another big if)
the program ever exits, then MiNT _should_ get control again.

Conjecture at this stage.

Enjoy.

/* CUT HERE */


#include <osbind.h>

int 	buf[512];	/* ints to ensure word alignment */

int	main(void)
{
	void	(*pfunc)(void);
	long	sssp;

	pfunc=(void (*)(void))&buf[0];	/* setup the function pointer */

	/* load the bootsector */
	if(Floprd(buf,0L,0,1,0,0,1))
		{
		Cconws("Disk read failed\r\n");
		return 1;
		}
	printf("Trying to boot...\n");

	/* toggle to supervisor mode. Bootsectors expect to be in it */
	sssp=Super(0L);

	/* Run that baby! */
	(pfunc)();

	/* Probably we'll never get here. You never know, though */
	Super(sssp);
	return 0;
}