home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
BASIC
/
QBS_0103
/
QBS103-3.DOC
< prev
next >
Wrap
Text File
|
1993-04-30
|
41KB
|
1,365 lines
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #11117
Date: 03-17-93 08:48 (Public)
From: JIM TANNER
To: CASEY PEARSON
Subject: Layout problem (HELP!<g>)
────────────────────────────────────────────────────────────────────────────────
CP> I need help with random access files. (RAF) Here is the layout:
CP> Field Columns Type
{ ----------------------------------------------------- }
TYPE TypeName { Give it a name }
StreetNumber String * 6 { 6 bytes }
StreetName String * 12 { 12 bytes }
StreetDirection String * 2 { 2 bytes }
StreetType String * 6 { 6 bytes }
City String * 15 { 15 bytes }
State String * 2 { 2 bytes }
ZipCode String * 6 { 6 bytes }
YTDHoursWorked Interger { 2 bytes }
HourlyRate Single { 4 bytes }
YTDGrossPay Double { 8 bytes }
SocialSecurity String * 9 { 9 bytes }
KillFlag Integer { 2 bytes }
Filler String * 54 { 54 bytes (Makes record 128 bytes long.)
END TYPE { ---- }
{ 128 total bytes in each record. }
{ I closed up the spaces in your field names. Be sure to do }
{ this in your code as there can't be any spaces. }
{ You may be able to get by with assigning "YTDGrossPay" as }
{ "Single" rather than "Double" You can save 4 bytes. If you }
{ do, be sure to increase Filler to String * 58 }
{ Also you may want to increase SocialSecurity to String * 11 to allow }
{ for the dashes as in "###-##-####" }
{ If so you'll need to decrease the number (54) in Filler }
{ by 2 }
{ *** See note below regarding "KillFlag" and "Filler" *** }
DIM NameType AS TypeName { DIMension the Record }
{ NameType is 1 Record }
FileNum% = FREEFILE { Get next available file number }
OPEN "FILENAME.EXT" FOR RANDOM AS #FileNum% LEN = LEN(NameType)
{ This opens the file for Read/Write }
{ Change "FILENAME.EXT" to whatever }
{ you want to call the file that will }
{ be written to disk as a permanent }
{ file. }
{ Now find out how many records are in the }
{ file and assign the next available number }
{ to the new record about to be created. }
NumRecords% = LOF(FileNum%) \ LEN(NameType)
IF NumRecords% <> 0 THEN { The file does have records in it. }
RecordNum% = NumRecords% + 1 { Assign next available number. }
ELSE { No records yet. }
RecordNum% = 1 { So first record is number 1. }
ENDIF
{ Gets number of records based on the length of file (LOF) divided by
{ the LENgth of the record (NameType).
{ If there's no records in the file then the length will be 0 and NumRecords%
{ will be 0 and the next available RecordNum% would be 1.
{ If the LOF of FileNum% was 1024 there would be 8 records in the file.
{ and NumRecords% would be 8 and the next available RecordNum% would be 9.
{ This is based on 1024 (LOF of FileNum% divided by LENgth of NameType [the
{ length {128 bytes} of each Record]). }
{ You can also setup an Index routine to keep up with the }
{ Record numbers (RecordNum%) if you need to. }
{ Now get some info to put in a new record. }
COLOR 7, 0
CLS
LOCATE 2, 5
INPUT "Enter Street number: "; NameType.StreetNumber
INPUT "Enter Street name: "; NameType.StreetName
INPUT "Enter Street direction: "; NameType.StreetDirection
.
.
NameType.KillFlag = 1
NameType.Filler = "AaBbCcDdEeFf... and so on for 54 characters"
{ *** See note below regarding "KillFlag" and "Filler" *** }
{ Now that the user has entered some info and the "KillFlag" and }
{ "Filler" data have been specified, you're ready to put it into the }
{ file as a record and write it to disk. }
PUT #FileNum%, RecordNum%, NameType { Puts info in file as a record. }
{ Use either of the 2 lines below. }
CLOSE #FileNum% { Close the file opened as FileNum% }
CLOSE { Closes any/all open files }
{ ------------------------------------------------------- }
*** NOTE ***
Notice I added 2 items to your list. The first is KillFlag. I use this in
all my Random access files in case I want to delete that record at some point
later. I set the KillFlag to 1 when the record is first created then if I
want to remove that record, set it to 2 and use a routine to remove the
record if KillFlag for that record number is <> 1 Note also that when a
record is removed/deleted using this method it's lost and gone forever. I
use a "DO/ LOOP" and "IF/ENDIF" routine to delete individual records from
Random access files.
Also the Filler is a string of text that can be anything you want. It makes
each record exactly 128 bytes long which is supposed to increase the speed or
something. I usually put in a copyright notice or something in the Filler
field. This will also provide some space in the record in case you want to go
in later and revise your code to add more fields.
I used "TypeName" and "NameType" as examples only. You can call 'em anything
you want. I try to be as descriptive as possible with these names as it
saves some additional commenting and makes the code more understandable when
you go back to it a year or so later (or the next Monday morning).
This may not be the *only* way to do this but it's what I use and it works.
YMMV (Your Mileage May Vary).
This is off the top of my head but should be close.
Now you may REALLY be confused.
Hope it helps...
Jim...
--- GEcho 1.00/beta+
* Origin: RiverBend | Home of GolfLog | HST DS 16800 | (1:19/99)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #12544
Date: 03-17-93 15:49 (Public)
From: ROBERT CHURCH
To: ALL
Subject: DOS Date and Time stamps
────────────────────────────────────────────────────────────────────────────────
Thanks to all of you for reading my question, but I've found my own solution.
<Grin> This turned out to be one of those things that's easier in assembly
and PowerBASIC 3.0's inline asm made it even easier. Here's my solition. I'm
also sending all of my DOS file routines for PB:
'QBS=YES!!!
'Start of .BI file
TYPE DTAType
Stff AS STRING * 21
Attr AS BYTE
FTime AS WORD
FDate AS WORD
Size AS DWORD
FileN AS STRING * 13
END TYPE
DECLARE SUB SetDTA(DTA AS DTAType)
DECLARE SUB PrintDTA (D AS DTAType)
DECLARE SUB CvtDOSDate (BYVAL DosDate AS WORD, Month AS WORD, Day AS WORD,_
Year AS WORD)
DECLARE SUB DPrint (BYVAL PrintMe AS STRING, BYVAL CRLF AS WORD)
DECLARE FUNCTION FindFirst? (FileN AS STRING, DTA AS DTAType, Attr AS WORD)
DECLARE FUNCTION FindNext? (DTA AS DTAType)
'Start of .BAS FILE
'Configure the compiler here.
$COM 0
$COMPILE UNIT "FILE.PBU"
$CPU 8086
$DEBUG UNIT OFF
$DIM ALL
$STATIC
$ERROR ALL OFF
$EVENT OFF
$FLOAT PROCEDURE
$LIB COM OFF, LPT OFF, GRAPH OFF, FULLFLOAT OFF, IPRINT OFF
$OPTIMIZE SIZE
$OPTION CNTLBREAK OFF, GOSUB OFF
$SOUND 0
$STACK &H600
$INCLUDE "FILE.BI"
DECLARE SUB SetDTA(DTA AS DTAType)
DECLARE SUB CvtDOSDate (BYVAL DosDate AS WORD, Month AS WORD, Day AS WORD,_
Year AS WORD)
DECLARE FUNCTION FindFirst? (FileN AS STRING, DTA AS DTAType, Attr AS WORD)
DECLARE FUNCTION FindNext? (DTA AS DTAType)
DEFWRD A-Z
SUB DPrint (BYVAL PrintMe AS STRING, BYVAL CRLF AS WORD) STATIC PUBLIC
'Add a CR if CRLF is true
IF ISTRUE(CRLF) THEN PrintMe = PrintMe + CHR$(13) + CHR$(10)
PrintMe = PrintMe + "$" 'append a $ for DOS
REG 1, &H0900
REG 4, StrPtr(PrintMe)
REG 8, StrSeg(PrintMe)
CALL INTERRUPT &H21
END SUB
FUNCTION FindFirst? (Spec AS STRING, DTA AS DTAType, Attr AS WORD) STATIC_
PUBLIC
DIM Flags AS BYTE
DTA.FileN = ""
REG 4, VARPTR (DTA) 'Set the new DTA
REG 8, VARSEG (DTA)
REG 1, &H1A00
CALL INTERRUPT &H21
Spec = Spec + CHR$(0) 'DOS wants a NULL
REG 1, &H4E00 'FindFirst
REG 3, Attr 'set the attribute
REG 4, StrPtr(Spec)
REG 8, StrSeg(Spec)
CALL INTERRUPT &H21
Flags = REG(0) AND 1 'Return NOT carry flag
IF Flags THEN FindFirst?? = 0 ELSE FindFirst?? = 1
END FUNCTION
' More next page!
--- FMail 0.90
* Origin: -= Floating Point =- Hillsboro, Oregon (1:105/330.3)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #12545
Date: 03-17-93 15:51 (Public)
From: ROBERT CHURCH
To: ALL
Subject: DOS Date and Time Stamps
────────────────────────────────────────────────────────────────────────────────
FUNCTION FindNext? (DTA AS DTAType) STATIC PUBLIC
DIM Flags AS BYTE
DTA.FileN = ""
REG 4, VARPTR (DTA) 'Set the new DTA
REG 8, VARSEG (DTA)
REG 1, &H1A00
CALL INTERRUPT &H21
REG 1, &H4F00 'FindNext
CALL INTERRUPT &H21
Flags = REG(0) AND 1 'Get the carry flag, NOT it and return
IF Flags THEN FindNext?? = 0 ELSE FindNext?? = 1
END FUNCTION
SUB CvtDOSDate (BYVAL DosDate AS WORD, Month AS WORD, Day AS WORD,
_Year AS WORD) STATIC PUBLIC
ASM Mov ax, DosDate ; process month
ASM Push ax
ASM Mov cl, 5 ; shift right 5 bits
ASM Shr ax, cl
ASM And ax, &H0F ; and the result with 16
ASM Cbw
ASM Les bx, Month ; get Month's address in ES:BX
ASM Mov es:[bx], ax ; move the month into Month
ASM ; Start on Day
ASM Pop ax ; get a new copy of DosDate
ASM Push ax ; save it for Year
ASM And ax, &H1F ; and it with 32
ASM Cbw
ASM Les bx, Day ; get Day's address in ES:BX
ASM Mov es:[bx], ax ; move the day into Day
ASM ; Year
ASM Pop ax ; get a new copy of DosDate
ASM Mov cl, 9 ; shift right 9 bits
ASM Shr ax, cl
ASM And ax, &H1F ; and it with 32
ASM Add ax, 80 ; add 80, Gates thought it would be smart
ASM ; to save this as years since 1980
ASM Cbw
ASM Les bx, Year ; get Year's address in ES:BX
ASM Mov es:[bx], ax ; move the year into Year
END SUB
SUB SetDTA(DTA AS DTAType) STATIC PUBLIC
'INT 21 - DOS 1+ - SET DISK TRANSFER AREA ADDRESS
' AH = 1Ah
' DS:DX -> Disk Transfer Area (DTA)
i = REG(8)
REG 1, &H1A00
REG 8, VARSEG (DTA)
REG 4, VARPTR (DTA)
CALL INTERRUPT &H21
REG 8, i
END SUB
FUNCTION GetDTA??? STATIC
'INT 21 - DOS 2+ - GET DISK TRANSFER AREA ADDRESS
' AH = 2Fh
'Return: ES:BX -> current DTA
asm mov ah, &H2F
asm int &H21
GetDTA??? = REG(9) + (65536 * REG(2)) + 1
END FUNCTION
>-= Rob =-<
--- FMail 0.90
* Origin: -= Floating Point =- Hillsboro, Oregon (1:105/330.3)
════════════════════════════════════════════════════════════════════════════════
Area: Net Mail
Msg: #13782
Date: 03-18-93 19:47 (Private)
From: JEFF FREEMAN
To: LEE MADAJCZYK
Subject: @1:124/7006
────────────────────────────────────────────────────────────────────────────────
Subj: Top Twenty
> Do you think you could repost your "Top Twenty Posters"
> list? I missed it (My host went to a new version of RA
No sweat!
---
The votes are in for "Person least likely to have a life" and these are
the results:
("Sort /R /+50" the list of persons, chopped out everything but this)
### --Name-- From Posts
1 Jones Zack 1:387/641 352
2 Jackson Quinn Tyler 1:153/918 211
3 Yiu Victor 1:106/30 166
4 Coates Dik 1:229/110 153
5 Butler Mark 1:105/319.32 113
6 McKee Rob 1:125/411 108
7 Gallas John 1:282/7 107
8 Henshaw Coridon 1:250/820 106
9 Pearson Casey 1:159/100 95
10 French Calvin 1:134/75 95
11 Pedley Rick 1:249/140 86
12 Harris Mark 1:121/8 71
13 Roberts Matt 1:325/602 69
14 Tracy Chris 1:2615/4 68
15 Montgomery Earl 1:124/4210 63
16 Madajczyk Lee 1:280/5 54
17 Mayo Walt 1:3627/101 52
18 Martin Hugh 1:128/13 51
19 Church Robert 1:105/330.3 50
20 Ford Eric B. 1:3632/1.6 49
Hasta
---
* Origin: WarWorld's point away from home... (1:124/7006.1)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13227
Date: 03-14-93 18:15 (Public)
From: CORIDON HENSHAW
To: ALL
Subject: New PostIt! like encoder
────────────────────────────────────────────────────────────────────────────────
Here's a little project that I've been working on.... A PostIt! replacemnt.
It generates files SMALLER than PostIt!, if you remove PostIt!'s compression.
--- --- --- Cut Here --- --- ---
'>>> Start of page 1.
DECLARE FUNCTION StripName$ (InFile$)
DECLARE SUB ChangeAttrs (X%, Y%, Attr%, Length%)
DECLARE SUB DrawBox (Row1%, Col1%, Row2%, Col2%, ShadowBack%,_
ShadowFore%, WindowBack%, WindowFore%, BoarderBack%, BoarderFore%,_
Shadow%, Boarder%)
DECLARE SUB DecodeFile (InFile$)
DECLARE SUB DecodeShiftTable (ShiftTable AS STRING, NumBlocks AS LONG)
DECLARE FUNCTION GetBlock% (InH%, Char() AS STRING * 1)
DECLARE FUNCTION EncodeBlock$ (Block() AS STRING * 1, Block%)
DECLARE SUB EncodeFile (InFile$, OutFile$)
'$STATIC
DIM SHARED GlobalUpShift(1 TO 16384) AS INTEGER
'$DYNAMIC
CONST Header = "=====BEGIN BT7 SCRIPT====="
CONST Footer = "=====END BT7 SCRIPT====="
COLOR 11
CLS
PRINT "(D)ecode or (E)ncode: ( )";
DO
IKey$ = UCASE$(INKEY$)
LOOP UNTIL IKey$ = "D" OR IKey$ = "E"
LOCATE , POS(0) - 2
PRINT IKey$
LINE INPUT "Input file: ", InFile$
IF DIR$(InFile$) = "" THEN
PRINT "File not found."
END
END IF
IF IKey$ = "D" THEN
DecodeFile InFile$
ELSE
LINE INPUT "Output file: ", OutFile$
IF DIR$(OutFile$) <> "" THEN
PRINT "File already exists."
END
END IF
EncodeFile InFile$, OutFile$
END IF
REM $STATIC
DEFINT A-Z
SUB ChangeAttrs (X, Y, Attr, Length)
DIM Offset AS LONG
DIM Count AS LONG
DEF SEG = &HB800
Offset = (X * 160) + Y
FOR Count = 1 TO Length
POKE Offset, Attr
Offset = Offset + 2
NEXT
END SUB
SUB DecodeFile (InFile$)
DIM Char(1 TO 6) AS STRING * 1
DIM InBuffer AS STRING
DIM ShiftTable AS STRING
DIM ScriptBuffer(1 TO 1801) AS STRING
DrawBox 2, 2, 22, 78, 0, 7, 7, 14, 7, 14, 2, 1
COLOR 0, 7
LOCATE 3, 3
PRINT "Files Decoding";
LOCATE 4, 3
PRINT "│ Input File: │ Line:";
LOCATE 5, 3
PRINT "│ └ Size: │ Block:";
LOCATE 6, 3
PRINT "│ Output File: │ Byte:";
LOCATE 7, 3
PRINT "└ └ Size: └ Percent:";
LOCATE 9, 3
PRINT "Reading header";
LOCATE 11, 3
PRINT "Reading shifttable";
LOCATE 13, 3
PRINT "Reading data";
LOCATE 14, 3
PRINT "└ Line:";
LOCATE 16, 3
PRINT "Decoding shifttable";
LOCATE 17, 3
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13228
Date: 03-14-93 18:16 (Public)
From: CORIDON HENSHAW
To: ALL
Subject: New PostIt! like encoder
────────────────────────────────────────────────────────────────────────────────
IF Upshift AND 2 ^ (Y - 1) THEN
Char(Y) = CHR$(ASC(Char(Y)) - 34)
END IF
IF HighBit AND 2 ^ (Y - 1) THEN
Char(Y) = CHR$(ASC(Char(Y)) + 2 ^ 7)
END IF
PUT #OutH, , Char(Y)
Ch& = Ch& + 1
IF Ch& = FileSize& THEN EXIT DO
LOCATE 4, 48
PRINT Lines;
LOCATE 5, 48
PRINT BlockCount&
LOCATE 6, 48
PRINT Ch&;
LOCATE 7, 48
PRINT INT(Ch& / FileSize& * 100)
NEXT
NEXT
Block$ = ""
HighBit = 0
Upshift = 0
LOOP UNTIL ExitFlag = 1
LOCATE 4, 48
PRINT Lines;
LOCATE 5, 48
PRINT BlockCount&
LOCATE 6, 48
PRINT Ch&;
LOCATE 7, 48
PRINT INT(Ch& / FileSize& * 100)
LOCATE 7, 13
PRINT LOF(OutH);
CLOSE #InH, #OutH
END SUB
SUB DecodeShiftTable (ShiftTable AS STRING, NumBlocks AS LONG)
DIM X AS LONG
ERASE GlobalUpShift
Y = 1
FOR X = 1 TO 16384
ShiftByte = ASC(MID$(ShiftTable, Y, 1)) - 34 + 1
IF ShiftByte AND 2 ^ Bit THEN
GlobalUpShift(X) = 1
END IF
Bit = Bit + 1
IF Bit = 1 THEN Bit = 2
IF Bit = 5 THEN Bit = 6
IF Bit = 7 THEN
Bit = 0
Y = Y + 1
IF Y >= NumBlocks THEN EXIT FOR
END IF
LOCATE 17, 13
PRINT X;
LOCATE 18, 13
PRINT Y;
LOCATE 19, 13
PRINT INT(Y / NumBlocks * 100);
NEXT
LOCATE 17, 13
PRINT X;
LOCATE 18, 13
PRINT Y;
LOCATE 19, 13
PRINT INT(Y / NumBlocks * 100);
END SUB
SUB DrawBox (Row1, Col1, Row2, Col2, ShadowBack, ShadowFore,_
WindowBack, WindowFore, BoarderBack, BoarderFore, Shadow, Boarder)
SELECT CASE Boarder
CASE 1
HorizLine$ = "─" '196
VertLine$ = "│" '179
LTCorner$ = "┌" '218
LBCorner$ = "└" '192
RTCorner$ = "┐" '191
RBCorner$ = "┘" '217
CASE 2
HorizLine$ = "═" '205
VertLine$ = "║" '186
LTCorner$ = "╔" '201
LBCorner$ = "╚" '200
RTCorner$ = "╗" '187
RBCorner$ = "╝" '188
CASE 3
HorizLine$ = "-"
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13229
Date: 03-14-93 18:17 (Public)
From: CORIDON HENSHAW
To: ALL
Subject: New PostIt! like encoder
────────────────────────────────────────────────────────────────────────────────
END FUNCTION
SUB EncodeFile (InFile$, OutFile$)
DIM Char(1 TO 6) AS STRING * 1
DIM OutBuffer AS STRING
DIM ScriptBuffer(1 TO 1801) AS STRING
DIM ShiftBuffer(1 TO 39) AS STRING
DrawBox 2, 2, 22, 78, 0, 7, 7, 14, 7, 14, 1, 1
COLOR 0, 7
LOCATE 4, 3
PRINT "File status Writing header";
LOCATE 5, 3
PRINT "│ Input File:";
LOCATE 6, 3
PRINT "│ └ Size: Writing shifttable";
LOCATE 7, 3
PRINT "│ Output File: └ Line:";
LOCATE 8, 3
PRINT "└ └ Size:"
LOCATE 9, 3
PRINT " Writing script"
LOCATE 10, 3
PRINT "Encoding └ Line:";
LOCATE 11, 3
PRINT "│ Line:";
LOCATE 12, 3
PRINT "│ Block:";
LOCATE 13, 3
PRINT "│ Byte:";
LOCATE 14, 3
PRINT "└ Percent:"
LOCATE 16, 3
PRINT "Creating shifttable";
LOCATE 17, 3
PRINT "│ Line:";
LOCATE 18, 3
PRINT "│ Block:";
LOCATE 19, 3
PRINT "│ Byte:";
LOCATE 20, 3
PRINT "└ Percent:";
InH = FREEFILE
OPEN InFile$ FOR BINARY AS #InH
OutH = FREEFILE
OPEN OutFile$ FOR OUTPUT AS #OutH
FOR X = 3 TO 7
ChangeAttrs X, 3, &H7E, 15
NEXT
COLOR 14, 7
LOCATE 5, 18
PRINT StripName$(InFile$);
LOCATE 6, 13
PRINT LOF(InH)
LOCATE 7, 18
PRINT StripName$(OutFile$);
LOCATE 8, 12
PRINT LOF(OutH)
FOR X = 8 TO 13
ChangeAttrs X, 3, &H7E, 15
NEXT
X = 0
DO
X = X + 1
Vx = Vx + 1
BytesLeft = GetBlock(InH, Char())
OutBuffer = OutBuffer + EncodeBlock(Char(), X)
IF Vx = 9 THEN
Lines = Lines + 1
ScriptBuffer(Lines) = OutBuffer
OutBuffer = ""
Vx = 0
END IF
FLoc = LOC(InH)
LOCATE 11, 13
PRINT Lines;
LOCATE 12, 13
PRINT X;
LOCATE 13, 13
PRINT FLoc;
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13230
Date: 03-14-93 18:18 (Public)
From: CORIDON HENSHAW
To: ALL
Subject: New PostIt! like encoder
────────────────────────────────────────────────────────────────────────────────
CLOSE #OutH, InH
END SUB
FUNCTION GetBlock (InH, Char() AS STRING * 1)
BytesLeft = LOF(InH) - LOC(InH)
FOR X = 1 TO 6
Char(X) = ""
NEXT
IF BytesLeft >= 6 THEN
FOR X = 1 TO 6
GET #InH, , Char(X)
NEXT
ELSE
FOR X = 1 TO BytesLeft
GET #InH, , Char(X)
NEXT
BytesLeft = LOF(InH) - LOC(InH)
IF BytesLeft <= 6 AND BytesLeft >= 1 THEN
FOR X = BytesLeft TO 6
Char(X) = CHR$(0)
NEXT
END IF
END IF
GetBlock = BytesLeft
END FUNCTION
FUNCTION StripName$ (InFile$)
FOR Y = LEN(InFile$) TO 1 STEP -1
IF MID$(InFile$, Y, 1) = "\" THEN
StripName$ = UCASE$(MID$(InFile$, Y + 1))
Flag = 1
EXIT FOR
END IF
NEXT
IF Flag <> 1 THEN
StripName$ = UCASE$(InFile$)
END IF
END FUNCTION
--- --- --- Cut Here --- --- ---
The next version will have more advanced features, and error-checking. It'll
be hatched through PDNBASIC because of it's size.
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13237
Date: 03-17-93 12:45 (Public)
From: CORIDON HENSHAW
To: VICTOR YIU
Subject: Looking for crc32 code
────────────────────────────────────────────────────────────────────────────────
Hello Victor!
Saturday March 13 1993, Victor Yiu writes to Coridon Henshaw:
CH>> ===BEGIN: CRC32.UUE===
CH>> begin 644 CRC32.OBJ
VY> Either I don't have a UUE code decoder or don't know how to extract the
VY> file.
Remember that encoder/decoder that I posted a few days ago? Here's a script
for it. The script is a UUdecoder, a simple one, mind you, but it works.
=====BEGIN BT7 SCRIPT=====
UUD20.COM,705,23
!!!!!!911%i%~*b!aia~n1-
h*!Sgh$CrAOqnf!Aq`lAQd!Gpthqdr!?ACNRAU!Pdqrhnm!?A1-/An!PqAghfg!Adq-.+#!W
.+Hmot!BsAo`sg!A.ehkd9!?AHmots!@AehkdA!`dqqnq-!?.+Ntso!BtsAehk!CdAdqqn!A
q-.+Dm!KcAmnsA!aentmc-!?.+O`cc!BhmfAsq!Gtmb`sd!?cAkhmd!A.+MnA`!Rbshnm.!_
+#o%!!!x!!!!!!!~=!!>o%,e{++?s0,c3A+9Cu6Az9Cu%)$1+jw3/L.!B;#r-9AT$"3*LB5j
7"KLB"(1~o%v>9BS5"84!:#;#!3?LB5b,V8'!2(PZ3>LB$,ow$n#9o8I%:yv&9#29"jG7!>b
<)&LBr+U$h.""%5."gg"gC1(!>`%,<3Hadts,<9?fhtm,<9?mAtg+99ACsz+9C,!tz+9Cs7?
z+?s$)$3js9`%2(OH).3;L*'Br$h>")t"'">2%,sg]!g5!:cq@:AA8#9#'++_+;,+O*BQc:"
O`Qg+C.1)+a++O>3*BQcOh=!Qg+C)+:#a+*B+L:1Qc+C)$:#')"$!-3\@$$vCj0'6g6!,<4K
dmt&+;1Gcs$gv!9cg@!3KL*'B*=+",)25#">@$;c,^8'!2(P?r*,z2@GH+Lt+O$OPgy!g@1'
!XW;_t!@%/Aj);+T.s<;+s!T:)}@!x=2OtY+Lt-?&Og|!W%P;+trj:7#EL*5#"5c,=+"=@4*
$B1c++;`?s6+A+"o?s0C@$:g$?$?:$;d!urs%}%2?1cH:@$!u9,^,};7$x2*G/5&Ar),z9=*
!"89!g$<^!wBxB;#,/)",H$<s@92%F#;')"!!,C|?'"3?L)&Br)9[")d85!j)*(%7+"B9o;D
%,q8!o-4,?%"3>6JLBq.,?BYt'g5!h#;>~,gB9=&H"84!O%Yg+!Wh-2e~9o"814g!:#!3?3L
LBBAAA&y
=====END BT7 SCRIPT=====
Don't remove the "=====BEGIN"... or "=====END"... lines. This encoder saved
600 bytes over PostIt 5.1.
--- GEcho 1.00
* Origin: TCS Concordia - Mail Only - Toronto, Ontario (1:250/820)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #13362
Date: 03-18-93 08:32 (Public)
From: DOUGLAS LUSHER
To: EARL MONTGOMERY
Subject: INTERRUPT HELP
────────────────────────────────────────────────────────────────────────────────
EM>MSGID: 1:124/6108.0 2ba53248
EM>Just when I thought I was getting the hang of interrupts I run
EM>across a new one that is giving me fits. It is Get the current
EM>Directory (&H21 function 47H).
Earl: here's the implementation of that I use. Be sure to load QB with
the /L switch.
DIM SHARED XRegister AS RegTypeX
'you need the Xtra registers for this one
CurDrive$ = "C:"
PRINT DefaultDirectory$(CurDrive$)
END
'*******************************************
FUNCTION DefaultDirectory$ (Drive$)
DefaultDirectory$ = ""
XRegister.AX = &H4700
XRegister.DX = 0
IF LEN(Drive$) THEN XRegister.DX = (ASC(Drive$) OR 32) - 96
'if a drive string is passed, convert it to lower case by ASC() OR 32
'and then subtract 96 to get the zero-based system DOS uses
Temp$ = SPACE$(64)
'set up a buffer to hold the output of the interrupt
XRegister.DS = VARSEG(Temp$)
XRegister.SI = SADD(Temp$)
'these registers must point to the buffer, the segment goes into DS
'and the offset into SI
CALL InterruptX(&H21, XRegister, XRegister)
IF (XRegister.Flags AND 1) = 0 THEN
'if the carry flag is clear, then no errors encountered
DefaultDirectory$ = LEFT$(Temp$, INSTR(Temp$, CHR$(0)) - 1)
'the info you want is now in the buffer you provided and it has a
'null byte - CHR$(0) - at the end of it. So find that null in the
'buffer using INSTR and subtract 1 to get the number of characters
'in the buffer that you want to keep. Then grab those characters
'using LEFT$()
END IF
END FUNCTION
Hope this helps!
---
■ SLMR 2.1a ■ Objectivity is in the eye of the beholder.
--- TMail v1.30.4
* Origin: TC-AMS MLTBBS 2.2 - Minnetonka, MN (612)-938-4799 (1:282/7)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #3313
Date: 03-18-93 14:31 (Public)
From: DICK DENNISON
To: ROBERT CHURCH
Subject: DOS Date and Time stamps
────────────────────────────────────────────────────────────────────────────────
RC> How do you convert the bit-mapped DOS date and time stamps in the DTA
RC> QB useable variables? I'd like to convert them to INTEGERs for:
FUNCTION fixdate$ (parm%)
'Date and time are in packed format - these are the breakouts
'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-9
0
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
'Does that help - It's not an integer, but a string.
--- VP [DOS] V4.09e
* Origin: The MailMan (914)374-3903 NY Quick Share Pt #7 *HST (1:272/34)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #3464
Date: 03-16-93 21:14 (Public)
From: RICHARD DALE
To: JEFF FREEMAN
Subject: ANSI0001.BAS 1/5
────────────────────────────────────────────────────────────────────────────────
JF>It is my understanding that something in the public domain cannot be
JF> copyrighted.
Heh heh. I'm glad I'm not a copyright lawyer! This has surely
caused numerous headaches. There are tons of words we use on a regular
basis that are really copyrights -- xerox, kleenex, and so on. Of
course those are copyrighted trademarks, but constant usage has turned
them into ersatz "public domain". The company still owns the rights,
but people use the names generically.
Coke is in a similar situation. There is a material -- "coke" --
which is used in making metal (steel, I believe), or something like
that. I'm relatively sure it existed long before the great Coca-Cola
Company trademarked "Coke". Although you're unlikely to confuse the two
-- indeed, drinking coke instead of Coke could be fatal -- it's the only
example I can think of right now where a "public domain" word is a
copyrighted trademark. Or is it? Heh heh heh!
Oh yeah. . . To keep on topic, this is pretty neat.
DECLARE SUB DrawPicture ()
SCREEN 9 'adjust for your system type
LINE (0, 0)-(639, 349), 11, BF
x1 = 0
x2 = 1020
y1 = 0
y2 = 764
xPos% = 10
yPos% = 10
i% = 1
DO
' define viewport
VIEW (xPos%, yPos%)-(xPos% + 200, yPos% + 155), 0, 15
' define logical coordinates
WINDOW SCREEN (x1, y1)-(x2 / i%, y2 / i%)
DrawPicture
i% = i% + 1
xPos% = xPos% + 210
IF i% = 4 THEN xPos% = 10: yPos% = 175
LOOP UNTIL i% = 7
END
DATA 68, 4, 200, 76, 52, 12, 112, 44, 128, 52, 172, 76, 128, 52
DATA 68, 84, 112, 44, 84, 60, 128, 68, 100, 84, 68, 36, 96, 52
DATA 128, 68, 154, 84, 128, 68, 128, 116, 130, 54, 130, 68, 68
DATA 4, 52, 12, 172, 76, 142, 90, 142, 76, 142, 108, 142, 108
DATA 200, 76, 200, 76, 200, 92, 200, 92, 68, 164, 128, 116, 84
DATA 140, 52, 12, 52, 154, 52, 154, 68, 164, 68, 164, 68, 100
DATA 68, 36, 68, 84, 84, 45, 84, 76, 84, 109, 84, 140, 68, 100
DATA 96, 116, 84, 124, 112, 108, 68, 84, 128, 116, 85, 75, 113
DATA 91, 112, 77, 112, 108, 84, 119, 92, 115, 142, 86, 150, 82
DATA 180, 66, 186, 62, 186, 62, 236, 90, 236, 90, 68, 184, 68
DATA 184, 16, 154, 16, 154, 52, 133, 16, 154, 16, 160, 16, 160
DATA 68, 190, 68, 190, 68, 184, 68, 190, 236, 96, 236, 96, 236
DATA 90
SUB DrawPicture STATIC
RESTORE
FOR i% = 1 TO 40 ' read coordinates
READ x1%, y1%, x2%, y2%
LINE (x1%, y1%)-(x2%, y2%), 1
NEXT
PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
PAINT (120, 80), 1, 1: PAINT (152, 110), 14, 1
PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
PAINT (92, 128), 2, 1: PAINT (36, 150), 12, 1
PAINT (150, 125), 12, 1: PAINT (80, 120), 14, 1
PAINT (150, 125), 12, 1: PAINT (150, 142), 14, 1
PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
PAINT (100, 120), 2, 1: PAINT (165, 90), 2, 1
END SUB
=-=-=-=-=-=-=-=-= END OF CODE =-=-=-=-=-=-=-=-=
Day 56: America Held Hostage
* DeLuxe2 1.26b #2989 * "We just screwed all these people." Hillary Clinton
--- FidoPCB v1.4 beta
* Origin: Sound Advice - 24 Nodes (816)436-4516 (1:280/333)
════════════════════════════════════════════════════════════════════════════════
Area: QuickBasic
Msg: #4717
Date: 03-20-93 03:07 (Public)
From: STEVE GARTRELL
To: ALL
Subject: Hey, rotate text, anyone?
────────────────────────────────────────────────────────────────────────────────
DEFINT A-Z
DECLARE SUB RotateArray (SourceArray%(), TargetArray%(), Angle%)
'Must have the appropriate QB.QLB/QBX.QLB/VBDOS.QLB loaded
' if in the environment-link with appropriate library....
DECLARE SUB ABSOLUTE (Var%, BYVAL HowFar%, address AS INTEGER)
CONST C$ = "Recreated 03/14/93 by Steve Gartrell"
CONST NumBytes = 21
'$STATIC
DIM SHARED RORproc%(1 TO (NumBytes / 2))
'$DYNAMIC
DIM SHARED BitsPP%, Planes%, MaskBits%, MathNotDone%
DIM SHARED yResult&(1 TO 3), xResult%(1 TO 3), VertOrient%
DIM TheScreens%(1 TO 9)
offset% = VARPTR(RORproc%(1))
FOR byte% = 0 TO NumBytes - 1
READ opcode%
POKE (offset% + byte%), opcode%
NEXT byte%
TheScreens%(1) = 1
TheScreens%(2) = 2
TheScreens%(3) = 7
TheScreens%(4) = 8
TheScreens%(5) = 9
TheScreens%(6) = 11
TheScreens%(7) = 12
TheScreens%(8) = 13
ScrCnt% = 8
VertOrient% = 0
DO
SCREEN TheScreens%(ScrCnt%)
MaskBits% = 128
SELECT CASE TheScreens%(ScrCnt%)
CASE 1
MaskBits% = 192
BitsPP% = 2: Planes% = 1
ColorMod% = 3
CASE 2, 11
BitsPP% = 1: Planes% = 1
ColorMod% = 2
IF TheScreens%(ScrCnt%) = 11 THEN WIDTH , 60
CASE 7, 8, 9, 12
BitsPP% = 1: Planes% = 4
ColorMod% = 16
SELECT CASE TheScreens%(ScrCnt%)
CASE 9
WIDTH , 43
CASE 12
WIDTH , 60
END SELECT
CASE 13
MaskBits% = 255
BitsPP% = 8: Planes% = 1
ColorMod% = 256
END SELECT
StartX% = 152: StartY% = 56: EndX% = 175: EndY% = 79
'StartX% = 64: StartY% = 0: EndX% = 263: EndY% = 199
NumCols% = (EndX% - StartX%) + 1: NumRows% = (EndY% - StartY%) + 1
ArrayBytes& = 4 + INT(((NumCols% * BitsPP%) + 7) / 8) * Planes% * NumRows%
REDIM SourceArray%(0 TO ArrayBytes& \ 2)
REDIM TargetArray%(0 TO 20)
FOR TheLine% = 1 TO 25
LOCATE TheLine%, 1
FOR cnt% = 1 TO 40
SELECT CASE TheScreens%(ScrCnt%)
CASE 1, 2, 11
CASE ELSE
thecolor% = thecolor% + 1
IF thecolor% > 15 THEN thecolor% = 1
COLOR thecolor%
END SELECT
'PRINT CHR$(cnt% MOD 3 + 60);
PRINT CHR$(cnt% MOD 10 + 48);
NEXT
NEXT
LOCATE 8, 20: PRINT "123";
LOCATE 9, 20: PRINT "456";
LOCATE 10, 20: PRINT "789";
GET (StartX%, StartY%)-(EndX%, EndY%), SourceArray%(0)
MathNotDone% = -1
Angle% = 0
DO
DO: t$ = UCASE$(INKEY$): LOOP UNTIL LEN(t$)
SELECT CASE t$
CASE "Q" 'QUIT!!!!!
SCREEN 0: WIDTH 80, 25: COLOR 7, 0: END
CASE "N" 'CHANGE SCREEN MODE!!!
ScrCnt% = ScrCnt% + 1
IF ScrCnt% = 9 THEN ScrCnt% = 1
EXIT DO
CASE "V" 'Toggle vertical orientation
VertOrient% = NOT VertOrient%
END SELECT
Angle% = (Angle% + 90) MOD 360
RotateArray SourceArray%(), TargetArray%(), Angle%
PUT (StartX%, StartY%), TargetArray%(0), PSET
LOCATE 25, 1: PRINT USING "###"; Angle%;
PRINT CHR$(248); " ";
LOOP
LOOP
RotRight:
DATA &H55 : 'push bp
DATA &H8B,&HEC : 'mov bp, sp
DATA &H51 : 'push cx
DATA &H8B,&H4E,&H06 : 'mov cx, [bp + 6]
DATA &H8B,&H5E,&H08 : 'mov bx, [bp + 8]
DATA &H8B,&H07 : 'mov ax, [bx]
DATA &HD2,&HC8 : 'ror al, cl
DATA &H89,&H07 : 'mov [bx], ax
DATA &H59 : 'pop cx
DATA &H5D : 'pop bp
DATA &HCA,&H04,&H00 : 'retf 4
SUB RotateArray (SourceArray%(), TargetArray%(), Angle%)
DIM SourcePix%(1 TO 4)
DIM SourceBitsPP%, SourceBytesPerRow&, SourceRowOffset&
DIM SourceX%, SourceY%, BytePosCopy&, SourceBytePos&
DIM SourceRightMove%, SourceBitMask%, SourceToTargetDiff%
DIM TargetBitsPP%, TargetBytesPerRow&, TargetRowOffset&
DIM TargetRightMove%, TargetBytePos&, TargetX%, TargetY%
DIM WhichBits%, NumCols%, NumRows%
SELECT CASE BitsPP%
CASE 1
WhichBits% = 7
CASE 2
WhichBits% = 3
CASE 8
WhichBits% = 0
END SELECT
SourceBitsPP% = SourceArray%(0)
NumCols% = SourceBitsPP% \ BitsPP%
NumRows% = SourceArray%(1)
IF Angle% MOD 180 THEN
'Make it square if it's not!!!
SELECT CASE NumRows% - NumCols%
CASE IS < 0
NumCols% = NumRows%
CASE IS > 0
NumRows% = NumCols%
END SELECT
END IF
TargetBitsPP% = NumCols% * BitsPP%
IF TargetBitsPP% AND 7 THEN
TargetBytesPerRow& = (TargetBitsPP% \ 8 + 1) * Planes%
ELSE
TargetBytesPerRow& = (TargetBitsPP% \ 8) * Planes%
END IF
IF MathNotDone% THEN
REDIM TargetArray%(0 TO ((TargetBytesPerRow& * NumRows%) \ 2) + 2)
TargetArray%(0) = TargetBitsPP%
TargetArray%(1) = NumRows%
REDIM yResult&(0 TO NumRows% - 1)
yResult&(0) = 4
FOR TargetY% = 1 TO NumRows% - 1
yResult&(TargetY%) = yResult&(TargetY% - 1) + TargetBytesPerRow&
NEXT
REDIM xResult%(0 TO NumCols% - 1)
FOR TargetX% = 0 TO NumCols% - 1
xResult%(TargetX%) = (TargetX% * BitsPP%) \ 8
NEXT
ELSE
REDIM TargetArray%(0 TO ((TargetBytesPerRow& * NumRows%) \ 2) + 2)
TargetArray%(0) = TargetBitsPP%
TargetArray%(1) = NumRows%
END IF
TargetBytesPerPlane% = TargetBytesPerRow& \ Planes%
IF SourceBitsPP% MOD 8 THEN
SourceBytesPerPlane% = (SourceBitsPP% \ 8 + 1)
ELSE
SourceBytesPerPlane% = (SourceBitsPP% \ 8)
END IF
SourceBytesPerRow& = SourceBytesPerPlane% * Planes%
SourceRowOffset& = 4
SourceBytePos& = SourceRowOffset&
SourceRightMove% = 0
SourceBitMask% = MaskBits%
'adj for zero base
NumRows% = NumRows% - 1
NumCols% = NumCols% - 1
RotRight% = VARPTR(RORproc%(1))
FOR SourceY% = 0 TO NumRows%
FOR SourceX% = 0 TO NumCols%
SELECT CASE Angle%
CASE 90
TargetX% = SourceY%
TargetY% = NumCols% - SourceX%
CASE 180
TargetX% = NumCols% - SourceX%
TargetY% = NumRows% - SourceY%
CASE 270
TargetX% = NumRows% - SourceY%
TargetY% = SourceX%
CASE ELSE
TargetX% = SourceX%
TargetY% = SourceY%
END SELECT
IF VertOrient% THEN
SELECT CASE Angle%
CASE 90
TempX% = TargetX%
TargetX% = (TempX% AND &H7FF8) + (7 - (TargetY% AND 7))
TargetY% = (TargetY% AND &H7FF8) + (7 - (TempX% AND 7))
TargetY% = (TargetY% AND &H7FF8) + (7 - (TargetY% AND 7))
CASE 180
TargetX% = (TargetX% AND &H7FF8) + (7 - (TargetX% AND 7))
TargetY% = (TargetY% AND &H7FF8) + (7 - (TargetY% AND 7))
CASE 270
TempX% = TargetX%
TargetX% = (TempX% AND &H7FF8) + (7 - (TargetY% AND 7))
TargetY% = (TargetY% AND &H7FF8) + (7 - (TempX% AND 7))
TargetX% = (TargetX% AND &H7FF8) + (7 - (TargetX% AND 7))
CASE ELSE
TargetX% = SourceX%
TargetY% = SourceY%
END SELECT
END IF
TargetBytePos& = yResult&(TargetY%) + xResult%(TargetX%)
TargetRightMove% = TargetX% AND WhichBits%
IF BitsPP% = 2 THEN
TargetRightMove% = TargetRightMove% + TargetRightMove%
END IF
SourceToTargetDiff% = (TargetRightMove% - SourceRightMove% + 8) AND 7
BytePosCopy& = SourceBytePos&
DEF SEG = VARSEG(SourceArray%(0))
FOR PlaneNum% = 1 TO Planes%
SourcePix%(PlaneNum%) = (PEEK(BytePosCopy&) AND SourceBitMask%)
BytePosCopy& = BytePosCopy& + SourceBytesPerPlane%
NEXT
IF SourceToTargetDiff% THEN
DEF SEG
FOR PlaneNum% = 1 TO Planes%
CALL ABSOLUTE(SourcePix%(PlaneNum%), BYVAL SourceToTargetDiff%, RotRight%)
NEXT
END IF
DEF SEG = VARSEG(TargetArray%(0))
FOR PlaneNum% = 1 TO Planes%
POKE TargetBytePos&, PEEK(TargetBytePos&) OR SourcePix%(PlaneNum%)
TargetBytePos& = TargetBytePos& + TargetBytesPerPlane%
NEXT
DEF SEG
SourceRightMove% = (SourceRightMove% + BitsPP%) AND 7
IF SourceBitMask% AND 1 THEN
SourceBitMask% = MaskBits%
SourceBytePos& = SourceBytePos& + 1
ELSE
CALL ABSOLUTE(SourceBitMask%, BYVAL BitsPP%, VARPTR(RORproc%(1)))
END IF
NEXT
SourceRowOffset& = SourceRowOffset& + SourceBytesPerRow&
SourceBytePos& = SourceRowOffset&
SourceBitMask% = MaskBits%
SourceRightMove% = 0
NEXT
END SUB
--- D'Bridge 1.30/071082
* Origin: RadioLink! Columbus, OH (614)766-2162 HST/DS (1:226/140)