start	move.l sp,a5		start the program!
	move.l #ustk,sp		Make space available...
	move.l 4(a5),a5
	move.l $c(a5),d0
	add.l $14(a5),d0
	add.l $1c(a5),d0
	add.l #$100,d0
	move.l d0,size
	move.l d0,-(sp)
	move.l a5,-(sp)
	move.w d0,-(sp)
	move.w #$4a,-(sp)
	trap #1			and free up unused memory
	add.l #12,sp		accordingly.

gosuper	clr.l -(sp)		enter supervisor mode
	move.w #32,-(sp)
	trap #1
	addq #6,sp
	move.l d0,savestk		keep track of the old stack

install	suba.l a4,a4		install the reset-program.
	move.l #$31415926,d0	magic number.
	move.l d0,$426(a4)		RESVALID
	move.l #go,d0		reset program address.
	move.l d0,$42a(a4)		RESVECTOR

gouser	move.l savestk,-(sp)	go back to user mode now
	move.w #32,-(sp)
	trap #1
	addq #6,sp

exit	clr.w -(sp)		and finish the installation.
	move.l size,d0
	move.l d0,-(sp)
	move.w #49,-(sp)
	trap #1
	
go	sub.l a4,a4		Start of the reset-program.
	move.l #0,$426(a4)		clear the program from memory
	move.l #0,$42a(a4)		after a reset!
	
newbit	lea	$FFFF8800,a0	Just replacing $FC0084 of
	move.b	#$7,(a0)		the ROM here, because we want to
	move.b	#$C0,$2(a0)	skip over the original version.
	move.b	#$E,(a0)
	move.b	#$7,$2(a0)
	move.b	$fc001d,d0
	btst	#$0,d0
	beq	continue
	lea	continue(pc),a6
	move.l	#$fc0e1a,a5
	jmp (a5)

continue	move.l #$ff820a,a5		Right... the frequency address.
	move.b #0,d0		D0 holds the new frequency.
	move.b d0,(a5)		0 for 60Hz, and 2 for 50Hz.
	move.l #$fc00b6,a6		Continue with original part of
	jmp (a6)			the ROM...
	
	ds.l 20			Stack space... stack grows
ustk	ds.l 1			downwards.
size	ds.l 1			Size of memory to keep
savestk	ds.l 1			old stack pointer.