--------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00004 Date: 03/17/98 From: KURT KUZBA Time: 08:02am \/To: DAVID ROTHSCHILD (Read 2 times) Subj: Individual bits DR> How do can I read the individual bits that are inside a byte? Just use division to get the bit you want as the first bit. FUNCTION Bitvalue%(Num%, Bit%) FOR T% = 0 TO Bit%: Num% = Num% \ 2: NEXT Bitvalue% = Num% AND 1 END FUNCTION One important note is that this will change the value of the integer you sent to the FUNCTION unless you specify that it be passed as a value rather than a reference, by enclosing that value in parentheses when passing it. Bit5% = Bitvalue((number%), 5) A somewhat faster method involves a precalculated table of values to AND with. DIM SHARED BITS(14) AS INTEGER BITS(0) = 1: BITS(1) = 2: BITS(2) = 4: BITS(3) = 8: BITS(4) = 16 BITS(5) = 32: BITS(6) = 64: BITS(7) = 128: BITS(8) = 256 BITS(9) = 512: BITS(10) = 1024: BITS(11) = 2048: BITS(12) = 4096 BITS(13) = 8192: BITS(14) = 16767 FUNCTION BitVal% (Num%, Bit%) IF Bit% = 15 THEN BitVal% = -(Num% < 0) ELSE BitVal% = -((Num% AND BITS(Bit%)) > 0) END IF END FUNCTION > ] You're trying to make me paranoid, but I'm on to your tricks --- * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00005 Date: 03/17/98 From: KURT KUZBA Time: 08:02am \/To: JOHN ZORTMAN (Read 2 times) Subj: Reading UNDER mouse... JZ> I'd like to have just a simple little SUB, that when JZ> called, just returns the ASCII code of the character JZ> currently under the mouse pointer in an integer variable JZ> I could work with. This would only need work in good ol' JZ> standard SCREEN 0... All you need to know is the screen location. Given that, you can use either direct screen memory PEEK()s or the SCREEN() function to get the value under the mouse pointer. This example will work in QB or QBasic. Since the mouse uses reverse order for X and Y from LOCATE and SCREEN(), I made the mouse SUBs switch them for programmer convenience. '_|_|_| MOUSECHAR.BAS PUBLIC DOMAIN Kurt Kuzba 3/17/1998 '_|_|_| Reads character under mouse in QBasic or Quick Basic. '_|_|_| Requires loading Quick Basic with /L switch. '_|_|_| No warrantee or Guarantee given or implied. DECLARE SUB MouseStatus () DECLARE SUB SetPointer () DECLARE SUB MousePointer (P$) DECLARE FUNCTION MouseInit% () TYPE Mousedata: S AS LONG: I AS INTEGER: X AS INTEGER Y AS INTEGER: B AS INTEGER: END TYPE DIM SHARED M AS Mousedata, Wide AS INTEGER, High AS INTEGER WIDTH 80, 25: High = 8: Wide = 8: IF MouseInit THEN SYSTEM COLOR 7, 1: CLS : MousePointer "on": LOCATE 8, 10 PRINT "Press Left Button to read character under mouse pointer." LOCATE 10, 10: PRINT "Press Right Button to END" LOCATE 14, 20: PRINT "Your pointer is on" LOCATE 12, 20: PRINT "Row Col" M.X = 14: M.Y = 36: SetPointer DO: MouseStatus IF (M.X = 12) THEN IF (M.Y > 23) AND (M.Y < 28) THEN MousePointer "off" END IF: LOCATE 12, 24: PRINT M.X; IF (M.X = 12) THEN IF (M.Y > 23) AND (M.Y < 28) THEN MousePointer "on" END IF IF (M.X = 12) THEN IF (M.Y > 31) AND (M.Y < 36) THEN MousePointer "off" END IF: LOCATE 12, 32: PRINT M.Y; IF (M.X = 12) THEN IF (M.Y > 31) AND (M.Y < 36) THEN MousePointer "on" END IF IF M.B = 1 THEN IF (M.X = 14) THEN IF M.Y = 40 THEN MousePointer "off" LOCATE 14, 40: PRINT CHR$(SCREEN(M.X, M.Y)) IF (M.X = 14) THEN IF M.Y = 40 THEN MousePointer "on" END IF: LOOP UNTIL M.B = 2: SYSTEM FUNCTION MouseInit% : DEF SEG = 0 M.S = 256& * PEEK(207) + PEEK(206) M.I = 256& * PEEK(205) + PEEK(204) + 2 ' see if a Mouse Driver is loaded DEF SEG = M.S: MouseInit = 0 IF (M.S OR (M.I - 2)) AND PEEK(M.I - 2) = 207 THEN SCREEN 0: LOCATE 12, 30: PRINT "Mouse Driver Not Found!" LOCATE 14, 28: PRINT " Load the Mouse and re-try" MouseInit% = -1 ELSE CALL absolute(0, 0, 0, 0, M.I) END IF: DEF SEG : END FUNCTION SUB MousePointer (P$) : DEF SEG = M.S SELECT CASE P$ CASE "on": CALL absolute(1, 0, 0, 0, M.I) CASE "off": CALL absolute(2, 0, 0, 0, M.I) END SELECT: DEF SEG : END SUB SUB MouseStatus ' Left Button = 1 Right Button = 2 Both buttons = 3 DEF SEG = M.S: CALL absolute(3, M.B, M.Y, M.X, M.I) M.Y = M.Y \ Wide + 1: M.X = M.X \ High + 1: DEF SEG : END SUB SUB SetPointer : DEF SEG = M.S ' in text mode Mickey reports 640 x 192 CALL absolute(4, 0, (M.Y - 1) * Wide, (M.X - 1) * High, M.I) DEF SEG : END SUB '_|_|_| end MOUSECHAR.BAS > ] Remain calm and think. I will help you. - Kwai Chang CPUfan. --- * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00006 Date: 03/17/98 From: KURT KUZBA Time: 08:02am \/To: PETER DALTON (Read 2 times) Subj: Making Libraries PD> I would like to know how to create the library and then PD> how to link it into another program please. After you compile your code, you will find the .OBJ for it on your drive. Just use your library utility to add it to an existing library or create a new one. example:: lib mylib, +myobj.obj Or you can just run lib without arguments and follow the prompts as you go. You can create a .QLB from you .LIBs for testing in the IDE, or just compile from the command line. > ] By tomorrow, this will all seem like a dream................ --- * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00007 Date: 03/17/98 From: BOB LOTSPEICH Time: 08:56am \/To: BILL WHITE (Read 2 times) Subj: Old Folks | Quoting from a message by Bill White | To Bob Lotspeich | About - Old Folks BW> I'll usually write the program in a rather simple BW> fashion, getting it working. They I begin to add bells BW> and whistles, a phase that sometimes never ends! Me, too! I like to write a simple working "wire-frame" model, as it is easier to keep one's thoughts straight, and once it does everything I want it to, then I add the color, graphics and other gee-whiz things. I guess the wire-frame model is my "flowchart" now. BW> But then again, I write code for pleasure. BW> Structure doesn't seem to fit my definition of fun! I feel the same way. I gave up long ago thinking I would write the great all-purpose program (GAPP) to end all programs. Once I got through that phase, programming became a lot more fun. I *do* try to write structured code to to maintain a little discipline in my life, but I've never let it overwhelm me. ... I have the world's best job -- I'm retired. --- Blue Wave/386 v2.30 * Origin: The Circle Circus * Dale City, VA * 703-730-3115 (1:265/124) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00008 Date: 03/17/98 From: BRUCE CORBETT Time: 07:59pm \/To: DAVID AUKERMAN (Read 2 times) Subj: Code FAQ organizer? Hi David Aukerman, hope you are having a nice day .+'~'+. | Qouted from a message from David Aukerman 13-Mar-98| To All `+._.+' | About Code FAQ organizer? DA> Hello All! It's me again, for those of you that know me from the DA> past year or so. And to those of you who are new to the echo, I'm DA> glad to see that we're not dying out as a group. Will QuickBasic ever die? DA> in time. If you don't know, I took over control of the Code FAQ DA> from Dave Shea when he left (gasp, has it been such a short time?) DA> last fall. And, as all things are bound to do, I've found that I So offering the code FAQ out is fine.... I'll take it over if ya want... any suggestions on what will be needed to have done to it? Please reply here or email (may take longer for a reply) (see below) .+'~'+. | Bruce Corbett (Hook@Cheerful.com) H O O K | Hk Software (www.members.tripod/~nzhook) `+._.+' | ruce's anter S (3:775/70) ((646) 756-6331 Np, Nz) --- * Origin: _.-~`~-._ ruce's anter S (3:775/70) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00009 Date: 03/16/98 From: SHAUN EWING Time: 10:21pm \/To: ALL (Read 2 times) Subj: Type for RemoteAccess 2.50 useron.bbs Thought you might be interested in the following types I would give you the whole program but for some reason IceEdit distorts the data although I could e-mail it to you (Mail me at shaunewing@usa.net for more info). TYPE useronrecord NameL AS STRING * 1 NName AS STRING * 35 handlel AS STRING * 1 handle AS STRING * 35 lline AS STRING * 1 Baud AS INTEGER cityl AS STRING * 1 city AS STRING * 25 status AS STRING * 1 attrib AS STRING * 1 statdescl AS STRING * 1 statdesc AS STRING * 10 freespace AS INTEGER nocalls AS INTEGER END TYPE Regards Shaun Ewing E-Mail: shaunewing@usa.net ... If Data is "fully functional can he get a woman pregnan\S --- FMail/Win32 1.22 * Origin: Immortal BBS (3:712/848.5) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00010 Date: 03/17/98 From: JOHN ZORTMAN Time: 01:33pm \/To: FRED STRAUSBAUGH (Read 2 times) Subj: QB.QLB+QBSER.QLB=BOTH.QLB KK> Get a copy of EasyDoor. The QB_EDR.LIB has all the serial, KK> ANSI, and low-level interrupt access routines you will need KK> for your project. I don't believe the author still supports KK> it, but you can send him a letter and find out. KK> If you have internet access, try http://www.filepile.com/ Hi Fred! This is an excerpt from a reply to a long ago posted message that just came in. Even though I have a workable way of doing things for now, I am *always* intensely interested in QuickBasic libraries that do with serial communications and low-level system interrupts I can take advantage of. I don't presently have ANY plans for writing my own machine level code type of FOSSIL handler, but there may very well come a time when I am, or most likely run across a situation where I'll need to at least dabble a bit to gain direct access to system resources around somebody elses software in a way that they can both get along with. (Windows) You know what I mean. Anyway, if you could peek around a bit and see about snagging this EasyDoor library thats floating around I'd *LOVE* to see what it has to offer. Even if all it does is give me a good idea for something I can do myself it'd be worth it. The more extensive my QuickBasic programming library gets the more power I have as a programmer, so to speak. I very well may WRITE my own "Door Frame" software down the road, as presently my programs DO most functions these ready made door frames offer to do, but I'm always learning.. :-) Thanks, John Zortman * SLMR 2.1a * When this message ends, you will awake feeling refreshed. --- Platinum Xpress/Wildcat! v1.3e * Origin: Seventh Star - York, PA (717)-225-7256 (1:2700/111) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00011 Date: 03/17/98 From: RICK PEDLEY Time: 12:07pm \/To: BOB LOTSPEICH (Read 2 times) Subj: Old Folks -=> Quoting Bob Lotspeich to Rick Pedley <=- BL> Like you, I find it much easier to BL> sit down and think the program out, then start typing it in. If I hit BL> a snag, I will briefly pseudo-code it out on paper sometimes, then go BL> back to working on the code itself. Flow charts were in vogue when programs had a beginning and an end: the program was run, it did something, it finished, more or less unattended. I don't know of too many programs like that anymore except for small utilities; instead they tend to be enormous closed loops with dozens of branches on the way around, each branch possibly a loop in itself. The sheer size of such a flow chart would minimize its usefulness as a simplified overview. And how do you represent event-driven Windows apps with flow charts? But whatever works for the individual, there's no hard and fast rule. Several studies have been done however, that showed flow charting made little or no difference in the quality of programs written by high school and college students. I can't quote you any sources unfortunately, it's been ten years or more since I left teaching. --- Blue Wave/DOS v2.20 * Origin: ...the vented spleen - kingston on (613) 544-9332 (1:249/139) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00012 Date: 03/17/98 From: RICK PEDLEY Time: 09:13am \/To: BILL WHITE (Read 2 times) Subj: Old Folks -=> Quoting Bill White to Rick Pedley <=- RP> IF Number% AND 1 THEN 'odd BW> And then there is BW> IF Number% MOD 2 THEN Yeah, I hadn't thought of that one (I wonder which is faster?). [later] AND, by more than 3x :) --- Blue Wave/DOS v2.20 * Origin: ...the vented spleen - kingston on (613) 544-9332 (1:249/139) --------------- FIDO MESSAGE AREA==> TOPIC: 125 QUICK BASIC Ref: F3M00013 Date: 03/17/98 From: RICK PEDLEY Time: 12:09pm \/To: BUCKY CARR (Read 2 times) Subj: Old Folks -=> Quoting Bucky Carr to Bob Lotspeich <=- BC> On (15 Mar 98) Bob Lotspeich wrote to Rick Pedley... BL> If I hit tricky aspects in my code, I have been known to make some BL> simple REMs for future reference, but even that is not a hard and BL> fast rule in my programming. BC> Are you confessing to documenting your code? You can be banished from BC> this echo forever if anyone finds out you do that. I'll sometimes REM out lines of code that didn't work and leave them there so I won't make the same stupid mistake next time - does that count? :) --- Blue Wave/DOS v2.20 * Origin: ...the vented spleen - kingston on (613) 544-9332 (1:249/139)