FROM THE CSA2
This message to advise the community that an update of Peersoft has been posted on my Web site.
This is version 1.5.6 which is a preview of version 1.6 due to be released this autumn^H^H^H^H^H^H^Hwinter^H^
H^H^H^H^Hnext^H^H^H^Hthis year ;-). The download ilnk is http://bgilon.free.fr/apple2/ Peersoftv1.5.6.zip .
Two domains have been covered within this release:
a) enhanced syntax and semantics:
a.1) with a new integer subtype (byte) and the introduction of optional unsigned integer arithmetic;
a.2) a new loop construct syntax for processing arrays with a valuable expected (and measured) performance gain.
b) Applesoft bug fixes: well just two of them but anyway this is a minor release…
Not so briefly stated, those features have been added from previous 1.5.5 version:
a) support for the 8bits wide integer subtype.
The main benefit you can get from using the byte variant instead of the original 16bits wide subtype is the smaller memory footprint to be considered when used in arrays. A tiny performance gain can be obtained when dealing with the new variable alternate syntax schemes which use 8bits arithmetic when dealing with byte variables (also the handling of the NEXT instruction might be a bit faster).
But you might say that the PEEK function over a memory area populated with previous POKE statements can provide the same result…
So what is the difference from using the PEEK function on memory which can also return byte values from memory?
a.1) The value returned from the PEEK function call lies within the range 0..255 unlike the byte subtype which range can be either from -128..127 or 0..255 according to the setting of a configuration byte (see list item below for details).
a.2) the PEEK function would be nearly useless should the user deal with arrays of more than one dimension.
a.3) Also the use of PEEK would imply the expense of one FP add operation between the base address and the index expression for every reference unlike using byte arrays where adresses are derived from integer arithmetic over element indexes.
b) A configuration byte (@ address 40167 decimal) has been set up to induce unsigned arithmetic in addition to default signed arithmetic for integer types like the original 16bits and the new byte subtypes.
The dot character (‘.’) suffix to the variable name is used to explicitly tag byte variables.
CLEAR :A% = – 1:A. = -1:A% -= 1:A. -= 1: PRINT A%,A.
POKE 40167,128: PRINT A%,A.:A% += 1:A. += 1: PRINT A%,A.
A% -= 65534:A. -= 254: PRINT A%,A.
A% -= 2
A. -= 2
onto display screen.
Also the arithmetic variant used within the NEXT statement processing is derived from the configuration byte setting as the corresponding FOR statement was processsing. However, if unsigned arithmetic option setting is on, this does not preclude from using negative step values. the addition with a negative value thus is replaced with a substraction by a positive value, opposite of the former value.
c) Applesoft bug fixes:
c.1) As a sideway of supporting the processing of the byte subtype, an Applesoft bug illustrated by codlet below is fixed:
10 REM Enter the “10:10” (w/o the double-quotes) string at input prompt
20 INPUT “TIME OF EVENT: “;A$: PRINT A$
Will output the string “10” to display under plain vanilla Applesoft instead of the entered string as a whole. This bug was noted by Ivan Drucker at a Kansasfest past session while describing his “Nu Input” package. From now on and with the help of Peersoft, Applesoft “sucks” a bit less (to quote Ivan’s own adjective to qualify those Applesoft statements) ;-).
c.2) Plain vanilla Applesoft could not handle this statement: A% = -32768 despite the fact that -32768 is a perfectly valid value to be bound to an integer variable (well when signed arithmetic is active ;-). Peersoft includes a fix for that bug as well.
d) New syntax scheme for iterating through arrays element by element. A previous syntax extension allowed for iterating thru a multidimensional array’s elements, using a loop with just one level/one index variable (see provided documentation and sample below).
10 DIM A%(2,2)
20 FOR I = 0 TO 8: EL% = A%(I): PRINT I;”TH ELEMENT INSPECTED: “;EL%::S += EL%: NEXT I:PRINT “SUM IS “;S
Now and from version 1.5.6, a new syntax is provided to further simplify array processing and enhance run-time performance as well:
10 DIM A%(2,2)
20 FOREACH EL%,A%: PRINT # ;”TH ELEMENT INSPECTED: “;EL%:S += EL%: NEXT EL%:PRINT “SUM IS “;S
Note the # designates the current element index (bound to zero value at the start of the loop and incremented by 1 upon every NEXT occurence).
Also note that the above syntax is also useful for updating an array’s elements, not just for reading their original content, that is the NEXT statement will update the array element with the value bound to loop variable as part of its processing.
15 POKE 40167, 128: FOREACH EL%,A%:EL% = RND (0) * 65536: NEXT EL%
will initialize the A% array with random values from 0 to 65535 (which will be rendered as in range -32768 to 32767 once the arithmetic flag is reset).
The documentation supplied within the archive also covers features which will be implemented within the next Peersoft release (1.6) but be advised that they are not operational at all within this release. They are marked with a yellow background in the documents.