Path: wuarchive!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!xanth!cs.odu.edu!Amiga-Request
From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
Newsgroups: comp.sources.amiga
Subject: v90i113: NTSCBoot - reboot into PAL or NTSC mode, Part01/01
Message-ID: <11803@xanth.cs.odu.edu>
Date: 15 Mar 90 01:33:52 GMT
Sender: tadguy@cs.odu.edu
Reply-To: johnf%ssl.Berkeley.EDU@jade.berkeley.edu (John Flanagan)
Lines: 204
Approved: tadguy@cs.odu.edu (Tad Guy)
X-Mail-Submissions-To: Amiga@cs.odu.edu
X-Post-Discussions-To: comp.sys.amiga

Submitted-by: johnf%ssl.Berkeley.EDU@jade.berkeley.edu (John Flanagan)
Posting-number: Volume 90, Issue 113
Archive-name: util/ntscboot

[ uuencoded executables enclosed.  ...tad ]

This contains source, binary and docs for NTSCboot, which Udi Finkelstein
wrote and posted to comp.sys.amiga.tech last week.  This is a program which
reboots PAL Amigas into NTSC mode, if they have the 1-Meg Agnus and Kickstart
1.3.  I have also addeda version of NTSCboot which I zapped to create PALboot,
which boots NTSC Amigas into PAL mode.

All credit goes to Udi Finkelstein (finkel%math.tau.ac.il@CUNYVM.CUNY.EDU).  I
was going to try to rewrite these in a more legal manner, such that it would
not need to jump to code on the ROMs, but this does not seem to be possible
given the fact that system RAM is scrammed from the bus upon reset.  Oh well.

John

