Microsoft KB Archive/35657

= &quot;Out of Data&quot;; Incorrect CALL Example Mac QuickBASIC Page 61 =

Article ID: 35657

Article Last Modified on 11/21/2006



This article was previously published under Q35657



SUMMARY
The example for the CALL statement on Page 61 of the &quot;Microsoft QuickBASIC for Apple Macintosh: BASIC Language Reference&quot; manual is incorrect. The example produces an &quot;Out of data&quot; error because the condition for the WHILE... WEND loop is &quot;A <> -1&quot;; however, there is not a data statement that sets A equal to -1. The following additional line needs to be added at the end of the code:

DATA -1



MORE INFORMATION
The example is still not a very good one even with the &quot;DATA -1&quot; statement, because you cannot substitute machine-language code that contains a literal value of -1. The machine-language routine would only be read in up to the first &quot;-1&quot;, and the resulting partial machine-language routine would probably hang (crash) when invoked.

The example should be rewritten to read the machine code as strings first, since there is no number that cannot appear in machine code. That way, we can signal the end with the string &quot;END&quot;, and the same BASIC statements can be used to read any machine language.

The following is a code example: DIM code%(50)   'big enough to hold all our machine code

'   this loop can be used to read in ANY machine code RESTORE myCodeData i% = 0 : a$ = &quot;&quot; WHILE a$ <> &quot;END&quot; READ a$   IF a$ <> &quot;END&quot; THEN code%(i%) = VAL(a$) :i% = i% + 1 WEND

myCodeData: DATA ...    ... machine code defined as hex constants ... DATA &quot;END&quot;   :'**   End of machine-language routine   **

Additional query words: MQuickB

Keywords: KB35657

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.