[net.micro.atari] Program to create double sided ST boot disks.

randy@nlm-vax.ARPA (Rand Huntzinger) (10/16/85)

Here is my quick and dirty program to create double sided boot disks for
the Atari 520ST.  Actually, all it does is write a properly configured
boot sector to a diskette.  Once that is done, you can copy TOS and the
desk accessories over and boot from the disk.

The program can also be used to install a boot on a single sided diskette
as well.  A shar archive appears below.  The archive contains the sources
of the programs and a uuencoded version of the binary.  [Unix users can
decode using uudecode].

Users not running UNIX will have to hand edit the files out of the archive
and if they don't have access to uudecode, install it from the sources.
That requires a developer's package.

-------------------------------CUT HERE-----------------------------------
: This is a shar archieve.  Extract with sh, not csh.
: The rest of this file will extract:
: README wboot.encoded wboot.c mkboot.c
echo extracting - README
sed 's/^X//' > README << '/*EOF'
XDescription of the wboot program:
X
XThis program writes a bootstrap sector on the specified disk
Xdrive.  By default, a boot for a single sided 80 track diskette
Xis written to drive A:, but wboot options permit boot blocks for
Xother disk formats to be written.  This is a quick and dirty
Xprogram, of TOS-TAKES-PARAMETERS type.  I might be fun to put in
Xthe GEM hooks, but I haven't tried this yet.
X
XThe distribution includes the following files:
X
X	readme			This file.
X	wboot.encoded		A "uuencoded" binary of the wboot program.
X	wboot.c			The C language source for wboot.ttp.
X	mkboot.c		A program to create a boot.h file.
X
XThis file is a shar archive.  If you are running Unix, you can unpacking
Xit by using it as input to sh.  If not, you can hand edit the files out of
Xthe archive by removing the sh commands in between.
X
XHow to install the binary version:
X
X    1.	After unpacking, run the wboot program through the Unix program
X	uudecode.  This will generate the binary file, wboot.ttp.
X
X    2.	Using kermit, modem, or what have you, do a binary download of the
X	program to your ST.
X
X    3.  You are ready to run, see below.
X
X
XHow to install the source version (requires developer's package):
X
X    1.	After unpacking, use kermit, modem, or whatever to download the
X	sources, wboot.c and mkboot.c.
X
X    2.	Compile mkboot.c and link the object file with gemstart, gemlib and
X	osbind.
X
X    3.	Put a disk with a bootstrap on it in drive A:.  (A copy of your TOS
X	system disk).
X
X    4.	Double click on the newly created mkboot.prg file.  You should end
X	up with a file called boot.h on the same disk as mkboot.prg.
X
X    5.	Check this file, it should have one C array, boot[], which is filled
X	with hex byte values.  That is the content of your current boot
X	block.
X
X    6.	Check the source of wboot.c to make sure when you compile it you
X	will include boot.h properly.  [You may have to add device & path
X	data].
X
X    7.	Compile the wboot.c program and link the object module with gemstart,
X	gemlib and osbind.
X
X    8.	Either install this file as a TOS-TAKES-PARAMETERS file, or change
X	the file extension to TTP (which has the same effect).
X
X    9.	You are ready to run.
X
X
XHow to run wboot:
X
X    1.	Double click on the wboot.ttp (or .prg) icon.  You should get an
X	box asking you to fill in the arguments.
X
X    2.	Supply the arguments as follows:
X
X		Use -d on the line if your diskette is double sided.
X
X		Use -4 if it is a 40 track (5 1/4 inch) diskette.  (This
X			option is not tested).
X
X		Put a: or b: on the line to indicate the drive where the
X		boot block is to be written.
X
X	If you supply no arguments, a single sided boot will be written
X	to drive A:.  For example, if you want to write a double sided
X	boot block to drive B:, the proper arguments are:
X
X				-d b:
X
X    3.	When done, click the button to start the application.  You will
X	see a line telling you the options which were selected.
X
X    4.	You will be asked if you want to write the boot.  Type Y and your
X	selected disk will blink once as the boot sector is written.  Any
X	other response will abort the write and exit from wboot.
X
X    5.	The program loops at the point back to #4.  You can write identical
X	boots to as many diskettes as you want before exiting.
X
XNot exactly a demonstration of the best of the ST, but it gets the job done
Xand I wrote it very quickly.  Good luck.
X
X					Randy
/*EOF
echo extracting - wboot.encoded
sed 's/^X//' > wboot.encoded << '/*EOF'
Xbegin 644 wboot.ttp
XM8!H  !=*   &I@  (YP   0V             "I/*FT !"/-   =\" M  S0
XMK0 4T*T '-"\   % "( THW"O/____XN02\ +PU"9S\\ $I.0=_\    #"!Y
XM   =\")H !C3Z  <(\D  !WT1>@ @! : H    #_/P O"IW.3KD   1 3OD 
XM  "Z(B\ !# \ ,A.0DYU(&\ !" (0>@! +_(9 1P_TYU(\   !WT0H!.=4Y6
XM   P+P ((B\ "DY"O_D  !WT9!0P/  )0?D  !BF(@A.0C \  !.0DY>3G4@
XM;P $,B\ "# O  I(P%. ;P80P5'(__Q"@$YU(&\ !# O  A*$&8$0H!.=; 8
XM9O0@"%. 3G5.5O_Z+JX "#\\  E.N0  %SI4CRZ\   :RC\\  E.N0  %SI4
XMCSZ\  A.N0  %SH]0/_^L'P 66<(#&X >?_^9A@NO   &M,_/  )3KD  !<Z
XM5(]P 6 68!0NO   &MD_/  )3KD  !<Z5(]"0$Y>3G5.5O_Z+JX "#\\  E.
XMN0  %SI4CRZ\   :WC\\  E.N0  %SI4CSZ\  A.N0  %SH]0/_^L'P #6<(
XM#&X "O_^9N0NO   &OL_/  )3KD  !<Z5(].7DYU3E;__"ZN  AAGCZN  Q.
XMN0  "6A.7DYU3E;_GD)N__X]?  "__I";O_V0F[__%BN  I3;@ (8   MB!N
XM  H@4 P0 "UF."!N  H@4! H  %(@& 40F[_^F B/7P  ?_V8!I2;O_\8!2P
XM?  T9^:P? !$9^:P? !D9^!@YF!H(&X "BZ03KD  !5@L'P  F92(&X "B!0
XM#"@ .@ !9D0@;@ *(% ,$ !!9PP@;@ *(% ,$ !A9@9";O_^8"0@;@ *(% ,
XM$ !"9PP@;@ *(% ,$ !B9@@]?  !__Y@!%)N__Q@!%)N__Q3;@ (6*X "DIN
XM  AN /]&2F[__&<0/KP  2\\   :_F$ _OA8CS N__J ;O_V/4#_]#Z\  $_
XM+O_T+SP!    +SP  !C*/SP $DZY   7&M_\    #"Z\   ;(#\\  E.N0  
XM%SI4CTIN__9F""Z\   ;/& &+KP  !M#/SP "4ZY   7.E2/+KP  !M*/SP 
XM"4ZY   7.E2/#&X  ?_Z;P@NO   &U)@!BZ\   ;53\\  E.N0  %SI4CRZ\
XM   ;6#\\  E.N0  %SI4CTIN__YO""Z\   ;>6 &+KP  !M[/SP "4ZY   7
XM.E2/+KP  !M]+PX&E____Z).N0  %3Y8CTIN__YO""Z\   ;E& &+KP  !N6
XM+PX&E____Z).N0  %118CRZ\   ;F"\.!I?___^B3KD  !446(\NC@:7____
XMHF$ _0A*0&<\/KP  4)G0F<_/  !/R[__D*G+SP  !C*/SP "4ZY   7&M_\
XM    $BZ\   ;FS\\  E.N0  %SI4CV"T0E=.N0  "6A.7DYU3E8  $CG 01.
XMN0  $51"5R\\   8OTZY   ,+EB//KP  2\\   8OTZY   ,+EB//KP  2\\
XM   8OTZY   ,+EB/(&X "#)N  S1R4(0*FX "& F$!5(@$C T+P  !T>($ (
XM$  #9PH0%4B T'P (& $$!5(@!J 4HU*%6;6/JX #"\N  A.N0  !-A8CTJ?
XM3-\@ $Y>3G5.5O_>2.<'#$)73KD  ! &(\   !W\(\   !X 0GD  !WZ+KP 
XM !BU80 #%BIN  A@  ).8 )2C4H59Q00%4B 2,#0O   '1X@0 @0  5FYDH5
XM9P ",@P5 ")G!@P5 "=F1AP5$ 9(@#Z +PU2ETZY    X%B/*$ @#&8.+KP 
XM !NL+PUA  )66(\@#$C D(T^ "!-,D?1R4(04D<NC5*780 "GF   =A"1V "
XM4D<@33)'T<E*$&<6$#5P $B 2,#0O   '1X@0 @0  5GWDHU< !G"B!-,D?1
XMR4(04D<0%4B 8  !AD)73KD   H*0E<O#5*73KD   Q&6(]*0&<0+HU2ER\\
XM   ;OF$  =!8CV   6P^O  !3KD   H*#"T /@ !9D ^O  !+PU4ETZY   ,
XM1EB/L'P  688/KP  D*G/SP  4ZY   ,>%R/L'S__V80+HU2ER\\   ;RV$ 
XM 7Q8CV D0E<O#5*73KD   DV6(^P?  !9Q NC5*7+SP  !O:80 !5EB/8   
XM\CZ\ #\O#4ZY    X%B/2H!F%#Z\ "HO#4ZY    X%B/2H!G  "P+7P  "2T
XM__PNKO_\!I<    X/SP &DZY    EE2//KP $2\-/SP  TZY   3T%R/' "\
XM/ #_9@XNO   &^DO#6$  .98CV!>+HX&E____]X0!DB /P O+O_\80 !6ER/
XM+HX&E____]Y.N0  %6 ^@%)73KD  !8 *$ NC@:7____WB\,3KD  !4^6(\N
XMC&$  /P^O  2+PT_/  #3KD  !/07(\< +P\ /]FG& &+HUA  #:8!2P?  \
XM9P#^=K!\ #YG /Z<8 #_$MK'2A5F /VP0I=A  "V4WD  !WZ+KD  !X 3KD 
XM  !ZL'S__V80+KP  !P#+SP  !OT82I8CT*7+SD  !W\/SD  !WZ3KD   '<
XM7(\^@$ZY   ):$J?3-\PP$Y>3G5.5O]\+JX ""\.!I?___^ 3KD  !4^6(\N
XMK@ ,+PX&E____X!.N0  %118CRZ\   <!"\.!I?___^ 3KD  !446(\NC@:7
XM____@#\\  E.N0   )94CSZ\__].N0  "6A.7DYU3E8  $CG 00J;@ (('D 
XM !X ((U8N0  '@!2>0  '?I*GTS?( !.7DYU3E8  $CG QPJ;@ ('BX #2AN
XM  Y'[0!6&-MF_$J?3-\X@$Y>3G5.5@  2.<#!$ZY   0[CX OGS__V8&</]@
XM  "2/H=.N0  $78P!\'\ C@J0-O\   >#$IN  YF! !5 ! NO   &+\O+@ (
XM3KD  !6.6(]*0&8* %4  S '8%)@'BZ\   8Q"\N  A.N0  %8Y8CTI 9@@ 
XM50 %, =@,CZ\ !8O+@ (/P=.N0  $]!<CTI 9Q8S_  C   =&C/Y   =^   
XM'1QP_V & %4  3 '2I],WR" 3EY.=4Y6__Q"5S\N  PO+@ (80#_.ER/3EY.
XM=4Y6__Q"5S\N  PO+@ (80#_(ER/3EY.=4Y6__P^O  !/RX #"\N  AA /\(
XM7(].7DYU3E;__$ZY   )@#ZN  A.N0   +I.7DYU3E8  $CG P!"1V 6, ?!
XM_  .T+P  !P(+H!.N0  ";)21[Y\ !!MY$J?3-\ @$Y>3G5.5@  2.<!!"IN
XM  @P+0 "P'P  V<J+HU.N0  "IH(+0 "  -G"BZM  1.N0  #GA"0$C *T  
XM""M   1";0 , FW_@  "/I5.N0  "@I*GTS?( !.7DYU3E8  $CG#P0^+@ (
XM/H=.N0  $>0J0" -9A8S_  )   =&C/Y   =^   '1QP_V!.0D8P%<!\  9F
XM%CZM  0_/  ^3KD  !:V5(\\ &P"?/\^ATZY   1=CZ'3KD  !$X2D9F!C &
XM8!9@%#/\  4  !T:,_D  !WX   =''#_2I],WR#@3EY.=4Y6__Q.7DYU3E8 
XM $CG!P0J;@ (,"T  L!\  JP?  "9BP@+0 (D*T !#P ;R ^AB\M  0_%4ZY
XM   0<%R//@"\1V<* &T $  "</]@2@@M  $  V<>2JT !&<6""T  P #9P@[
XM?  !  Q@!CM\ ?\ #& </KP  3 M  Q$0$C +P _%4ZY   ,>%R/0FT #"MM
XM  0 "$) 2I],WR# 3EY.=4Y6  !(YP,$3KD  !#N/@"^?/__9@9P_V   -8^
XMATZY   1=C 'P?P"."I V_P  !X,2FX #&8$ %4 "$IN  YF! !5 ! NO   
XM&+\O+@ (3KD  !6.6(]*0&82 %4  SMN  P !# '8   AF >+KP  !C$+RX 
XM"$ZY   5CEB/2D!F" !5  4P!V!D/KP #R\N  @_!TZY   3T%R/2D!G'CZ'
XM3KD  !$X,_P  @  '1HS^0  '?@  !T<</]@, !5  $^O  "0J<0+0 #2( _
XM $ZY   ,>%R/0E="IQ M  -(@#\ 3KD   QX7(\P!TJ?3-\@@$Y>3G5.5O_\
XM0E<_+@ ,+RX "&$ _O9<CTY>3G5.5O_\0E<_+@ ,+RX "&$ _MY<CTY>3G5.
XM5O_\/KP  3\N  PO+@ (80#^Q%R/3EY.=4Y6  !(YP$$/JX "$ZY   1Y"I 
XM( UF%C/\  D  !T:,_D  !WX   =''#_8"0^K@ ./RT !"\N  H_/ !"3KD 
XM !:V4(\K0  & E7_WR M  9*GTS?( !.7DYU3E;__#Z\  %"IS\N  AAE%R/
XM3EY.=4Y6  !(YP,$/BX "%Y'YD]21SZ'81XJ0" -9@1"@& */H<O#6$  (98
XMCTJ?3-\@@$Y>3G5.5@  2.<!#"AY   <\"I48%I"0# M  1"03(M  :S0$9 
XM2D!G#CZ\  %.N0  #_Y"@& Z0D P+0 $L&X "&4$( Q@*KOY   <\&8</JX 
XM"&$  *8J0" -9@X^O  "3KD   _^0H!@!BA-*E5@I$J?3-\P $Y>3G5.5@  
XM2.<!#"!N  @J4$) ,"X #%A L&T !&4((&X """58$8H34) ,"X #.=(2$!"
XM0$A V<!"0# M  20;@ ,.4  !$) ,"P !$9 .4  !BB5(&X """,.VX #  $
XM0D P+0 $1D [0  &(^X "   '/ @#5" 2I],WS  3EY.=4Y6  !(YP,,/BX 
XM"-Y\ #_L1^U', ?G0#Z 3KD  ! &*D"[_/____]F!$* 8"H@#5* P+S____^
XM*D H33E'  1"0# L  1&0#E   8NC%"781 @.0  '/!*GTS?,(!.7DYU3E8 
XM $CG 0PJ;@ (48U"0# M  1"03(M  :S0$9 2D!G$#Z\  -.N0  #_YP_V  
XM ,0H>0  '/"[S&4$N]1E$+G490B[U&,(N\QD!"A48.B[S&4R( U"03(M  3G
XM24A!0D%(0="!(@Q"0C0L  3G2DA"0D)(0M*"L(%B"B/,   <\$) 8&X@#4)!
XM,BT !.=)2$%"04A!T(&PE&8<(%0P*  $T6T !$) ,"T !$9 .T  !B!4*I!@
XM BJ4( Q"03(L  3G24A!0D%(0="!N\!F&D) ,"T !-%L  1"0# L  1&0#E 
XM  8HE6 "*(TCS   '/!"0$J?3-\P $Y>3G5.5O_\2.<##"IN  @NC6$ _O(^
XM+@ ,7D?F3U)'/H=A /V(+4#__&8$0H!@2B!N__PH4%",N\QG,KG-9!!@!AC=
XM4VX #$IN  QF]& >0H P+@ ,V<!"@# N  S;P& &&253;@ ,2FX #&;T/H<O
XM+O_\80#]KEB/2I],WS" 3EY.=4Y6__Q.7DYU3E;__$Y>3G5.5@  2.<###XN
XM  A(Q\Z\  #__P@'  !G E*'*GD  !WT*$?9^0  '?0NC$ZY    >K!\__]F
XM%C/\  P  !T:,_D  !WX   =''#_8!(^K@ (0F<O#4ZY    Q%R/( U*GTS?
XM,(!.7DYU3E8  $CG 00^K@ (3KD  !'D*D @#68$</]@6$IN  YF!$) 8$X(
XM+0 #  %G%C/\  D  !T:,_D  !WX   =''#_8# (+0 $  %G%CZN  XO+@ *
XM+PU.N0  $D90CV 48!(^K@ .+RX "B\-3KD  !-64(]*GTS?( !.7DYU3E8 
XM $CG!P!\ 4)'8!@@!L"Y   <]&8*C;D  !ST, =@'N.&4D>^?  0;>(S_  8
XM   =&C/Y   =^   '1QP_TJ?3-\ P$Y>3G5.5O_\< $R+@ (XV!&0$C P;D 
XM !ST0D!.7DYU3E8  $CG P!"1V &/H=A$E)'OGP $&WT2I],WP" 3EY.=4Y6
XM  !(YP$,,"X ",'\ C@J0-O\   >## N  @;0  #0E5"+0 "*WS_____  I"
XMK0 &0JT #CZ\ "!"9R\-!I<    23KD   #$7(\^O  +/SP ("\-!I<    3
XM3KD   #$7(]*GTS?, !.7DYU3E8  $CG P0^+@ (OGP $&46,_P "0  '1HS
XM^0  '?@  !T<0H!@,$) , ? _ (X*D#;_   '@P(+0    %F%C/\  D  !T:
XM,_D  !WX   ='$* 8 (@#4J?3-\@@$Y>3G5.5O_Z2.<##"IN  @H;@ ,/BX 
XM$$) /4#_^CU __Q@  #(8 12;O_ZOF[_^F,0($R3R3)N__K1R0P0  IFYD) 
XM,"[_^I!N__QC9CZ\  $_+O_Z0D P+O_\D5<@#$*!,B[__-"!+P O+0 &+PT&
XMEP   !).N0  %GK?_     X]0/_^0H P+O_^T:T !DIN__YF%C/\  4  !T:
XM,_D  !WX   =''#_8%X];O_Z__Q@.%)N__H^O  !/SP  2\\   <^"\M  8O
XM#0:7    $DZY   6>M_\    #CU __Y"@# N__[1K0 &OF[__&( _S0@+0 &
XML*T #F\&*VT !@ .0D P+O_\2I],WS" 3EY.=4Y6__Y(YP$$*FX "#Z\  $_
XM+@ 0+RX #"\M  8O#0:7    $DZY   6>M_\    #CU __Y*;O_^9A8S_  %
XM   =&C/Y   =^   '1QP_V @0H P+O_^T:T !B M  :PK0 .;P8K;0 &  Y"
XM0# N__Y*GTS?( !.7DYU3E;_^DCG QPJ;@ *,"X ",'\ CC0O   '@PM0/_\
XM?O\NC6$  .PF36 "4HM*$V<&#!, .F;T2A-G'!UC__H,+@!!__IM# PN $__
XM^FX$*DM@!$OK  (P+@ .8   D$)7+PT_/  \3KD  !:V7(\^ &\*(&[__#%'
XM  1"1V   (9"5R\-/SP 3DZY   6MER/2H!G!$) 8 0P/ #_/@!@9#Z\ $].
XMN0  %K9*@&<$0D!@!# \ /\^ &!*+HT_/  ]3KD  !:V5(\^ &\*(&[__#%'
XM  1"1V L+HT_/ !!3KD  !:V5(\^ & :8!B0?  /L'P !V(.Y4 P0-'\   <
XM^B!03M P!TJ?3-\X@$Y>3G5.5O_\(&X " P0 &%M$B!N  @,$ !Z;@@@;@ (
XM!!  ("!N  @0$$B 4JX "$H 9M1.7DYU3E8  $CG 0PJ;@ ,*&X "& "4HQ*
XM%&;Z&-UF_" N  A*GTS?, !.7DYU3E8  $CG 0PJ;@ ,*&X "!C=9OP@+@ (
XM2I],WS  3EY.=4Y6  !(YP$,*FX ""A-8 )2C$H49OH@#$C D(U*GTS?, !.
XM7DYU3E;__$Y>3G5.5@  2.<'#"IN  @H;@ ,8"00'4B /H!A,!X $!Q(@#Z 
XM828< +X&;P1P 6 2O@9L!'#_8 I*%6;82A1FU$) 2I],WS# 3EY.=4Y6  !(
XMYP, /BX "+Y\ &%M"KY\ 'IN!-Y\_^ P!TJ?3-\ @$Y>3G4@7T* ,!]:@ B 
XM   B>0  '?1#Z0$ 0_$( +_)8@9.^0   *R?P$/O  0@"4[02H5G"BZ\____
XM_XO\  !.=4Y6__H@;@ (/6C_\O_^+JX $#!N !8O"#!N !0O"$ZY   6QE"/
XM+P _+O_^/SP /TZY   6ME"/3EY.=4Y6__H@;@ (/6C_\O_^+JX $#!N !8O
XM"#!N !0O"$ZY   6QE"/+P _+O_^/SP 0$ZY   6ME"/3EY.=2/?   >!$Y!
XM+SD  !X$3G5.5O_\0D)*K@ (; 9$K@ (4D)*K@ ,; 9$K@ ,4D(P+@ *P.X 
XM#BU __PP+@ (P.X #C(N  S"[@ *T$'0;O_\/4#__" N__P( @  9P)$@$Y>
XM3G4CWP  '@A.3B\Y   >"$YU(]\  !X(3DTO.0  '@A.=2/?   >"$Y!+SD 
XM !X(3G4  0 " 0$" 0$  0$" 0$! 0$              0   0 #!0 %!0  
XM 0$" 0 0!P$" 0             ! 0$" 0$" 0$" 0$! 0(! 0$         
XM       " 0$! 0$& 0$$ 0$! P$" 0$$ @$( 0$        ! 0$) 0$! 0$!
XM 0  !0$                                                     
XM       $ P ( P & 0 ( 0 ( 0 $ 0$# 0$ !0 ! 0$ !0   0$  0$     
XM                             @(                             
XM       % 0 % 0 ! 0 ! 0 "!0 & 0 " 0 ! 0 &!0       0$  0 " 0 "
XM 0$! 0$                      0(# 0(! 0$! 0$  0$  0)3=&%C:R!/
XM=F5R9FQO=R1#(')U;G1I;64 0T]..@!,4U0Z !I@.$QO861E<CT7 P " @$ 
XM G  T +X!0 )  $                $     (  5$]3(" @("!)34< ,_K_
XMX@  !((_.0  !$8_/  '3DU83TJ 9P  ]BI 0?K_T$J09@8@N0  !#(P+0 (
XMX4C0@#A V?K_N# Z_ZIG$#PZ_Z8X.O^D)GK_HF   +0\+0 *."T "-AM  8F
XM>O^280  LF8  *H@3# M  ;A2.-(0?   $/Z_WR0_  @L<QM  ".< H2,   
XMLC$  &;J4<C_]'X 'B@ &^%/'B@ &BQZ_TXF>O]&0H2^? _P;%(V!U5#QNT 
XM M9M  RX? ! ; A*1&<.MD5G$&%(9D+AC..,U\0\ SH#0H38;0 "VFT  C0'
XMXDK41Q(V( 'A21(V(  (!P  9P+H2<)\#_\^ 6"H2D1G!&$,9@8O.O[@3G5"
XM@$YU/SD   1&/P8_!"\+0F<_/  $3DW>_  .2D!.=4YE=71E<B!";V]T97(-
XM"BA#*3$Y.#4@071A<FD@0V]R<"X-"@                              
XM                                                            
XM                                                          "(
XM7C\@6UDO3ET@ %EE<PT* $YO#0H #0I4>7!E(%)%5%523B!T;R!C;VYT:6YU
XM92XN+@ -"@!5<V%G93H@=V)O;W0@6V$Z('P@8CH@72!;+31=(%LM9%T #0H*
XM5W)I=&4@82!B;V]T<W1R87 @9F]R(&$@ '-I;F=L90!D;W5B;&4 ('-I9&5D
XM(  X,  T,  @=')A8VL@9FQO<'!Y(&1I<VME='1E(&]N(&1R:79E( !" $$ 
XM#0I7<FET92!B;V]T(&]N(&1R:79E( !" $$ #0H 0F]O="!W<FET=&5N#0H*
XM   Z('5N;6%T8VAE9"!Q=6]T90!#86YN;W0@;W!E;B  0V%N;F]T(&%P<&5N
XM9"  0V%N;F]T(&-R96%T92  .B!.;R!M871C: !3=&%C:R!/=F5R9FQO=P  
XM#0HD      $               $ "@               @ *            
XM   #                  0                 !0                 &
XM                  <                 "                  )    
XM              H                 "P                 ,        
XM          T                 #@                 /            
XM       <Z   __\  !SH      T    4B@  %-0  !10   4<   %*@  !34
XM   4U   %"X      0$! 0$! 0$!(2$!(2$! 0$! 0$! 0$! 0$! 0$! 0$B
XM @(" @(" @(" @(" @("! 0$! 0$! 0$! (" @(" @((" @(" @(" @(" @(
XM" @(" @(" @(" @(" (" @(" A 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0
XM @(" @%#4"]-+38X2RAT;2DL(%9E<G-I;VX@,2XR+"!#;W!Y<FEG:'0@*&,I
XM(#$Y.#,L($1I9VET86P@4F5S96%R8V@@6%A86"TP,# P+38U-#,R,0  7U]E
XM>&ET  "B     +I?7V)R96%K *$    =]%]?7V-P;7)VH0   !WX7U]B87-E
XM  "A    '?!?7W-O=F8  *(     K%]C<GES=&%LH@    !N7V-T<FQ?8VZD
XM    %TI?8G)K     *(     >E]?7T)$3U, H@    "67V)L:V9I;&RB    
XM ,1?:6YD97@  *(     X%]S=')C:'( H@    #@7U]?<&YA;66D    &+5?
XM7U]T;F%M9:0    8OU]?7VQN86UEI    !C$7U]?>&5O9@"D    &,E?8F]O
XM=    *0    8RE]O:P      H@    #Z7W!A=7-E  "B     6Q?<75I=   
XM *(    !Q%]M86EN    H@    '<7U]M86EN  "B    !$!?7U]M86EN *( 
XM   $V%]?8W)E870 H@    AH7V-R96%T  "B    "1Y?8W)E871A *(    )
XM-E]C<F5A=&( H@    E.7V5X:70   "B    "6A?7V-L96%N=:(    )@%]F
XM8VQO<V4 H@    FR7V-L;W-E  "B    "@I?7VEO8@   *0    <"%]?7V9D
XM96-LH@    J27V9F;'5S: "B    "II?7V]P96X  *(    +-%]O<&5N    
XMH@    PN7V]P96YA  "B    #$9?;W!E;F(  *(    ,7E]L<V5E:P  H@  
XM  QX7W1E;&P   "B    #-1?7V%F<F5E8J0    <Z%]?869L:7-TI    !SP
XM7VUA;&QO8P"B    #.I?9G)E90   *(    .>%]R96%L;&]CH@    ]V7VUA
XM;&QO8U^B    #_9?7V5R<FUA;*(    /_E]S8G)K    H@   ! &7W=R:71E
XM  "B    $'!?7V-H=F5C *0    <]%]?86QL;V-CH@   !#N7U]F<F5E8P"B
XM    $3A?7V-H:6YI=*(    15%]?7V-H:6YIH@   !%V7U]C:&MC  "B    
XM$>1?7W=R=&%S8Z(    21E]?=W)T8FENH@   !-67U]?;W!E;@"B    $]!?
XM=6-A<V4  *(    4X%]E<G)N;P  I    !T:7U]E<G)C<&VD    '1Q?<W1R
XM8V%T *(    5%%]S=')C<'D H@   !4^7W-T<FQE;@"B    %6!?7U]A=&%B
XM *0    ='E]?7U]A=&%BH@   !6&7U]S=')C;7"B    %8Y?7W-A;&QO8Z( 
XM   6 %]S=U\     H@   !8N7U]P8U]R96&B    %CY?7W!C7W=R::(    6
XM>E]T<F%P    H@   !:V;&UU;     "B    %L9?9V5M9&]S *(    7.E]B
XM:6]S    H@   !<J7WAB:6]S  "B    %QI?7V9D<P   *$    >#     @V
XM#A@&)!@,5@@*#!@*#@H:" H,& H:=GPF"@P*#@@*" H0" H("@X("@@.#@@.
XM" XJ"@P*#!((!@P&# 8@+!P&!@8&("P.1"@,$!06&!(4$A82#A82$# *$A@\
XM!@8,!@P&!@H@% @.% P6" 8^%@X0"A8*'@X&!&@*' @P$AX>#@8$'! ($@8$
XM2$XF%@X:"AX*'@X(!@0<%&H.!@0:<"(:&H8N.#8,2G"^" @.!@02("0&!!P6
XM(@@6!@0B0#(8)@8$%! &!(@B!@0>$F88!@1(4B(<'!X< 402/A(J$@P(7 @(
X3" @( 0$! 0&N" H$! 0$! 0$  0>
X 
Xend
/*EOF
echo extracting - wboot.c
sed 's/^X//' > wboot.c << '/*EOF'
X/*
X	wboot			Write a bootstrap loader onto a disk
X
X	Wboot writes a bootstrap loader onto the boot sector of an
X	Atari 520ST diskette.  This is a TOS-TAKES-PARAMETERS application.
X
X	The bootstrap written to the diskette can be configured using
X	flags as follows:
X
X		-d		This diskette is formatted double-sided.
X		-4		This is a 40 track diskette (5 1/4 inch.
X					(not tested)
X
X	The diskette drive can be also selected on the command line.  The
X	usual variants are:
X
X		-d a:		DS diskette on drive A:
X		-d b:		DS diskette on drive B:
X		a:		SS diskette on drive A:
X		b:		SS diskette on drive B:
X		(no args)	Default is SS on drive A:
X
X				--------
X
X	Link with gemstart, gemlib and osbind.
X
X	Written by Rand Huntzinger, not for distribution for profit.
X*/
X
X#include	<osbind.h>		/* TOS (GEMDOS) sys call bindings */
X#include	"boot.h"	/* The bootstrap loader */
X
X/*	Some pseudo procedures for file I/O	*/
X
X#define	CRLF	"\r\n"
X#define fputl(x) Fwrite(x, 2L, CRLF)
X#define fprint(x,y) Fwrite(x, (long) strlen(y), y)
X#define fprintl(x,y) { Fwrite(x, (long) strlen(y), y); fputl(x); }
X#define fputc(x, y) { char c; c = (char) y; Fwrite(x, 1L, &c); }
X#define	SERIAL	0x01000000L		/* Random serial number */
X
Xok(msg)
X	char	*msg;
X{
X	int	c;
X
X	Cconws(msg);
X	Cconws("? [Y/N] ");
X	if((c = Cnecin()) == 'Y' || c == 'y') {
X		Cconws("Yes\r\n");
X		return(1);
X	}
X	else	{
X		Cconws("No\r\n");
X		return(0);
X	}
X}
X
Xpause(msg)
X	char	*msg;
X{
X	int	c;
X
X	/* Print message and wait for a CR or LF */
X
X	Cconws(msg);
X	Cconws("\r\nType RETURN to continue...");
X	while((c = Cnecin()) != '\r' && (c != '\n'));
X	Cconws(CRLF);			/* Echo CRLF */
X}
X
X
Xquit(msg, rv)
X	char	*msg;
X	int	rv;
X{
X	pause(msg);
X	exit(rv);
X}
X
X
X/*	The main program	*/
X
Xmain(argc, argv)
X	int	argc;
X	char	**argv;
X{
X	/* Local variables */
X
X	int	drive, usage, tracks, shell, sides, type;
X	char	msg[81];
X
X	/* Set defaults */
X
X	drive = 0; tracks = 2; sides = 0; usage = 0;
X
X	/* Process the arguments */
X
X	argv++; argc--;
X	while(argc > 0) {
X		if(**argv == '-') {
X			/* Switch arguments */
X			switch(argv[0][1]) {
X			  case '4':	/* Forty track drive */
X
X					tracks = 0;
X					break;
X
X			  case 'd':	/* Double sided drive */
X			  case 'D':
X					sides = 1;
X					break;
X
X			  default:	/* Oops */
X
X					usage++;
X			}
X		} else {
X			if(strlen(*argv) == 2 && argv[0][1] == ':') {
X				if(**argv == 'A' || **argv == 'a')
X					drive = 0;
X				else if (**argv == 'B' || **argv == 'b')
X					drive = 1;
X				else usage++;
X			} else usage++;
X		}
X		argc--;
X		argv++;
X	}
X
X	/* If there was an error, abort */
X
X	if(usage)
X		quit("Usage: wboot [a: | b: ] [-4] [-d]", 1);
X
X	/* We are  ready, Prototype the disk block */
X
X	type = tracks | sides;
X	Protobt(boot, SERIAL, type, 1);
X
X	/* Write the disk block to the floppy */
X
X	Cconws("\r\n\nWrite a bootstrap for a ");
X	Cconws(sides == 0 ? "single" : "double");
X	Cconws(" sided ");
X	Cconws(tracks > 1 ? "80" : "40");
X	Cconws(" track floppy diskette on drive ");
X	Cconws(drive > 0 ? "B" : "A");
X	strcpy(msg,"\r\nWrite boot on drive ");
X	strcat(msg, drive > 0 ? "B" : "A");
X	strcat(msg, CRLF);
X
X	for(;;) {
X		if(!ok(msg))
X			break;
X		Flopwr(boot, 0L, drive, 1, 0, 0, 1);
X		Cconws("Boot written\r\n\n");
X	}
X	exit(0);
X}
/*EOF
echo extracting - mkboot.c
sed 's/^X//' > mkboot.c << '/*EOF'
X/*
X	mkboot.c	Create a boot.h file from an existing disk
X
X	A quick and dirty program to create a boot.h file by reading the
X	bootstrap sector off of the disk currently in drive A: or the
X	Atari ST.  The boot.h file, contains the contents of the bootstrap
X	sector, in hex, in the character array boot.  This is to be included
X	in the wboot.c program.
X
X	link with gemstart, gemlib, and osbind.
X
X	Written by Rand Huntzinger, not to be distributed for profit.
X*/
X
X#include	<osbind.h>
X
X#define	CRLF	"\r\n"
X#define fputl(x) Fwrite(x, 2L, CRLF)
X#define fprint(x,y) Fwrite(x, (long) strlen(y), y)
X#define fprintl(x,y) { Fwrite(x, (long) strlen(y), y); fputl(x); }
X#define fputc(x, y) { char c; c = (char) y; Fwrite(x, 1L, &c); }
X
Xstatic char hex[] = "0123456789abcdef";
X
Xmain(argc, argv)
X	int	argc;
X	char	**argv;
X{
X	char	buf[512];
X	int	i,j,k;
X	int	out;
X
X	Floprd(buf, 0L, 0, 1, 0, 0, 1);		/* Read boot from A: */
X
X	/* Write boot data, as text, out to standard output */
X
X	out = Fcreate(argc > 1 ? *argv : "boot.h", 0);
X	if(out < 0) {
X		Cconws("Open Error on ");
X		Cconws(argc > 1 ? argv[1] : "boot.h");
X		Cconws(CRLF);
X		exit(1);
X	}
X
X	fprintl(out, "/* Atari 520 ST Boot Block */");
X	fputl(out);
X	fprintl(out, "char	boot[] = {");
X	for(i=0; i < 512; i += 16) {
X		for(j=i; j < (i+16); j++) {
X			k = ((int) buf[j]) & 0xff;
X			if(i < j) fputc(out, ' ');
X			fprint(out, "0x");
X			fputc(out, hex[k >> 4]);	/* In hex */
X			fputc(out, hex[k & 15]);
X			if(j < 511) fputc(out, ',');
X		}
X		fputl(out);
X	}
X	fprintl(out, "};");
X	Fclose(out);
X	exit(0);
X}
/*EOF