Main Menu

PlayBASIC V1.64k Beta Announcements

Started by kevin, October 23, 2009, 11:22:51 PM

Previous topic - Next topic

kevin

PlayBASIC V1.64 K BETA #4 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)

   PB V1.64k4  is the latest beta of PBV1.64 retail update.     This beta brings a few new compiler level changes to  PB, namely math short support and Byte & Word field support in User Defined Types.

    Math Short cuts are another idea borrowed from C.  The syntax is basically the same, expect PB only supports these operations in Assignments, while in C you can apply them anywhere, which is handy in C,  not so much in BASIC.    

    What are they ?  - Well they're simply a way of short cutting math operations being performed upon the same variable or array.

    For example,  in older versions of PB, if you have a variable SCORE and wish to add 100 to it,  they you'd either type   Score=Score + 100 or use the INC operator.  Eg  INC score,100  (Note: Only available in older editions of PB V1.64)

     Now in V1.64K  we have the following short cut operators.  

     ++    ;  Increase by one.    This is the equivalent of INC operator.  Except you can use these on arrays/ type fields
     --     ;  decrease by one.    This are the equivalent of DEC operator.  Except you can use these on arrays/ type fields

     +=   ;  Add right value to left.             Eg   Score += 100  , is the same as Score = Score +100
     -=   ;  Subtract right value from left.    Eg   Score -= 100  , is the same as Score = Score -100
     *=   ;  Multiply right value by left.        Eg   Score *= 100  , is the same as Score = Score *100
     /=   ;  Divide right value by left.           Eg   Score /= 100  , is the same as Score = Score /100


    So really these additions just allow us to shorten some long expressions.    These operators can be used on most data types and structures within PB.   Including Integers, Floats, Strings, Arrays, Pointer writes (limited support) and even User Defined Users.    However Array Field elements in User defined types are not currently supported.  

PlayBASIC Code: [Select]
      Dim Table(2000)

Table(110)+=1000
Table(110)-=2222

print Table(110)

Dim Table#(1000)
Table#(10)=1000

Table#(10)/=50
print Table#(10)

Dim Table$(200)
Table$(10)="Yeah"

Table$(10)+="Dude"
print Table$(10)

a$="Cool"
print a$

c$="DUDEDDD"
b$="YESAH"
A$=C$+b$
print a$

a$++
print a$

Type Test
Aaa
X
Y#
z$
EndType

Dim Dude as test

Dude.x +=100
Dude.x +=100
Dude.x +=100
Print Dude.x

Dude.y +=200
Dude.y +=200
Print Dude.y

Dude.z +="aaa"
Dude.z +="bbb"
Print Dude.z

Dim Qrr(10,5) as test
print "Typed Array"

Qrr(10,5).x =45

Qrr(10,5).x +=100
Qrr(10,5).x +=100
Qrr(10,5).x +=100
Print Qrr(10,5).x


Dim You2 as integer pointer

Dim You as integer pointer
Bank=NewBank(1000)
addr=GetBankPtr(Bank)
You= addr

*You = 45
*You += 100
*You *=2
*You /=10
print *You


Dim Me as test pointer
Me = new test

me.x =13
print me.x

me.x *=4
print me.x

me.x /=13
print me.x

print "Y test"

me.y +=22
print me.y
me.y *=4
print me.y
me.y /=13
print me.y


me.z +="HellO"
me.z +="HellO"
me.z +="HellO"
print me.z

