Ŀ
                                                                    
                                                                    
 AT&T PC6300 SUPPORT BBS - Bulletin Service                         
                                                                    
 SUBJECT:  GW-BASIC Notes for the PC6300                            
 PROVIDED BY:  AT&T PC-Hotline                                      
                                                                    
Ĵ
                                                                    
    DIFFERENCES BETWEEN IBM BASIC VERSION 1.1 AND GW-BASIC          
                                                                    
Ĵ
                                                                    
    1) IBM COMPATABILITY PACKAGE MODIFICATIONS                      
                                                                    
       1.1) RESERVED WORDS AND TOKENS                               
            The reserved words and tokens were incompatable,        
            making exchange of binary and protected program         
            files impossible. GW-Basic token values have been       
            modified by this modification package.                  
                                                                    
       1.2) LINE PRINTER AND KEYBOARD OPEN MODE                     
            IBM Basic allows these devices to be open without       
            a mode specification. GW-Basic would interpret          
            these cases as open for random and declare a mode       
            error.                                                  
                                                                    
       1.3) RS232 SUPPORT                                           
            The /C switch on the IBM Basic command line allows      
            the user to specify the sieze of communications         
            buffers. This feature has been added to all             
            versions of Basic.                                      
                                                                    
       1.4) CLEAR Processing                                        
            CLEAR should turn off music, reset music to             
            foreground, turn off PEN and STRIG, and reset DRAW      
            scale color. Similar processing should happen for       
            LOAD, RUN, CHAIN, CLEAR, and NEW. This processing       
            has been added for all GW-Basic versions.               
                                                                    
       1.5) BSAVE and BLOAD                                         
            IBM Basic appends the .BAS suffix to file names         
            when the user does not supply a suffix. GW-Basic        
            did not append a suffix.                                
                                                                    
       1.6) CENTER OF GRAPHICS SCREEN                               
            IBM Basic calculates the center by dividing the         
            one relative screen dimensions by two. GW-Basic         
            calculates the center by dividing the zero              
            relative screen dimensions by two. The IBM Basic        
            method of calculating the center of the screen is       
            now used by GW-Basic.                                   
                                                                    
       1.7) COMMON STATEMENT                                        
            IBM Basic allows the user to define new variables       
            using the COMMON statement. GW-Basic declared an        
            error if a COMMON statement referred to a               
            previously undefined variable.                          
                                                                    
       1.8) LIST STATEMENT                                          
            During PRINT and LIST processing, IBM Basic clears      
            characters from the end of the print item to the        
            end of line. All versions of BASIC now function in      
            this manner.                                            
                                                                    
       1.9) CURSOR DESIGN                                           
            A) The GW-Basic cursor is on only during character      
               input requests from the keyboard.                    
            B) The IBM Basic displays different cursors for         
               the Screen Editor overstrike mode and insert         
               mode.                                                
               The GW-Basic cursor is now turned off when           
               printing characters to the screen. The cursor is     
               turned to the user cursor when the PRINT             
               statement terminates. When input is requested,       
               the cursor is turned to the insert mode cursor       
               or the overwrite mode cursor, depending on the       
               Screen Editor mode.                                  
                                                                    
       1.10) INKEY$, INPUT$, INPUT                                  
             A) INKEY$ did not return the same key codes as         
                IBM Basic                                           
             B) INPUT$ did not return the same key codes as         
                IBM Basic. It should be noted that IBM Basic        
                key codes returned to INKEY$ are not the same       
                as IBM Basic keycodes returned to INPUT$ for        
                all keys.                                           
             C) Device input from "KYBD:" read no break (no         
                interrupt takes place) if using the INPUT           
                statement. An interrupt took place if               
                INPUT$(N,kybd:) IS SPECIFIED.                       
                GW-Basic now provides the OEM with filters for      
                mapping characters on input. These filters          
                provide the capability of returning IBM Basic       
                keycodes.                                           
                                                                    
       1.11) CHR$                                                   
             Certain IBM character codes in the range               
             [&H00,&H1f] have been assigned fonts and are           
             printable. Other codes in this range have been         
             assigned functions (such as carriage return).          
             GW-Basic now provides filters which allow OEM to       
             decide which codes in this range are printable         
             and which specify control functions.                   
                                                                    
       1.12) SCREEN function                                        
             SCREEN function requests for the character at the      
             current cursor position may return a zero in           
             place of &H20 (space) for IBM if there are no          
             non-space characters to the right of the               
             specified cursor position. GW-Basic can now            
             support this character code for the screen             
             function.                                              
                                                                    
       1.13) POKE/PEEK                                              
             Results of the POKE and PEEK statements were           
             different. The GW-Basic machine interface now          
             includes routines to filter PEEK and POKE              
             instructions. The OEM may now modify the PEEK or       
             POKE address and data value.  Certain GW-Basic         
             routines have been provided for use in these           
             filters. GW-Basic provides the capability to           
             support the function of all PEEK and POKE              
             locations specified by IBM user documentation.         
                                                                    
       1.14) INITIALIZATION DIFFERENCES                             
             A) HEADING: GW-Basic displays the heading when a       
                program is specified on the command line,           
                while IBM Basic does not print a heading or         
                display function keys in this case. The             
                GW-Basic machine interface now contains a           
                parameter that specifies to GW-Basic whether to     
                print the heading and function keys when a          
                program is specified on the command line.           
             B) FUNCTION KEY DISPLAY: GW-Basic did not give the     
                option of displaying the function keys when         
                BASIC initializes, when there is no program on      
                the command line. A configuration switch now        
                specifies the function key display switch           
                position on BASIC initialization.                   
                                                                    
       1.15) ERROR CODES                                            
             Some of the error codes and messages were              
             different. GW-Basic error codes and messages have      
             been modified to conform to IBM Basic.                 
                                                                    
                                                                    
       1.16) MUSIC AND SOUND                                        
             A) PLAY octave default not the same.                   
             B) BEEP duration not the same                          
             C) SOUND STATEMENT:                                    
                   1)SOUND freq,0 causes the IBM Basic to be        
                     flushed                                        
                   2)GW-Basic does not perform range checking on    
                     frequency.                                     
                   3)SOUND statement foreground mode was not        
                     interruptable by CTL-C or BREAK. This is a     
                     problem because it is possible to create       
                     extremely long notes.                          
             These conditions are considered bugs and have          
             been fixed for all versions. Foreground SOUND          
             interruptability is available through a GW-Basic       
             keyboard routine provided to the OEM for use           
             within the speaker control support.                    
                                                                    
       1.17) COLOR statement syntax                                 
             The IBM COLOR statement syntax was not                 
             supportable by the GW-Basic OEM interface. This        
             problem has been fixed in GW-Basic.                    
                                                                    
