'=========================================================================== ' Subject: QB Frequently Aske Questions Date: 12-15-02 ( : ) ' Author: Mike Stechcae Code: TEXT ' Origin: mstechcae@webcity.ca Packet: FAQ.ABC '=========================================================================== Advanced QBasic FAQ ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Q. Why do I get a "String Space Corrupt" message before my program is supposed to end? A. I think Microsoft claims that it is a bug in Qbasic 1.x. To prevent this from happening, declare every variable and try using fixed length strings. Q. What does DEFINT mean? A. DEF stands for Default, and INT stands for integer. After this statement gets processed, Qbasic assumes that your variables are all integers. Q. In some programs, I see that variables end with #, &, !, %, and $. Why? A. This is one way to force declaration. the # means the variable is a double, & means long, ! means single, % means integer, and $ means string. Q. How else can I declare variables? A. Use DIM followed by a variable (without a symbol) followed by the word AS and the data type. For example, DIM b AS STRING makes the variable b a string variable. This is the same as b$. Q. I have assembly code in my program and when the program runs, it locks up or windows gives me an error message about Qbasic. A. The assembly code used is incorrect. The end of the code must have the machine equivalent of RETF or RETF x where x is the number of characters to return. Q. How do I convert assembly code to machine code? A. Access DEBUG.EXE. (Sorry Windows XP users, but you need the real DOS)and type in "a". Type in assembly commands one per line. When you are done, press enter twice. Now type "u 100". The column to the left of the assembly codes is the actual machine code you copy. Read the column as if you were reading a book. Q. Why is assembly required in some programs? A. It makes some operations faster, It introduces and uses new operations, and the code generally runs faster. Also, the chances of getting errors are usually lower. Q. How do I put a blue dot in the top left corner of the screen without using any of the Qbasic drawing commands? A. First, find out the address of your video card. The address must allow pixel drawing. Usually it is A000:0000 or 000A0000 in windows. Convert it to xxxx:xxxx (which is A000:0000). The segment is the left side and the offset is the right side (of the colon). Use DEF SEG=&HA000. Now just type POKE 0, 1. This will make a dot with color 1 (blue) at position 0 in video memory (which is the top left). Q. What does &H before something do? A. &H lets Qbasic know it is hexadecimal. Qbasic automatically converts this to decimal. So if a = &H10, then a = 16. Q. What does DEF SEG do? A. Changes the working memory segment to whatever you specify. This is to be used heavily in assembly programming. Q. What is the difference between '$dynamic and '$static? A. '$dynamic makes the program use variables only when needed. This method frees memory when variables become unused. '$static makes variables always in use until the program ends.