Sync
waitkey





   Byte & Word Fields

    As of PB1.64k,   PB now supports BYTE (8 bit unsigned) and WORD (16bit unsigned)  fields within User defined type structures.   This address a bit of gotcha when trying to work with some external functions (ie windows, other 3rd party dll's mainly)..  But you can use this stuff in your programs like so.  

PlayBASIC Code: [Select]
   // Create a structure so we can access the fields of ARGB colour
// directly from memory (via pointer). Notice the order, INTEL
// sludge boxes use LITTLE ENDIAN, so longs are stored in memory in reverse order
Type Colour
B as byte
G as byte
R as byte
A as byte
EndType

// allocate a bank the size of the Colour structure (4 bytes in other words)
Bank=NewBank(sizeOf(Color))

// me a user defined type pointer, so we can query memory.
Dim me as Colour Pointer

// set the ME to point at our Bank
Me = GetBankPtr(Bank)

// Poke a colour into the bank
PokeBankInt Bank,0,Argb(50,100,200,250)

// use the Typed Pointer to query the colour that we stored in the bank
print Me.A
print Me.R
print Me.G
print Me.B

Sync
waitkey







WIP Thread


  Follow the WIP beta gallery thread in the show case




kevin

#1
Play Basic V1.64 K BETA #6 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)

   PB V1.64k6  is the latest beta of PBV1.64 retail update.     This beta brings a more compiler level changes, some Runtime speeds up and a few bugs fixes from the previous beta.

    In this beta the math short cuts have been extended further, both in what they can be applied to (should support all data types) and the a few new operators,  namely  AND (&=), OR (|=), XOR (~=) operators

    Other changes revolve around the priority of certain opcodes (low level stack + pointers) within the VM1 instruction set.   The latter gives a nice speed boost to accessing array fields in user defined types.  In fact all pointer operations should be faster, but don't get too excited though we're probably only talking 10->15% real world speed improvement on those operations.   Of course, if you don't really use pointers, then this is unlikely to make any great impact in your programs.

    The last changes have been to the stack opcodes.  While the changes thus far are fairly minor really, even so, the clean up should help with programs that use a lot of function calls.  In some test programs the changes we're producing a handy 12% speed up,  but In real world code, I doubt we'll see that.  Perhaps 5%.  But a saving is a saving..  




Download


    See newer versions bellow.




WIP Thread


  Follow the WIP beta gallery thread in the show case



kevin

#2
PlayBASIC V1.64 K BETA #7 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)

   PB V1.64k7  is the latest beta of PBV1.64 retail update.     This beta focuses on a number stack opt's in the runtime.




Download


     Newer version bellow.





WIP Thread


    Follow the WIP beta gallery thread in the show case



kevin

#3
PlayBASIC V1.64 K BETA ROUND up  #9 to Beta #20




PlayBASIC V1.64 K BETA #7 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


  This beta focuses on a number stack opt's in the runtime.




Play Basic V1.64 K BETA #9 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


   This adds the new auto assignment casting between Integers/Floats and pointers,  as well as it includes some (VERY) limited Array operator support.  See example




Play Basic V1.64 K BETA #10 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


   This beta adds the ability to declare and return locally allocated UDT pointers from functions..

   Read Here about usage





Play Basic V1.64 K BETA #12c (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


    This beta adds the ability to pass individual UDT's into functions (as well as the original array containers) as well as the ability to pass locally declared Integer Arrays out of functions.  So you can create an array inside a  function then export it it's handle.  To access the array you either need to assign the handle to an existing array, or create a redirection array so you access the data.  


   Passing UDT's to Functions

   Returning Local Arrays from Functions





Play Basic V1.64 K BETA #13 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


    This beta adds the ability to return typed arrays/variables & list containers from functions.

   Returning Typed Arrays & Lists from Functions





Play Basic V1.64 K BETA #14 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


    This beta corrects from bugs found in beta 13 plus adds support for post fixes on user functions and bound functions.

   Read More About Beta 14





Play Basic V1.64 K BETA #16 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


  This beta adds support for (import/export) pointer and buffer  operations into PSub.

  Read more about POinters/Buffers And Psubs





Play Basic V1.64 K BETA #17 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


   PlayBasic V1.64k17  is the latest beta of PBV1.64 retail update.     This beta corrects some issues found in beta #16 with Array passing into PSUB's

   Read about Here





Play Basic V1.64 K BETA #19 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


 This beta adds the CallFunction operator.  This features allows the user to dynamically call user defined functions/psubs and linked dll functions by Name.  While the call can pass parameters (basic types only such as Integers,Floats and String), the operation can't handle returning data from the called function at this time.

   What does CallFunction give you, it gives you the ability write routines that have call backs (ie emulated function pointer ) styled behavior

   Read about Here






Play Basic V1.64 K BETA #20 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


    With this beta we're finally about to bring some support for optional parameters in internally bound functions and commands.   Not every command or function has optional support, in fact at the moment only a hand full do (List in history).   Most of which relate to switch styled parameters.  A flag to return something on/off in the command.

    What optional parameter supports does, is it lets the programmer use the commands 'default' parameters for a particular operation.  So each  command/function that supports optional, gives the optional parameters a default value.  You can't change these, they're built in.   These defaults will hopefully be the most commonly used settings though.    So they're a sort cut.

    Now those with very long memories,  will remember some of the initial PB design discussions.  Where we asked various communities about how the PlayBASIC commands names/ basic features should be set out.   Surprisingly, optional parameters wasn't something that was seen as a bonus.   I think the reason for is, was that it can actually make code more cryptic.  As functions seems to pull their operational state from thin air.     For example, if a user sees a function being used with 3 parameters say, then elsewhere they see it with 4, or 5 even.    This will no doubt case one of those WTF moments, and hence is one the initial reasons why it was demoted to the PB V2.00  design document..  


   Read More about the new features in the beta at the links bellow.

   FUnction Index & Function Exist
   
   Optional Parameters In Commands

   Optional Parameters In Functions




Download


    Newer version bellow





WIP Thread


  Follow the WIP beta gallery thread in the show case



kevin

#4

PlayBASIC V1.64k  Beta 22 - Optional Parameters In User Defined Functions/Command Calls


     This address an omission in the previous beta, where functions that didn't return a result couldn't use optional parameters,  which has since been addressed.   The only thing missing now (off the top of my head) is Psub support for optional parameters.  


PlayBASIC Code: [Select]
      Dude 10,20,30
Dude 10,20

a=MyFunction(100,200)

Sync
WaitKey


Function Dude(a,b,c=55)
print "DUDE"
print a
print b
print c
EndFunction


; Declare A,B and C as an optional that defaults to 1
Function MyFunction(a,b,c=234,f$="Yeah",g=true)
print "My Function"
print a
print b
print c
print f$
aa=a+b+c
EndFunction aa







 Psub Support


PlayBASIC Code: [Select]
      SubDude 10,20
SubDude 10,20,30
SubDude 10,20

a=MyFunction(100,200)

Sync
WaitKey


Function Dude(a,b,c=55)
print "DUDE"
print a
print b
print c
EndFunction



Psub SubDude(a,b,c=55)
print "DUDE as a SUB"
print a
print b
print c
EndPsub



; Declare A,B and C as an optional that defaults to 1
Function MyFunction(a,b,c=234,f$="Yeah",g=true)
print "My Function"
print a
print b
print c
print f$
aa=a+b+c
EndFunction aa




   



 PlayBASIC V1.64k  Beta 22 - SortArray (string)
 
   Dropped this old chestnut back in.  While it works, it's not particularly quick.


PlayBASIC Code: [Select]
   Size=10
Dim name$(Size)
for lp=0 to size
name$(lp)=ReadData$()
next


SortArray name$(),0,size

for lp=0 to size
print name$(lp)
next
Sync
waitkey

Data "zack","wolf","kev","andy","michelle","dogs","tess","c64","zynaps","dudes","Alpha"








PlayBASIC V1.64 K BETA #23 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)


    PlayBASIC V1.64k 23  is the latest beta of PBV1.64k retail update.       This beta pretty much rounds off what the 1.64K will be.
   

    If you haven't already tested your  code in 1.64K then I'd strongly advise doing so PRIOR to the release.  





WIP Thread


  Follow the WIP beta gallery thread in the show case






kevin

#5

PlayBASIC V1.64k  Revision #2  Beta #2 - Clean Up


   This beta attempts to address the issues found in the PB1.64K release.

    Users are STRONGLY urged to test all of your code with this beta, prior to the coming V1.64K Revision #2 release.    Issues not discovered during beta testing will not be addressed until the next major update!



Download


   Old beta removed.




WIP Thread


  Follow the WIP beta gallery thread in the show case






kevin

#6

PlayBASIC V1.64k  Revision #2  Beta #3 - Clean Up


   Beta #3 looks like being the final beta in the V1,64K clean up...  

    Users are STRONGLY urged to test all of your code with this beta, prior to the coming V1.64K Revision #2 release.    Issues not discovered during beta testing will not be addressed until the next major update!



Download


   old Beta removed.





WIP Thread


  Follow the WIP beta gallery thread in the show case