Shop OBEX P1 Docs P2 Docs Learn Events
OSX/Win32/Linux Spin Compiler-0.15.3 — Parallax Forums

OSX/Win32/Linux Spin Compiler-0.15.3

BradCBradC Posts: 2,601
edited 2010-05-03 14:48 in Propeller 1
Q : Bugs ?
A : Almost certainly.

Have at it [noparse]:)[/noparse]

I guess I should put something here..
Brads Spin Tool Compiler v0.13 - Copyright 2008,2009 All rights reserved
Compiled for i386 Linux at 15:08:42 on 2009/02/19
Program Usage :- bstc (Options) Filename[noparse][[/noparse].spin]
 -a            - Create Propeller object archive zipfile
 -b            - Write .binary file
 -c            - Write .dat file for C-Compiler (Drops a <filename.dat> file)
 -d <device>   - Device to load to (Default : /dev/ttyUSB0)
 -e            - Write .eeprom file
 -f            - Double download baud rate
 -h            - Display this help information
 -l            - Generate listfile
 -L <Lib Path> - Add a library path or file holding library path(s) to the searchpath (may be used multiple times)
 -o <filename> - Output [noparse][[/noparse].list/.eeprom/.binary/.zip] Filename (Defaults to input Filename without .spin)
 -O <options>  - Optimise Binary (HIGHLY EXPERIMENTAL!!!!!)
    a          - Enable all optmisations (Be careful! No, really)
    b          - Bigger constants (should be slightly faster at the expense of code size)
    c          - Fold Constants
    g          - Generic "safe" size optimisations for smaller/faster code, however not what the Parallax compiler will generate
    r          - Remove unused Spin Methods
    u          - Fold Unary "-" Operations on Constants if it will make the code smaller
 -p[noparse][[/noparse]012]       - Program Chip on device (-d)
    0          - Load Ram and run
    1          - Load EEProm and shutdown
    2          - Load EEProm and run
 -s            - Intersperse source in listfile (use with -l)
 -w[noparse][[/noparse]012]       - Error/Warning level - 0 - Errors only / 1 - Error/Warning / 2 - Error/Warning/Information (Default 0)





0.02 - Optimiser - Added 'c flag for _experimental_ SPIN constant folding "-Oc"
- Zipper/Listfile - Improvements to the ASCII object tree (list and zipfiles)
- Optimiser - Added 'a' - All flag.
- Optimiser - Added 'g' flag for Generic optimisations. Currently shortens STRING() absolute addresses if possible,
- also does not expand relative addresses from $FF to $100 on start of Lookup/dn/case statements.
- Optimiser - Added 'b' flag to supress inverting bigger constants and adding a '!' mathop. Should be slightly quicker.
- Optimiser - Added 'u' flag. Parallax compiler does not do unary constant reduction on CONSTANT() or constants from objects.
- If it will make for shorter code overall, this will. Not actually seen it happen in real life yet though.
- Linker - Fixed a bug causing object PBASE to be located incorrectly in the listfile (and @@@ below the top object).
- Linker - Fixed check for final binary object size with _free and _stack from top object. (Thanks tpw_man)
- Zipper - Removed requirement for temporary file/dir creation.
- Compiler - -L will now take a directory or a file to read paths from. Any combination/number of each may be used.

0.03 - Optimiser - Had the 'b' flag hooked to 'u' instead.. oops..
- Assembler - Fixed obscure bug resolving local labels in DAT blocks (Thanks stevenmess2004).
- Tokeniser - Fixed replacement of tabs with 8 Spaces.
- Tokeniser - Fixed properly dealing with Linux/MacOS/Windows differing CR/LF combinations.
- Assembler - Added error for source / dest exceeding $1FF.
- Compiler - Added BYTECODE() to allow hackers to insert user-defined bytecode into a spin method.

0.04 - Arch - Major architectural rework to allow insertion / control from BST IDE.
- Assembler - Added listfile output as close to homespun as possible (Thanks mpark)
- Tokeniser - Rewrote Unicode conversion routines (Now accepts Windows UTF16 / Plain ASCII / UTF8 with Propeller Characters)
- Tokeniser - Changed stucture to support pre-processing defines (not implemented)
- Zipper - Changed zipname date/time to sort better (Thanks Harrison)
- Release - Not individually but as part of bst