Ĵ
                                                                    
    2) DIFFERENCES WHICH WILL NOT BE RESOLVED                       
                                                                    
       2.1) SCREEN EDITOR DIFFERENCES                               
            (THESE DIFFERENCES MAY NOT EXIST IN SOME VERSIONS       
             OF GW-BASIC BECAUSE OF THE FLEXIBILITY OF THE OEM      
             INTERFACE FOR MAPPING AND OMITTING FEATURES)           
                                                                    
            A) Input sequences that wrap to a subsequent            
               physical line cause a scroll to open another         
               physical line. IBM Basic allows the user to          
               type over the text which is on the subsequent        
               line. The IBM Basic end of logical line is then      
               moved to the end of the logical line which is        
               being overwritten.                                   
            B) Skip-to-next-word function. When the cursor is       
               positioned on a space the IBM skip-to-next-word      
               control function will skip spaces until a word       
               is found, progress over the word and proceed to      
               the word following. The GW-Basic skip-to-next-       
               word control function will skip spaces until a       
               word is found.                                       
            C) TAB. In GW-Basic, after stopping at the last         
               position on a line, TAB will proceed to the          
               next line. IBM Basic TAB only operates on one        
               line.                                                
            D) Cursor movement control functions do not join        
               physical lines into logical lines. In IBM Basic      
               cursor movement can join lines.                      
            E) Line delete. The GW-Basic Screen Editor uses a       
               character other than ESC for line delete.            
            F) GW-Basic extends logical lines to new physical       
               lines (when required by LF or wrapping at the        
               end of the screen).  A new blank line is inserted    
               following the current line. When physical lines      
               following the first physical line in a logical       
               line are deleted, the line is removed from the       
               screen. In IBM Basic, lines are not inserted or      
               removed.                                             
            G) AUTO. The IBM AUTO statement allows the user to      
               modify the statement corresponding to the line       
               number printed by AUTO only. If the user uses        
               the Screen Editor to move to another line, or        
               otherwise attempts to modify the line number,        
               strange results are obtained. The GW-Basic AUTO      
               statement allows the user to modify any line by      
               making use of the Screen Editor to modify the        
               line number or to move to another line on the        
               screen.                                              
            H) Functions added to Screen Editor                     
              1) HELP. This control function allows the             
                    programmer to edit the last statement where     
                    an error ocurred, or if no error ocurred,       
                    the last direct statement.                      
              2) DELETE WORD. This control function deletes         
                    the current word starting at the current        
                    cursor position, and ending at the character    
                    previous to the next word                       
              3) CLEAR TO END OF SCREEN. This control               
                    function clears all data from the current       
                    cursor position to the end of the screen.       
                                                                    
       2.2) Breaking from INPUT                                     
            IBM Basic allows the user to break from an INPUT        
            statement using either Control-C or BREAK. GW-Basic     
            provides only one BREAK function code. This             
            function code may be assigned to either BREAK,          
            Control-C, or both by the OEM. However, no special      
            processing is performed to differentiate between        
            the INPUT statement and other statements.               
                                                                    
       2.3) Sequences returned by the GW-Basic RANDOM NUMBER        
            GENERATOR (RND function) will NOT be identical to       
            sequences returned by the IBM Basic random number       
            generator.                                              
                                                                    
       2.4) /F and /S Options                                       
            IBM Basic statically allocates file space using         
            the /F and /S BASIC command line switches. GW-Basic     
            allocates space dynamically and is not limited by       
            these switches. GW-Basic will not declare an error      
            if the user specifies either of these switches.         
                                                                    
       2.5) File Format of BASIC                                    
            IBM Basic is in ".COM" file format. GW-Basic is in      
            ".EXE" file format.                                     
                                                                    
       2.6) Fielded Strings                                         
            IBM Basic fielded strings retain their values           
            after the file is closed. In GW-Basic this space is     
            deallocated. Any field statement which is executed      
            while a file is opened, has no effect after that        
            file is closed. For example, assume file 1 is           
            opened, fielded, and closed. If file 1 is               
            reopened, it should be refielded.                       
                                                                    
       2.7) VARPTR                                                  
            In IBM Basic, the value returned by VARPTR for a        
            given file number is not subject to  change during      
            program execution. In GW-Basic, FBD's are moved in      
            memory when files are opened and closed. To avoid       
            problems due to this difference, the statement          
            "X=VARPTR(file)" should be executed before every        
            referrence to X because a file buffer may be moved      
            in memory when another file is closed.                  
                                                                    
       2.8) Line Printer Filenames                                  
            Line printer filenames have the following syntax:       
                   "LPTn:[bin]"                                     
            Where if bin is included, the file is opened in         
            Binary mode. In this mode, tabs are not expanded        
            to spaces, and CR is not forced at end-of-line.         
                                                                    
       2.9) DATE$                                                   
            Both IBM Basic and GW-Basic allow a single digit        
            for year. IBM Basic interprets the digit 8 as           
            1980. GW-Basic interprets the digit 8 as 2008.          
                                                                    
       2.10) Pen and Joy Stick                                      
             The statement 'STRIG ON' and 'STRIG OFF' perform       
             no function in GW-Basic. In IBM Basic these            
             functions are used to enable and disable the joy       
             stick trigger interrupts.                              
                                                                    
       2.11) Parity Checking on the OPEN statement                  
             There is an undocumented PE on the IBM OPEN            
             statement. This OPEN option enables/disables           
             parity checking on input. With no PE specified,        
             the IBM OPEN for communications will report no         
             parity errors.                                         
                                                                    
