Z-100 GW BASIC (BASICA) Author: Lloyd W. Tull 5380 Challedon Drive Virginia Beach, Va. 23462 Date: 28 May 1985 A comparision of Z-100 GW BASIC (BASICA) Version 2 and the IBM BASICA was performed to determine the differences in the two MICROSOFT BASICA languages. The differences in the various statements/functions was determined by comparing the alphabetic listing for the GW BASIC Reference Guide against the IBM PC BASICA Reference Guide. When compared with the version of IBM BASICA that I used, the Z-100 BASICA contained several Statements/Functions that the IBM BASICA did not contain. Some of the added statements allows access to the operating system. These additional statements/functions include: CHDIR, ENVIRON, ENVIRON$, ERDEV, ERDEV$, IOCTL, IOCTL$, MKDIR, ON PLAY, ON TIMER, PMAP, RMDIR, SHELL, TIMER, VIEW, VIEW PRINT, and WINDOW. The statements that are different in some way will be covered in alphabetic order. * COLOR Statement The IBM BASICA COLOR statement has two formats, one for the text mode and one for the graphics mode. The IBM COLOR (text) statement is used to set the colors for the foreground, background, and border screen. It's format is: COLOR[foreground] [,[background] [,border]] The foreground is a numeric expression in the range of 0 to 31, representing the character color. The background is a numeric expression in the range 0 to 7 for the background color. The border is a numeric expression in the range 0 to 15. It is the color for the border screen. Colors conversion for foreground: 0 Black 8 Gray 1 Blue 9 Light Blue 2 Green 10 Light Green 3 Cyan 11 Light Cyan 4 Red 12 Light Red 5 Magenta 13 Light Magenta 6 Brown 14 Yellow 7 White 15 High Intensity White You can think of colors 8 to 15 as "light" or high-intensity values of colors 0 to 7. Characters are made to blink by setting the foreground equal to 16 plus the number of the desired color. That is, a value of 16 to 31 causes blinking characters. The IBM COLOR Statement (Graphics) has the following format: COLOR[background] [,[palette] The background is a numeric expression specifying the background color. The colors allowed for background are 0 through 15, as described above in the Text mode. The palette is a numeric expression which selects the palette of colors. The colors selected when you choose each palette are as follows: Color Palette 0 Palette 1 1 Green Cyan 2 Red Magenta 3 Brown White If palette is an even number, palette 0 is selected. Palette 1 is selected when palette is an odd number. The SCREEN statement is used to select whether the COLOR statement is being used in the Text or the Graphics mode. The Z-100 BASICA COLOR statement is used to set the colors for the foreground and background areas of the screen. Its format is: COLOR [foreground] [,[background]] The foreground is a numeric expression in the range of 0 through 7, representing the color of the character. The background is a numeric expression in the range of 0 through 7 that specifies the background color. The following colors are allowed: 0 Black 1 Blue 2 Green 3 Cyan 4 Red 5 Magenta 6 Yellow 7 White * INKEY$ Function/Variable The INKEY$ Function/Variable is basically the same in both the IBM and Z-100 BASICAs. The main difference is the control characters that are trapped and their function. The IBM BASICA traps the following: Ctrl-Break, which stops the program. Ctrl-Num Lock, which sends the system into a pause state. Alt-Ctrl-Del, which does a System Reset. PrtSc, which prints the screen. The Z-100 BASICA traps the following: CTRL-C, which terminates the program CTRL-S, which suspends program execution. ALT-CTRL-DEL (Z-100/Z-100PC), SHIFT-RESET (Z-100) which performs a system reset. CTRL-P, which print the current contents of the screen on the printer. Keys for which trapping is enabled. * KEY Statement The KEY statement is similar for both BASICA's. The IBM format is: KEY n,x$ The n is the function key number in the range of 1 to 10. The X$ is a string expression which will be assigned to the key. The Z-100 format is: KEY keynum,string The keynum is the number of the function key. It must be in the range of 1-12, or the trappable key, in the range of 17-22. The string is a string expression up to 15 characters long that will be assigned to the function key. Initially, the IBM assigns the soft keys as follows: F1 LIST F2 RUN< F3 LOAD" F4 SAVE" F5 CONT< F6 ,"LPT1:" F7 TRON< F8 TROFF< F9 KEY F10 SCREEN 0,0,0 The < indicates Enter/Return Initially, the Z-100 assigns the soft keys as follows: F1 LIST F7 AUTO F2 RUN< F8 FOR F3 LOAD" F9 NEXT F4 SAVE" F10 GOSUB F5 CONT< F11 TRON< F6 PRINT F12 TROFF< The KEY ON statement if both BASICAs causes the soft key values to be displayed on the 25th line. The KEY OFF statement in both BASICAs erases the soft key values from the 25th line. The KEY LIST causes the soft key values to be displayed on the screen. The IBM lists the ten soft keys where the Z-100 lists all twelve soft key values on the screen. * KEY (n) Statement The KEY (n) Statement, which is used to enable/disable trapping of the specified key in a BASIC program, is basically the same for both the IBM and the Z-100 except for the number of trappable keys. The (n) on the IBM is a numeric expression in the range of 1 to 14, and indicates the key to be trapped: 1-10 function keys F1 to F10 11 Cursor Up 12 Cursor Left 13 Cursor Right 14 Cursor Down The (n) on the Z-100 is a numeric expression in the range 1-22 that designates the keys to be captured as follows: 1-12 function keys F1 through F12 13 up-arrow key 14 left-arrow key 15 right-arrow key 16 down-arrow key 17-22 keys defined by the form: KEY n,CHR$(ASCII code) The KEY (n) ON enables trapping of the specified key. When you specify KEY n OFF, no trapping takes place, and even if the key is pressed, the event is not remembered. Once a KEY (n) STOP statement has been executed, no trapping will take place. However, if you press the specified key, the event will be remembered so that an immediate trap takes place when KEY n ON is executed. * LINE Statement The LINE Statement is used to draw a line or box on the screen. It is available only in Graphics mode in the IBM BASICA. The IBM BASICA format is: LINE [(x1,y1)] -(x2,y2) [,[color] [,B[F]]] The Z-100 statement format is: LINE [(x1,y1)] -(x2,y2) [, [color] [,B[F]]] [,style] The (x1,y1) are the coordinates of the starting point of the line. The (x2,y2) are the coordinates of the ending point of the line. In the IBM BASICA, the color is the color number in the range of 0 to 3. In the Z-100 BASICA, the color is the color number in a range of 0-7. The B draws a rectangle with the points (x1,y1) and (x2,y2) as opposite corners. The BF (filled box) fills the interior points of the box with the selected color. The style parameter in the Z-100 BASICA is a 16-bit integer mask used to put points on a screen. * LIST Command The LIST Command is very similar in both BASICAs. The IBM format is: LIST [line1] [-[line2]] [,filespec] The Z-100 format is: LIST [linenum1] [-[linenum2]] [,filespec |,dev] The [line1/linenum1] is the number of the first line to be listed. The [line2/linenum2] is the number of the last line to be listed. The filespec is a string expression containing a device and filename to which the program lines will be listed. In the Z-100 BASICA, the dev is the name of an output device to which the program lines will be listed. * LOCATE Statement The LOCATE Statement in the IBM BASICA has the following format: LOCATE [row] [,[col] [, [cursor] [, [start] [,stop] ]]] The row is a numeric expression in the range of 1 to 25 which indicates the screen line number where you want to place the cursor. The col is a numeric expression in the range 1 to 40 or 1 to 80 which indicates the screen column number where you want to place the cursor. The cursor is a value indicating whether the cursor is visible or not. A 0 (zero) indicates off, 1 (one) indicates on. The start is the cursor starting scan line. It must be a numeric expression in the range of 0 to 31. The stop is the cursor stop scan line. It also must be a numeric expression in the range of 0 to 31. In IBM BASICA, the cursor, start, and stop do not apply to the graphics mode. The LOCATE Statement in Z-100 BASICA has the following format: LOCATE [row] [,[col] [,cursor]] The row is the number of the line on the screen where you want to place the cursor and the values must be in the range 1-25. The col is the number of the column on the screen where you want to place the cursor and the values must be in the range of 1-80. The cursor indicates whether the cursor is visible or not. A 0 (zero) indicates cursor off, a 1 (one) indicates cursor on. * LPOS(n) Function The LPOS(n) Function is basically the same in both the IBM and Z-100 BASICAs. Its format is: LPOS(n) The n is a numeric expression that indicates the printer being tested. The Z-100 BASICA uses 0 or 1 to test LPT1. The IBM BASICA uses the following: 0 or 1 LPT1: 2 LPT2: 3 LPT3: * ON COM(n) Statement The ON COM(n) Statement has the same format for both BASICAs as follows: ON COM(n) GOSUB line The n is the number of the communications adapter. The Z-100 BASICA allows a valid value of 1. The IBM BASICA allows either 1 or 2 depending on the communications adapter. The line is the number of the first line of the trap routine. * ON KEY(n) Statement The ON KEY(n) Statement is used to set up an event trap line number for BASIC to use when the specified key has been pressed and both BASICAs have the format: ON KEY(n) GOSUB line The IBM BASICA n is a numeric expression in the range of 1 to 14 indicating the key to be trapped as follows: 1-10 function keys F1 to F10 11 Cursor Up 12 Cursor Left 13 Cursor Right 14 Cursor Down The Z-100 BASICA n is the number in the range 1-22 that indicates the key to be trapped as follows: 1-12 function keys F1 through F12 13 up-arrow key 14 left-arrow key 15 right-arrow key 16 down-arrow key 17-22 keys defined in the form: KEY n,CHR$(ASCII code) * OPEN COM... Statement The OPEN "COM... Statement is used to allocate a buffer for a communication file for RS-232 asynchronous communications with other computers and peripherals. The IBM BASICA format is: OPEN "COMn:[speed] [,parity] [,data] [,stop] [,RS] [,CS[n]] [,DS[n]] [,CD[n]] [,LF]" AS [#]filenum [LEN=number] The Z-100 BASICA format is: OPEN "COM1:[speed] [[,parity] [,data] [,[stop]]]] [,LF] [,ASC]" [#]filenum [LEN=numbytes] In the IBM BASICA, n is 1 or 2 indicating the number of the Asynchronous Communications Adapter. The speed parameter is an integer constant that specifies the baud rate for transmitting and receiving. The parity parameter is a one-character constant that specifies the parity for transmitting and receiving. The IBM BASICA allows the following: S Space: Parity bit always transmitted and received as a space (0 bit). O ODD: Odd transmit parity, odd receive parity checking. M MARK: Parity bit always transmitted and received as a mark (1 bit). E EVEN: Even transmit parity, even receive parity checking. N NONE: No transmit parity, no receive parity checking. The default is EVEN (E). The Z-100 BASICA parity values are as follows: O ODD:Odd parity transmitted; odd parity checking during receiving. E EVEN: Even parity transmitted; even parity checking during receiving. N NONE: No parity transmitted; no parity checking during receiving. The data parameter is an integer constant indicating the number of transmit/receive data bits. The IBM BASICA allows valid value of: 4, 5, 6, 7, or 8. The default is 7. The Z-100 BASICA has valid values of 5, 6, 7, or 8. The stop parameter is an integer constant indicating the number of stop bits, either 1 or 2. The filenum is an integer expression which evaluates to a valid file number. The number/numbytes is the maximum number of bytes that can be read from the communications buffer with a GET. The RS, CS, DS, CD, and LF options affect the line signals as follows: RS suppresses RTS (Request To Send). CS(n) Controls CTS (Clear To Send). DS(n) controls DSR (Data Set Ready). CD(n) controls CD (Carrier Detect). LF sends a line feed following each carriage return. * PAINT Statement The PAINT Statement is basically the same for both BASICAs. The IBM BASICA format is: PAINT (x,y) [,paint[,boundary]] The Z-100 BASICA format is: PAINT (x,y) [,[color] [,border] The (x,y) parameters are the coordinates of a point within an area to be filled in. The IBM BASICA paint parameter is the color to be painted with, in the range of 0 to 3. The Z-100 BASICA color parameter can be a numeric or string expression. If color is a numeric expression then that is the color to be painted with and must be in the range of 0-7. If color is a string expression, PAINT executes tiling; a process similar to line styling. The IBM BASICA boundary parameter is the color of the edges of the figure to be filled in, in the range of 0 to 3. The Z-100 BASICA border parameter is the color of the boundary of the figure to be filled in and must be in the range of 0-7. The Z-100 background parameter is a one-byte string expression used in paint tiling. * SCREEN Statement The IBM BASICA SCREEN Statement sets the screen attributes to be used by subsequent statements. Its format is: SCREEN [mode] [,[burst] [,[apage] [,[vpage]]] The IBM BASICA mode is a numeric expression resulting in an integer value of 0, 1, or 2. Valid modes are: 0 Text mode at current width. 1 Medium resolution graphics mode (320x200). Used with Color/Graphics Adapter only. 2 High resolution graphics mode (640x200). Used with Color/Graphics Monitor Adapter only. The burst is a numeric expression resulting in a true or false value used to enable color. In text mode (mode=0), a false (zero) value disables color and a true (non-zero) value enables color. In medium resolution graphics mode (mode=1), a true (non-zero) value will disable color, and a false (zero) will enable color. The apage (active page) is an integer expression in the range 0 to 7 for width 40 or 0 to 3 for width 80. It selects the page to be written to by output statements to the screen, and is valid in text mode (mode=0) only. The vpage (visual page) selects which page is to be displayed on the screen, in the same way as apage above. The visual page may be different that the active page. Vpage is valid in text mode only. The Z-100 BASICA SCREEN Statement format is: SCREEN [graphics,] [reverse video] The graphics parameter is a numeric expression with the value of zero or one. Valid values are: 0 Clears H-19 graphics mode. 1 Sets H-19 graphics mode. The reverse video parameter is a numeric expression with the value of zero or one. Reverse video prints black characters on a white foreground. Valid values are: 0 Clears H-19 reverse video. 1 Sets H-19 reverse video. * WIDTH Statement The WIDTH Statement has the same format for both BASICAs but the IBM version allows more valid devices. The format is: WIDTH ["device", | filenum,] size The size is a numeric expression in the range of 0-255 that sets the new width. The filenum is a numeric expression in the range of 1 to 15. It is the number of a file opened to one of the valid devices. The IBM BASICA device is a string expression for the device identifed and the valid devices are: SCRN:, LPT1:, LPT2:, LPT3:, COM1:, or COM2:. The Z-100 BASICA device is a string expression that identifies the device to be affected. Valid devices are: LPT1: line printer 1 COM1: RS-232 communications 1 Since the Z-100 BASICA is designed for use on both the Z-100 and Z-100PC, it includes a few commands, functions, or statements that are not available on the Z-100. Thes functions/statements include: ON PEN, ON PLAY(n), ON STRIG (n), PEN Function, PEN Statement, PLAY Statement, PLAY (n) Function, SOUND Statement, STICK Function, STRIG Function, and STRIG (n) Statement. End