#!/bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  NTSCBoot.uu NTSCboot.asm PALBoot.uu README
# Wrapped by tadguy@xanth on Wed Mar 14 20:33:35 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'NTSCBoot.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'NTSCBoot.uu'\"
else
echo shar: Extracting \"'NTSCBoot.uu'\" \(132 characters\)
sed "s/^X//" >'NTSCBoot.uu' <<'END_OF_FILE'
Xbegin 644 NTSCBoot
XM```#\P`````````!```````````````(```#Z0````@L>``$3J[_:D?Y`-_Q0
X7HG(`+'@``DOY``-!($YP3M5.<0```_((_
X``
Xend
Xsize 68
END_OF_FILE
if test 132 -ne `wc -c <'NTSCBoot.uu'`; then
    echo shar: \"'NTSCBoot.uu'\" unpacked with wrong size!
fi
# end of 'NTSCBoot.uu'
fi
if test -f 'NTSCboot.asm' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'NTSCboot.asm'\"
else
echo shar: Extracting \"'NTSCboot.asm'\" \(2675 characters\)
sed "s/^X//" >'NTSCboot.asm' <<'END_OF_FILE'
XX;
XX; NTSCBoot.asm
XX;
XX; Copyright (C) 1990 By Udi Finkelstein.
XX; 17 feb 1990
XX;
XX; Reboot a SuperAgnus equipped PAL machine into NTSC mode.
XX;
XX; With thanks to Bart Whitebrook from CBM for his article on the new ECS
XX; registers in the 3rd european DevCon notes!
XX
XX; get into supervisor state, since we can only execute RESET there.
XX       xref    _LVOSuperState
XX       move.l  4,a6
XX       jsr     _LVOSuperState(a6)
XX
XX; ************************************
XX; Warning!!! a grand hack ahead!!!!!!!
XX; Never do this stuff alone at home!!!
XX; ************************************
XX
XX; Now we are in supervisor mode, and can issue a RESET command.
XX; Unfortunately, after RESET there is no RAM in the system!
XX; We can issue exacly *one* instruction ( 1 word length ) because
XX; the instruction was fetched before RESET was executed. This
XX; instruction can be a 'jmp (aX)', to somewhere on the ROM, where the
XX; program can continue. After searching the Kickstart 1.3 ROM, I found
XX; that at address $ff4120 you can find the code:
XX
XX; [ Notice - for Kickstart 1.3 ***ONLY***!!! Is there anybody out there
XX;   with a Kickstart 1.2/super Agnus combination? you have a problem! ;-) ]
XX
XX;00FF4120 2741 0038              move.l  d1,$38(a3)
XX;00FF4124 4281                   clr.l   d1
XX;00FF4126 4ED6                   jmp     (a6)
XX
XX; We can use this code fragment to set the NTSC bit in the super agnus,
XX; and then jump to the reset code. The PAL/NTSC bit is contained in
XX; address $DFF1DC   (BEAMCON0 !).
XX;
XX; 'move.l d1,$38(a3)' writes a longword, therefor $38(a3) must point to
XX; $dff1da because it's a read only location, which we can't harm, and
XX; $dff1dc contains the PAL/NTSC bit.
XX; $38(a3) == $dff1da   -->  a3 == $ddf1a2
XX; we must reset d1 ofcourse, or set d1 == #$00000020 to set PAL mode.
XX;
XX; ofcourse we have to set a6 to $00000002 to run the reset code later.
XX;
XX
XXROMADR =       ($ff4120-$fc0000)
XX
XX; ROMADR points to $ff4120 after the ROM appears in address $0000.
XX
XX       lea.l   $dff1a2,a3
XX       move.l  #$0,d1
XX       move.l  2,a6
XX       cnop    0,4
XX       lea.l   ROMADR,a5
XX       RESET                   ;reset the machine...
XX       jmp     (a5)            ;execute our code fragment.
XX
XX; Well, that's it. I tried writing a more portable code by trying to
XX; set/reset the OVL bit in $BFE001 instead of 'jmp (aX)' after RESET,
XX; but I wasn't able to get it working, so the only way I found to run
XX; a code after RESET is to find a ROM fragment that happenes to match
XX; my requirement. You don't have to tell me how bad it is. Hopefully,
XX; the 1.4 preferences will have a PAL/NTSC software switch ( Will it?!!)
XX
XX       END
END_OF_FILE
if test 2675 -ne `wc -c <'NTSCboot.asm'`; then
    echo shar: \"'NTSCboot.asm'\" unpacked with wrong size!
fi
# end of 'NTSCboot.asm'
fi
if test -f 'PALBoot.uu' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'PALBoot.uu'\"
else
echo shar: Extracting \"'PALBoot.uu'\" \(131 characters\)
sed "s/^X//" >'PALBoot.uu' <<'END_OF_FILE'
Xbegin 664 PALBoot
XM```#\P`````````!```````````````(```#Z0````@L>``$3J[_:D?Y`-_Q0
X7HG(@+'@``DOY``-!($YP3M5.<0```_((?
X``
Xend
Xsize 68
END_OF_FILE
if test 131 -ne `wc -c <'PALBoot.uu'`; then
    echo shar: \"'PALBoot.uu'\" unpacked with wrong size!
fi
# end of 'PALBoot.uu'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1245 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XHello everyone,
X
XThis is a program I wrote last night to reboot a PAL machine into
XNTSC mode. You must have the new Agnus chip, and Kickstart 1.3 .
XThe program relies on static location of certain Kickstart 1.3
XROM instructions, so it MUST be modified for Kickstart 1.2 . Are there
Xany users of the new Agnus chip users with Kickstart 1.2??
X
XThe program has been tested on a PAL A500 with a super Agnus chip,
Xa fully populated A590, Kickstart 1.3 ROM, and a Rev 3 motherboard
Xhacked to contain the super Agnus chip.
X
XThe program should work as is on 2000's as well, but I didn't
Xtest it. Again, it will *not* work with Kickstart 1.2 .
X
XThe program can be easily modified to reboot an NTSC machine in PAL
Xmode, but I remember reading that the american monitors can't work
Xin PAL mode, while the european monitors can work in both modes.
X( This was verified by me ;-) ).
X
XI could modify it to be more user-friendly ( find the appropriate
Xaddress in the Kickstart ROM at run time, etc. ), but I was too
Xlazy to do this ;-) ( actually, I had an exam the next morning so I
Xdidn't have too much time improving it ).
X
XSince our Usenet connection has been down for the last 3 weeks, any
Xcomments should be mailed to me directly, and not posted.
X
XEnjoy!
END_OF_FILE
if test 1245 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 
Mail submissions (sources or binaries) to <amiga@cs.odu.edu>.
Mail comments to the moderator at <amiga-request@cs.odu.edu>.
Post requests for sources, and general discussion to comp.sys.amiga.
