'=========================================================================== ' Subject: DOS SHELL TYPE PROGRAM Date: 12-15-99 (17:47) ' Author: Randall L. Glass Code: PB ' Origin: rlglass@yahoo.com Packet: PB.ABC '=========================================================================== '------------------------------------------------------------------------- ' ' DShell Program ' CopyRight Aug3,1999 ' BY Randall L Glass ' '--------------------------------------------------------------------------- ' ' Email rlglass@yahoo.com ' '--------------------------------------------------------------------------- ' ' This Program is Freeware ' You may use this program for non-commerical use, As long As ' you give me credit somewhere in the documentation. ' ' No frills Program to travel thru directories, view files[Also "zip lzh ' files"],copy files,rename files,delete files,make directories,remove ' directories,rename directories,unarchive zip or lzh files ,or unarchive ' part of zip lzh files. ' ' You must SET the value of TEMP in your autoexec.bat file. ' Example SET TEMP = D:\TMP ' ' OR Rewrite the code in the program to set TempDir to your tempory directory. ' And Rewrite the code to your editor or file viewer. ' ' This Program uses assigns "Listr.com" to Viewer$ ' ' Fell Free To Add your own viewer to it instead of list. ' ' When you choose copy the Program Copies files from the directory you are ' looking at to the directory you run Dshell from. ' ' It is the same way with unarchive. ' '---------------------------------------------------------------------------- $DYNAMIC $HUGE $STACK 15000 DEFINT A-Z TYPE ZipType ' Zip File Header Signature AS DWORD Version AS WORD GPBFlag AS WORD ' Not sure Compress AS WORD ' Compression type FileTime AS WORD Filedate AS WORD ' Took a while to figure out CRC32 AS DWORD CompressSize AS DWORD UnCompressSize AS DWORD FileNameLen AS WORD ExtraField AS WORD END TYPE TYPE LZHHead HeadSize AS BYTE CheckSum AS BYTE Id1 AS STRING * 3 Method AS BYTE Id2 AS BYTE CompressSize AS DWORD UnCompressSize AS DWORD FileTime AS WORD FileDate AS WORD Attrs AS BYTE HeaderLevel AS BYTE FileNameLen AS BYTE FileName AS STRING * 12 END TYPE DECLARE Function GetKey%() AS INTEGER DECLARE SUB GetStrLoc() DECLARE SUB BoxBorder () DECLARE SUB Scroll(BYVAL TopRow%,BYVAL TopLeftCol%,BYVAL BottomRow%,BYVAL BottomRightCol%,BYVAL TotalLines%,BYVAL Attr%,BYVAL WhichWay%) DIM ScreenSegment AS shared WORD DIM DirStack$(50),ShellDir$(50),DirLoc%(50) DIM Directory$(10000), DirInfo$(10000) SHARED Directory$(), DirInfo$() SHARED Viewer$,TempDir$,StackPos%,DirStack$(), DirLoc%(),DirPos% SHARED StartLine$,EndLine$,FileList$,Response$,ExtractCmd$,ExtractReponse$ SHARED DosError??,ShellDir$(),ShellPos%,ExitShell%,DirStack% SHARED NextHandle%,LineSeg??,LinePtr??,NowDir$,NewPos%,DirChoice% SHARED TempDir$,RunBatch$,TD$,CrLf$,NewPosFlag%,DirDisplayPos% COLOR 0,1 CLS NewPosFlag% = instr(UTRIM$(Command$),"/RETURN") SearchPath$ = EXTRACT$(Command$," ") IF SearchPath$ = "" OR SearchPath$ = "/RETURN" THEN SearchPath$ = "\" ELSE SearchPath$ = SearchPath$ + "\" REPLACE "\\" WITH "\" IN SearchPath$ REPLACE "//" WITH "/" IN SearchPath$ END IF IF(PBVScreenCARD AND 1) = 0 THEN ScreenSegment?? = 47104 '&HB800 'color monitor ELSE ScreenSegment?? = 45056 '&HB000 'mono monitor END IF %PkSig = &H04034B50 ' Signature %UpArrow = -72:%DownArrow = -80:%Enter = 13:%Escape = 27 %Home = -71:%PageDown = -81:%PageUp = -73:%EndKey = -79 %Up = 6:%Down = 7:%LeftArrow = -75:%RightArrow = -77 %AltHome = -151:%AltA = -30:%AltV = -47 %AltU = -22:%AltC=-46:%AltD=-32:%AltR=-19:%AltN = -49:%AltM = -50:%AltH = -35:%F1 = -59 %ReadOnly = 1:%Hidden = 2:%System = 4:%Volume = 8:%SubDir = 16:%Archive = 32 %AllFiles = 33 Crlf$ = CHR$(13,10) COLOR 0,1 CLS Viewer$ = "listr.com" LastDir$ = SearchPath$ NowDir$ = CURDIR$ TD$ = ENVIRON$("TEMP") IF Td$ = "" THEN MKDIR "\TMP" TD$ = "\TMP" ELSE TempDir$ = TD$ + "\dosview" RunBatchDir$ = TD$ END IF IF NewPosFlag% AND FileExist%(TD$+"\Shelview.dat") THEN OPEN TD$+"\Shelview.dat" FOR INPUT AS #1 INPUT #1,DirChoice% INPUT #1,DirDisplayPos% DO INCR I% INPUT #1,DirLoc%(I%) LOOP UNTIL EOF(1) DirPos% = I% CLOSE #1 END IF IF FileExist%(TD$+"\Shelview.dat") THEN Kill TD$+"\Shelview.dat" IF FileExist%(TD$+"\Shelview.bat") THEN Kill TD$+"\Shelview.bat" ShellPos% = 0 DO DosShell LastDir$ CHDIR NowDir$ LOOP STOP SUB DosShell(ShellDirectory$) Choice% = 1:DisplayPos% = 1:LowFIle% = 1:HiFile% = 18:Ky% = 0 InfoLine$ = " FileName"+" Size"+" Date" + " Time" PushDir2 ShellDirectory$,ShellDir$(),ShellPos% IF NewPosFlag% THEN GOSUB GetAndSort INCR NewPos% IF NewPos% <= DirPos% THEN DosShell Directory$(DirLoc%(NewPos%)) ELSE Choice% = DirChoice% DisplayPos% = DirDisplayPos% NewPos$ = "" DirPos% = 0 END IF END IF DO GOSUB GetAndSort Pick% = ChooseProgram%( DirInfo$(),Directory$(),FilesInfo$,InfoLine$,Choice%,DisplayPos%,LowFile%,HiFile%,Ky%,DirNum%,"Directory") Ext$ = Extension$(Directory$(Pick%)) COLOR 0,7 SELECT CASE Ky% CASE %RightArrow,%Enter IF BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN PushLoc Pick% DosShell(Directory$(Pick%)) COLOR 7,1 CLS ELSEIF ISFALSE BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN SELECT CASE Ext$ CASE ".ZIP",".LZH" ShowZip(RealDir$ + Directory$(Pick%)) CASE ".EXE",".COM" IF Ky% = %Enter THEN DirFreeFile% = FREEFILE OPEN TD$ +"\ShelView.Dat" FOR OUTPUT AS #DirFreeFile% PRINT #DirFreeFile%,Choice% PRINT #DirFreeFile%,DisplayPos% FOR IX% = 1 to DirPos% PRINT #DirFreeFile%,DirLoc%(IX%) NEXT IX% CLOSE #DirFreeFile% DirFreeFile% = FREEFILE OPEN TD$ +"\ShelView.bat" for output as #DirFreeFile% Batch$ = "@cls" + CrLf$ + "@Echo off" + CrLf$ + RealDir$ + Directory$(Pick%) + CrLf$ Batch$ = Batch$ + "cls" + CrLf$ + ProgName$ +" RETURN" + CrLf$ PRINT #DirFreeFile%,Batch$ StuffBuffer TD$ +"\ShelView.bat"+chr$(13) CLOSE #DirFreeFile% SCREEN 0 CLS COLOR 0,0 LOCATE 1,1 PRINT STRING$(800,219) LOCATE 1,1,0 BIT RESET PbvSwitch,0 SYSTEM END IF CASE ELSE '".TXT",".DOC" ShellCmd$ = Viewer$ + " " + RealDir$ + Directory$(Pick%) SHELL ShellCmd$ ClearBuffer COLOR 7,1 CLS DELAY .1 END SELECT END IF CASE %LeftArrow DECR ShellPos% DECR DirPos% EXIT LOOP CASE %Escape CHDIR NowDir$ COLOR 7,0 CLS LOCATE 1,1 BIT RESET PbvSwitch,0 STOP CASE %AltC IF Pick% > 0 AND ISFALSE BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN LOCATE 25,1:PRINT "Copy File " + Directory$(Pick%);:INPUT; "(Y/N) ?",YesNo$ IF UTRIM$(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "COPY "+RealDir$ + Directory$(Pick%) +" "+NowDir$ END IF END IF CASE %AltD IF Pick% > 0 THEN IF ISFALSE BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN PRINT "DELETE File " + Directory$(Pick%);:INPUT; "(Y/N) ?",YesNo$ IF UTRIM$(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "DEL "+RealDir$ + Directory$(Pick%) END IF ELSEIF BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN PRINT "DELETE Directory " + Directory$(Pick%);:INPUT; "(Y/N) ?",YesNo$ IF UTRIM$(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "RD "+RealDir$ + Directory$(Pick%) END IF END IF END IF CASE %AltR IF Pick% > 0 THEN IF ISFALSE BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN LOCATE 25,1 Print "RENAME ";Directory$(Pick%);" TO What ? "; Input;, NewName$:PRINT " "; IF NewName$ <> "" THEN INPUT; "Continue ? (Y/N)",YesNo$ IF UTRIM$(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "RENAME "+ RealDir$ + Directory$(Pick%) + " " + NewName$ END IF ELSEIF BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN LOCATE 25,1 Print "RENAME ";Directory$(Pick%);" TO What ? "; Input;, NewDirName$:PRINT " "; IF NewDirName$ <> "" THEN INPUT;"Continue ? (Y/N)",YesNo$ IF UTRIM(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "MOVE "+ RealDir$ + Directory$(Pick%) + " " + RealDir$ + NewDirName$ END IF END IF END IF CASE %AltM LOCATE 25,1 INPUT; "New Directory Name ? ", NewDirName$ IF NewDirName$ <> "" THEN INPUT;"Continue ? (Y/N)",YesNo$ IF UTRIM(YesNo$) = "Y" THEN LOCATE 25,1:SHELL "MD " + RealDir$ + NewDirName$ END IF CASE %AltU IF ISFALSE BitTest%(Attrib(RealDir$ + Directory$(Pick%)),4) THEN LOCATE 25,1 PRINT "Unarchive ";Directory$(Pick%);:INPUT;" ? (Y/N)";YesNo$ IF UTRIM$(YesNo$) = "Y" THEN COLOR 7,0 CLS SELECT CASE Ext$ CASE ".ZIP" SHELL "PKUNZIP -d "+ RealDir$ + Directory$(Pick%) + " " + NowDir$ CASE ".LZH" IF RIGHT$(UTRIM$(NowDir$),1) <> "\" THEN UnLhaDir$ = NowDir$ + "\" ELSE UnLhaDir$ = NowDir$ END IF SHELL "LHA.EXE X " + RealDir$ + Directory$(Pick%) + " " +UnLhaDir$ END SELECT COLOR 0,1 END IF END IF CASE %AltV SHELL Viewer$ + " " + RealDir$ + Directory$(Pick%) ClearBuffer COLOR 7,1 CLS DELAY .1 CASE %AltH,%F1 Help CASE %AltA About END SELECT LOOP EXIT SUB GetAndSort: TotalFiles% = 0 RealDir$ = AddSlash$(TrueDir2$(ShellDir$(), ShellPos%)) GetDirs RealDir$ + "*.*", Directory$(), DirInfo$(), FilesInfo$, TotalFiles% DirNum% = TotalFiles% IF DirNum% > 1 THEN ARRAY SORT Directory$(1) FOR TotalFiles%,TagArray DirInfo$() GetFiles RealDir$ + "*.*", Directory$(), DirInfo$(), FilesInfo$, TotalFiles% SortNumber% = TotalFiles - DirNum% IF SortNumber% > 1 THEN FileStart% = DirNum% + 1 ARRAY SORT Directory$(FileStart%) FOR SortNumber%,TagArray DirInfo$() END IF RETURN END SUB SUB ShowZip(File$) COLOR 0,1 CLS LOCATE 1,1,0 Ext$ = Extension$(File$) File$ = TrueName$(File$) IF ISFALSE FileExist%(File$) THEN EXIT SUB PushDir TempDir$ ViewZip File$ PopDir SHELL "DELTREE /Y " + Rtrim$(RealDir$,"\") + " >NUL" COLOR 7,1 CLS END SUB SUB ViewZip(File$) IF ISFALSE FileExist%(File$) THEN LOCATE 5,15:PRINT File$;" doesn't exist !"; EXIT SUB END IF DIM ArchiveFiles$(10000),ArchiveInfo$(10000),ArchiveDir$(10000) Choice% = 1:DisplayPos% = 1:LowFIle% = 1:HiFile% = 18 Ky% = 0 InfoLine$ = " FileName"+" Size"+" Date" + " Time" Ext$ = Extension$(File$) IF Ext$ = ".ZIP" OR Ext$ = ".LZH" THEN PresentDir$ = CURDIR$ PresentDrive$ = CURDRIVE$ CHDRIVE Left$(File$,1) CHDIR GetDirectory$(File$) SELECT CASE Ext$ CASE ".ZIP" ZipView GetFileName$(File$), ArchiveFiles$(), ArchiveInfo$(), FilesInfo$, Success% CASE ".LZH" LzhView GetFileName$(File$), ArchiveFiles$(), ArchiveInfo$(), FilesInfo$, Success% END SELECT CHDRIVE PresentDrive$ CHDIR PresentDir$ IF ISFALSE Success% THEN EXIT SUB TotalFiles?? = CVWRD(ArchiveFiles$(0)) 'ARRAY SORT ArchiveFiles$(1) FOR TotalFiles??,TAGARRAY ArchiveInfo$() DO Pick% = ChooseProgram%( ArchiveInfo$(),ArchiveFiles$(),FilesInfo$,InfoLine$,Choice%,DisplayPos%,LowFile%,HiFile%,Ky%,0,"") Choice% = Pick% SELECT CASE Ky% CASE %Escape CHDIR NowDir$ COLOR 7,0 CLS LOCATE 1,1,0 BIT RESET PbvSwitch,0 STOP CASE %LeftArrow EXIT SUB CASE %RightArrow,%Enter,%AltV IF Pick% > 0 THEN Pick$ = UCASE$(ArchiveFiles$(Pick%)) RealName$ = GetFileName$(Pick$) PickExt$ = Extension$(Pick$) IF (PickExt$ =".ZIP" OR PickExt$ = ".LZH") AND Ky% <> %AltV THEN PushDir "TEMP" RealDir$ = TrueDir$ + "\" IF ISFALSE FileExist%(RealDir$+Pick$) THEN SELECT CASE Ext$ CASE ".ZIP" SHELL "PKUNZIP -e -o " + File$ + " " + Pick$ + " " + RealDir$ + " >NUL" 'SHELL "UNZIP " + File$ + " " + Pick$ + " " + "-d" + RealDir$ + " >NUL" CASE ".LZH" SHELL "lha.exe e /pn2 " + File$ + " " + RealDir$ + " "+ Pick$ END SELECT END IF fe% = FetchErrorLevel% IF FetchErrorLevel% > 0 THEN SHELL "DELTREE /Y " + Rtrim$(RealDir$,"\") + " >NUL" EXIT SUB END IF ViewZip RealDir$ + RealName$ SHELL "DELTREE /Y " + Rtrim$(RealDir$,"\") + " >NUL" PopDir COLOR 7,1 CLS DELAY .1 ITERATE LOOP ELSE RealDir$ = TrueDir$ + "\" SELECT CASE Ext$ CASE ".ZIP" SHELL "PKUNZIP -e -o " + File$ + " " + Pick$ + " " + RealDir$ ' + " >NUL" 'SHELL "UNZIP " + File$ + " " + Pick$ + " " + "-d" + RealDir$ ' + " >NUL" CASE ".LZH" SHELL "lha.exe e /pn2 " + File$ + " " + RealDir$ + " "+ Pick$ END SELECT END IF 'CLS fe% = FetchErrorLevel% IF FetchErrorLevel% > 0 THEN SHELL "DELTREE /Y " + Rtrim$(RealDir$,"\") + " >NUL" EXIT SUB END IF PresentDir$ = CURDIR$ PresentDrive$ = CURDRIVE$ CHDRIVE LEFT$(TrueDir$,1) CHDIR TrueDir$ SHELL Viewer$ + " " + RealName$ ClearBuffer COLOR 7,1 CLS KILL RealName$ CHDRIVE PresentDrive$ CHDIR PresentDir$ DELAY .1 END IF CASE %AltU IF Pick% > 0 THEN Pick$ = UCASE$(ArchiveFiles$(Pick%)) RealName$ = GetFileName$(Pick$) RealDir$ = NowDir$ CLS SELECT CASE Ext$ CASE ".ZIP" SHELL "PKUNZIP -e -o " + File$ + " " + Pick$ + " " + RealDir$ ' + " >NUL" CASE ".LZH" SHELL "lha.exe e /pn2 " + File$ + " " + RealDir$ + " "+ Pick$ END SELECT DELAY .2 CLS END IF CASE %AltA ABOUT CASE %AltH,%F1 ZipHelp END SELECT LOOP END IF COLOR 0,1 END SUB FUNCTION ChooseProgram%(ArchiveInfo$(),ArchiveFile$(),InfoLine1$,InfoLine2$ ,Choice%, DisplayPos%,LowFile%, HiFile%,Ky%,DirNum%,ChooseType$) DIM PrintLine AS STRING * 47 DIM DirLine AS STRING * 80 DisplayLine% = 18 TotalFiles% = CVWRD(ArchiveInfo$(0)) IF TotalFiles% < DisplayLine% THEN HiFile% = TotalFiles% BottomDisplayLine% = DisplayLine% COLOR 7,1 CLS COLOR 0,7 LOCATE 1,1:PRINT SPACE$(80); COLOR 7,1 LOCATE 2,2:PRINT Ltrim$(InfoLine1$) LOCATE 4,2:PRINT InfoLine2$ DO COLOR 15, 1 LinePos% = 0 IF TotalFiles% < 15 THEN BottomDisplayLine% = TotalFiles% IF ScrollIt% = 0 THEN 'POKE$ 0, SaveScreen$ : LOCATE y%, x% 'restore old screen FOR ArchiveFile% = LowFile% TO HiFile% INCR LinePos% LSET PrintLine$ = ArchiveInfo$(ArchiveFile%) IF LinePos% = DisplayPos% THEN QPrint 5 + LinePos%,1, PrintLine$ ,71 ELSE QPRINT 5 + LinePos%,1,PrintLine$,23 END IF NEXT ArchiveFile% LSET PrintLine$ = "" FOR I% = LinePos% + 1 To DisplayLine% QPRINT 5 + I%,1,PrintLine$,23 NEXT I% ELSE LSET PrintLine$ = ArchiveInfo$(Choice%) QPRINT 5 + DisplayPos%,1,PrintLine$,71 END IF DirLine$ = SPACE$(80) MID$(DirLine$,2) = ArchiveFile$(Choice%) COLOR 0,7:LOCATE 25,1:PRINT DirLine$; ScrollIt% = 0 ClearBuffer DO: ky$ = UCASE$(INKEY$): LOOP WHILE ky$ = "" Ky% = ASC(ky$): IF Ky% = 0 THEN Ky% = -ASC(MID$(ky$, 2)) SELECT CASE Ky% CASE %Enter,%RightArrow ChooseProgram% = choice%: EXIT DO CASE %Escape ChooseProgram% = 0: EXIT DO CASE %Home choice% = 1:LowFile% = 1 HiFile% = BottomDisplayLine% DisplayPos% = 1 CASE %EndKey Choice% = TotalFiles% DisplayPos% = MODTYPE(Choice%, BottomDisplayLine%) LowFile% = Choice% - DisplayPos% + 1 HiFile% = TotalFiles% CASE %PageDown INCR Choice%, DisplayLine% INCR LowFile%,DisplayLine% HiFile% = LowFile% + BottomDisplayLine% -1 IF HiFile% > TotalFiles% THEN HiFile% = TotalFiles% IF choice% > TotalFiles% THEN Choice% = TotalFiles% DisplayPos% = ModType(Choice%, BottomDisplayLine%) LowFile% = Choice% - DisplayPos% + 1 HiFile% = TotalFiles% END IF CASE %PageUp DECR Choice%,DisplayLine% DECR LowFile%,DisplayLine% HiFile% = LowFile% + DisplayLine% -1 IF LowFile% < 1 THEN LowFile% = 1:HiFile% = BottomDisplayLine% IF Choice% <=1 THEN Choice% = 1 LowFile% = 1 HiFile% = BottomDisplayLine% DisplayPos% = 1 END IF CASE %DownArrow INCR Choice% IF Choice% <= TotalFiles% THEN INCR DisplayPos% ELSE Choice% = TotalFiles% END IF IF DisplayPos% > BottomDisplayLine% THEN DisplayPos% = BottomDisplayLine% LowFile% = Choice% -BottomDisplayLine% + 1 IF HiFile% >= TotalFiles% THEN HiFile% = TotalFiles% ELSE HiFile% = LowFile% + BottomDisplayLine% -1 END IF PrintAtr BottomDisplayLine%+5, 1, 47, 23 Scroll 5,1, BottomDisplayLine%+4,47, 1,23,%Up ScrollIt% = 1 END IF CASE %UpArrow DECR choice% DECR DisplayPos% IF choice% <=1 THEN choice% = 1 LowFile% = 1 HiFile% = BottomDisplayLine% DisplayPos% = 1 ELSE IF DisplayPos% < 1 THEN DisplayPos% = 1 LowFile% = Choice% HiFile% = Choice% + BottomDisplayLine% -1 IF HiFile% >= TotalFiles% THEN HiFile% = TotalFiles% ELSE HiFile% = LowFile% + BottomDisplayLine% -1 END IF PrintAtr 6, 1, 47, 23 Scroll 5,1, BottomDisplayLine%+4,47, 1,23,%Down ScrollIt% = 1 END IF END IF CASE 48 TO 57,65 TO 90 IF ChooseType$ = "Directory" THEN ScanFiles% = TotalFiles% - Choice% ARRAY SCAN ArchiveInfo$(Choice% + 1) FOR ScanFiles% ,FROM 2 TO 2,=Ky$,To PossibleChoice% IF PossibleChoice% > 0 THEN Choice% = Choice% + PossibleChoice% ELSEIF PossibleChoice% = 0 THEN ARRAY SCAN ArchiveInfo$(1) FOR Choice% - 1 ,FROM 2 TO 2,=Ky$,To PossibleChoice% IF PossibleChoice% > 0 THEN Choice% = PossibleChoice% END IF IF PossibleChoice% > 0 THEN LowFile% = Choice% - DisplayPos% + 1 HiFile% = LowFile% + BottomDisplayLine% -1 IF LowFile% < 1 THEN LowFile% = 1:HiFile% = BottomDisplayLine%:DisplayPos% = Choice% IF HiFile% > TotalFiles% THEN HiFile% = TotalFiles% END IF END IF CASE -255 to -1 ChooseProgram% = choice%: EXIT DO CASE ELSE EXIT DO END SELECT LOOP COLOR 7,0 END FUNCTION SUB Scroll(BYVAL TopRow%,BYVAL TopLeftCol%,BYVAL BottomRow%,BYVAL BottomRightCol%,BYVAL TotalLines%,BYVAL Attr%,BYVAL WhichWay%) ! PUSH DS ! PUSH BP ! MOV AH,WhichWay% ! MOV AL, TotalLines% ! MOV BH, Attr% ! MOV CH, TopRow% ! MOV CL, TopLeftCol% ! MOV DH, BottomRow% ! MOV DL, BottomRightCol% ! INT &H10 ! POP BP ! POP DS END SUB SUB QPrint(BYVAL Row, BYVAL Col, BYVAL Text$, BYVAL attr) PUBLIC ScreenSeg?? = ScreenSegment?? ! push DS ; save DS for PowerBASIC ! mov ax,Row% ; get the row ! dec al ; convert row to zero base ! mov bl,80 ; get the number of cols ! mul bl ; multiply # of cols * rows ! add ax,Col% ; add the column ! dec al ; convert column to zero base ! mov di,ax ; offset within video page ! shl di,1 ; account for color/attribute ! push WORD PTR Text$ ; push string handle on the stack ! call GetStrLoc ; find the string ! jcxz QPExit ; if it's Null, exit ! mov DS, DX ; put segment in DS ! mov SI, AX ; put offset in SI ! mov ES, ScreenSeg?? ; move to ES ! mov AH, attr ; put attribute in AH WriteChar: ! lodsb ; get Char from string ! stosw ; write Char and attribute to screen ! loop WriteChar ; do it all CX times QPExit: ! pop DS ; restore DS for PowerBASIC END SUB SUB PrintAtr(byval Row%, byval Col%,ByVal LineWidth%, byval Attr%) ScreenSeg?? = ScreenSegment?? ! push ds ;save the good stuff ! mov ax,Row% ; get the row ! dec al ; convert row to zero base ! mov bl,80 ; get the number of cols ! mul bl ; multiply # of cols * rows ! add ax,Col% ; add the column ! dec al ; convert column to zero base ! mov di,ax ; offset within video page ! shl di,1 ; account for color/attribute ! mov es,ScreenSeg?? ;put video segment into ax ! mov ah,Attr% ;the color attribute will be needed ! mov cx,LineWidth% forloop: ! inc di ;increment to the next vidram position ! mov es:[di],ah ;poke the attribute into vidram ! inc di ! loop forloop ;loop until cx = 0 ! pop ds END SUB FUNCTION GetKey%() Public While ISFALSE INSTAT:Wend ky$ = Inkey$ IF len(ky$) = 2 then GetKey% = -ascii(right$(ky$,1)) ELSE GetKey% = ascii(ky$) END IF END FUNCTION SUB ClearBuffer DO:LOOP UNTIL INKEY$ = "" END SUB SUB GetDirs(Spec$,Directory$(), DirInfo$(), FilesInfo$, TotalDirs%) DIM FileName AS STRING * 8 DIM Ext AS STRING * 4 DirFile$ = DIR$(Spec$,16) IF DirFile$ <> "" THEN GetDirInfo DirDate$,DirTime$,DirSize???,DirAttr? IF BIT(DirAttr?,4) THEN INCR TotalDirs% Directory$(TotalDirs%) = DirFile$ LSET FileName$ = Extract$(DirFile$,".") LSET Ext$ = Extension$(DirFile$) IsDir$ = "