Shop OBEX P1 Docs P2 Docs Learn Events
Try the SX/B 2.0 Public Beta NOW!! 2.00.31 April 8, 2010 — Parallax Forums

Try the SX/B 2.0 Public Beta NOW!! 2.00.31 April 8, 2010

BeanBean Posts: 8,129
edited 2012-02-29 20:49 in General Discussion
As you know SX/B 2.0 has been in private beta testing for quite some time.

Although the documentation and help file still has a little·work, we decided to release the beta version to the public so we may get some feedback on it. I have attached version 2.00.07. The first official release will be 2.01.

Unzip the attached file. Put the files in your C:\Program Files\Parallax Inc\SX-Key v3.2.92\Compilers\SXB directory (overwritting the existing files).

Please read the "What's New" pdf file to get an idea of what has changed.

To the private beta testers: I really appreciate all your help in the development of SX/B 2.0, you are now free to post all of your SX/B 2.0 projects or demo code to the public forum. Let everyone see what this puppy can do!

I know there will be questions, please feel free to post them. I'd encourge any of the beta testers to answer any question you'd like.

Enjoy,

Bean (On behalf of the whole SX/B Beta Tester team)

[noparse][[/noparse]Edit] Jan·30. 2009 Posted version 2.00.08
Version 2.00.08
· FIXED: ENDSUB always generates a RETP (in case RETURN is in conditional code).
· FIXED: ENDFUNC without a return didn't adjusts stack pointer.
· FIXED: Optimize wordvar = wordvar + constant (where constant < 256, and/or constant = 1)

[noparse][[/noparse]EDIT] Feb 9, 2009 Posted version 2.00.09
Version 2.00.09
· OPTIMIZED: "FOR byteVar = x TO 1 STEP -1" now generates "DJNZ temp,@__FOR"
· FIXED:· "w = $0F & fsr" and "w = fsr & $0F"
·
[noparse][[/noparse]EDIT] Feb 11, 2009 Posted version 2.00.10
Version 2.00.10
· CHANGED: Compiler conditionals are now NOT evaluated when nested.
··· But $ELSE and $ENDIF will affect only the outermost loop.

[noparse][[/noparse]EDIT] Feb 13, 2009 Posted version 2.00.11
Version 2.00.11
· FIXED: byteVar = ~byteVar· error introduced in version 2.00.09 to handle "W"

[noparse][[/noparse]EDIT] Feb 17, 2009 Posted version 2.00.12
Version 2.00.12
· Fixed: HEXVAL & HEXSTR should not subtract one when first parameter is a constant
· Changed: "MODE = const" or "M = const" on SX28 generates "MODE const" (Saves 1 instruction)

[noparse][[/noparse]EDIT] Feb 20, 2009 Posted version 2.00.13

Version 2.00.13
· ADDED: WCON (Word CONstant) diretive // SUB, FUNC, RETURN, DATA
· ENHANCED: SUB declaration· "MySub SUB 2,3,WORD,BYTE"
··········· FUNC declaration "MyFunc FUNC 2,2,3,WORD,WORD,BYTE"

[noparse][[/noparse]EDIT] Feb 24, 2009 Posted version 2.00.14
Version 2.00.14
· FIXED: Use LSB if you give a WORD to a SUB or FUNC that requires a BYTE
··· Make one routine to pass parameters for SUBs or FUNCs
· FIXED: MySub __WPARAM12 ' Does not load __PARAM1 and __PARAM2

[noparse][[/noparse]EDIT] Feb 25, 2009 Posted version 2.00.15
Version 2.00.15
· FIXED: Error for FUNC with no parameters

[noparse][[/noparse]EDIT] Feb 25, 2009 Posted version 2.00.16
Version 2.00.16
· FIXED: Word constant as SUB or FUNC parameter is not counted as 2 bytes

[noparse][[/noparse]EDIT] Mar 26, 2009 Postsed version 2.00.17
Version 2.00.17
· FIXED: FUNC cannot have 5 parameters "STOAB FUNC 1,5,5"