Ĵ
                                                                    
    3) IBM BASIC PROBLEMS FIXED IN GW-BASIC                         
                                                                    
       3.1) Homing The Graphics and Text Cursor                     
            IBM Basic does not home the cursor after CLS in         
            version A1.0. GW-Basic allows the OEM to choose         
            when to home the graphics cursor. The text cursor       
            is always returned home as per IBM PC Basic             
            version A1.1.                                           
                                                                    
       3.2) NAME statement On Open Files                            
            IBM Basic allows the NAME statement to refer to an      
            open file. This causes no immediate problem, but        
            can lead to problems as in the following case:          
                   10 OPEN"0",#1,"JUNK"                             
                   20 NAME"JUNK" AS "JUNK2"                         
                   30 KILL"JUNK2"                                   
                   40 PRINT#1,"My data"                             
                   50 CLOSE                                         
            IBM Basic allows this program to execute. Data          
            printed to the file is lost. This is inconsistent       
            in that KILL is illegal when referring to an open       
            file.                                                   
            GW-Basic and the standard MS-DOS version of             
            BASIC-86 do not allow NAME to refer to open files.      
                                                                    
       3.3) Detection Of Identical File Names                       
            IBM Basic does not detect identical file names          
            when the only difference in the name is the case        
            of the alphabetic characters comprising the file        
            name. This problem prevents IBM Basic from              
            detecting that a file in an OPEN statement has          
            already been opened.                                    
            GW-Basic and the standard MS-DOS version of             
            BASIC-86 are able to detect this user error.            
                                                                    
       3.4) Interruptability Of Input From The Keyboard             
            Variable length input (INPUT n,var...) from             
            the keyboard is not interruptable using the break       
            key. The program:                                       
                   10 OPEN "KYBD:" FOR INPUT AS 1                   
                   20 INPUT #1,A$                                   
                   30 GOTO 20                                       
            will read break as a character (the program is          
            virtually uninterruptable). This problem is fixed       
            in GW-Basic.                                            
                                                                    
       3.5) Communications                                          
            1) End Of File. IBM-PC Basic returns EOF true           
               whenever the input buffer is empty. GW-Basic         
               returns EOF true only when file was opened in        
               non binary mode, and CTL-Z has been received.        
               Once EOF is true, it remains true until the          
               file is closed. This is more analogous to the        
               way EOF works on other devices.                      
            2) Default Data Bits. IBM Basic documentation           
               states that the default bit count for                
               communications is 7. The commas in the               
               statement:                                           
                            OPEN "COM1:,,,"                         
               cause 7 bit mode to be invoked. However, if          
               parity or speed are specified, the default data      
               bit count is set to 8. GW-Basic defaults to 7        
               data bits.                                           
                                                                    
       3.6) Graphics                                                
            1) POINT. The IBM BASIC POINT function does not         
               detect that certain coordinates are not on the       
               screen and therefore are not legal.                  
            2) GET and PUT. The array format and speed              
               capability of these statements is supportable        
               by GW-Basic. However, the operation of these         
               commands is highly dependent on hardware design      
               and the implementation of OEM specific               
               routines.                                            
                                                                    
       3.7) Screen Editor                                           
            1) The IBM Screen Editor returns a zero to input$       
               function when a null function key is depressed.      
               GW-Basic Screen Editor returns no key code to        
               INPUT$ for null function keys.                       
            2) The IBM Screen Editor terminates function key        
               expansion when a key code greater than &H7f is       
               encountered. The high bit of this key code is        
               removed. GW-Basic allows codes greater than          
               &H7f. In late ROMs, the IBM Screen Editor will       
               not remove the high order bit from codes             
               returned by function key expansion.                  
                                                                    
       3.8) Trailing Blanks                                         
            The following BASIC program demonstrates a problem      
            in IBM Basic:                                           
                          10 OPEN "JUNK FOR OUTPUT AS #1            
                          20 PRINT #1,"ABC         "                
                          30 CLOSE #1                               
                          40 OPEN "JUNK" FOR INPUT AS #1            
                          50 INPUT A$                               
                          60 PRINT LEN(A$)                          
                          70 CLOSE #1                               
            The IBM Basic result of the print statement in          
            line 60 is 13.  The trailing blanks have not been       
            removed. GW-Basic removes these trailing blanks as      
            specified by the ANSI Standard.                         
                                                                    
