Post Reply 
Sharp BASIC anomaly
01-19-2023, 06:45 PM (This post was last modified: 01-19-2023 06:50 PM by Dave Britten.)
Post: #2
RE: Sharp BASIC anomaly
Correct, in most Sharps, the variables A-Z share the same (fixed) memory locations as A$-Z$, and thus the space for a float/numeric variable ends up being big enough to hold strings of 7 characters. (8 bytes each in most models, I believe.)

Later models (I think this includes your EL-5500II and PC-G850) can DIM larger strings, but they have to be declared as arrays (which can have just a single element if you wish).

e.g. DIM R$(0)*26 gives you an array R$ with one element (subscript 0) that will hold a string up to 26 characters in length. DIM NM$(10)*10 gives you an array with 11 elements (subscripts 0-10) that hold 10 characters each.

EDIT: And if you use "simple variables" (i.e. two-character variable names that are allocated dynamically upon use), those hold strings up to 16 characters in length. AA$="PASSWORD12345678" should work as expected.

The PC-1500 has a more traditional BASIC that dynamically allocates space for strings depending on length.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Sharp BASIC anomaly - polbit - 01-19-2023, 12:53 AM
RE: Sharp BASIC anomaly - Dave Britten - 01-19-2023 06:45 PM
RE: Sharp BASIC anomaly - polbit - 01-19-2023, 07:43 PM



User(s) browsing this thread: 1 Guest(s)