[noparse][[/noparse]EDIT] Mar 26, 2009 Posted version 2.00.18
Version 2.00.18
· FIXED: negative constants as SUB parameters (assumes positive < 256)

[noparse][[/noparse]EDIT] Apr 1, 2009 Posted version 2.00.19
Version 2.00.19
· FIXED: SUB 5,5

[noparse][[/noparse]EDIT] Apr 11, 2009 Posted version 2.00.20
Version 2.00.20
· FIXED: localWord = WordFunc ' __PARAM0 error

·[noparse][[/noparse]EDIT] Apr 17, 2009 Posted version 2.00.21
Version 2.00.21
· FIXED: RCTIME timing was off by 2 cycles per loop

[noparse][[/noparse]EDIT] May 11, 2009 Posted version 2.00.22
Version 2.00.22
· FIXED: COUNT using a WORD variable for result

[noparse][[/noparse]EDIT] May 11, 2009 Posted version 2.00.23
Version 2.00.22
· FIXED: CRASH on SUB definition

[noparse][[/noparse]EDIT] May 13, 2009 Posted version 2.00.24
Version 2.00.24
· FIXED: localWord = localWord SHR localByte ' "INC FSR" and "DEC FSR" are swapped
· FIXED: localWord = lsb,msb ' Only lsb is set

[noparse][[/noparse]EDIT] June 8, 2009 Posted version 2.00.25
Version 2.00.25
· FIXED: PUT var1, var2 to var3 ' Lowercase "to" didn't work properly

[noparse][[/noparse]EDIT] June 15, 2009 Posted version 2.00.26
Version 2.00.26
· FIXED: W = byteVar OR byteVar
· FIXED: W = byteVar - byteVar

[noparse][[/noparse]EDIT] June 26, 2009 Posted version 2.00.27
Version 2.00.27
· CHANGED: Word subtractions leave carry correct when finished (PJV)
· CHANGED: WORD division added "SZ" to avoid incorrect result 1 / $FF02 = 1 should be zero

[noparse][[/noparse]EDIT] July 13, 2009 Posted version 2.00.28
Version 2.00.28
· ENHANCED: Conditional compiler directives can now be nested (32 levels).
· FIXED: wordVar = Const - Const ' Should NOT do the math

[noparse][[/noparse]EDIT] July 16, 2009 Posted version 2.00.29
Version 2.00.29
· FIXED: Bug introduced in 2.00.28 with WordVar = WordVar - Const
· FIXED: WordVar = WordVar + Const > 255

[noparse][[/noparse]EDIT] July 31, 2009 Posted version 2.00.30
Version 2.00.30
· ADDED: TASKS INIT [noparse][[/noparse], MAXTASKS]
·········· Sets up TASK variables so you can place TASK RUN after TASKS SET
· FIXED: On SX48 TRIS_A = localbyte generated an error
· OPTIMIZED: localbyte = Register (Doesn't use PARAM1 now)

[noparse][[/noparse]EDIT] April 8, 2010 Posted version 2.00.31
Version 2.00.31
· FIXED: WordVar1 = Const - WordVar2




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Use BASIC on the Propeller with the speed of assembly language.
PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There are two rules in life:
· 1) Never divulge all information

Post Edited (Bean) : 4/9/2010 1:23:57 AM GMT
«13