0.05 - Compiler - Fixed crash bug in repeat x from y to z where (x) was undefined - (Thanks Bamse)
- Compiler - Fixed a crash bug in displaying circular object references - (Thanks OBC)
- Release - Not individually but as part of bst

0.06 - Downloader - Re-worked detection/download to solve some glitches - (Thanks KeithE)
- Release - 20/10/2008

0.07 - Downloader - Fixed the bit I broke rushing 0.06 out the door.

0.08 - Assembler - Fixed bug in list file generation.

0.09 - Tokeniser - Fixed bug with consecutive unary operators
- Tokeniser - Fixed crash with mismatched parentheses (Thanks Oldbitcollector)
- Linker - Fixed overflowing object relocation table (Thanks agodwin)
- Tokeniser - Major speedup (Regression test went from 35 minutes to 4 minutes)

0.10 - Compiler - Changed error message on CON block fatal error (Thanks heater)
- Compiler - Prevented COG registers being used in CON block (Thanks heater)
- Compiler - Re-worked @@ operator to behave same as Parallax Compiler (Thanks heater)
- Interface - Internal improvements to bst interface

0.11 - Tokeniser - Improved unicode converter (15-40% compiler speedup)
- Tokeniser - Properly report missing brackets (TChapman)
- Compiler - Pre-cache case-insensitive symbol names. Massive speedup on complex files
- Compiler - Fixed error with While ~Variable (Originator)
- Compiler - Fixed missing object error message to properly give location
- Compiler - Sped up compilation of "repeat x from a to b" by over 60%
- Linker - Fixed pre-compile duplicate object detection

0.12 - Compiler - Fixed endless loop with invalid OBJ block
- Compiler - More optimisation
- Tokeniser - Properly report incomplete strings
- Tokeniser - Correctly set BlockID on Parentheses and Index tokens (Ale)
- Compiler - Disallow () beginning a line (TChapman)
- Compiler - Don't allow variables without operators "x << 6" is not a valid spin statement (TChapman)
- Compiler - Included files in DAT section are reported as too big rather than crashing if they overflow object memory (Oldbitcollector)
- Compiler - Fixed endless "Unknown Token EOL" when encountering an unresolved symbol in CASE statement (linuxvolts)
- Compiler - Allow address operator in REPEAT loops (Oldbitcollector)
- Archiver - Archive DAT section included files (Oldbitcollector)

0.13 - Loader - Was loading the entire variable section in addition to the code
- Loader - Re-wrote detect/download code, please see http://forums.parallax.com/showthread.php?p=754527 for the gory details
- Loader - Option to double download speed (-f)
- Tokeniser - Fixed mis-handling of invalid numbers
- Tokeniser - Properly truncate numbers over 32bits
- Compiler - nasty crash bug on invalid code ("cogstop cogid" in DAT section)
- Compiler - Crash if OBJ had same name as a CON or VAR symbol (Oldbitcollector)
- Compiler - Crash if unable to open source or data files (hinv)
- Compiler - Ensure all source and data files are opened read-only (hinv)
- Compiler - Allow @ after size specifier in dat section (Oldbitcollector)
- Compiler - Fix case without colon (Chuck Rice)
- Compiler - Unary after repeat (Lawson)
- Compiler - DoubleFree crash in list file generator on "Binary too Large" Error (agodwin)
- Compiler - Detect duplicate local symbols (agodwin)
- Compiler - Properly diffentiate between := and = in Spin blocks (agodwin)
- Compiler - Don't allow external references to PRI symbols (agodwin)
- Compiler - Add information and warning reporting
- Compiler - Warn on JMP/DJNZ without #
- Compiler - Warn when data value exceeds data size (byte $123)
- Compiler - Warn when trying to coginit/cognew a Spin method in another object
- Compiler - Warn on ORG/FIT/RES with no parameter
- Compiler - Warn on data after RES in cog
- Compiler - Information for unused Spin methods and Spin global variables
- Compiler - Experimental - Use a single "Return" in each eliminated spin method rather than no bytecode at all
- Compiler - Properly generate a ".dat" file of the first compiled DAT section for use with a C compiler (-c)

0.14 - Compiler - Properly create DAT excerpt for C compiler (-c)

