Path: utzoo!utgpu!watserv1!watdragon!tiger!mwandel From: mwandel@tiger.waterloo.edu (Markus Wandel) Newsgroups: comp.sys.amiga.tech Subject: Re: Writing to WCS Message-ID: <20080@watdragon.waterloo.edu> Date: 23 Jan 90 17:43:45 GMT References: <90012003501244@masnet.uucp> <20011@watdragon.waterloo.edu> <629@shodha.dec.com> Sender: daemon@watdragon.waterloo.edu Reply-To: mwandel@tiger.waterloo.edu (Markus Wandel) Organization: U. of Waterloo, Ontario Lines: 47 In article <629@shodha.dec.com> ridder@elvira.enet.dec.com (Hans Ridder) writes: >> >> lea bootcont,a0 >> move.l a0,$80 > ^^^-----------Ack! Pounding the autovectors! >> trap #0 >>bootcont: >> move.l $fc0004,a0 > ^^^^^^----------Cough! Jumping to ROM! >> jmp -2(a0) >> end >> And proceeds to give the official, supported way to reboot an Amiga. Fine and good, except the official, supported way, won't leave the WCS enabled, which was the goal of the whole exercise. Try it. I did, just to make sure. You see, when you jump to location 2 after doing a RESET instruction, you are jumping to the A1000's boot ROM. This ROM will merrily proceed to checksum the kickstart RAM, find it valid, write-protect it again, and go through a 100% normal reboot. What else would you expect, that Commodore's official way to reboot all Amigas will leave an A1000 with its WCS enabled and prone to all-the-way-back-to-kickstart crashes? But to make you happy, here is another WCS enabler which is similar to the Commodore reboot code. All I do is jump to $FC0002 after the RESET, instead of $000002. This gets me the WCS code instead of the boot ROM. I also move the CNOP 0,4 to preserve the longword alignment of the RESET instruction. _ColdReboot: MOVE.L 4,(A6) ; Get pointer to ExecBase LEA.L MagicResetCode(PC),A5 ; Location of reset code JSR _LVOSupervisor(A6) ; Start code in supervisor mode MagicResetCode: LEA.L $FC0002,A0 ; Point to JMP instruction at start of WCS ^^^^^^ ^^^ CNOP 0,4 ; IMPORTANT: Must be longword aligned RESET ; All RAM goes away now! JMP (A0) ; Rely on prefetch to execute this instruction Oh, this code is also slightly more future-proof as it no longer depends on that RESET instruction at the start of the WCS code. Markus Wandel mwandel@tiger.waterloo.edu (519) 884-9547