Shop OBEX P1 Docs P2 Docs Learn Events
Examples and Manual for GEAR emulation Tool — Parallax Forums

Examples and Manual for GEAR emulation Tool

StefanL38StefanL38 Posts: 2,292
edited 2007-05-27 16:36 in Propeller 1
Hello

some time ago i downloaded the GEAR emulation Tool

but some how i do not understand how it works

is there an update with some kind of readme or manual?

could somebody post an example-file

and some screenshots what SHOULD happen by clicking on ? yeah ! what?

what is the plugin-function good for

do i have to "plugin" the application or is it a standard function of .net not used here?

if i load a binaryfile and start clicking step instruction there where a lot of lines frame_call_returns
what does this mean


to me who had really nothing to do with .net Applications i do not now what to do to get a result
where i can learn from

could somebody help me?

thank you very much

best regards

Stefan

Comments

  • mirrormirror Posts: 322
    edited 2007-05-21 22:49
    Stefan,

    I have found the Gear emulation tool to be a fantastic aid to the development of some reasonably complex code. Having said that, I can understand that you're frustrated with the lack of documentation. I'll try and answer just two of your questions:
    1) What are the plugins good for?
    2) What's all the frame_call_XXX stuff?

    1) The plugins can be used to simulate *any* sort of external device. It really is *any*, the only catch being how complicated the device is which could result in a lot of code. Personally, I haven't programmed any plugins. I haven't even used any plugins. I just use the emulator to step though my code.

    2) The frame_call_xxx stuff is a bytecode that tells the spin interpreter to prepare for a function call. It causes the spin interpreter to set up stack frames and so on. In the case of the "abort" variants it also makes sure that the environment is left in a sensible state if the code aborts - which may be several nested levels of function calls down. The frame_call_xxx variants are always used in conjuction with a call bytecode.

    I've re-written a lot of the spin opcodes for my own benefit. I've included a copy of my current variation of Gear. Have a look and see if it makes more sense. The is VERY BETA. The conversion of opcodes is not complete, but you may find it more friendly for the majority of spin programs.

    Brief explanation of opcodes:

    The spin interpreter accesses objects in four memory areas:

    Mem : which is in the main memory.

    Loc : which is on the local stack frame.

    Var : which is the variable space for the specific object (also Var variables)

    Obj : which is the memory offset of the object itself (also Dat variables)

    I've used a forthish notation for accessing and storing each of the memory areas:

    word Var[noparse][[/noparse]0]@ : Fetch the word at Var address 0, and put it on the locals stack.

    Var[noparse][[/noparse]1]! : Get the long from the locals stack and store it at Var address 1.

    byte Loc[noparse][[/noparse]0]@ then (xx) : Fetch the byte from Local address 0, keep a copy of it on the stack, then perform operation xx and place the result·back into Local address 0.

    &Obj[noparse]/noparse :·Get the address of the n'th long in the object space, where n'th is determined by the value on the top of the locals stack.

    That's a dangerous enough getting started guide. If you have more questions, then ask.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
  • StefanL38StefanL38 Posts: 2,292
    edited 2007-05-22 11:52
    Ok so i do not need plugins

    anyway

    could you post a VERY SUPER-SIMPLE example SPIN-Prg als Sourcecode and the binary file

    i tried it with example 1 from the manual


    PUB Toggle
    dira[noparse][[/noparse]16]~~
    repeat
    !outa[noparse][[/noparse]16]
    waitcnt(3_000_000 + cnt)


    compiling with F8

    saving the binary file

    loading it into GEAR

    choose register Logic probe

    when i click some dozen times on step instruction nothing happens on logic probe

    if i click on run the level changes to high

    and then stays high all the time
    even if i change time frame and tick mark in a wide range 0,0001-0,01-0,1,1,10

    so PLEASE could you describe this example with ALL details to get a result
    showing IO-PIN16 changing low-high-low?

    i don't like counting sandcorns of all beaches all over the world
    tell me the country, and the city of which beach !
  • mirrormirror Posts: 322
    edited 2007-05-22 23:24
    Change your code to:
    PUB Toggle
    dira[noparse][[/noparse]16]~~
    repeat
      !outa[noparse][[/noparse]16]
      waitcnt(1_000 + cnt)
    
    

    and you'll be laughing.

    Note: there are two changes (both critical to Gear - one critical in general):

    1) INDENTATION IS CRITICAL
    The code as you included·it did not have the indentation after the repeat. Indentation is the begin-end of Pascal, it's the {-} of c, c++ and c#. If your code is not indented correctly - it will not work. The amount of indentation is not important - I normally use two spaces, but you could use a tab.

    2) Gear emulation is sloooooooow.
    I normally use it to test snippets, concepts and interactions. Often my bit of test code looks quite different to the final code. To do a waitcnt(3_000_000 + cnt) you might as well go and watch some·other higher speed phenomena (like continental drift) to pass the time. You'll see I've changed it to waitcnt(1_000 + cnt).

    I've found this·emulation·tool to be the most useful debugging aid so far. It's more that once that I've stepped through a bit of assembly code - thought the Gear emulation was faulty - and ended up learning more about the Propeller.

    So once again, to view this emulation:
    1) Compile the above program using the Proepeller Tool (hit F8).
    2) Save the binary file
    3) Open the binary file in Gear
    4) I normally maximize the emulation window.
    5) Select the logic probe tab.
    6) Press the split button (which moves the logic probe to the bottom of the screen).
    7) Change the Time Frame (seconds) to 0.005, and press the Update button.
    8) Scroll the Logic probe so that you're looking at P16.
    9) Click on the Cog 0 tab.
    10) Press Run.

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
  • potatoheadpotatohead Posts: 10,255
    edited 2007-05-27 16:36
    If you've got long loops to wait through, choose one of the COG tabs that isn't active. The screen updates take a lot of time. GEAR performance is 2-3x when not having to update the screen.

    If you are on a HYDRA, or your own prop setup, the TV plugin is written for the demo board. All that is needed is to change the pins being watched.

            Voltage =
                ((pins[noparse][[/noparse]24] == PinState.OUTPUT_HI) ? 1 : 0) +
                ((pins[noparse][[/noparse]25] == PinState.OUTPUT_HI) ? 2 : 0) +
                ((pins[noparse][[/noparse]26] == PinState.OUTPUT_HI) ? 4 : 0);
    
    
Sign In or Register to comment.