GfABASIC *xxx~|:f<SSSTVTVTVTbTzTzTU"U*U*U*OCOWWINULLFFPMPUADFSUA1RBSECCLLENIDSNPSHBCSS1MPUDUMMYSUREOLJFRSIZFILSECOLDCLOLDMEDCOMDFDSUGO1GOGO2DSTAT1DSTAT2PSTATMPROGINITALLMENUEPINFODINFO2SETMLDOSUMDINFOINITINFODIRSAVLOAFMTSDFMTDDXSETDDIREKTPUFFERLISTPRPUFSHPUFCLPUFSAPUFSETPDSTSTDSET128SET256SHOWNRCLWSUREFILEFMTSUREFINDFREEFINDFRE2CLSECYFE#H FEHHF(!!!FH@*  !pp !@@ ! ! !@@ F7!M!AUX:FE! FE! FEFMFRFEGpFFQ F Z ***FF F  EF  EFFDesk , ATARI ST/XL Interface ,----------------------,1,2,3,4,5,6,"" \Disk 1 , Directory, Save Disk, Load Disk, Format SD, Format ED,------------, Set,"" \Disk 2 , Directory, Save Disk, Load Disk, Format SD, Format ED,------------, Set,"" BPrinter , Direct, Buffer, List, Print Buffer, Show Buffer t8 Clear Buffer, Save Buffer,---------------, Set,"" TCopy , Disk 1 to ST , Disk 2 to ST,--------------, ST to Disk 1, ST to Disk 2,"" BSettings , 128 BpS, 256 BpS, Show Sector# ,----------------- H Clearw Disk 1, Clearw Printer , Clearw Disk 2, Clearw Status,"" oEnd, * Quit * ,*** l FTurn on Menu bar  [F"\!Disk 1FnWindow 1 = Disk 1 r]!-F[F"\!PrinterFWindow 2 = Printer ]!-F[F"\!Disk 2FFWindow 3 = Disk 2 ]!-F [F2.\!StatusFWindow 4 = Status window EGFW^FOpen all windows YFand clear them Fl$vLFInitialize Menu procedures  L:Ep!!!!!! FSet baudrate to 19200 baud E0GpF0!FETurn off menu items in the Disk 1 menu Fu EFDisk 2: Active *EFShow sector# by default not active (P!FeDisk 2: Mark it checked vEF Printer: Active (!FrPrinter: Mark it checked <EFsh%=1 printer output to window, sh%=0 not to window w(x!FpPrinter: 'List' checked s,<!FpSettings: '128 BpS' checked 0MFShow Printer Status 2MFShow Disk Status .MFInitialize Machine Language subroutine  |FF|! Fz.Ea FFlush all characters from modem port FFF |FFF|8! FaWait for a character on the modem port .F Or for the user selecting a menu option mF F |FF( Ea F Get 1 Byte from the modem port > #  # 71   # 72   Fs8-F# Check to see if one of our devices is addressed, : Fand check to see if they were active, if not go back " E FcOtherwise continue here eEGFw Ea F Get the command frame e$ EFstore it for later usage E F4 E#  %  FCalculate checksum FEa F Get the checksum 8  F If it does not match the calculated value 2^FF write an error message to the screen  Invalid Command-Frame !Fe@-Fn Then go back and wait for information on the modem port s F > 71  72 FIs the selected device a disk drive? :****************** Disk Routines ******************* i4E 70 F* Determine which disk was selected *"E!7A F Send ACKNOWLEDGE (ACK) HE  FGCalculate sector number from the command frame  E: 7R FIs the command a read request? (READ). &********** Read Sector ********** E!7A F Send ACK 2 F Do we have to print the sector number? ,^Fl If so, open window and print it r2Y! "Sending Sector $"n " ("") FR F8M!@ B@ CF(Send the sector contents -Fand the checksum . FThat was the read request (from the XL) r < 7P  7W FA write request (WRITE - PUT). ,********** Put/ Write Sector ********** tE!7A FSend ACK @ F Sectors 1 to 3 are always 128 Bytes in size n(@ E_!M F1Get 128 Bytes l F4@ E_!M FOtherwise it might be 256 bytes t FEa FGet the checksum E!7A FSend ACK 2 FDo we have to print the sector number? ^F2Y! "Getting Sector $"n " ("") Ft F2M FeCalculate the checksum for the sector t8 FDoes it match checksum we got from the XL? ,^FFIf not, print an error message : PUT: Checksum-Error in $"n " : $"n "<>$"n F E!7E FSend ERROR to the XL -Fand wait again  F2E!7C Fotherwise send COMPLETE to signal the <-Fend of the command  F $ 7S Fc STATUS request? t&********** Disk Status ********** ^F* Open window u4 Fd for a determined sector length, $(RFsend the associated status frame  FsRFF F$EG@Fi 6 Status bytes QFRead data E!Fe send it to the XL u Fe-FAnd wait again |F67,16,0,1,0,17 g|F667,48,0,1,0,49 g F7 72 7!  FeFormat commands ,0********** Format Disk SD or ED ********** E!7A FSend ACK , E Fs Set disk to SD or ED MF*and update the menu D Formatting....FMFoInitialize disk n0M!! FSend 'all sectors are OK' sE!7C FSend COMPLETE -FWait for WRITE  F 8^FiUnrecognized command, print error message .Unknown Command : "n W("B ")F -Fk F . F Was the printer selected? :***************** Printer Routines ******************  * 7S F************ Printer Status ********** *"RF*Send printer status frame *6EG`FtSend ACK and the 6 status bytes * QFread E!Feand send it S Fn|F65,67,128,78,5,0,211 n F5 5" 7W F, Write request? (********** Printer Write ********** E!7A F Send ACK "E_ !M F Read 40 bytes *$Ea Fand then read the checksum E!7A F Send ACK Ez FS6 E z !  FCalculate checksum ourselves   FDoes it match? ,^FFIf not, print an error message 2 Printer: Checksum-Error : $"n "<>$"n Fe E!7N F Negative ACK (NACK) $E!7E F And send ERROR -F FE:EC@B FRSearch for any CRLF characters ($9B) FFE;@ B  BP Freplace with CR and LF ($0A - $0D)  FE F 'List' selected? ^F&"FYes, print text to the window!  F F, Buffer activated? ,EFYes, append text to the buffer! w FE$ F Direct output selected? b2;"FThen print it on the printer immediately! R FE!7C FSend COMPLETE h F! F! F! -FDone, so go wait again! n 4***************** Procedures ***************** a *:+F*Program control is transferred here when the user *E#  Fselects a menu item e w LF$w  L ! ! ! ! !!F$w L ! ! ! ! !!F*w `L!!!!!!!!Fw L!!!!F(w 8L!!!!!!!F F$ dFEnd selected? !F(!!!PF * QUIT * c<)!" Are you sure you | want to quit ?!! Yes | No !F04 FoIf OK selected, return to the desktop `F F6(!!!FKOtherwise re-activate the menu bar vLF FL.FL L4+FF Copyright message, please * DO NOT * change aV)!C ATARI ST/XL Interface | S.A.G.HARDWARE | FREAKS 1988 !! OK !F.F! !"+F Clear Window, erase screen ^ HFnYF.F 2+FMachine Language subroutine initialization :RFThis subroutine quickly calculates the checksum of &EFh the data that has been read a:EG@FtA basic subroutine would be too slow QFEB5&H F F|FJ2a,6f,00,04,42,85,52,45,3a,2f,00,08,42,80,12,1d,d1,01,51,cd,ff,fa,4e,75 .Fa a*********** Disk Procedures **********  *+F*Set 128 Bytes/Sector  FsMFAre You sure? S Fo OK 4E! FSet the Null$ to the proper length <!F Check '128 BpS' t<@!F Remove the check mark in front of '256 BpS' c8EF Set length variable to the proper value p(MF Re-initialize disk and clear it h F F.F+FSet 256 Bytes/Sector  FsMF FE! F,<!F Remove '128 Bps' check mark r(@!F Set '256 Bps' check mark EFMF F F.F6+F The alert box to acknowledge changing/erasing eD)!) Changing Sector size| Erases ALL Data !|!! STOP | OK !F4 Fi8J !FBoth disks are empty to the program after this MF and show this r F.F ,+F Turn on/off sector number reporting m FnIf it is turned on, rEFturn it off  FtEFotherwise turn it on  FE*D!F Set/remove the check mark g.F &+ FCalculate sector checksum a" FeSectors 1 to 3 (EFalways 128 Bytes in size  F@EF Any other sector number gets the current sector length  FE Ez Fy< E z@ ! FCalculate it using the ML-routine. "@ E F store the checksum .F + F ** Print Directory ** k ^FPYF "FEFF E$  F * Single Density * .E4G8FeDirectory sectors h4EGbHFrloop through them all rEFE8 Z?@ @ @ B FEnd of directory? i. ?@ @@ B FFile erased? 4E?@ @ @0 F No: Get filename .;@ "."=@ WWW"F and print it B7?@ @@ 7?@ @@ "Ffile length EF FF F&P "| "FPrint a separator @ F F F @ Zdd?@ @ @ B FNo more files h FFXE#7?@44 @@ 7?@4 @ @ Ffree sectors 6W Sectors =W# W Bytes freeF?print it!   FS * Double Density * EG@F*2E# GbHF!EFE Z?@ @@ B F ?@ @@ B FE?@ @@0 F8;@ "."=@ WWW7?@ @@@ "FEF FF FP "| "F F F F * Zdd?@ @@ B F FFjFEGF& ?@@ @@ B~ F4F? F F,WBlocks =WW Bytes freeF FF.F (+FInitialize and erase boths disks EGFiMF FG.F+FThe erase subroutine EGFs8@ E! FSectors 1 to 3 always 128 Bytes F @ EF FEG@ Fo2@ E! FFill entire string with nulls B"@ EFand the checksum too F ^FYF.F  + F* Save an entire disk * o  FMFGet the filenaam F}FMouse = Busy bee! cE@ IF!: Z@ ! FkStore from the first full sector Fstarting at the end f7R!M!!F PM!l!lF4 EA DA LA FFirst all parameters E FNE FM!FF0EGF then the contents of all sectors NE@ F*EB@ F and store their checksum M!F F8MF}F Mouse = arrow  FF FF.FF F + Fu * Load an entire disk * rEF:  F A message if the disk already contains data @)!$ Loading clears | current contents |!! OK | CANCEL !F F! FnMFGet a filename F}FMouse = busy bee, MFu 7I!M!F$E_!M FeLoad parameters t(E5 FDetermine number of sectors s8 E5?@C@D @ FsRetrieve disk format < 5?@C@L @ FiDoes the BpS match the $ Fcurrent length? iE_!M Fc FEEGF0@ E_!M FRead the sector contents and 0@ E7_!M Fdthe checksum from the file F7EGFM4@ E;@ @ FRead sectors 1 to 3 a F;* FWas the sector length different? .)! Invalid Sector Length |!! Stop !Ft F!8MFMF  F}FMouse arrow again M Fu Print directory e F .F  .+F Enter filename in a file selector box t(fBH  :\*.DSK!!F C@. FE.DSKF FE.FE E"+F Activate/de-activate drive EFt^F&  FIf the drive is active,  EFF de-activate it 0!Fremove the check mark o2]! InactiveFReport new status of the drive 2E0GpFa!FE F0 F$ EF Otherwise activate drive ,!FSet the check mark 2E0GpFa!FE F0MFReport new setting  F.F + F * Format Disk SD * M F Are You sure? S0 Fo Yes, then 707 free sectors in VTOC <@4 !!  EB BC B BC B F&@4 !0! EBp F4@4 !@!2 E2! FF@4 !`! EB B~ FDir. sectors are occupied 0@4 E`FESet Checksum of VTOC  EFDisk status: SD SMFEReport it t F.F + F * Format Disk ED * M F Fm0@ !p! EB| B% F@ EFEEGF@@ ! EB~ F F@@ E~F  EFMFE F.F (+ FE Do You want to format the disk? ,E#  FDetermine drive number EF>  FIf the disk is formatted, acknowledge formatting <)!! Formatting erases everything ! |!! OK | STOP !Fg F!( Ft'OK' starts the formatting &MFCall the formatting procedure n F.F .+F Report the status for both disk drives EGFtMF FG.F (+F Report the status for one drive d  F]! InactiveFu F  F"]! Active : UnformattedFr F  F$]! Active : Single DensityF F&]! Active : Enhanced DensityF F F F.F .********** Printer procedures **********  *$+F*Direct output enable/disable Fth!F EF Fh!F EF FEMF Report status again /.F +F Enable/disable buffer i^FYFF Fep!F/ EFEF Fp!F/ EF FEMF Report status again r.F &+F Write buffer contents to paper . FOnly if the buffer contains data >)!" Print buffer | Printer on-line ?|!! OK | CANCEL !F F &;Fclick on OK to print the stuff  F F.F &+FStore buffer contents on disk 4 FAgain only if the buffer contains data &fBH  :\*.*!!F F7O!M!FOpen file "M!FWrite the buffer to disk 8MFClose file  F F.F ,+FPrint buffer contents to the screen i^FF.F +FClear the buffer EFl.FE E(+FFEnable/disable printer routines e" Fe If they are enabled t"!FIRemove check mark tEhGxF "!FETurn off the menu items t FuEF F8!FbOtherwise enable, and set the check mark EhGxFa&!FEand re-enable the menu items FnEF FE"MF Report the printer status t.F +F Enable/disable list t Fe<x!F/Depending on current setting either disable, EF Fx!F/or enable oEF FEMF Report the new status u.F "+F Report the printer status nEFe FoDirect output? E Direct PrintingF? FE Fe"E Buffer FTo the buffer?  FE FB E List FTo the screen?  FE FsE InactiveFDisabled? e FE0]!Fn Put all information on the status line .F! !**** Copy procedures ****  * +F *** Disk to ST Copy *** E  FoWhich drive? (  F If the drive is formatted t ^F .:Select file to copy:"F Get the filename ::$9B => 10,13 (y/n) " F Translate CRLF to LF and CR e E F1&EC@. F3Is there an extension? ( F.#if so, format the file name C6E;@  =@6  #6  F F@2E06 Fotherwise append spaces  FE E  F** Single Density ** EF.E4G8FhDirectory sectors c8EGbHFr keep looking for the file p< ?@ @ @0 ?@ @@ CF <E7?@ @@ 7?@ @@ F  FE ZF F ZF F& FIf the file is not found ,)! File not found! |!! CONTINUE !F F! Fe EFFClear the buffer FE2E;@ @ F Read sector into buffer :E#7?@ @@ 7?@ @@ F 0FContinue until next sector is zero . ; @ YFe Translate CRLF to LF,CR? EB FCopy buffer CEFEF*EG6 FLook for the combination 6 ? @@ B FIf CRLF found translate it 8E? @@ B  BP FTo LF and CR EF FE F F:fBH  :\*.*!!FFile name to save F&!z !6 FWrite with this name  F F  F>** Double Density ** for DD comments are the same as for SD EFEG@FD2E# GbHF < ?@ @@0 ?@ @@ B F E7?@ @PP@ FBE7?@ @``@ 7?@ @p@ FF FE ZF F ZF F F,)! File not found! |!! CONTINUE !F F! FeEFFFEEHHFEG`FE;@ @ F FE7?@@ @@ FI}F@  6 F&fBH  :\*.*!!F!z !F F4)! Error: | File too short!|!! Tough! !F F! F! F! F!.F! ! +F *** ST to Disk Copy *** t E ,,FDWhich disk? t&  FIs the disk formatted? .)! Disk not formatted!|!! CONTINUE !F FD ^Fk8fBH  :\*.*!!FChoose file name F ;@ \F$E=@6  F Correct file name  FE7I!M!FOpen file tEsM FGet the length 8 # @FeIs the file too large? 8MFIf so, close file @<)!$ File too large | for your ATARI !|!! CANCEL !F@ F jFF$EC@. FoFormat the file name F.6E;@  =@6  #6  F F@E06 F FE E  F** Single Density ** V # #7?@4 @@ 7?@4 @ @ F:)!" File too large | for your disk!|!! CANCEL !F F j!F>E4G8FrLook for a free spot in directory @EGbHFo6 Z?@ @@ B ?@ @@ B F4FZ F6 Z?@ @@ B ?@ @@ B F FM! F%Find free sector @ !! EBF Status 4@ !! EB# }p FLength LO >@ !! EB## }p  FLength HI $@ !! EB FSector LO 4@ !! EB F Sector HI L6@ ! !0 EF Insert file name M F'Calculate checksum EG# H# F$@ E_# !M FRead sectors EFEM! F# Next free sector? e:@ E@ B B B# FM F Calculate checksum F ,E # FThe rest in the last sector B6@ E_!M #  B B B FM FCalculate checksum ** Update the VTOC ** kE44Fh)VTOC sector uD@ !! EB7?@ @@ ##  FF@ ! ! EB7?@ @ @ %#  F$M F%Calculate checksum VTOC  FSD File too large e  F ,** Double Density ** again the same story jFoEGF*& ?@@ @@ B~ F4F? F F  F:)!" File too large | for your disk!|!! CANCEL !F F EFEG@Fr2E# GbHFL6 Z?@ @@ B ?@ @@ B F F6 Z?@ @@ B ?@ @@ B F FM" F@ !! EB@ F@ !!0 EF?0@ !@! EB }p F @ !P! EB F @ !`! EB F(@ !p! EB F M F EGH FEEFEG`F F@ E_!M F EF F@ E_!M F F M F ZrM F F ZrM FEF4FF M" FF@@ !! EB F F"@@ !! EB} FE@@F M F  F FM FPrint directory E8MF F F F.F &+! FtFind the next free sector h!FjF E0GF> Z?@4 @@ B FSearch for free byte in VTOC FE`IF@D Z7?@4 @@  FIn this byte look for free bit FJE#0 #` F Mark the sector as being used 6@4 !! EB7?@44 @@   Fa.F (+" FFind next free cluster in ED EGFeB Z?@@ @@ B~ FSearch for free cluster n F.F