Comments

  • BeanBean Posts: 8,129
    edited 2009-01-28 17:57
    Here is a little demo that shows how to use the new TASK Scheduling feature in SX/B 2.0.
    ' TASK demo code
    ' Connect RB.0 to RB.4 to five LEDs
    '
    DEVICE SX28, OSC4MHZ, BOR26
    FREQ 4_000_000
    STACK 16              
     
    LEDS    PIN RB OUTPUT ' Connect RB.0 to RB.4 to five LEDs
     
    SUB INTERRUPT 1250 ' Interrupt every 1/1250 seconds (0.8milliSeconds)
      TASKS RUN, 100   ' Task "tick" is 0.8*100milliseconds (80 milliseconds)
    ENDSUB
     
    ToggleLED TASK
     
    PROGRAM Start
     
    Start:
      TASKS SET, 0, ToggleLED, 10, 1 ' Run this task every 10 ticks, wait 1 tick before 1st run
      TASKS SET, 1, ToggleLED, 10, 3 ' Run this task every 10 ticks, wait 3 ticks before 1st run
      TASKS SET, 2, ToggleLED, 10, 5 ' Run this task every 10 ticks, wait 5 ticks before 1st run
      TASKS SET, 3, ToggleLED, 10, 7 ' Run this task every 10 ticks, wait 7 ticks before 1st run
      TASKS SET, 4, ToggleLED, 10, 9 ' Run this task every 10 ticks, wait 9 ticks before 1st run
      TASKS ENABLE ' Start task handling
     
      ' Do nothing forever (while tasks continue to run in the background)
      DO
      LOOP
    END
    
    TASK ToggleLED
      taskSlot VAR BYTE        ' This is local variable
      taskSlot = __PARAM1      ' Task slot that called this task
      PUTBIT LEDS, taskSlot, 2 ' "2" means to invert(toggle)the bit
    ENDTASK
    
    

    Try to guess what it will do before you run it...

    You can run this in SX-Sim if you change "TASKS RUN,100" to "TASKS RUN,1" and uncheck "Check RETI" in SX-Sim. Make sure you have the I/O panel open.

    Bean.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.




    Post Edited (Bean (Hitt Consulting)) : 1/29/2009 1:55:56 AM GMT
  • ZootZoot Posts: 2,227
    edited 2009-01-28 19:24
    Cool.

    I have a few comments off the top of my head about some big differences that could "trap" you, esp. if re-compiling an old SX/B program in 2.x:

    - the startup code is much different and much shorter, and the power-up vs. reset handling is different.

    - locations of pseudo-shadow registers for saving/restoring __PARAM variables during interrupts have moved; if you have hand-defined memory locations in an older program, check the locations on re-compile (if it matters vis a vis bank numbering, etc)

    You may want to duplicate or copy your existing SX/B 1.5x compiler so you can switch back. The 1.51x compiler is online, but it can be very useful to quickly switch back and forth when necessary.

    There are enough new features that I would hazard to guess the beta testers and Bean himself each have their "favorites", in the sense of what has proven to be the most useful, or coolest or whatever. For some, tasks are the niftiest thing. Ditto local variables for subs/funcs. IFUSES seems to be popular with folks who have large included libraries. I've been leveraging larger arrays, Word assignments in any locations, the freeing of registers if NOCODE/NOPRESERVE is used, top down banking (for code optimization), and all the new "primitive" commands like GETBIT, PUTBIT, CREAD, I2CSPEED and I2C clock-stretching compatibility, etc.

    In any case, remember it's a public beta -- not a "perfect" release, so have a heart vis-a-vis Bean's workload and Jon's documentation-in-progress.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php


    Post Edited (Zoot) : 1/28/2009 7:43:45 PM GMT
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2009-01-28 23:01
    Excellent job Bean and Jonny Mac. We've waited anxiously for the release. Parallax supports your efforts and we appreciate this milestone.

    Ken Gracey
    Parallax, Inc.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-01-29 03:42
    I figured that as an old school compiler (optimizer) writer (I was·worked on·the Prospero and TopSpeed code generators if you remember those) I'd have a look at some of the generated code for you.

    I've started simple so far :

    If you have a WORD data type and add one to it the code generated is:

    · ADD seconds_LSB,#1 & 255······ ;··· seconds = seconds + 1
    · ADDB seconds_MSB,C···········
    · ADD seconds_MSB,#1 >> 8······

    the simple and easy optimisation is that you check for the high-byte of the second constant add being zero. If it is (it often will be) then you save two words (33%)

    If you wish to get really cute you can special-case the increment case (it isn't that rare - consider i++) and us

    · inc seconds_lsb

    · addb seconds_msb,z

    I don't know to what extent performance really matters - but I figured 50% on a common case might be worth it ...
    HTH

    David
  • BeanBean Posts: 8,129
    edited 2009-01-29 04:32
    David,
    If you use "INC seconds" in SX/B I think you will get the optimized code.
    But your point is valid, that "seconds = seconds +1" could check for "+1" and generate the INC code.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • paolopaolo Posts: 17
    edited 2009-01-29 11:17
    Congratulation, this is an excellent improvement.

    It also seems to be more efficient in memory space:
    I've compiled the same program with the two SX/B revisions
    SX/B v. 1.51.03: program size = $FD2
    SX/B v. 2.0: program size = $F95
    The difference (61 words) is a lot of saved space for the SX chip.


    Just one comment: It would be nice to add a directive that allows the compiler to clear the watchdog timer in the time consuming commands.
    For instance, when the watchdog is enabled, commands like serin with no (or long) timeout cannot be used "as is", otherwise the watchdog resets the SX.

    Paolo.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-01-29 19:22
    Ok - the INC does generate the good code. The other optimization applies to all numbers under 255 though ...

    Another place we often found juice was in loops ... it is harder (I don't know if your compiler is one pass or two pass) but the case of a FOR loop where the loop variable is not used (or changed) can be treated specially. You can load the UPPER bound into the index variable and then use djnz; saves a couple of words and makes the loop faster.

    Start:
    mov no,#10
    loop:
    djnz no,Loop

    I've had a look at the code for the WORD case ... I'm pretty sure there was a trick there too ... but I cannot presently remember it (senior moment - sorry [noparse]:([/noparse] )

    David
  • ZootZoot Posts: 2,227
    edited 2009-01-29 20:46
    I believe SX/B is a top-down compiler, which means there might not be a way to check the inside contents of the for loop to see if the index is being used. Also variations would need to be taken into account for things like (for x = 3 to 100 step 3) even if the var isn't being used in the loop.

    Secondly, Bean -- I did not think pure optimization was your goal (or we'd have AUTOBANK ON|OFF and AUTOPAGE ON|OFF -- heh heh), though it seems you always have an eye towards optimzation ... ???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
  • BeanBean Posts: 8,129
    edited 2009-01-29 20:49
    David,
    It is a one-pass compiler.

    We try not to use any "tricks" in the compiled code so it can be easily followed by assembly newbies.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-01-29 20:54
    Zoot - as I said in my first post - I don't know if optimization is the goal. Obviously if it isn't then so be it. I am not trying to be mean or rude. However as as someone with experience in the field I figured I would offer some ideas ...

    With regard to your point about the step bounds and method; provided the variable is not being used they are irrelevant - you can pre-compute the number of iterations that will occur and set your outer variable accordingly.

    In fact the savings in the case you mention are even higher as a -3 is much more expensive than an INC.

    I don't think top-down (recursive decent) or bottom up (lalr et al) is really the issue. It comes down to whether they compile into some kind of intermediate representation and then generate code or whether they generate the code 'line-by-line'. If the latter then this form of 'global' optimisation is almost impossible - if the former then it is relatively easy.

    David
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2009-01-29 21:20
    Bean--

    "Clarity is king" for us newbies. Clarity, leading to ease of use and almost instant use, is also what made BASIC the most popular language on this particular planet.

    Everything that can be done to make assembler clear is a step in the right direction. In many cases, speed of execution should be sacrificed for clarity for it does no good to be fast if no one uses it due to the fact that it is difficult to learn. (Pardon the double negative!)

    It may be sacrilege, but I cannot help but believe the Propeller will never Spin financially due to the very issues mentioned above.

    Pardon my newbie preaching on this particular issue. But, in the broad sense of programming, a newbie I ain't.

    Great work.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-01-29 21:59
    Fair enough - if the goal is to pull people into the Assembly then the more straightforward translation makes sense.
    However [noparse]:)[/noparse] given I finally remembered I will just note the 2 word for-loop 'trick' - where you do -

    MOV seconds_LSB,#1 ; for seconds = 1 to 1000
    CLR seconds_MSB
    __FOR_seconds_1:

    INC seconds_LSB ; next
    ADDB seconds_MSB,Z
    CJB seconds_MSB,#(1000 >> 8),@__FOR_seconds_1
    CJA seconds_MSB,#(1000 >> 8),@__NEXT_seconds_1
    CJBE seconds_LSB,#(1000 & 255),@__FOR_seconds_1
    __NEXT_seconds_1:


    you can -
    mov no1,#4
    mov w,#1000-3*256+1
    skip
    oloop:
    mov w,#255
    mov no,w
    loop:
    djnz no,Loop
    djnz no1,oloop

    saves about 50% of the code and reduce timings somewhat ....
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-01-29 22:56
    At first glance this update looks awesome!! Thank you bean, et al. , for your diligent and no doubt hard work!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!

    Post Edited (Shawn Lowe) : 1/30/2009 6:33:54 PM GMT
  • T'SaavikT'Saavik Posts: 60
    edited 2009-01-30 00:07
    Heya bean,

    Thanks so much, really enjoying reading about sx/b 2.0. The STR and TASK commands are just %$#@ awesome!!!

    I found a small (but confusing) typo in your PDF. It is on page 10.

    For the "GET and PUT command examples you have this same sentence twice:
    "And you want to put values from an array into these variables. You can now use:"

    I think one of those should say get instead of put [noparse]:D[/noparse]

    Post Edited (T'Saavik) : 1/30/2009 12:14:40 AM GMT
  • BeanBean Posts: 8,129
    edited 2009-01-30 00:45
    Thanks T'Saavik,
    I actually saw a typo or two in there myself. I'll give it a once over before I post the next update.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • BeanBean Posts: 8,129
    edited 2009-01-30 12:34
    I have posted an updated version (2.00.08) in the original post at the top of this thread.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-01-30 15:31
    I can confirm the INC / ADD of a constant word is now optimal - thnx
  • JonnyMacJonnyMac Posts: 8,927
    edited 2009-01-30 16:35
    Just a note on the PDF: __GLOBAL should be __DEFAULT. This constant will be set to $00 for the SX20/28 and $10 for the SX48.
  • UghaUgha Posts: 543
    edited 2009-02-04 16:38
    Where is the proper location to request new features for a future version? I'm assuming its not this thread and I don't want to bother you with PMs Bean.
  • JonnyMacJonnyMac Posts: 8,927
    edited 2009-02-04 16:44
    It might be wise to get a really good grasp on current features before asking for new ones -- there are many ways to skin a cat (uh, write a program) and making compiler changes that require a lot of testing may not be the best overall solution. Just a thought.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-04 17:32
    Whilst that is a defensible position I would personally recommend that ALL suggestions should be welcomed at ALL times.

    You are correct it is the 'seasoned veterans' who are most likely to spot genuine problems in the products core capabilities; however it is the 'newbies' who are most likely to spot defects in usability, documentation and examples.

    In fact it is generally deemed good practice in the compiler world to insist upon at least a few 'virgins' to be included in the beta phase as they are the ones most likely to unearth problems in the 'out of the box' experience.

    David
  • BeanBean Posts: 8,129
    edited 2009-02-04 17:34
    Ugha,
    · I don't mind if you want to post them in this thread.

    · Suggestions and comments are welcome, demands are not tongue.gif

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ·The next time you need a hero don't look up in the sky...Look in the mirror.


    ·
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2009-02-04 17:55
    Bean--
    PDF: __GLOBAL should be __DEFAULT.
    Well, I REQUEST to know why JonnyMac charges nothing for this variable in an SX28 but wants ten bucks for it in an SX48! [noparse]:)[/noparse]

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-04 18:01
    Hmmm ... well one thing you may wish to consider .... but it is fairly huge so I didn't want to mention it .... but I think your stack may be upside down ...
    The advantages of having your stack go DOWN (rather than up) are -

    a) One local variable per procedure can be accessed without adding an offset
    b) If ever you want to check for stack underflow you are checking against 0 which is cheap
    c) For the user debugging the variable offsets go from 0 -> n rather than from $2f->$2f-n

    You may also wish to consider giving yourself NAMED (rather than enumerated) parameters to a subroutine; and then automatically copy them in at subroutine startup ... eg

    get_button func(byte button),byte

    func get_button
    'implicit button var byte declaration
    resu var byte
    'implicit button = __PARAM1
    resu = Buttons >> button
    resu = resu & 1
    return resu
    endfunc

    Maybe this just isn't very BASIC [noparse]:)[/noparse] <Spot the aging Pascal programmer [noparse]:)[/noparse] >

    David
  • UghaUgha Posts: 543
    edited 2009-02-04 18:27
    My request simply stims from a minor annoyance I've found while attempting to learn SX/B...
    However I think it may be better suited to an IDE change rather than a compiler update.
    I'm not sure who made the IDE so I'll just give my suggestion and see if it can be attempted.

    Is it possible to be able to realias some of the operators and syntax to better customize the IDE/language to each user?

    For example, I'm repeatedly attempting to use ( and ) for my if statements and attempting to use [noparse][[/noparse] and ] for array elements.
    Using <> for NOT instead of != is also an issue of minor annoyance for me.

    Is it possible to make some kind of preprocessor macro or IDE configuration available to allow us to realias such things to better
    suit programmers of other languages?

    I'm not complaining, I'm just making a request.

    JonnyMac: I completely understand what your saying and I will refrain from making suggestions for things I only half understand
    in the future.
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-04 18:49
    Actually the decrementing stack would also allow you to support stacks greater than 16 bytes at the cost of one extra instruction word for every local variable fetch if you have > 1 local variable (after the add of the variable offset you OR with $10)

    -- You would still be limited to at most 16 bytes per subroutine though
  • JonnyMacJonnyMac Posts: 8,927
    edited 2009-02-04 19:16
    I don't want to dissuade you, Ugha, because as David pointed out sometimes those that are ignorant of things ask really great questions. The danger -- in my opinion -- in customizing the language to individual preferences is that getting help from those that are using it as-is may become more difficult. Again, just thoughts.

    Now... just to demonstrate that I'm gifted and can talk out of both sides of my mouth (grin), SX/B does have a few operators that do the same thing, & and AND, for example -- maybe adding a few more is not out of the question. The possible danger, however, in adding C-like operators is that C programmers may want to start doing things like:

    tmpB1 = tmpB1 + tmpB2++

    Even if SX/B supported the post-increment operator this would be illegal in SX/B as SX/B only supports one expression per line.

    Keep in mind that Bean controls the compiler -- I just put it to use and have a great time!
  • David BaylissDavid Bayliss Posts: 58
    edited 2009-02-10 02:53
    Tiny nit2:

    a)

    Normally when an array in indexed you obviously have to restore the bank register afterwards (which you do with BANK 0).In the particular case where someone has @d the array after the zeroeth bank - ie -

    ports var byte(3) @$05

    you don't need to do the restore

    b)

    Presently you auto-spot an array index being used on the left and right and side of an equals and common up the index computation (very nice). eg -

    Ports(MyIdx) = Ports(MyIdx) | Value

    Unless Value is a constant you·temp-store it before the index computation (in _param1). You are obviously concerned that accessing Value from a variable will screw up the IND register you are computing. However, if the value is a variable from the first 32 bytes you can perform the same optimisation that you do for the constants. This saves you two instructions.

    David
  • Alex41Alex41 Posts: 112
    edited 2009-02-25 16:24
    Bean,

    I read the below in·the instructions for installing SX/B 2.0,

    "Unzip the attached file. Put the files in your C:\Program Files\Parallax Inc\SX-Key v3.2.92\Compilers\SXB directory (overwritting the existing files)."

    Will this overwrite my current version of SX/B 1.50?

    I'd like to keep SX/B 1.50 while learning 2.0



    Alex

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If at first you don't succeed, then skydiving is not for you.
  • ZootZoot Posts: 2,227
    edited 2009-02-25 16:35
    Alex -- copy/duplicate/move the contents of the SXB compiler folder elsewhere if you want to keep 1.5x.

    Remember also that the current non-beta release is always available in a sticky thread at the top of the SX forum, so you can always download whichever one you want and use it even if you don't have a local copy.

    Note that the current non-beta release is 1.51.03, not 1.50

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST

    1uffakind.com/robots/povBitMapBuilder.php
    1uffakind.com/robots/resistorLadder.php
Sign In or Register to comment.