GfABASIC *xxx~(RRS"SSSSSSSTRTZTZTZOCOWWINULLFFPMPUADFSUA1RBSECCLLENIDSNPSHBCSS1MPUDUMMYSUREOLJFRSIZFILSECOLDCLOLDMEDCOMDFDSUGO1GOGO2DSTAT1DSTAT2PSTATMPROGINITALLMENUEPINFODINFO2SETMLDOSUMDINFOINITINFODIRSAVLOAFMTSDFMTDDXSETDDIREKTPUFFERLISTPRPUFSHPUFCLPUFSAPUFSETPDSTSTDSET128SET256SHOWNRCLWSUREFILEFMTSUREFINDFREEFINDFRE2CLOSEWCLSECYFE#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 1FlWindow 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 JFh$vLF Initialize Menu procedures  :Ep!!!!!! FSet baudrate to 19200 baud @!Ft<!FE G@Fs0!FTurn off menu items in the Disk 2 menu NFi EFDisk 2: Inactive  EFDisk 1: Active *EFShow sector# by default not active (!F Disk 1: Mark it checked EF Printer: Active M(!FrPrinter: Mark it checked <EFsh%=1 printer output to window, sh%=0 not to window 1(x!FpPrinter: 'List' checked sMFShow Printer Status sMFShow Disk Status .MFInitialize Machine Language subroutine  |FF! Fz.Ea FFlush all characters from modem port FNFF |FFF8! 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 L #  # 71   F  AND (c%<>ASC("2") OR d%(1)=0) 8-F Check to see if one of our devices is adressed, : Fand check to see if they were active, if not go back " E FcOtherwise continue here eEGFs Ea F Get the command frame e$ EFstore it for later usage E F4 E#  %  FCalculate checksum LFEa F Get the checksum 8  F If it does not match the calculated value c2^FF write an error message to the screen  Invalid Command-Frame !Fr@-F Then go back and wait for information on the modem port n F H 71 FaOR c%=ASC("2") !Is the selected device a disk drive? :****************** Disk Routines ******************* 4E 70 FO Determine which disk was selected e"E!7A F Send ACKNOWLEDGE (ACK) HE  FCCalculate sector number from the command frame  : 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? ,^F If so, open window and print it u2Y! "Sending Sector $"n " ("") F( F2M! B CFoSend the sector contents -Fand the checksum . FThat was the read request (from the XL) e < 7P  7W FA write request (WRITE - PUT). ,********** Put/ Write Sector ********** rE!7A FSend ACK @ F Sectors 1 to 3 are always 128 Bytes in size n& E_!M FoGet 128 Bytes  F2 E_!M FOtherwise it might be 256 bytes B FEa FGet the checksum E!7A FSend ACK 2 FDo we have to print the sector number? ^F2Y! "Getting Sector $"n " ("") Fn F2M FDCalculate the checksum for the sector 8 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 h-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  FhRFF F$EG@Fi 6 Status bytes QFRead data E!Fe send it to the XL u Fn-FFAnd wait again |F67,16,0,1,0,17 c|F667,48,0,1,0,49 c F 8  7!  FsFormatteer commando's. 0********** Format Disk SD or ED ********** tE!7A FSend ACK , E Fs Set disk to SD or ED MFEand update the menu d Formatting....FMFInitialize disk e0M!! FSend 'all Sectors are OK' tE!7C FSend COMPLETE -FWait for WRITE  F 8^F Unrecognized command, print error message .Unknown Command : "n W("B ")Fv-Fk F . FgWas the printer selected? r:***************** Printer Routines ******************   r 7S F************ Printer Status ********** *"RFSend printer status frame r6EG`FtSend ACK and the 6 status bytes e QFread E!Feand send it S $Fn|F65,67,128,78,5,0,211 K F " 7W Fi 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 FA6 E z !  FCalculate checksum ourselves   FDoes it match? ,^FFIf not, print an error message 2 Printer: Checksum-Error : $"n "<>$"n F* E!7N F Negative ACK (NACK) rE!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)  F F 'List' selected? ^F&"FYes, print text to the window!  F F, Buffer activated? ,EFYes, append text to the buffer! w F$ 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 *****************  :+FProgram 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$ dFFEnd selected? F(!!!PF * QUIT * z<)!" Are you sure you | want to quit ?!! Yes | No !F 4 FIf OK selected, return to the desktop `F F6(!!!FKOtherwise re-activate the menu bar vLF F.F 4+F 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 Fe 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 .F *********** Disk Procedures **********  +FSet 128 Bytes/Sector  FcMFAre You sure? S Fu OK 4E! FSet the Null$ to the proper length <!F Check '128 BpS' t<@!F Remove the check mark in front of '256 BpS' $8EF Set length variable to the proper value p(MF Re-initialize disk and clear it h F F.F+F Set 256 Bytes/Sector  FcMF FE! F,<!F6 Remove '128 Bps' check mark r(@!F6 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   FmEFotherwise turn it on  F*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 Fl: E z ! FcCalculate it using the ML-routine.  E F Store the checksum .F + FE ** Print Directory ** ^FDYF "FEFF $  F * Single Density * .E4G8F*Directory sectors 4EGbHFrloop through them all uEFE4 Z? @ @ B FEnd of directory? u, ? @@ B FFile erased? 2E? @ @0 F No: Get filename .;@ "."=@ WWW"F and print it <7? @@ 7? @@ "Ftfile length sEF lFF F&P "| "FPrint a separator  F F <F < Zdd? @ @ B FNo more files s  FFPE#7?4 @@ 7?4 @ @ Ffree sectors 6W Sectors =W# W Bytes freeF4print it!   pFS * Double Density * EG@F*2E# GbHF EFE Z? @@ B F ? @@ B FE? @@0 F6;@ "."=@ WWW7? @@@ "FEF FF FP "| "F F F F & Zdd? @@ B F FFjF@EGF" 6?@ @@ B~ F4F? F  F,WBlocks =WW Bytes freeF FF.F (+F Initialize and erase boths disks  FOR d%=0 TO 1 OEFMF NEXT d% .F+FThe erase subroutine TEGFn6 E! FSectors 1 to 3 always 128 Bytes  EF  FEG@ Fo. E! FFill entire string with nulls 8  EFand the checksum too nF ^FYF.F + FE* Save an entire disk *  FMFGet the filename żF}FMouse = Busy bee! ĶE@ IF 6 Z ! FStore from the first full sector Fstarting at the end 7R!M!!FtPM!l!lF4 EA DA LA FFirst all parameters E FNE FM!FF0EGF then the contents of all sectors NE F&EB Fand store their checksum M!F XF8MF}F Mouse = arrow o F F.F + Fo * Load an entire disk * eEF:  F A message if the disk already contains data @)!$ Loading clears | current contents |!! OK | CANCEL !F F (FnMFGet a filename F}FMouse = busy bee, iMFu 7I!M!F$E_!M FeLoad parameters a(E5 FDetermine number of sectors a8 E5?@C@D @ FsRetrieve disk format < 5?@C@L @ FiDoes the BpS match the $ Fcurrent length? iE_!M Fm F8EGF. E_!M FRead the sector contents and , E7_!M Fthe checksum from the file F7ȀEGFM. E; @ FRead sectors 1 to 3 FF;* F;Was the sector length different? .)! Invalid Sector Length |!! Stop !Fl F8MFMF  F}FMouse arrow again M Fo Print directory  F.F .+F Enter filename in a file selector box (fBH  :\*.DSK!!F ɲC@. FE.DSKF F.F "+F Activate/de-activate drive ˸F EFa^F&  FIf the drive is active, t EFF de-activate it 0!Fremove the check mark p2]! InactiveFReport new status of the drive 2E0GpFv!FE F0 ˴F$ EFr Otherwise acticate drive ,!FSet the check mark 2ˌE0GpFv!FE zF0MFReport new setting  F F.F + F * Format Disk SD * M F Are You sure? S0 Fo Yes, then 707 free sectors in VTOC :44 !!  EB BC B BC B F$44 !0! EBp F244 !@!2 E2! FD44 !`! EB B~ FDir. sectors are occupied f,4 E`FSet Checksum of VTOC  EFEDisk status: SD CMFEReport it t F.F + F * Format Disk ED * M F LFk. !p! EB| B% F EF"EGF@@ ! EB~ F F@ E~F  EFMFE F.F (+ F Do You want to format the disk? V,E#  FDetermine drive number EF>  FIf the disk is formatted, acknowledge formatting <)!! Formatting erases everything ! |!! OK | STOP !Fe F( F'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]! InactiveFn F h F"]! Active : UnformattedFe F Т F$]! Active : Single DensityF F&]! Active : Enhanced DensityF F F F.F .********** Printer procedures ********** O $+FDirect output enable/disable ^Fth!F EF vFh!F EF FMF Report status again /.F +F Enable/disable buffer i^FYF  Frp!F  EFEF  Fp!F  EF FMF 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 EFu.F (+FEnable/disable printer routines e" Fe If they are enabled t"!FIRemove check mark tEhGxFn"!FTurn off the menu items t FeEF մF4!F Otherwise enable, set the check mark ժEhGxFa&!FAnd re-enable the menu items vFeEF F"MFF Report the printer status t.F +F Enable/disable list t TFf<x!F/Depending on current setting either disable, EF ~Fx!F/or enable oEF FMF Report the new status t.F "+F Report the printer status nEFr FoDirect output? E Direct PrintingFn F @ Fe"E Buffer FTo the buffer?  F nFB E List FTo the screen?  F ךFsE InactiveFDisabled? e F0]!Fn Put all information on the status line .F **** Copy procedures ****  +F *** Disk to ST Copy *** * E  FeWhich 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 Fhotherwise append spaces  F   F** Single Density ** EF.E4G8FhDirectory sectors c8EGbHFr keep looking for the file R6 ڼ? @ @0 ? @@ CF6E7? @@ 7? @@ Fe F ZF LF ZF F& FbIf the file is not found ,)! File not found! |!! CONTINUE !F F ݸFe EFClear the buffer F.E; @ FRead sector into buffer 2E#7? @@ 7? @@ F2F Continue untill 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 F ܨF F:fBH  :\*.*!!FFile name to save e ݴF&!z !6 FWrite with this name  F F  jF>** Double Density ** for DD comments are the same as for SD EFEG@F 2E# GbHFa6 ? @@00 ? @@ B FE7? @P@ F?<E7? @`@ 7? @pp@ F  F ZF TF ZF "F JF,)! File not found! |!! CONTINUE !F F fFeEFFFEHHF߮EG`FE; @ F ߎFE7?@ @@ F`}F@  *6 F&fBH  :\*.*!!F!z !F bF4)! Error: | File too short!|!! Tough! !F F F F F.F +F *** ST to Disk Copy *** t E ,,FtWhich disk? o&  FIs the disk formatted? .)! Disk not formatted!|!! CONTINUE !F FD ^Fk8fBH  :\*.*!!FChoose file name F ;@ \F$E=@6  F Correct file name  F7I!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@. FlFormat the file name F.6E;@  =@6  #6  F F@E06 F F  ( F** Single Density ** N # #7?4 @@ 7?4 @ @ F:)!" File too large | for your disk!|!! CANCEL !F F j!F>E4G8FiLook for a free spot in directory ZEGbHFi0 ZZ? @@ B ? @@ B F4FZ F0 Z? @@ B ? @@ B F FM! F"Find free sector  !! EBFStatus 0 !! EB# }p FLength LO < !! EB## }}p  FLength HI y" !! EB FSector LO 0 !! EB F Sector HI F2 ! !0 EF Insert file name M F$Calculate checksum EG# H# F" E_# !M FhRead sectors EFEM! FNext free sector? t4 E B B B# FM FNCalculate checksum F ,E # FThe rest in the last sector e2 E_!M #  B B B FM FCalculate checksum ** Update the VTOC ** E44Fr)VTOC sector e> !! EB7? @@ ##  F@ ! ! EB7? @ @ %#  F.M F %Calculate checksum VTOC berekenen n FSD File too large e  F ,** Double Density ** again the same story jFoEGF*" ?@ @@ B~ F4F? F zF  F:)!" File too large | for your disk!|!! CANCEL !F F EFEG@Fr2E# GbHFL0 Z? @@ B ? @@ B F ZF0 Z? @@ B ? @@ B F (FM" F !! EB@ F !!0 EF?, !@! EB }p F !P! EB F !`! EB F$ !p! EB F M F EGH FEEF8EG`F F E_!M F! EF F E_!M F! F M F 8ZrM F F ZrM FEF4FF M" FF@@ !! EB F F @@ !! EB} FE@@F M F  F FM FoPrint directory a8MF F F F.F &+! FtFind the next free sector h!FjF E0GF< Z?44 @@ B FSearch for free byte in VTOC XFE`IF@@ Z7?4 @@  FIn this byte look for free bit FJE#0 #` FeMark the sector as being used e044 !! EB7?4 @@   Fi.F (+" FFind next free cluster in ED 4EGFe@ Z?@@ @@ B~ FSearch for free cluster e F.FJ $<V°`ϦVT͒6Ѽ \"N8Ԉ `x