Ĵ
                                                                    
    4) RS232 COMMUNICATIONS                                         
                                                                    
       Previous releases of GW-Basic were incompatable with         
       IBM-PC Basic communications in the following areas:          
              1) When a com file was opened with default            
                 parameters and closed, a CONTROL-Z (1A hex) was    
                 sent to let the other end of the RS-232            
                 protocol know that end-of-file had been            
                 reached. This is not done in IBM-PC BASIC.         
            2) Under GW-Basic if a COM device was opened with       
                 the BIN option, EOF always returned false. In      
                 ASCII mode, EOF returned false until it            
                 received a CONTROL-Z, after which time it          
                 always returned true.                              
       These changes made EOF behave in a device independent        
       manner. For example, a program which was written to          
       read sequentially through a disk file, stopping when         
       EOF was true, can now be used to read a COM file.  For       
       another example, GW-Basic can load "COM1:" and terminate     
       when the load is finished if the user on the other end       
       of the RS232 line types SAVE "COM1:",A.                      
                                                                    
       The number of application programs which have been           
       written to use IBM-PC COM cannot be ignored. The             
       following change in GW-Basic is intended to provide          
       compatability with IBM-PC Basic while retaining the          
       features added to GW-Basic.                                  
       NOTE: This change is isolated to version independent         
       code and has no effect on OEM written routines.              
                                                                    
       COM files can be opened in one of the following ways:        
                                                                    
            1) With the ASC option                                  
               In this mode, EOF is always false until a CTL-Z      
               is received. When a file is opened for OUTPUT        
               or RANDOM, a CTL-Z is sent when the file is          
               closed.                                              
                                                                    
            2) With the BIN option                                  
               In this "raw" mode, Basic performs no filtering      
               of data. This includes forcing carriage return       
               when line width is exceeded. This option             
               overrides the LF option. EOF has the same            
               meaning as it does in IBM-PC Basic. EOF is TRUE      
               if no data exists in the input buffer.               
                                                                    
            3) With neither the BIN nor the ASC options.            
               This mode is compatible with IBM-PC Basic. No        
               CTL-Z is sent when the file is closed. EOF is        
               TRUE if no data exists in the input buffer.          
                                                                    
       BSAVE, BLOAD force the mode to BINARY. This insures          
       BASIC will not force any Carriage Returns if the device      
       is not 255 (infinite).                                       
                                                                    
       SAVE "COMn:...",A forces the mode to ASCII.                  
                                                                    
       LOAD 'COMn:..."   forces the mode to ASCII if the first      
       character received is less than 80 hex, indicating an        
       ASCII file is being loaded. This ensures that ASCII          
       LOADs will terminate.                                        
                                                                    
       COM file syntax:                                             
            "COMn: [speed] [,parity] [,data] [,stop] [,RS]          
            [,CS[n]] [DS[n]] [,CD[n]] [,LF] [,ASC] [,BIN]"          
       Where:                                                       
       SPEED  baud rate in bits per second                          
       PARITY N, E, 0 (none, even, odd)                             
       DATA   5,6,7,8 bits per byte                                 
       STOP   1, 1.5, 2 stop bits                                   
              Default for baud greater than 110 is 1                
              Default for 110 baud or lower & 5 data bits           
              is 1.5                                                
              Default for 110 baud or lower & 6-8 data bits         
              is 2                                                  
       RS     Suppress RTS (Request To Send)                        
       CS[n]  Controls CTS (Clear To Send)                          
       DS[n]  Controls DSR (Data Set Ready)                         
       CD[n]  Controls CD  (Carrier Detect)                         
              This is also referred to as RLSD                      
              (Receive line Signal Detect)                          
       LF     Send a Line Feed character (X'OA')                    
              following a Carriage Return (X'OD')                   
       ASC    Open COM file in ASCII mode                           
       BIN    Open COM file in BINARY mode                          
                                                                    
       The RTS (Request To Send) line is turned on when you         
       execute an OPEN "COM..." statement unless you include        
       the RS option.                                               
       If CD is omitted, it defaults to CSO                         
       If DS is omitted, it defaults to DS1000                      
       If CS is omitted, it defaults to CS1000                      
       If RS is specified and CS is omitted, then CS defaults       
       to 0.                                                        
                                                                    
       Normally I/O statements to a communication file will         
       fail if the CTS (Clear To Send) or DSR (Data Set Ready)      
       lines are not cabled. The CS and DS options allow you        
       to avoid this problem by ignoring these lines. If the        
       [n] argument is included, it specifies the number of         
       milliseconds to wait for the signal before returning a       
       "Device Timeout" error.                                      
                                                                    
       If the argument [n] in the CS, DS, and CD options is         
       omitted, or equal to 0, then that line's status is not       
       checked at all.                                              
                                                                    
       NOTE: The speed, parity, data, and stop parameters are       
       positional, but RS, CS< DS, and CD may appear in any         
       order after STOP.                                            
                                                                    
       When included in the parameter list, LF will cause a         
       Line Feed to be sent after a Carriage Return.                
                                                                    
                                                                    