0.15 - Compiler - Report () in SPIN Method Line as an error just like Parallax compiler does (Bamse)
- Compiler - Make raw float numbers in SPIN expressions a Warning rather than an Error
- Tokeniser - Report any const larger than 32 bits as an error like Parallax compiler
- Optimiser - Make single byte mask constants simple single byte constants (quicker and no size penalty)
- Compiler - Fixed reporting error locations in strings (Andy Valencia)
- Compiler - Brown paper bag bug in parsing CON block '#define' (Heater)
- Tokeniser - #define/#undef/#ifdef/#ifndef/#elseifdef/#elseifndef/#else/#endif/#warn/#info/#error (Enable with -Oa or -Ox)
- Beware! These are global across objects and passed down to sub objects. Use #undef if you want to reset one
- Compiler - List file line numbers off by one (Ale)
- Assembler - Warning for FIT had reversed mathematics (heater)
- Base - Fixed console redirection on Windows (Oldbitcollector)
- Compiler - Added information in list to report number of longs free between ORG and FIT (heater)
- Compiler - "I :=" - Is not valid Spin
- Assembler - "DAT flibble byte 123, 456," - Is not valid (Ale)
- Compiler - "VAR long fred," - Is not valid
- Compiler - @@ is not valid in constant expressions (Ale)
- Assembler - Crash when expecting PASM effect (heater)
- Compiler - Accept Unary operator after SPIN memory command X := X.Byte - 1 (Chris Merck)
- Assembler - $ in Dat section damaging data alignment on non-long data
- Assembler - @$ Caused a math stack underflow and locked up compiler (heater)
- Assembler - fred long 0[noparse][[/noparse]first - second] was not properly warning non-long aligned data (heater)
- Compiler - ClkFreq was wrong for RCSLOW
- Compiler - Failed to emit bytecodes when Trunc() Round() Float() used directly in Spin operations
- Compiler - Trap divide by zero in constant evaluator
- Compiler - -Or now removes all traces of unused SPIN methods
- Compiler - Report compiled code size

0.15.1 - Compiler - Fixes/Improvements to redundant SPIN method eliminator

0.15.2 - Compiler - Overly large memory allocations in DAT were causing compiler to appear to spin infinitely (Ale)

0.15.3 - Compiler - Properly report location of errors when referencing other objects (Ale)

www.fnarfbargle.com/bst/bstc/

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Release the hounds!

Post Edited (BradC) : 7/20/2009 12:20:55 AM GMT
«13456

