HotBasic™ News Continued 2003
July 31 HotFiles 1.2 tests some file read/write functions. HotBasic is now on the "home stretch."
July 29 Media celebrities and leaders of government and business are starting to arrive for the 2-Month Birthday of HotBasic at the HotBasic Manor in the rolling hills of the Global Services Estate. Guests eagerly await an entertainment spectacle including the HotBasic Icon Wet T-Shirt show. One guest was heard saying, "It's amazing how well-developed she is at only two months of age."
Two new $APPTYPE's will be added: OBJ and DLL so a HotBasic program myprog.bas can be compiled directly to myprog.obj and myprog.dll respectively.
July 25 Added precedence for Operators, FILE, LIST and MEMORY. HotBasic accepts these keywords or the RapidQ equivalents listed above.
July 23 HotTest 1.4 is used to test various functions.
July 21 The new hotspeed.zip contains a new feature of HotBasic arrays -- namely, that the compiler "autodetects" zero-based arrays, on a per dimensioned array basis, so added speed is obtained with the arrays that are zero-based.
July 20 The RapidQ function LOG was renamed to LN so that LOG now is log base 10. Added BIN$ and HEX2DW which converts a hex string to a 4-byte non-floating value.
July 19 The little utility HotTypes 1.1 shows where HotBasic is at concerning various numerical types and functions. It also includes the Symbol Table printout.
July 18 Only 11 days to the two-month birthday of HotBasic! A party? Secret: In HotBasic, Declared SUBs can be called in the usual manner or GOSUB can be used to enter a Declared SUB at any line label in your SUB code. Soon, hottest.zip which shows results from user inputs, will be posted. During development, this program is used to see "if everything still works" re functions and numerical and string data types.
July 17 HotBasic was optimized to write executables that are about twice as fast. With this speed increase measured with the hotspeed procedure, HotBasic-compiled executables are now more than 3.5 times faster than VB6.0, 5 times faster than RealBasic and 60 times faster than RapidQ and are also much smaller.
One person has shown that a C-based version of the hotspeed procedure is with current information about twice as fast which is expected since HotBasic is not yet optimized. But it is not known if a one-pass compiler was used.
Revising a previous report, HotBasic will maintain 4 and 8 byte RAM storage for SINGLE and DOUBLE data types respectively, and add a new type REAL10 for 10 byte floating RAM storage.
July 16 Added COLOR, CRSLIN, POS or POS(0) and SCREEN.
SUB and FUNCTION sections were generalized to handle any number of user arguments. In RapidQ and HotBasic, it may not be necessary to pass any arguments at all, since user SUBs and FUNCTIONs have access to all dimensioned variables and arrays. DECLARE with LIB automatically loads the libraries and ALIAS is accepted, but not used or required.
The HotBasic compiler uses a linker utility so that only what you write in your source code is compiled (and linked) and then uses your RAM resources. These details are all handled automatically by the compiler and do not require any specific user actions. In sum, the HotBasic.lib is a true library of object modules and only those used in a particular program are linked. This also implies that other compatible libraries or object modules created with other languages could also be linked into HotBasic programs.
July 14 For speed, HotBasic does all string operations with assembler routines, although Windows does offer an impressive set of string APIs. So "optimization" refers to (1) general choices made at compile-time (not completed) and (2) use of the FPU and MemoryStream objects. When #1 is done, HotBasic should produce exe's that are as fast or faster than those from any language (except custom Assembler). Use of #2 in math procedures should put HotBasic far ahead of any competitor.
In HotBasic, all dimensioned arrays and strings are objects. Some implications: String functions could be used on arrays. Any string could be used as a StringList. Any array or string could be manipulated with MemoryStream properties and methods.
July 12 For fun, try out HotSpeed 1.4 which includes hotspeed.bas source and hotspeed.exe compiled with HotBasic (updated July 14 with a non-zero based array). If you also compile the source with RQ, you may find as I did that the HotBasic .exe is about 38 times faster. This speed factor will further increase as the code-generation processes of the compiler are further optimized for conventional expressions as used in hotspeed.bas. If anyone wants to try this code in another language and get a run-time for the same procedure, those results would be of interest. Please let me know, including a copy of the source in the other language and the run-time compared to hotspeed.exe, and whether (or how) attribution for your contribution should be done.
July 9 Just returned from a trip, but I did much work on HotBasic. Here's an update:
A growing list of assembler routines were repackaged into a HotBasic.lib file and problems with this new format were worked out (mainly global definitions of internal variables). In many cases, no arguments are passed in the conventional sense, since values are in CPU registers or at known locations. SELECT CASE was generalized so CASE statements can include comma-delimited lists and relational operators. Assembler routines to set up arrays and get and put values were written. Array setup includes a vector of products which should speed up item localization. Also, QMemoryStream statements can be applied to arrays for increased speed in reading/writing sequential array values. E.g., x=A(i,j,k) or A(i,j,k)=x leave the Position property of the array pointing to the next value. Hence, y=A.ReadNum(4) gets the next value without offset calculation used by A(i,j,k). Finally, miscellaneous bugs in previous work were noted and corrected.
June 27 Having almost finished the basic language HotBasic compiler, soon GUI objects can be added.
While we are at it, let's add new string functions COMMA, CRLF, NULL and SPACE. Using these functions would give the same benefits as using ONE, ZERO, etc described below. E.g., c$=NULL for c$="" or IF c$<>NULL THEN... or c$=a$+CRLF or PRINT c$+SPACE;. SPACE would be faster than SPACE$(1). The double quote null string would still work.
June 26 Functions added: ONE, ZERO, PI, LOG2E, LOG2TEN, LOGTWO and LNTWO. These are FPU formated constants for one, zero, pi, log base 2 of e, log base 2 of 10, log base 10 of 2 and natural log of 2 respectively. Usage: x=2*PI*r^2 or x=ONE/y or x=ONE/PI or x=ZERO. In almost all cases, using these functions would increase speed and reduce executable size. E.g., IF x>ZERO THEN ... No big deal. These functions use single-line FPU instructions. Thank the FPU designers.
There is no use of a software FPU library and associated overhead, since the HotBasic compiler already knows where the source and destination values are and in almost all cases, a single assembler instruction does the math operation. Thus, even an ordinary basic language statement like "i=a*cos(b)" is done rapidly, since at the point of compilation, much work is already done and assembler language calls to subroutines with or without arguments are not required.
June 25 BEEP, DATA, RESTORE and READ added. NEW... FPU object! Seeing what it takes at the assembler language level to implement user program interaction with the floating point unit (FPU), a FPU object will be added so HotBasic users can do calculations as efficiently as if you wrote your math routines in assembler yourself. E.g., FPU.load(i) would load varible i. FPU.CHS would change its sign, etc. That is, the FPU object would further optimize calculation-intensive code. Even in assembler, i=CHS(i) involves overhead to fetch the value, operate on it and then store it back to the RAM location for i. The FPU object will bring much greater efficiency (speed) in calculation to HotBasic users.
Such a FPU object could be used to replace a statement like "i=a*cos(b)" if an array of "b" values are processed while "a" remains the same. During this period, "a" would have to be loaded into the FPU just once. Another example: For recursive calculations where a result is an argument for a subsequent calculation, coding using the HotBasic FPU object could produce the theoretical maximum for optimization of compiled machine opcode sequences for the FPU hardware.
June 24 Buffer overflows? HotBasic will not allow that. Buffer size will just be increased. DLLs? Sure, you can write custom .dll's in HotBasic. More standard math functions than RapidQ? Yes, that's on the way. A new REAL10 data type will allow storage of the full 10 bytes of floating numbers, which is what the FPU unit uses. So you have full precision in these floating numbers.
June 23 Numerical functions (giving numbers as results) with string and/or number arguments are now done. Further, the operators are done:  ^ * / \ + - SHL SHR MOD INV AND OR XOR NOT. Soon, for fun, a source program and its compiled .exe will be posted here showing that HotBasic is almost ready for beta testers.
June 22 String functions are done, including more complicated cases like REPLACESUBSTR$. HotBasic calls will be somewhat faster since in many cases, the arguments are already in a known location and need not be added as stack arguments. This is one advantage of programming in assembler. No system string functions are used, again enhancing speed. Also done are functions as arguments in other functions and of course, concatenation.
June 17 In HotBasic, all dimensioned strings are equivalent to MemoryStreams. That is, strings can be manipulated in the ordinary fashion or MemoryStream properties and methods can be used. "Dim s$ As STRING" and "Dim s$ As MemoryStream" result in identical actions.
June 14 The list above is most of the keywords that have already been coded in the alpha version of HotBasic:
Unlike RQ Basic, the application icon automatically displays for compiled executables in system file listings and links. An important milestone will be for the compiler to compile itself.
June 6 The new HotBasic compiler now includes much of the basic infrastructure code and produces working .exe files from Basic code. Mostly complete are:
directives (including a new $SYMBOLTABLE which displays the user code symbols);
dimensioning including DIM, DEF... and TYPE structures as qualified types;
nested DO LOOP UNTIL, WHILE, and FOR NEXT loops;
nested IF ELSEIF ELSE and SELECT CASE code blocks;
most keywords representing dozens of statements and functions.
Detailed error messages show source file ($INCLUDE may be used), source code line, position in line and explanatory text.
Usage is simple: "hot test" compiles test.bas to test.exe and "test" runs it.
May 29, 2003 Work has begun on HotBasic, which is designed as an RQ-compatible true compiler from .bas to .exe. The present RapidQ compiler, rc.exe, produces "byte code" which is interpreted at run time. Therefore, RapidQ executables contain a language interpreter and are slower and require more system resources.
Both RapidQ Basic and HotBasic share advantages.
The program development software consists of stand-alone components which do not alter the system Registry or require information from it. Installation does not create CLSID's nor an entangled mess of classes and objects, which the user probably does not understand anyway. In contrast, the mere installation of some other programming software is a sort of "assault" on the system, much less the use of it.
This slim-trim-isolated profile may generally have favorable security implications as well. By the code written, the user knows exactly which system functions are invoked. This degree of isolation of software development from system services may give the user more control and may avoid inadvertant incorporation into user programs of bugs or vulnerabilities in system services.
On the other hand, user programs may interact with the Registry and create classes, types and objects in RapidQ Basic and HotBasic.
Copyright © 2003 James J Keene PhD
HotBasic™ is a trademark of James J Keene
Original Publication: May 29, 2003
Please use Back on your browser to return to HotBasic.