Download TMQ Vol I.i - tim
Transcript
Volume 1.1 THE MISOSYS QUARTERLY - SUMMER 1986 fielding (i.e. XFIELD 1, VAR#, (32)VAR$, BIG!, LITTLE%). The "X" type allows for logical record lengths up to 32767! LDIR: POP HL:LD A,15:LD B,5:RST 40:RET HIGH-MODE: ENDCOM First, note the absence of line numbers. With EnhComp, they're not needed except when you need to reference a line (i.e. GOTO, GOSUB, etc.). You can also use labels in lieu of line numbers if you so choose. Second, note the assembler code intermixed with the "high-level" BASIC. Note in this assembler routine that it can access BASIC's variables and you can also put more than one assembler instruction on a physical line - just like in BASIC! The EnhComp "COMMAND" reserved word allows you to add to BASIC's reprtoire of statements - somewhat akin to FORTH's extensibility. Now for those BASIC types who just want to code in BASIC, how does this compiler's dialect differ from that you may be used to? To begin with, let me very clearly state that there is no intention that this compiler can directly compile any existing BASIC program designed for your BASIC interpreter. What the author of EnhComp has tried to do is to provide you a set of features that will mimic most of the features of your interpretive BASIC. In some cases, the mimicry has been perfect. Well, the only legitimate basis of comparison would be to use the BASIC interpreter as a benchmark. On the Model I and III environments, you compound the comparison because of the preponderance of different DOS vend ors and differences in the disk BASIC they provided. On the Model 4, there is only one - Microsoft's BASIC as provided with TRSDOS 6. So lets take a look at that one. EnhComp supports unlimited length variable names versus a maximum of 40 for MS. String variables, on the other hand, can be up to 32767 bytes in length with EnhComp. EnhComp does not support EQV or IMP, all other numeric and string operations are supported. For sequential files, EnhComp supports OPEN, PRINT#, PRINT# USING, WRITE#, INPUT#, LINE INPUT#, EOF, and CLOSE identically as Microsoft. We consider LOC to be superfluous for sequential files. For direct access "R" files, EnhComp supports fielding and access exactly like Microsoft. EnhComp also supports a special "X" type of direct access file which uses list-directed The Tower of Babel Volume 1.1 - 23 - For statements, EnhCoip does not support CALL, COMMON, ERASE, OPTION BASE, CHAIN, WHILE WEND, WAIT, DEFUSR, NAME, or SOUND. On the other hand, EnhComp supports BKOFF and BKON to disable/enable the BREAK key; DRAW with ROT and SCALE for turtle-like graphics; COMPLO, INVERT, PAINTO, PLOT, RESETO, and SET() for pixel graphics; COMMAND and ENDCOM to define extensions to BASIC statements, INC and DEC to increment and decrement integer variables; UP, DOWN, LEFT, and RIGHT to scroll the video screen in four directions; IF ELSE ENDIF conditional construct; FUNCTION and ENDFUNC for multi-line user functions; labeled statements for readability; INPUT@pos for better control of input prompts; the ability to SORT arrays with SCLEAR, KEY, TAG, and SORT; ON BREAK GOTO address for programmer control over BREAK key handling; POP to remove one level of GOSUB; POSFIL to reposition sequential files; a SYSTEM command which allows you to invoke ANY command; PZONE and SZONE to establish actual tab stops for printer and video output used with PRINTing; REPEAT and UNTIL for looping (similar to WHILE WEND); and finally WPEEK and WPOKE for easier memory access of 16-bit "words". Note also that EnhComp's PRINT# statement supports redirection to video, printer, or disk file by the value of the buffer number (-3 for printer, 0 for video, 1-n for file). EnhComp supports every Microsoft numeric function; however, we also support double precision arguments with DOUBLE PRECISION results. That includes ABS, ATM, COS, EXP, LOG, SIN, SQR, and TAN. The "EXISTS" function can be used to check if a particular file is available before you proceed to OPEN it. We don't support ERRS$, INPUT$, or SPACE$ (which can be derived from STRING$) but we do add BINs and WINKEY$ (which of course can be derived from INI(EY$). Note that EnhComp's USING is actually a function which returns a string value. This means that it can be used by itself without a PRINT statement, which adds the flexibility of continued processing of the formatted string by your program before printing (perhaps like the The Tower of Babel