Comments

  • SapiehaSapieha Posts: 2,964
    edited 2008-09-29 10:55
    Hi BradC.

    Very fine listing to understand Byte Code.
    Thanks.

    Ps. It is only PASM in same clas for at have fine tool

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • BradCBradC Posts: 2,601
    edited 2008-09-29 10:58
    PASM listing is coming. I wanted to get it out the door first [noparse]:)[/noparse]
    Features can be added later.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-29 12:16
    Hi BradC.

    One suggestion to -L option.
    Istead of Lib Patth have Filename.path .... Plain text file with nested path type.

    C:\Program\Propelre Tools
    D:\Propeler\MyLibs
    etc....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • BradCBradC Posts: 2,601
    edited 2008-09-29 12:45
    Hmm.. in my IDE I use an ini style file.

    Windows it's in the registry, Mac and Linux use ~/.bst.ini

    As the IDE and Compiler share common code I did think about having the compiler read the .ini file in addition to the command line variables.

    Personally as a command line junkie I tend to like simple, clear options though.

    The other thing you need to remember is this is cross platform, so oddities like the direction of the slash, colons and semi-colons in path names and other issues do need to be taken into account.

    Like the suggestions though. Thanks for the feedback.

    Just remember windows users, spaces in the path or filenames mean you need to put quotes around the entry.
    -L "C:\Program Files\MyLib"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • AleAle Posts: 2,363
    edited 2008-09-29 13:00
    Seems to be fine (linux 386, Ubuntu 7.04)

    If you do not select either binary or eeprom output it compiles anyways (it tells so) without saving anything smile.gif
  • BradCBradC Posts: 2,601
    edited 2008-09-29 13:26
    Absolutely.. a quick compile only for syntax check [noparse]:)[/noparse]
    You need to specify -b/-e/-px for it to drop a file or load a prop. You can just specify -l/-p and have it only drop a .list file too. It's all completely independent.

    While I'm here..

    Here's the difference eliminating unused spin methods makes on propeller_demo.spin

    test1 is a straight compile
    test2 is -Or (unused spin method elimination)
    test3 is -Oc (constant folding)
    test4 is -Orc (both)

    Not huge..

    -rw-r--r-- 1 brad brad 8268 2008-09-29 17:25 test1.binary
    -rw-r--r-- 1 brad brad 8196 2008-09-29 17:25 test2.binary
    -rw-r--r-- 1 brad brad 8248 2008-09-29 17:26 test3.binary
    -rw-r--r-- 1 brad brad 8176 2008-09-29 17:26 test4.binary

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • AleAle Posts: 2,363
    edited 2008-09-29 13:37
    Constant folding (assuming it is i := 3 +2 -> i := 5) is very welcome. I'm working with the original spin interpreter (to run spin in my simulator) and the amount of work per opcode is quite big there, so saving a push/pop and operation... sppeds everything up !, good good.
  • BradCBradC Posts: 2,601
    edited 2008-09-29 13:40
    Yep.. constant folding is not in the 0.01 version though.. I only wrote it up for testing this afternoon. It is working though so it'll be in the next release.

    On the propeller demo, it removes 8 constants and 8 operations.. not significant, but still a saving.

    This compiler has compiled the entire obex and is absolutely bit for bit compatible with the output of propellent, inclusive of floating point constants, so I'd be interested to see how it fares. It's been _extensively_ tested on valid spin code, but it may well explode with a segfault on some syntax errors.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • AleAle Posts: 2,363
    edited 2008-09-29 13:44
    Can I translate it to java ? (or should I build my own compiler :-( ?) As I see it now there is full support for the propeller without PropellerTool/propellent !, now they (Parallax) will have to play catch up with you guys! (maybe they will implement everything we asked for..., that probably will have to be done by us, though).
  • BradCBradC Posts: 2,601
    edited 2008-09-29 13:53
    Linking bstc
    12652 lines compiled, 1.4 sec

    I'm not sure you _want_ to translate it to Java. (No, honestly.. I'm not much of a code architect and even less of a programmer)

    To be honest, the reason I wrote it the way I did was to get as far _away_ from the whole VM thing as possible and go to native binaries.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • BaggersBaggers Posts: 3,019
    edited 2008-09-29 13:56
    nice 1 BradC, I especially like the constant folding [noparse]:)[/noparse] and so look forward to the next rev.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

    ·
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-29 14:19
    Hi BradC.

    You said
    "" Just remember windows users, spaces in the path or filenames mean you need to put quotes around the entry.
    -L "C:\Program Files\MyLib" ""

    It is more complicated that so.
    In English version it is.
    "C:\Program Files\MyLib" And In Swedish it is "C:\Program\MyLib"

    I have not thinking me .INI files but Project oriented "MyProjekt.path" file that I can write in plain Text editor maybe if its name is same as TOPobjekt.spin "TOPobjekt.path" compiler run it automatic as -L else I specify its name.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • BradCBradC Posts: 2,601
    edited 2008-09-29 14:32
    Ale said...
    Constant folding (assuming it is i := 3 +2 -> i := 5) is very welcome. I'm working with the original spin interpreter (to run spin in my simulator) and the amount of work per opcode is quite big there, so saving a push/pop and operation... sppeds everything up !, good good.

    I'd love some input on what is quicker here Ale.

    There are a few spots where the Parallax compiler does stuff I'd have thought was slower in the name of smaller bytecode.
    Unary or binary inversion of constants for example rather than a 4 byte constant load.
    I'd love to know if it's not just quicker to load the constant whole rather than the constant and then mathop.
    For example..
    6 X1 := (-53)
    Addr : 0024: 38 34 : Constant 1 Bytes - 34
    Addr : 0026: E7 : Math Op !

    Which evaluates to FFFFFFCB. Is it quicker to load 4 bytes (a 5 byte op in total) or 1 byte and a math op (a 3 byte op in total)

    If we had profiled spots like this it would be easy to add a switch for "compatibility(code size) or speed"

    Looking at the way multi-byte reads are done in the interpreter source, I guess the math op has to be read and completed in about ~10 instructions to actually be faster.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • mparkmpark Posts: 1,305
    edited 2008-09-29 15:14
    Kudos, Brad!
  • BradCBradC Posts: 2,601
    edited 2008-09-29 15:39
    mpark said...
    Kudos, Brad!

    Cheers Michael!

    I'm having <ahem> "problems" getting homespun to run my regression tests.

    The "problem" (which won't likely manifest itself on windows) is that the search for other objects appears to be case sensitive on Linux.
    (I had to build a case insensitive file search to work around this issue)

    brad@bklaptop2:/media/raid3/Viridian-Work/Prop-Projects/Stuff$ mono ~/Desktop/homespun017.exe -L/media/raid3//Viridian-Work/Prop-Projects/Library DemoBoard_001.spin
    Homespun Spin Compiler 0.17
    parsing DemoBoard_001.spin
    parsing DS1307Obj.spin
    parsing basic_i2c_driver.spin
    DS1307Obj.spin, line 41: Could not find file "/media/raid3/Viridian-Work/Prop-Projects/Stuff/basic_i2c_driver.spin".
    i2cObject : "basic_i2c_driver"
    ^
    brad@bklaptop2:/media/raid3/Viridian-Work/Prop-Projects/Stuff$ ls
    Basic_I2C_Driver.spin DS1621Obj.spin MD23Object.spin PS2_Controller.spin USB_lowlevel_011.spin
    Chase_001.spin i2cDemoApp.spin One_wire_P_001.spin PS2_Spin.spin USB_Serial_009.spin
    CRC16_001.spin i2cObject_v2_1.zip One_wire_P_002.spin _README_.txt usbtenki-1.6.tar.gz
    Debug_PC.spin LCD_16x2_4Bit.spin One-Wire-Test.spin SD21Object.spin
    DemoBoard_001.spin mcp23016Object.spin pcFullDuplexSerial.spin Simple_Numbers.spin
    DS1307Obj.spin MD22Object.spin PS2_Controller_Serial_demo.spin SRF08Object.spin

    Not sure how you'd go about fixing this though..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • AleAle Posts: 2,363
    edited 2008-09-29 16:57
    That sequence takes ~312 cycles take or give 10 cycles wink.gif
    Loading a 4 byte constant takes...232 cycles, again take or give 10.
    It is shorter but not necessarily faster !
  • BradCBradC Posts: 2,601
    edited 2008-09-29 17:05
    Ale said...
    That sequence takes ~312 cycles take or give 10 cycles wink.gif
    Loading a 4 byte constant takes...232 cycles, again take or give 10.
    It is shorter but not necessarily faster !

    This was my point. If using a 4 byte constant can buy 80 cycles (give or take) then there are speed gains to be had by using "larger" code in some instances.

    It's all about the speed baby!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • tpw_mantpw_man Posts: 276
    edited 2008-09-29 20:20
    That is AWESOME! It loads the HC4LED demo PERFECTLY! Congratulations on creating this! jumpin.gif Now I will go and find a spin syntax for TextWrangler.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
    tongue.gif
  • tpw_mantpw_man Posts: 276
    edited 2008-09-29 21:09
    I just had an idea. Would it be possible to have 'macro' assembly instructions? There could be two types. One where the assembly code is inserted 'in line' and another where a call is inserted, like for large macros. Type 1 (in line) example:

    #MAKE MACRO T1 push [noparse][[/noparse]val]
    sub stkptr, #4
    rdlong [noparse][[/noparse]val], stkptr
    #END MACRO
    
    



    This macro would be titled push and have one parameter, [noparse][[/noparse]val]. It would be called like this: push whatever. That would push whatever onto the stack according to the macro.

    Type 2 (call) example:
    #MAKE MACRO T2 shiftout [noparse][[/noparse]val], [noparse][[/noparse]pin]
    mov mask, #1
    shl mask, [noparse][[/noparse]pin]
    or dira, mask
    mov temp, #8
    :loop
    shr [noparse][[/noparse]val], #1 wc
    muxc outa, mask
    djnz temp, #loop
    #END MACRO
    
    



    This macro would have a call inserted in its place and a name and ret automatically made.

    Would it be feasible?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
    tongue.gif
  • tpw_mantpw_man Posts: 276
    edited 2008-09-29 21:19
    Bug Report:
    The OSX version seems to just plain crash when the compiled binary is too large.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
    tongue.gif
  • BradCBradC Posts: 2,601
    edited 2008-09-30 04:52
    tpw_man said...
    Bug Report:
    The OSX version seems to just plain crash when the compiled binary is too large.

    Can you send me a zip file of source that makes it crash please?

    brad at fnarfbargle dot com

    Nevermind.. found it. Fixed in the next release.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!

    Post Edited (BradC) : 9/30/2008 6:29:33 AM GMT
  • BradCBradC Posts: 2,601
    edited 2008-09-30 07:31
    tpw_man said...
    I just had an idea. Would it be possible to have 'macro' assembly instructions? There could be two types. One where the assembly code is inserted 'in line' and another where a call is inserted, like for large macros. Type 1 (in line) example:

    #MAKE MACRO T1 push [noparse][[/noparse]val]
    sub stkptr, #4
    rdlong [noparse][[/noparse]val], stkptr
    #END MACRO
    
    



    This macro would be titled push and have one parameter, [noparse][[/noparse]val]. It would be called like this: push whatever. That would push whatever onto the stack according to the macro.

    That part would be fairly achievable. I wonder if we'd be better off providing hooks for a pre-processor rather than building it into the compiler?
    tpw_man said...

    Type 2 (call) example:
    #MAKE MACRO T2 shiftout [noparse][[/noparse]val], [noparse][[/noparse]pin]
    mov mask, #1
    shl mask, [noparse][[/noparse]pin]
    or dira, mask
    mov temp, #8
    :loop
    shr [noparse][[/noparse]val], #1 wc
    muxc outa, mask
    djnz temp, #loop
    #END MACRO
    
    



    This macro would have a call inserted in its place and a name and ret automatically made.

    Why would you want a Macro to a subroutine? Sounds like a way of overcomplicating things to me. You already have the subroutine there, just place a call to it.
    Or am I missing something obvious?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • BradCBradC Posts: 2,601
    edited 2008-09-30 09:45
    Sapieha said...
    Hi BradC.


    It is more complicated that so.
    In English version it is.
    "C:\Program Files\MyLib" And In Swedish it is "C:\Program\MyLib"

    I have not thinking me .INI files but Project oriented "MyProjekt.path" file that I can write in plain Text editor maybe if its name is same as TOPobjekt.spin "TOPobjekt.path" compiler run it automatic as -L else I specify its name.

    You can now specify a text file after -L and it will load all the paths in that file.
    Hope this solves your problem [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • SapiehaSapieha Posts: 2,964
    edited 2008-09-30 11:04
    Hi BradC..

    It was fantastic.
    With that solution I can have Project oriented Path files.
    (Win XP tends to have very large Path)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • tpw_mantpw_man Posts: 276
    edited 2008-09-30 11:51
    BradC said...
    tpw_man said...
    I just had an idea. Would it be possible to have 'macro' assembly instructions? There could be two types. One where the assembly code is inserted 'in line' and another where a call is inserted, like for large macros. Type 1 (in line) example:

    #MAKE MACRO T1 push [noparse][[/noparse]val]
    sub stkptr, #4
    rdlong [noparse][[/noparse]val], stkptr
    #END MACRO
    
    



    This macro would be titled push and have one parameter, [noparse][[/noparse]val]. It would be called like this: push whatever. That would push whatever onto the stack according to the macro.

    That part would be fairly achievable. I wonder if we'd be better off providing hooks for a pre-processor rather than building it into the compiler?
    tpw_man said...

    Type 2 (call) example:
    #MAKE MACRO T2 shiftout [noparse][[/noparse]val], [noparse][[/noparse]pin]
    mov mask, #1
    shl mask, [noparse][[/noparse]pin]
    or dira, mask
    mov temp, #8
    :loop
    shr [noparse][[/noparse]val], #1 wc
    muxc outa, mask
    djnz temp, #loop
    #END MACRO
    
    



    This macro would have a call inserted in its place and a name and ret automatically made.

    Why would you want a Macro to a subroutine? Sounds like a way of overcomplicating things to me. You already have the subroutine there, just place a call to it.
    Or am I missing something obvious?
    Well it would be nice, because normally you would like have to do mov pin, #2 mov val, #"T". This would do that and expand it to a call in one call.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    I am 1011, so be surprised!


    Advertisement sponsored by dfletch:
    Come and join us on the Propeller IRC channel for fast and easy help!
    Channel: #propeller
    Server: irc.freenode.net or freenode.net
    If you don't want to bother installing an IRC client, use Mibbit. www.mibbit.com
    tongue.gif
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-30 12:05
    Nice work Brad !

    Here is some instruction counts (timing) from the different methods:
    (yyy) = the pasm instructions executed (need to x4 to get cycles, plus allow for hub loss in rdbyte/wrbyte)

    I have also included the results from my version of the intepreter.
     
    bytecode        count          clusointerpreter
    3B 12 34 56 78  (44)           (36)             (can't compile 3B FF FF FF CB)
    65              (32)           (25)
     
    38 34           (29)           (21)
    E7              (35)           (21)
    65              (32)           (25) 
     
    37 21           (33)           (23)
    37 00           (33)           (23)
    EC              (44)           (27)
    65              (32)           (25) 
     
    
    38 05           (29)           (21)
    65              (32)           (25) 
     
    


    ·Discovered a bug in my interpreter when I did these tests :-(
  • BradCBradC Posts: 2,601
    edited 2008-09-30 13:55
    Cluso99 said...

    I have also included the results from my version of the intepreter.


      
    
    bytecode        count          clusointerpreter 
    
    3B 12 34 56 78  (44)           (36)             (can't compile 3B FF FF FF CB) 
    
    
    



    You can now [noparse]:)[/noparse]

    -Ob will prevent the inversion and should write a full 4 byte constant.

    |===========================================================================|
    Spin Block ABCD with 0 Parameters and 1 Extra Stack Longs. Method 1
    PUB ABCD | X1
    |===========================================================================|
    5 X1 := $FFFFFFCB
    Addr : 0018: 3B FF FF FF CB : Constant 4 Bytes - FF FF FF CB
    Addr : 001D: 65 : Variable Operation Local Offset - 1 Write
    6 X1 := (-53)
    Addr : 001E: 3B FF FF FF CB : Constant 4 Bytes - FF FF FF CB
    Addr : 0023: 65 : Variable Operation Local Offset - 1 Write
    Addr : 0024: 32 : Return

    actually.. -Ob *would* have done it had I not bolloxed up the trigger flag. You will need to use -Oa or -Ou for it to do this until I release the next version.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-30 15:17
    Brad,

    I was just looking at the Interpreter code. The loop to read bytecodes in the 38-3B bytecodes loops in 5 instructions per extra byte, which means that 3 wasted instructions (cycles x4) waiting for hub access per byte. So therefore 4 x 3 = 12 extra instructions would need to be added to my counts above. My interpreter uses the same instructions here also - it is my decoding which is faster in this section.

    There would also be some loss on the 34-37 bytecodes also.

    The 3B xx xx xx xx is still quicker.
  • AleAle Posts: 2,363
    edited 2008-09-30 21:03
    (I also found some bugs in my simulator when doing the tests smile.gif, well more use brings down the bugs ! But now I have my complete, if not yet fully functional, LMM development "platform" for the prop, at last !
  • stevenmess2004stevenmess2004 Posts: 1,102
    edited 2008-10-01 08:03
    Looks cool,

    I get the following when I try to compile RGW_JTC_TinyBasic_010.spin from the hydra cd

    steven-messengers-computer:~ stevenmessenger$ /Users/stevenmessenger/Downloads/bstc.osx -l /Users/stevenmessenger/Documents/Projects/Propeller/Hydra/demos/JT_Cook/T_Basic_Mod_08_06_07/RGW_JTC_TinyBasic_010.spin 
    Brads SpinTool Compiler v0.02 - Copyright 2008, All rights reserved
    Compiled for i386 Darwin at 12:04:01 on 2008/09/30
    Loading Object RGW_JTC_TinyBasic_010
    Loading Object RGW_JTC_HTBasic_Support_010.spin
    Loading Object RGW_keyboard_iso_010.spin
    Loading Object RGW_HTBasic_Constants_010.spin
    Loading Object JTC_char_display_001.spin
    Loading Object rem_tv_014.spin
    Loading Object JTC_char_engine_001.spin
    Loading Object RGW_HTBasic_Constants_010.spin
    Math Stack Underflow!
    Math Stack Underflow!
    
    


    And then it doesn't do anything and doesn't return to the command line.
Sign In or Register to comment.