News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

PlayBASIC V1.65 (Work In Progress) Gallery

Started by kevin, April 03, 2016, 12:01:41 AM

Previous topic - Next topic

kevin

#105
 PlayBASIC V1.65C3 BETA #7 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (27th Sep , 2023)

     V1.65C3 Beta #7 is the current build of the compiler .   This also includes a build of the Runtimes  


      Build 7 fixes the SIGN bug for floats where it would do conversion of the float to integer which would round it.. Normally this isn't a problem, but it is for values near zero.   That logic has been replaced now.    So if you pass an Integer it performs the comparison on Integers and if you pass a float it occurs on the Floats..    (bug found by Stevmjon)

 
PlayBASIC Code: [Select]
  ; Older versions of V1.65 will give odd results in this code

a# = -1.9
b# = 0
c# = 1.9

print "value -1.9 = sign: " + str$( sgn(a#) )
print "value 0 = sign: " + str$( sgn(b#) )
print "value 1.9 = sign: " + str$( sgn(c#) )
print ""


a# = -0.9
b# = 0
c# = 0.9

r=sgn2(a#)
print "value -0.9 = sign: " + str$( r )
r=sgn2(b#)
print "value 0 = sign: " + str$( r )
r=sgn2(c#)
print "value 0.9 = sign: " + str$( r )


print ""


a# = -0.9
b# = 0
c# = 0.9

print "value -0.9 = sign: " + str$( sgn(a#) )
print "value 0 = sign: " + str$( sgn(b#) )
print "value 0.9 = sign: " + str$( sgn(c#) )

sync : flushkeys : waitkey


function sgn2(v#)
Result=(V#>0) - (V#<0)
endfunction result





     Anyway, have fun..


    See->> Read V1.65 Update Work In Progress gallery (login required) for some info on what's changed..  Lots and lots of STUFF.




Bug Reporting


    See->> PlayBASIC V1.65 Bug Reports (login required).


       

Download


  Download PlayBASIC V1.65C3 Beta 7 (login required)  (27th,Sep,2023)


kevin

 PlayBASIC V1.65C3 BETA #8b (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (29th Sep , 2023)

     V1.65C3 Beta #8b is the current build of the compiler .


      Build 8 replace the implementation of the RoundUp and RoundDown functions.    I honestly don't know how these were originally intended to work as there's little to no definition of them..   So these changes will no doubt break old programs that use the original behavior; so careful what you wish !  :)

 
PlayBASIC Code: [Select]
   openscreen 1000,1000,32,1

loadfont "courier new" ,1 ,24
spacing = 150

text xpos ,ypos,"Value:"
text xpos+spacing*1 ,ypos,"RoundDown()"
text xpos+spacing*2 ,ypos,"RoundDown2()"

text xpos+spacing*3 ,ypos,"RoundUp()"
text xpos+spacing*4 ,ypos,"RoundUp2()"
text xpos+spacing*5 ,ypos,"Floor()"
text xpos+spacing*6 ,ypos,"Ciel()"


ypos+=30
for lp =-20 to 20
Value#=lp/10.0
text xpos ,ypos,Value#
text xpos+spacing*1 ,ypos,RoundDown(Value# )
text xpos+spacing*2 ,ypos,RoundDown2(Value# )
text xpos+spacing*3 ,ypos,Roundup(Value# )
text xpos+spacing*4 ,ypos,Roundup2(Value# )

text xpos+spacing*5 ,ypos,Floor(Value# )
text xpos+spacing*6 ,ypos,Ceil(Value# )
ypos+=20
next

sync
waitkey





function RoundDOWN2(ThisVALUE#)
if (ThisVALUE#>=0)
Result= ThisVALUE# - 0.5
else
Result= ThisVALUE# + 0.5
endif
EndFunction Result




function RoundUp2(ThisVALUE#)
if (ThisVALUE#>=0)
Result= ThisVALUE# + 0.5
else
Result= ThisVALUE# - 0.5
endif
EndFunction Result






      Build 8 is also using the latest update the memory manager at runtime.  These changes were moved across from recent compiler work so that that front and back end can use the same mechanics..  They've only been in place for a day but seem to be running as expected.  Some other tweaks can be found in the debugger with the Stack info as well as stack overflow detection is a bit better also.   Previously if your code overflowed the runtime stack; the runtime would hang..  now if your lucky you might get an error.  It'll try and give you a line number; but generally those errors will only get caught as at sync or runtime refresh.   The later occurs when a program executes more than 6 million instructions and needs to check system messages.    


     Anyway, have fun..


       

Download


  Download PlayBASIC V1.65C3 Beta 8b (login required)  (29th,Sep,2023)



kevin

#107
 PlayBASIC V1.65C3 BETA #9 (Retail Compiler Only Beta) - (Avail for Registered Users ONLY)  (3rd Oct, 2023)


      Build 9 restores  RoundUp and RoundDown functions to make that of V1.64 revisions.    The newer versions are still available just renamed as  RoundUp2 and RoundDown2

      A few other functions are available also;  such as Poke2Bytes / Poke3Bytes / Poke4Bytes   and a few that appear to be undocumented commands.   One handy one seems to the RgbFLT(R#,G#,B#)  which is a floating point version of the RGB() function.  In this version the R#/G#/B# fields should range between 0.0 and 1.0

     The runtime has a few more tweaks with the internally bound command sets... I want to remove that block of instructions form the runtime;   But i've more work to do with that; some of those instructions also had a few legacy hooks into the how the older VM stored programs..  which was a bit of worry;  but I think they weren't in use; so this step shouldn't really break anything.  


PlayBASIC Code: [Select]
   openscreen 1200,1100,32,1
loadfont "courier new" ,1 ,24,0,8



Test_Rounding()
Test_PokeBytes()



function Test_Rounding()

spacing = 180
th=gettextheight("|")+1

ScrollY#=0

do
cls
Ypos=ScrollY#

lockbuffer

if ypos+th>0

text xpos ,Ypos,"Value:"
text xpos+spacing*1 ,Ypos,"RoundDown()"
text xpos+spacing*2 ,Ypos,"RoundDown164()"

text xpos+spacing*3 ,Ypos,"RoundUp()"
text xpos+spacing*4 ,Ypos,"RoundUp164()"
text xpos+spacing*5 ,Ypos,"Floor()"
text xpos+spacing*6 ,Ypos,"Ciel()"
endif

ypos+=(th*1.5)
for lp =-20 to 20

if (Ypos+th<0) or Ypos>GetScreenHeight()
Ypos+=th
continue
endif

if (lp/10)*10=lp
Boxc 0,ypos,GetSurfaceWidth(),Ypos+th,true,$334455
endif

Value#=lp/10.0

ink -1
text xpos ,ypos,Value#

Same = RoundDown(Value# )=RoundDown164(Value# )
ink -1
if Same=true then ink $00ffff00

text xpos+spacing*1 ,ypos,RoundDown(Value# )
text xpos+spacing*2 ,ypos,RoundDown164(Value# )
ink -1

Same = RoundUp(Value#) = RoundUp164(Value# )
ink -1
if Same=true
ink $00ff00ff
endif

text xpos+spacing*3 ,ypos,Roundup(Value# )
text xpos+spacing*4 ,ypos,Roundup164(Value# )

ink -1
text xpos+spacing*5 ,ypos,Floor(Value# )
text xpos+spacing*6 ,ypos,Ceil(Value# )


ypos+=th
next
unlockbuffer

Final_YPOS = YPOS - ScrollY#

mz#=mousemovez()
ScrollSpeed#+= (mz#*th)

ScrollY#+=ScrollSpeed#
ScrollY#=ClipRange#(ScrollY#,-Final_YPOS,0)
ScrollSpeed#=curvevalue(0,ScrollSpeed#,5)

sync
loop Spacekey()
flushkeys

EndFunction






// Functions that emulate behavior of 1.64

function RoundDown164(ThisVALUE#)
intResult=(ThisVALUE# - 0.5)
Result#=IntResult
EndFunction Result#


function RoundUp164(ThisVALUE#)
intResult=(ThisVALUE# + 0.5)
Result#=IntResult
EndFunction Result#


// Functions that emulate behavior of 1.65 beta 9

function _RoundDOWN2(ThisVALUE#)
if (ThisVALUE#>=0)
Result= ThisVALUE# - 0.5
else
Result= ThisVALUE# + 0.5
endif
EndFunction Result



function _RoundUp2(ThisVALUE#)
if (ThisVALUE#>=0)
Result= ThisVALUE# + 0.5
else
Result= ThisVALUE# - 0.5
endif
EndFunction Result




Function Test_PokeBytes()

Do
Cls

mx#=mousex()
my#=mousey()

ThisRGB =RgbFLT(mx#/GetScreenWidth(),0,my#/getscreenHeight())

lockbuffer
boxc 100,100,400,400,true,ThisRGB
Login required to view complete source code




     Anyway, have fun..



Bug Reporting


    See->> PlayBASIC V1.65 Bug Reports (login required).

       

Download


  Download PlayBASIC V1.65C3 Beta 9 (login required)  (3rd,Oct,2023)