Shop OBEX P1 Docs P2 Docs Learn Events
How to short size for PropBASIC — Parallax Forums

How to short size for PropBASIC

caskazcaskaz Posts: 957
edited 2010-03-27 01:48 in Propeller 1
Hi.

I translate atomic-watch from spin to PropBASIC.
Part of time-decode's program(spin) is 273Longs.
But part of time-decode's program exceed cog-memory by 66Longs.

It become 4Longs(exceed size) to use sub/func.

There are technique of shorting code-size?

Post Edited (caskaz) : 3/25/2010 1:47:49 AM GMT

Comments

  • Christof Eb.Christof Eb. Posts: 1,245
    edited 2010-03-25 11:26
    Hi, caskaz,

    you can either use the LMM option for PropBasic.

    Bean wrote how to use it in some thread·about the question which is the preferred language.



    Or you can try to squeeze your code.

    Your question is very very open, it is difficult to give you the right hints, without seeing the source code.

    I don't know "atomic-watch".
    Good luck, Christof
  • BeanBean Posts: 8,129
    edited 2010-03-25 12:03
    To use LMM append the word "LMM" to the end of the PROGRAM line. Like this:

    PROGRAM Start LMM

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-26 06:24
    Hi, Bean.

    Thanks for your reply.

    Where is "the end of the PROGRAM"?

    I insert "PROGRAM Start LMM" to "the end of the PROGRAM" .
    And then error message
    "Error: Symbol already allocation here __init"
  • BeanBean Posts: 8,129
    edited 2010-03-26 11:27
    No, don't add a new line, just put the "LMM" at the end of the line you already had that started with the "PROGRAM" keyword.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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
    ·
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-03-26 11:30
    Have a look at line 76 of the attached program.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • BeanBean Posts: 8,129
    edited 2010-03-26 15:18
    Jon,
    · I'm not sure if you are aware that you can replace
      FOR idx = 0 TO 6
        GETADDR BitMask, maddr
        maddr = maddr + idx
        RDBYTE maddr, mask
        LEDs = mask
        DELAY_MS LED_DELAY
      NEXT
    
    



    With this


      FOR idx = 0 TO 6
        RDBYTE BitMask(idx), mask
        LEDs = mask
        DELAY_MS LED_DELAY
      NEXT
    

    It generates the same code, but I think it's easier to follow what's happening.

    Bean



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-27 01:20
    Thanks Bean, Jon.

    I see about LMM.

    Attached file occure "monitor.spin(45,1) Error:Symbol already allocated here __Init" to compile.
    Sorry, ' cogstart PropClock --> cogstart monitor inside attached file
    I attached not-modified file by mistake.

    How does this solve?

    Post Edited (caskaz) : 3/27/2010 1:35:15 AM GMT
  • BeanBean Posts: 8,129
    edited 2010-03-27 01:32
    You can only use PROGRAM once.
    You don't use PROGRAM with task code.

    Just remove the PROGRAM line from your "TASK monitor" routine.
    If you want a TASK to use LMM you add LMM to the "TASK taskname" line. Such as "TASK monitor LMM". It is pretty rare that a task need to use LMM so it not used very often.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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
    ·
  • caskazcaskaz Posts: 957
    edited 2010-03-27 01:48
    Thanks Bean.
    I deleted PROGRAM with task code.
    Error has gone.

    Post Edited (caskaz) : 3/27/2010 7:33:52 AM GMT
Sign In or Register to comment.