home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
BASIC
/
QBS_0103
/
QBS103-8.DOC
< prev
next >
Wrap
Text File
|
1993-04-30
|
42KB
|
1,381 lines
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #8693
Date: 03-30-93 08:58 (Public)
From: DOUGLAS LUSHER
To: LEE MADAJCZYK
Subject: DISK NOT READY, AND GENER
────────────────────────────────────────────────────────────────────────────────
LM> DL> By the way, if you're doing a lot of work on floppy drives, you
LM> > might also want to check if the disk in the drive is
LM> > write-protected or not. I have code for that also, if you need
LM> Douglas...
LM> Could you post that here? If I said Pretty Please? Thanks..
Sure, here it is. I trust you know to load QB with the /L switch
and to include the QB.BI file. Of course when you use this in a
program, you will want to use the code I posted earlier to make
sure that there is a disk in the drive before using this to make
sure that the floppy is not write protected. This function returns
True (-1) if the disk in the specified drive *can* be written to,
i.e. it is not write protected.
FUNCTION FloppyWriteOK% (Drive$)
DIM XRegister as RegTypeX
Drive% = (ASC(Drive$) OR 32) - 97
'reset floppy drive
XRegister.AX = 0
XRegister.DX = Drive%
CALL InterruptX(&H13, XRegister, XRegister)
'spin it
XRegister.AX = &H401
XRegister.CX = &H101
XRegister.DX = Drive%
CALL InterruptX(&H13, XRegister, XRegister)
Buffer$ = SPACE$(512)
'read from the disk
XRegister.AX = &H201
XRegister.ES = VARSEG(Buffer$)
XRegister.BX = SADD(Buffer$)
XRegister.CX = &H101
XRegister.DX = Drive%
CALL InterruptX(&H13, XRegister, XRegister)
'try writing back to the disk
XRegister.AX = &H301
XRegister.ES = VARSEG(Buffer$)
XRegister.BX = SADD(Buffer$)
XRegister.CX = &H101
XRegister.DX = Drive%
CALL InterruptX(&H13, XRegister, XRegister)
FloppyWriteOK% = ((XRegister.Flags AND 1) = 0)
END FUNCTION
---
■ SLMR 2.1a ■ Being weird isn't enough.
--- TMail v1.30.4
* Origin: TC-AMS MLTBBS 2.2 - Minnetonka, MN (612)-938-4799 (1:282/7)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #8487
Date: 03-29-93 15:27 (Public)
From: JOE NEGRON
To: SEAN SULLIVAN
Subject: Need a routine
────────────────────────────────────────────────────────────────────────────────
SS> I know I've seen a routine for determining the directory from which a
> program was launched, but can't remember where. Anyone have this info?
Here you go:
============================== Begin code ==============================
DEFINT A-Z
'$INCLUDE: 'qbx.bi'
DECLARE FUNCTION ProgName$ ()
'***********************************************************************
'* FUNCTION ProgName$
'*
'* PURPOSE
'* Uses DOS ISR 21H, Function 51H (Get PSP Address) to return the
'* name of the currently executing program.
'*
'* EXTERNAL ROUTINE(S)
'* QBX.LIB
'* -------
'* SUB Interrupt (IntNum%, IRegs AS RegType, ORegs AS RegType)
'***********************************************************************
FUNCTION ProgName$ STATIC
DIM IRegs AS RegType, ORegs AS RegType
IRegs.ax = &H5100 'DOS Function 51h
Interrupt &H21, IRegs, ORegs ' Get PSP Address
DEF SEG = ORegs.bx
EnvSeg% = PEEK(&H2C) + PEEK(&H2D) * 256 'Get environment address
DEF SEG = EnvSeg%
DO
Byte% = PEEK(Offset%) 'Take a byte
IF Byte% = 0 THEN 'Items are ASCIIZ terminated
Count% = Count% + 1
IF Count% AND EXEFlag% THEN 'EXE also ASCIIZ terminated
EXIT DO 'Exit at the end
ELSEIF Count% = 2 THEN 'Last entry in env. terminated
EXEFlag% = TRUE ' with two NULs. Two bytes
Offset% = Offset% + 2 ' ahead is the EXE file name.
END IF
ELSE 'If Byte% <> 0, reset
Count% = FALSE ' zero counter
IF EXEFlag% THEN 'If EXE name found,
Temp$ = Temp$ + CHR$(Byte%) ' build string
END IF
END IF
Offset% = Offset% + 1 'To grab next byte...
LOOP 'Do it again
DEF SEG 'Reset default segment
ProgName$ = Temp$ 'Assign Temp$ to the FUNCTION
Temp$ = "" 'Clean up
END FUNCTION
=============================== End code ===============================
--Joe in Bay Ridge, Brooklyn, NY, Mon, 03-29-1993--
... Old enough to know better; too young to resist.
___
X Blue Wave/QWK v2.12 X
--- Maximus 2.01wb
* Origin: * BlueDog BBS * (212) 594-4425 * NYC FileBone Hub (1:278/709)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #9614
Date: 03-30-93 22:58 (Public)
From: LYN BORCHERT
To: QUINN TYLER JACKSON
Subject: A Simple PickList Sub
────────────────────────────────────────────────────────────────────────────────
Hello Quinn!
Just thought I'd contribute a little to the source code floating around here.
Feel free to capture it for QBS or whatever.
I also have something I'd like you to take a look at. Is there a Fido
address that I can send you a file to?
-=[ Lyn ]=-
---------------------------[ Snip Snip ]----------------------------------
DEFINT A-Z
DECLARE SUB pl (rw, co, fg, bg, Hfg, Hbg, sr() AS STRING, reslt)
'***** The Following Code is to Demo the PickList Routine *****
COLOR 0, 1
CLS
'**** First we must Create a Dynamic Array with the number of
'**** elements our picklist will contain. In this example we
'**** have a menu of 5 choices. To use this Sub-program with
'**** QuickBasic, you will need to make the array sharable since
'**** QuickBasic doesn't allow passing of Arrays as an argument.
'**** (I think)
REDIM main(1 TO 5) AS STRING
'**** Next we must populate the Array
main(1) = "This is the First Selection"
main(2) = "Selection 2"
main(3) = "Selection Number three is this one"
main(4) = "Selection 4"
main(5) = "Selection 5"
'**** Now call the Picklist Sub with all the arguments needed ****
CALL pl(6, 23, 0, 7, 15, 0, main(), result)
'**** When program execution returns from the Sub, the variable
'**** "result" has been populated with the array element that the
'**** user selected.
'**** Lets move our cursor to a place away from our picklist for
'**** displaying the results and set the colors.
LOCATE 20, 30
COLOR 15, 0
'**** Now lets use a Select Case to determine which item was selected
'**** and do the appropriate task for that selection.
SELECT CASE result
CASE 1
PRINT "You Picked Selection 1";
CASE 2
PRINT "You Picked Selection 2";
CASE 3
PRINT "You Picked Selection 3";
CASE 4
PRINT "You Picked Selection 4";
CASE 5
PRINT "You Picked Selection 5";
CASE ELSE
END SELECT
'**** A good practice when ending a program is to set the colors back
'**** to the default and locate the cursor to a nice spot.
COLOR 7, 0
LOCATE 25, 1
END
'*****************************************************************
'* PickList Subroutine *
'* by Lyn Borchert *
'* *
'* Purpose: To display a list of selections for the user to *
'* select from. *
'* *
'* Compiler: MS BASIC v7.x PDS *
'* *
'* This source code is hereby released into the Public Domain. *
'* *
'* QBS * Yes *
'* *
'*****************************************************************
SUB pl (rw, co, fg, bg, Hfg, Hbg, sr() AS STRING, reslt)
'**** These are several var. declarations that I usually use as
'**** Constants.
FALSE = 0
TRUE = NOT FALSE
done = FALSE
backspace = 8
downarrow = 20480
endkey = 20224
enter = 13
escape = 27
home = 18176
leftarrow = 19200
rightarrow = 19712
tabkey = 9
uparrow = 18432
'**** First thing to do is find the longest string in the array
'**** so we know how big the box needs to be. The loop goes one by
'**** one through the array until only the length of the longest
'**** array element is in the var. c
FOR x = 1 TO UBOUND(sr)
IF LEN(sr(x)) > c THEN
c = LEN(sr(x))
END IF
NEXT x
'**** So that our box looks nice, the first line will be blank.
'**** I add an extra 4 spaces, 2 for each side.
LOCATE rw, co
COLOR fg, bg
PRINT SPACE$(c + 4)
'**** Now to loop through our array again, this time to print the
'**** elements of the array using the normal forground and background
'**** colors. First I print a blank line just like above, then go 2
'**** characters beyond for a shadow effect. and finally print the
'**** contents of the array.
FOR x = 1 TO UBOUND(sr)
LOCATE rw + x, co
COLOR fg, bg
PRINT SPACE$(c + 4);
COLOR 8, 0
PRINT SPACE$(2)
COLOR fg, bg
LOCATE rw + x, co + 2
PRINT sr(x)
NEXT x
'**** Next I print one line below the last line to complete the box.
'**** Then one more line below that and shifted 2 characters to the
'**** right to finish up the shadow effect.
LOCATE rw + x, co
COLOR fg, bg
PRINT SPACE$(c + 4);
COLOR 8, 0
PRINT SPACE$(2)
LOCATE rw + x + 1, co + 2
PRINT SPACE$(c + 4)
'**** This next section will paint the default highlighted selection.
'**** The var sp is used to pad any array elements that were shorter
'**** than any other ones. That way our highlight always looks the
'**** same length. Of course, if this is the longest selection we don't
'**** need to generate the sp var.
IF c > LEN(sr(1)) THEN
LOCATE rw + 1, co + 2
sp = c - LEN(sr(1))
COLOR Hfg, Hbg
PRINT sr(1) + SPACE$(sp)
ELSE
LOCATE rw + 1, co + 2
COLOR Hfg, Hbg
PRINT sr(1)
END IF
'**** Now to set some pointer variables to keep track of things.
'**** laslin is the Last Line of a valid selection.
'**** firslin is the First Line of a valid selection.
'**** Pointer is the currently highlighted selection.
'**** oldpointer is the previously highlighted selection until it
'**** gets returned to a non-highlighted state.
'**** rwp is the row location of the highlighted selection.
laslin = rw + UBOUND(sr)
firslin = rw + 1
pointer = 1
oldpoint = 1
rwp = rw + pointer
'**** Put it all in a loop.
DO
DO '**** This little loop is my canned
k$ = INKEY$ '**** input routine. It waits for a
LOOP UNTIL k$ <> "" '**** keypress from the user and then
KC = CVI(k$ + CHR$(0)) '**** returns a unique number for
'**** every key on the keyboard.
SELECT CASE KC '**** Now a case select to act upon
'**** whatever key was pressed.
CASE downarrow
rwp = rw + pointer '**** First locate row position of
pointer = pointer + 1 '**** current selection.
'**** Then increment the pointer var
'**** and if it goes beyond the end
'**** send it back to the top.
IF pointer > UBOUND(sr) THEN pointer = 1
CASE uparrow '**** Do the same as above only in
rwp = rw + pointer '**** reverse for the up arrow.
pointer = pointer - 1
IF pointer < 1 THEN pointer = UBOUND(sr)
CASE enter '**** Here the user made his selection
reslt = pointer '**** so we load the var reslt with
done = TRUE '**** his selection number and tell
'**** the loop we are all done.
CASE ELSE
SOUND 999, 1 '**** Here we beep at the user to
'**** indicate a bad keypress.
END SELECT
'**** Now we need to update the screen with the users movements.
'**** I first locate to where the highlight was and reprint the line
'**** in the normal colors. Using the sp var. for the same purpose
'**** as before if necessary.
LOCATE rwp, co + 2
IF c > LEN(sr(oldpoint)) THEN
sp = c - LEN(sr(oldpoint))
COLOR fg, bg
PRINT sr(oldpoint) + SPACE$(sp)
ELSE
COLOR fg, bg
PRINT sr(oldpoint)
END IF
'**** Now update the row location of our new highlighted line.
rwp = rw + pointer
'**** Next print the new highlighted line.
LOCATE rwp, co + 2
IF c > LEN(sr(pointer)) THEN
sp = c - LEN(sr(pointer))
COLOR Hfg, Hbg
PRINT sr(pointer) + SPACE$(sp)
ELSE
COLOR Hfg, Hbg
PRINT sr(pointer)
END IF
'**** Lastly, update the old highlight location pointer with the
'**** current highlighted position.
oldpoint = pointer
'**** Are we done? If not go get another keypress from the user.
LOOP UNTIL done = TRUE
END SUB
---
* Origin: ->Home of JEM DISC CD-ROM, Freq. JEMDISC for Info.<- (1:300/12)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #9916
Date: 03-29-93 14:10 (Public)
From: RICH TIETJENS
To: ARTHUR SHIPKOWSKI
Subject: QB-CIMR Positions
────────────────────────────────────────────────────────────────────────────────
In a message of 26 Mar 93 16:33:12, Arthur Shipkowski wrote:
AS> You call 6:27am early? On school days, I get up at 5:50am, take a shower,
AS> poll my bossnode for mail, eat breakfast and get to school by 7:15am. I'm
AS> a miracle worker...sometimes I even use PB & QBX that early... That's
AS> when I get code like:
AS>
AS> FOR I% = 1 TO 10
AS> DO
AS> NEXT I%
AS> LOOP
AS>
AS> and spend all afternoon figuring out what's wrong.
ROFL! I wish I could share this with my non-programming friends, but it
wouldn't be funny if I had to explain it (which I would).
Looks like an Aggie program to me!
--- FIDOdoor+ 3.2.6 [IOSmail 0.89]
* Origin: You make my head explode. (1:3807/10.0)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10184
Date: 03-31-93 06:46 (Public)
From: DICK DENNISON
To: MICHAEL BAILEY
Subject: File Date/Time
────────────────────────────────────────────────────────────────────────────────
MB> If you could go ahead and post GetFileDateTime, I'd appreciate it.
'Ok should be in the next 4 msgs:
______O_/_________________| SNIP |________________\_O_____
O \ | HERE | / O
'This file created by PostIt! v5.0ba (VBDos version from Brent Ashley)
'>>> Start of page 1 of dt.bas
' DT BAS : A Quick Basic tool to manipulate a file's date/time
' stamp
' author .....: Dick Dennison [74270,3636] 1:272/34 914-374-3903 *hst*
' 24 hrs
' supports ...: At least Dos 5.0 and later, untested to Dos 3.1
' syntax .....: DT [FILENAME]
' returns ....: The filename (or directory)
' includes ...: QB.bi from Microsoft
' cost .......: Free = Credit where credit due
' : Do not use as is for commercial use - may not be resold
' : May not be rebundled without prior written consent
' dated ......: 03/30/93 Version 1.0 released
'
'$INCLUDE: 'qb.bi' 'Supply correct path and start QB /L QB
'
DECLARE FUNCTION GetNum% (howmany%, min%, max%)
DECLARE FUNCTION getdate& ()
DECLARE FUNCTION gettime& ()
DECLARE SUB SetFileDate (filename$, datef&, timef&)
DECLARE FUNCTION filestru$ (filespec$)
DECLARE FUNCTION fixdate$ (parm%)
DECLARE FUNCTION fixtime$ (parm%)
DECLARE FUNCTION getdir$ ()
TYPE filestruct
res AS STRING * 20
attr AS INTEGER
timef AS INTEGER
datef AS INTEGER
size AS LONG
nameff AS STRING * 14
END TYPE
DIM SHARED fi AS filestruct
DIM SHARED mon(12) AS STRING
mon$(1) = "-Jan-": mon$(2) = "-Feb-": mon$(3) = "-Mar-": mon$(4) = _
"-Apr-"
mon$(5) = "-May-": mon$(6) = "-Jun-": mon$(7) = "-Jul-": mon$(8) = _
"-Aug-":
mon$(9) = "-Sep-": mon$(10) = "-Oct-": mon$(11) = "-Nov-": mon$(12) = _
"-Dec-"
PCOPY 0, 1
COLOR 11, 0
filename$ = getdir$
CLS
PRINT filestru$(filename$)
x& = getdate&
y& = gettime&
SetFileDate filename$, x&, y&
PRINT filestru$(filename$)
PRINT "Press a key"
DO: a$ = INKEY$: LOOP WHILE a$ = ""
PCOPY 1, 0
LOCATE 25, 1
FUNCTION filestru$ (filespec$)
DIM regs AS RegTypeX
'File structures
temp$ = filespec$ + CHR$(0)
regs.ax = &H1A00 'DOS service to set DTA
regs.ds = VARSEG(fi)
regs.dx = VARPTR(fi)
CALL INTERRUPTX(&H21, regs, regs)
regs.ax = &H4E00 'Find first matching file
regs.cx = 0 'regular files
regs.ds = VARSEG(temp$)
regs.dx = SADD(temp$)
CALL INTERRUPTX(&H21, regs, regs)
IF regs.flags AND 1 THEN
a$ = filespec$ + " File not Found"
filestru$ = a$
EXIT FUNCTION
END IF
' PRINT fixdate$(fi.datef),
' PRINT fixtime$(fi.timef),
' PRINT fi.size,
' PRINT fi.nameff 'parse for AsciiZ
datef$ = fixdate$((fi.datef))
timef$ = fixtime$((fi.timef))
a$ = fi.nameff + " " + STR$(fi.size) + " " + datef$ + timef$
filestru$ = a$
END FUNCTION
FUNCTION fixdate$ (parm%)
'Date and time are in packed format - these are the breakouts
'>>> Continued on page 2.
--- VP [DOS] V4.09e
* Origin: The MailMan (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10185
Date: 03-31-93 06:46 (Public)
From: DICK DENNISON
To: MICHAEL BAILEY
Subject: File Date/Time
────────────────────────────────────────────────────────────────────────────────
'>>> Start of page 2 of dt.bas
'bits 00h-04h = day (1-31)
'bits 05h-08h = month (1-12)
'bits 09h-0Fh = year (relative to 1980)
day% = parm% AND 31 'get bits 0-4
dayz$ = LTRIM$(STR$(day%))
IF LEN(dayz$) = 1 THEN dayz$ = "0" + (dayz$) 'Parse and add leading 0
' if needed
parm% = parm% \ 32 'shift left 5
Month% = parm% AND 15 'get bits 5-8
parm% = parm% \ 16 'shift left 4
year% = (parm% AND 255) + 80 'get bits 9-15 and add to 1980
moddate$ = dayz$ + mon$(Month%) + LTRIM$(STR$(year%)) 'Format is
' 20-Oct-90
fixdate$ = " " + moddate$ + " "
END FUNCTION
FUNCTION fixtime$ (parm%)
'Date and time are in packed format - these are the breakouts
'bits 00h-04h = 2 second incs (0-29)
'bits 05h-0Ah = minutes (0-59)
'bits 0Bh-0Fh = hours (0-23)
temp& = parm%
IF parm% < 0 THEN temp& = temp& + 65536 'Check for sign (+ -)
secs% = (temp& AND 31) * 2 'get bits 0-4 and multiply by 2
temp& = temp& \ 32 'shift right 5
mins% = temp& AND 63 'get bits 5-10
temp& = temp& \ 64 'shift right 6
hours% = temp& AND 31 'get bits 11-15
sec$ = LTRIM$(STR$(secs%))
IF LEN(sec$) = 1 THEN sec$ = "0" + sec$ 'Parse and add leading 0's
min$ = LTRIM$(STR$(mins%))
IF LEN(min$) = 1 THEN min$ = "0" + min$ 'if needed
hour$ = LTRIM$(STR$(hours%))
IF LEN(hour$) = 1 THEN hour$ = "0" + hour$
modtime$ = hour$ + ":" + min$ + ":" + sec$ 'Format is 01:30:46
fixtime$ = modtime$
END FUNCTION
FUNCTION getdate&
gdatetop:
PRINT "New Month (01-12): ";
mo% = GetNum%(2, 1, 12)
IF mo% = 0 THEN
getdate& = fi.datef + 0&
PRINT "Use Old Date"
EXIT FUNCTION
END IF
PRINT "New Date (01-31): ";
da% = GetNum%(2, 1, 31)
PRINT "New Year : 19";
yr% = GetNum%(2, 0, 99) - 80
PRINT " New File Date : "; LTRIM$(STR$(mo%)); "/"; _
LTRIM$(STR$(da%)); "/"; LTRIM$(STR$(yr% + 80))
'datef% 'bits 0-4h=day(1-31),5-8h=month(1-12),9-Fh=year-1980
' + , * 32 ,*512
datef& = yr% * 512& + mo% * 32& + da%
getdate& = datef&
END FUNCTION
FUNCTION getdir$
CLS
SHARED dta AS STRING * 44
'SHARED namef$
DIM regs AS RegTypeX
DIM array(125) AS STRING
regs.ax = &H1A00 'DOS service to set DTA
regs.ds = VARSEG(dta)
regs.dx = VARPTR(dta)
CALL INTERRUPTX(&H21, regs, regs)
temp$ = "*.*" + CHR$(0)
IF LEN(COMMAND$) THEN temp$ = COMMAND$ + CHR$(0)
findnext% = 0
FOR p% = 0 TO 124
'BEEP
IF findnext% THEN
regs.ax = &H4F00
ELSE
regs.ax = &H4E00 'find first
END IF
regs.cx = 0 'normal attributes
regs.ds = VARSEG(temp$)
regs.dx = SADD(temp$)
CALL INTERRUPTX(&H21, regs, regs)
'PRINT regs.ax
'>>> Continued on page 3.
--- VP [DOS] V4.09e
* Origin: The MailMan (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10186
Date: 03-31-93 06:47 (Public)
From: DICK DENNISON
To: MICHAEL BAILEY
Subject: File Date/Time
────────────────────────────────────────────────────────────────────────────────
'>>> Start of page 3 of dt.bas
IF regs.ax AND 255 THEN
'PRINT "not found"
EXIT FOR
ELSE
namef$ = RTRIM$(MID$(dta$, 31, 12))
mark% = INSTR(namef$, CHR$(0))
IF mark% > 0 THEN namef$ = LEFT$(namef$, mark% - 1)
END IF
array$(p%) = namef$
PRINT namef$,
findnext% = -1
NEXT p%
'Setup some special key functions
cr$ = CHR$(13)
Nul$ = CHR$(0)
ArrowLt$ = Nul$ + CHR$(75)
ArrowRt$ = Nul$ + CHR$(77)
ArrowUp$ = Nul$ + CHR$(72)
ArrowDn$ = Nul$ + CHR$(80)
EndKey$ = Nul$ + CHR$(79)
Esc$ = CHR$(27)
Home$ = Nul$ + CHR$(71)
SpaceBar$ = CHR$(32)
'==========================================
botline% = p% \ 5 + 1
'Move cursor around
IF LEN(COMMAND$) THEN GOTO skip
LOCATE 1, 1, 1
DO 'This section lets the user move
In$ = INKEY$ 'move the cursor around on the screen
SELECT CASE In$
CASE cr$
EXIT DO
CASE Esc$ 'END
END
CASE Home$ 'Goto the beginning of the line
LOCATE , 1
CASE EndKey$ 'Goto the end of the line
LOCATE , 57
CASE ArrowUp$ 'UpArrow
x% = CSRLIN
IF x% > 0 THEN
xx% = xx% - 5
LOCATE x% - 1
END IF
CASE ArrowDn$ 'DownArrow
x% = CSRLIN
IF x% < botline% THEN
xx% = xx% + 5
LOCATE x% + 1
END IF
CASE ArrowLt$ 'LeftArrow
IF POS(0) > 14 THEN LOCATE , POS(0) - 14
IF yy% > 0 THEN yy% = yy% - 1
CASE ArrowRt$ 'RightArrow
IF POS(0) < 56 THEN LOCATE , POS(0) + 14
IF yy% < 4 THEN yy% = yy% + 1
CASE SpaceBar$
BEEP
END SELECT
LOCATE , , 1 'Keep cursor flashing
LOOP
'======================================================================
num% = xx% + yy%
'CLS
skip:
getdir = array$(num%)
END FUNCTION
FUNCTION GetNum% (howmany%, min%, max%)
'asc 48-57
FOR n% = 1 TO howmany%
getnumtop:
DO
a$ = INKEY$
LOOP WHILE a$ = ""
'PRINT ASC(a$)
SELECT CASE ASC(a$)
CASE 48 TO 57
PRINT a$;
CASE 13
GetNum% = 0
EXIT FUNCTION
CASE ELSE
BEEP
a$ = ""
GOTO getnumtop
END SELECT
IF VAL(a$) > max% THEN
'>>> Continued on page 4.
--- VP [DOS] V4.09e
* Origin: The MailMan (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10187
Date: 03-31-93 06:47 (Public)
From: DICK DENNISON
To: MICHAEL BAILEY
Subject: File Date/Time
────────────────────────────────────────────────────────────────────────────────
'>>> Start of page 4 of dt.bas
BEEP
a$ = ""
GOTO getnumtop
END IF
nu$ = nu$ + a$
a$ = ""
NEXT n%
IF VAL(nu$) > max% OR VAL(nu$) < min% THEN
BEEP
nu$ = ""
GOTO getnumtop
END IF
PRINT
GetNum% = VAL(nu$)
END FUNCTION
FUNCTION gettime&
'mo% = GetNum%(2, 1, 12)
gtimetop:
PRINT "New Hour (00-23): ";
hour% = GetNum%(2, -1, 23)
IF hour% < 0 THEN
gettime& = fi.timef + 0&
PRINT "Use old time"
EXIT FUNCTION
END IF
PRINT "New Minutes (00-59): ";
min% = GetNum%(2, 0, 59)
PRINT "New Seconds (00-59) : ";
sec% = GetNum%(2, 0, 59)
PRINT " New file time : " + LTRIM$(STR$(hour%)) + ":" + _
LTRIM$(STR$(min%)) + ":" + LTRIM$(STR$(sec%))
'timef% 'bits 0-4h=2secincs(0-29),5-Ah=mins(0-59),B-Fh=Hours(0-23)
' + , * 32 ,*2048
timef& = hour% * 2048& + min% * 32& + sec%
gettime& = timef&
END FUNCTION
SUB SetFileDate (filename$, datef&, timef&)
DIM regs AS RegType
OPEN filename$ FOR APPEND AS 1
handle% = FILEATTR(1, 2)
regs.ax = &H5700 + 1 'SET file date/time + 0 the GET
regs.bx = handle% 'file handle
'timef% 'bits 0-4h=2secincs(0-29),5-Ah=mins(0-59),B-Fh=Hours(0-23)
' + , * 32 ,*2048
'timef% = 2 * 2048 + 22 * 32
'datef% 'bits 0-4h=day(1-31),5-8h=month(1-12),9-Fh=year-1980
' + , * 32 ,*512
'datef% = 12 * 512 + 6 * 32 + 16
IF timef& > 32767 THEN tim% = timef& - 65536 ELSE tim% = timef&
IF datef& > 32767 THEN dat% = datef& - 65536 ELSE dat% = datef&
regs.cx = tim%
regs.dx = dat%
CALL INTERRUPT(&H21, regs, regs)
IF regs.flags AND 1 THEN BEEP
CLOSE 1
END SUB
______O_/_________________| SNIP |________________\_O_____
O \ | HERE | / O
--- VP [DOS] V4.09e
* Origin: The MailMan (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10275
Date: 03-31-93 12:00 (Public)
From: SEAN SULLIVAN
To: JANUSZ SUCHOROLSKI
Subject: ASCII TEXT SEARCH +
────────────────────────────────────────────────────────────────────────────────
Greetings and Salutations JANUSZ!
Monday March 29 1993 11:12, JANUSZ SUCHOROLSKI wrote to ALL:
JS> I'd like to implement a "text search" while inside ASCII file.
JS> Here's some code:
.....
JS> It simply shows the whole line in reverse video, however I'd like to see
JS> just the occurence(s) of the string highlighted instead of the whole
JS> line. I guess somebody did it before and might post a missing
JS> bit(bytes).
Janusz, I've reworked your code a little to give you what you want. Hope
this helps.
---------------------8<-------cut here---------->8----------------------------
DEFINT A-Z
CLS
'Get input file and search string
LOCATE 1, 1: COLOR 0, 11: PRINT SPACE$(80)
LOCATE 1, 1: INPUT "Text file name: ", tf$
LOCATE 1, 1: PRINT SPACE$(80)
LOCATE 1, 1: INPUT "Search for:", ts$
ts$ = UCASE$(ts$)
'search string length
tl = LEN(ts$)
COLOR 7, 0
'open file
freenum = FREEFILE
OPEN tf$ FOR INPUT AS #freenum
LineNum = 0
'set up view port for printing file
VIEW PRINT 2 TO 24
'read in file line by line highlighting found search text found
WHILE NOT EOF(freenum)
LineNum = LineNum + 1
LINE INPUT #freenum, Check$
'if line contains the search text, highlight that text
IF INSTR(UCASE$(Check$), ts$) THEN
TextFound = INSTR(UCASE$(Check$), ts$)
COLOR 7, 0: Found$ = MID$(Check$, 1, TextFound - 1): PRINT Found$;
COLOR 0, 7: Found$ = MID$(Check$, TextFound, tl): PRINT Found$;
COLOR 7, 0: Found$ = MID$(Check$, TextFound + tl): PRINT Found$
'else print the line
ELSE PRINT Check$
END IF
'pause when page is full
IF LineNum = 21 THEN
COLOR 0, 12: PRINT "< MORE >": COLOR 7, 0
DO
Ky$ = INKEY$
LOOP WHILE Ky$ = ""
LineNum = 0
CLS 2
END IF
WEND
CLOSE #freenum
--------------------------8<-----cut here----->8-------------------------
I've added a top line prompt for easier testing and print the text in a
view port. You were using INPUT to get the file data, but that chops up the
input if commas, etc, are in the line. Using LINE INPUT you get the whole
line
at once. If the string is found in the line, the line is then parsed to
highlight just the search string, otherwise the whole line is printed as is.
I add a routine to pause when the screen is full. Hope this helps ya.
Sean
--- GoldED 2.40.P0623
* Origin: COMNET Point #28 [Watervliet, NY] (1:267/113.28)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #10684
Date: 03-31-93 15:31 (Public)
From: JOHN GALLAS
To: PAUL CRUTCHFIELD
Subject: Quickbasic 4.5 Question]
────────────────────────────────────────────────────────────────────────────────
PC> I wish to know the following:
PC> Using Soundblaster, play music through sb speaker (Without .MOD,
PC>.CMF, just memory stuff..like the PLAY "ABC" command except going
PC>through the sb speaker.
Try this:
'-------------------------------clip here-------------------------------
' Sound Blaster Source Code
' Made by Brandon Callison
' Register 388h is the address/status port, and 389h is the data port.
'This is, of course, only for the FM music. (The cannels 1-11) which are
'compatible with Ad-Lib, Sound Blaster, SB Pro, Thunder Board, and many
'others. All boards advertised as compatible with Ad-Lib or Sound Blaster
'are compatible with this. Explainations of the mysterious code will be
'throughout the program.
DEFINT A-Z
DECLARE SUB SBStop ()
DECLARE SUB SBReset ()
DECLARE SUB SBOutPort (reg, x)
DECLARE SUB SBPlayNote (freq#, oct)
' vvvvvvvvvvvvvvvvvvvvvvv
' The following are his variable declarations; I'm leaving them in so you
' can see what all the variables are for:
'
'float freq; /* Frequency */
'int oct; /* Octave */
'int reg; /* Register no. */
'int x; /* Poke number to register */
'int i; /* GLOBAL Dummy loop signal */
'
' ^^^^^^^^^^^^^^^^^^^^^^^
SBReset
SBPlayNote 277.2, 5 'Middle C sharp on octave 5
SLEEP 2
SBStop 'Must be called to cut sound
END
SUB SBOutPort (reg, x)
OUT &H388, reg 'Outputs the register to be written to
FOR I = 1 TO 6
reg = INP(&H388)
NEXT I
' ^- This loop requires some explaining. The sound card must allow time
'to process it's code. 6 reads from the status port will cause it to wait
'for 2.3 microseconds. You MUST NOT make any outputs to the sound card port
'without waiting at least this amount of time in-between calls. The same
'applies below, except the wait is 23 microseconds, by 35 reads from the data
'port.
OUT &H389, x
FOR I = 1 TO 35 'Outputs the data into the register
reg = INP(&H389)
NEXT I
END SUB
SUB SBPlayNote (freq#, oct)
freq2 = INT(1.31 * freq#) 'Convert from hz to raw frequency?!?!
SBOutPort &H60, &HF0
SBOutPort &HC0, 1
SBOutPort &HA0, freq2 AND &HFF
SBOutPort &HB0, ((freq2 AND &HFF00) / &H100) OR (oct * 4) OR 32
' ^- for different channels, do anywhere from the register
' 0xB0 to 0xBA. (channels 1-11)
END SUB
SUB SBReset
FOR I = 1 TO 244 ' The sound card has 244 data ports. Just clears
OUT &H388, 0 ' all of them.
NEXT I
END SUB
SUB SBStop
SBOutPort &HB0, 0 ' As I said earlier for different channels
END SUB
* OLX 2.1 TD * "If you can't make it good, make it LOOK good." - B Gates
--- Maximus 2.01wb
* Origin: Command Line BBS =Mpls. MN= V.32bis [612-788-6685] (1:282/2007)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #11477
Date: 04-01-93 00:05 (Public)
From: SCOTT BAILEY
To: PAUL CRUTCHFIELD
Subject: pocal 1/3
────────────────────────────────────────────────────────────────────────────────
In a message dated 28 Mar 93 14:48:21, Paul Crutchfield wrote:
PC> What is your name? (Then they enter their name..(both sides see it)
PC> (I can backspace a letter if they type it in right
PC> after they type it in)
PC> then it does:
PC> Hello, (red) <name>!
Here are a couple SUBs from one of my first doors. I don't use the
command parser, but I thought I'd write a quick one just to see how hard it
would be, so it may be a little rough. I prefer using the COL sub myself.
Anyway, here goes...
'----Start of pocal.bas----
'ANSI.SYS must be installed
'colour commands must be in lowercase
'for bright colours and blink use col
DEFINT A-Z
DECLARE SUB col (A%, f%, b%)
DECLARE SUB pocal (text$, y%, Z%)
DECLARE SUB getkeys (hm%, A$)
DIM SHARED A$, modem, display, baud&, plaintext
'A$ holds answer after a call to getkeys
plaintext = 1 '0=no ANSI
modem = 1
display = 2
baud& = 0 'not online
CLS
LOCATE , , 1 'turn cursor on
OPEN "com2:2400" FOR RANDOM AS #modem
OPEN "cons:" FOR OUTPUT AS #display
pocal "@cyanEnter your name:>@magenta", 0, 1
CALL getkeys(32, "")
pocal "", 1, 1 'CR+LF
pocal "@cyanHello @red" + A$ + "@cyan!", 1, 1
col 1, 33, 40'bright yellow on black
pocal "", 1, 1
pocal "Good bye!", 1, 1
'simple menu
'pocal "@greenEnter <@cyanM@green>enu,", 0, 1
'pocal "<@cyanL@green>ook,<@cyanS@green>earch@magenta>", 0, 1
'CALL getkeys(1, "MLS")
'pocal "", 1, 1
'IF A$ = "M" THEN pocal "@blueYou chose Menu", 1, 1
'IF A$ = "L" THEN pocal "@whiteYou chose Look", 1, 1
'IF A$ = "S" THEN pocal "@cyanYou chose Search", 1, 1
END
SUB col (A, f, b)
'a=attribute: 0=all attributes off
' 1=bold on
' 5=blink on
' 7=reverse video
'f=foreground: 30=black
' 31=red
' 32=green
' 33=yellow
' 34=blue
' 35=magenta
' 36=cyan
' 37=white
'b=background 40=black
' 41=red
' 42=green
' 43=yellow
' 44=blue
' 45=magenta
' 46=cyan
' 47=white
IF plaintext = 0 THEN EXIT SUB
change$ = CHR$(27) + "[" + LTRIM$(STR$(A)) + ";"
change$ = change$ + LTRIM$(STR$(f)) + ";" + LTRIM$(STR$(b)) + "m"
IF baud& THEN 'if online then
CALL pocal(change$, 0, 1) 'print to modem and locally
ELSE
CALL pocal(change$, 0, 0) 'just print locally
END IF
END SUB
'Continued next message
--- DLG Pro v0.995/DLGMail
* Origin: Computer Answers, Prince Albert, Sask., Canada (1:140/601)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #11478
Date: 04-01-93 00:12 (Public)
From: SCOTT BAILEY
To: PAUL CRUTCHFIELD
Subject: pocal 2/3
────────────────────────────────────────────────────────────────────────────────
'Continued
SUB getkeys (hm%, pare$)
'------
'hm%=# of chars to ask for
'pare$=accepted chars ("" for any char)
'------
A$ = ""
back:
DO
DO
temp$ = INKEY$
IF LEN(temp$) THEN EXIT DO 'local key pressed
LOOP UNTIL LOC(modem) > 0 'chars waiting?
IF temp$ = "" THEN 'if no local keys pressed then
temp$ = INPUT$(LOC(modem), 1)'take all remote chars so no overflow
temp$ = LEFT$(temp$, 1) 'accept only 1st char
END IF
IF temp$ = CHR$(13) AND INSTR(pare$, CHR$(13)) THEN 'CR valid?
A$ = A$ + CHR$(13)
EXIT SUB
END IF
IF temp$ = CHR$(8) AND LEN(A$) = 0 THEN GOTO back 'a$ empty-can't backup
IF temp$ = CHR$(13) AND LEN(A$) = 0 THEN GOTO back'a$ empty-CR not valid
IF temp$ = CHR$(13) AND LEN(A$) > 0 THEN EXIT SUB 'a$ not empty-CR exits
IF temp$ = CHR$(8) THEN 'backspace char
A$ = LEFT$(A$, LEN(A$) - 1) 'shorten a$
'pocal CHR$(27) + "[D " + CHR$(27) + "[D", 0, 1 'ANSI backspace
pocal CHR$(8) + " " + CHR$(8), 0, 1 'backspace
GOTO back
END IF
IF pare$ <> "" THEN 'any keys to look for?
temp$ = UCASE$(temp$) 'yes, change params to uppercase(if any)
il% = INSTR(pare$, temp$) 'check if key is in pare$
IF il% = 0 THEN A$ = "": GOTO back 'nope, get another char
END IF
A$ = A$ + temp$
pocal temp$, 0, 1 'print locally and to modem with no CR or LF
IF LEN(A$) >= hm% THEN EXIT SUB 'reached max length so exit
LOOP
END SUB
SUB pocal (text$, y%, Z%)
'text$=text to send
'y%=add CR+LF (0=NO or 1=YES)
'Z%=Send to modem(0=NO or 1=YES)
SHARED hm%
FOR count = 1 TO LEN(text$) STEP 4 'shortest command is 4 chars so we
ps = INSTR(text$, "@black") 'won't miss any if we
IF ps > 0 THEN 'step through for speed
text$ = LEFT$(text$, ps - 1)
rtext$ = MID$(text$, ps + 6)
A = 0: f = 30: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@red")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 4)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 31: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@green")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 6)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 32: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@yellow")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 7)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 33: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@blue")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 5)
text$ = LEFT$(text$, ps - 1)
'Continued next message
--- DLG Pro v0.995/DLGMail
* Origin: Computer Answers, Prince Albert, Sask., Canada (1:140/601)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #11479
Date: 04-01-93 00:14 (Public)
From: SCOTT BAILEY
To: PAUL CRUTCHFIELD
Subject: pocal 3/3
────────────────────────────────────────────────────────────────────────────────
'Continued
A = 0: f = 34: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@magenta")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 8)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 35: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@cyan")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 5)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 36: b = 40
GOSUB ansi
END IF
ps = INSTR(text$, "@white")
IF ps > 0 THEN
rtext$ = MID$(text$, ps + 6)
text$ = LEFT$(text$, ps - 1)
A = 0: f = 37: b = 40
GOSUB ansi
END IF
NEXT
IF y% THEN text$ = text$ + CHR$(13) + CHR$(10)
IF baud& AND Z% = 1 THEN PRINT #modem, text$;
PRINT #display, text$;
EXIT SUB
ansi:
text$ = text$ + CHR$(27) + "[" + LTRIM$(STR$(A)) + ";"
text$ = text$ + LTRIM$(STR$(f)) + ";" + LTRIM$(STR$(b)) + "m" + rtext$
RETURN
END SUB
'----End of Pocal.bas----
--- DLG Pro v0.995/DLGMail
* Origin: Computer Answers, Prince Albert, Sask., Canada (1:140/601)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #11577
Date: 03-30-93 06:42 (Public)
From: CHRIS TRACY
To: GEOFFREY LIU
Subject: DISABLE THE PAUSE KEY
────────────────────────────────────────────────────────────────────────────────
Well, since everyone might not have an assembler compiler, I compiled it for
the less fortunate...
--- Snip
CLS:?STRING$(50,178):DEFINT A-Z 'Created by PostIt! v5.1
Y$="*+,-./":FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "B",1,"NOPAUSE2.OBJ
T$="abcdefghijklmnopqrstuvwxyz":T$=T$+UCASE$(T$)+"0123456789()
G"a6*m42BWfwDZvMmUe2CTPmIF,qvDYj2BGe0CZvwBIXwzYbciwvMCZL2BUbImUatUis
G"b*LUU84Ngm42BWfwDZvMmUe2CTvaId*qPZKLc+OH4+uOuAjfa0GtpbvqvnvrY8fv
G"fHfvem0tevuoyE*iniacmqaqAjdauWxefevbrarbrvqcJ5baGe*qqbb8GLiaGbeDKupv
G"fulQjbayW)cSfJl*cc91tovewjrfaPJib*KObejOdcqae+EiLla6db*qD3OBya4Gu
G"Ac,Wcat3j4YrnnhIlmAG*4sIE+4YrjE4Wh6MeanhYhUySbeaW)4())RpaKRaSwFS
G"Shtb1mB7427IbbkEaj3J4byT1hU8Vl*Gla6db+DzaLh4YrjU4OhcaGllAb*0CiFGLl
G"gBab*WYBZzmaqmdufaXVqvaeBavbWCewfaXHqvaeBcvbq8nufaXBrvaedgvbqCBufaXYr
G"vaeVhvbGHIc+0b"
N=379:K=255:IF LEN(C$)<>506 THEN ?"Incomplete script!":END
FOR A=1 TO N:LOCATE 1:?STRING$(50/N*A,177):IF L=0 THEN GOSUB G:L=6
W=T\P(6-L):GOSUB G:W=W OR T*P(L):L=L-2:B$=CHR$(W AND K):PUT 1,,B$:NEXT
?:IF C=11 THEN ?"Ok":END ELSE ?"Bad checksum!":END
G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C\256+(C AND 255):RETURN
SUB G(A$):SHARED C$,Y$:FOR Q=1 TO 6:DO:S=INSTR(A$,CHR$(Q+41))
IF S THEN A$=LEFT$(A$,S-1)+STRING$(Q+1,97)+MID$(A$,S+1)
LOOP WHILE S:NEXT:C$=C$+A$:END SUB
--- Snip
Welp.. there it is.. I compiled it with Turbo Assembler becuase Macro
Assembler wan't happy when I tried to compile it to an object file..
-chris
--- T.A.G. 2.6d Standard
* Origin: DangerBase ][ Programming Staff 412-438-4101 (1:2615/4@FIDONET.ORG)