Shop OBEX P1 Docs P2 Docs Learn Events
PASM Single Line SImulation — Parallax Forums

PASM Single Line SImulation

T ChapT Chap Posts: 4,223
edited 2014-01-21 16:34 in Propeller 1
I have always wanted to have a tool to test PASM instructions one-off without having to memorize or refer to the manual. As a learning and reference tool, I have an idea to create a library with an instruction name and simple formula that the app can use to perform a function on a single line of code and show the result.

Any thoughts on whether this is useful or not? Obviously I am thinking of a simple set of library functions, not the full scope of the language. I think it would be not too difficult to parse a text file for the instruction name and formula, use a drop down menu to load the function, the hit RUN to see the result. A few variables could sit below for easy recall via drop downs as well.
774 x 523 - 104K

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-01-14 14:15
    Nice idea! Do it in HTML and Javascript so it will run in a web browser.

    -Phil
  • ctwardellctwardell Posts: 1,716
    edited 2014-01-14 14:26
    This would be very useful.

    It would be really nice if you could enter and see the results as binary, decimal, hex, and ASCII.

    C.W.
  • T ChapT Chap Posts: 4,223
    edited 2014-01-14 14:30
    Using Xojo (formerly Real Basic) it is pretty simple to whip up so that the text file of library parts can live on your drive. My thoughts are to allow anyone to submit a text library part like:

    Instruction Equation Description

    cmp if x < y compare etc etc etc


    The parts can be accumulated into a text file and shared.

    "see the results as binary, decimal, hex, and ASCII." conversion for display is easy.
  • T ChapT Chap Posts: 4,223
    edited 2014-01-14 20:44
    Experimenting to see if this is doable as a casual endeavor. The text file for loading user contributed examples seems to be far too involved, so the everything may have to live under one roof.
    749 x 583 - 82K
  • ctwardellctwardell Posts: 1,716
    edited 2014-01-15 07:42
    Looks good.

    C.W.
  • T ChapT Chap Posts: 4,223
    edited 2014-01-21 12:40
    I have some updates on the idea for the single line simulator. The idea is to allow for a library of instructions(scripts) to be created one a time, the library parts are a la carte and will sit in a folder. The script can contain :

    -method of demonstrating the instruction including rules
    -method to pass the code a par from the caller
    -method to display a set of text notes for the instruction. limit on chars? maybe 100 words?
    -method to detect and show errors ( value input too big etc)
    -method to store some number of longs, words, bytes as in a DAT section, then call the values with dropdown menu near text field
    -method to run some number of back to back instructions

    Non working example:
    //
    // CMP script (not really)
    //
    // known variables:
    //
    // INPUT
    // inValue1 as Int32
    // inValue2 as Int32
    // inPar as Int32
    // inAdditionalPar1 as Int32
    // inAdditionalPar2 as Int32
    // inAdditionalPar3 as Int32
    // inAdditionalPar4 as Int32
    // inNR as boolean
    // inWC as boolean
    // inWR as boolean
    // inWZ as boolean
    //
    // OUTPUT
    // outDestValue as Int32
    // outReturnValue1 as Int32
    // outReturnValue2 as Int32
    // outReturnValue3 as Int32
    // outReturnValue4 as Int32
    // outC as boolean
    // outZ as boolean
    // outError as boolean
    // outErrorText as string
    
    
    if UInt32(inValue1) = UInt32(inValue2) then
        if inWZ then
            outZ = true
        end if
        if inWZ then
            outDestValue = UInt32(inValue1) + UInt32(inValue2)
        end if
    end if
    


    The desktop application (multi platform build) will allow the ability to select an instruction from a drop down, then inter some data and add any flags to update. The library part will contain the rules, error messages, etc, and the app will show the output with flags, plus show an errors plus error message that the user wants it to show.

    The app is currently 2450kb. The binary for the Xojo project is 173kb. The Xojo app building software is free and will build fully functional builds, but they build will time out after 5 minutes I think. I have the licensed versions. If anyone had an interest, I will post the Xojo binary and builds. My hope was that others would have an interest and a collection of scripts could evolve. I may include the multi viewable values (dec, hex, bin) later.

    The goal is to have it as a reference tool for myself for future needs as the use of PASM will be increasing.
    704 x 524 - 54K
  • kuronekokuroneko Posts: 3,623
    edited 2014-01-21 16:23
    FWIW, NR == !WR i.e. there is no point having both as a tick box unless they affect each other (e.g. selecting NR unselects WR).

    Are there any plans to import the instruction's default setting (e.g. cmp is NR, sub is WR, rdxxxx is always WR, wrxxxx is always NR)? Or is it more like pick the base instruction and make up your mind about NR/WR (cmp/sub, test/and, ...)?
  • T ChapT Chap Posts: 4,223
    edited 2014-01-21 16:34
    I have someone writing this for me that does not know ASM. I only know a little. My goal is you have the flexibility to do whatever with the script. We can make it do whatever you suggest. Today was more just testing the script process. Making changes is easy. The default should be displayed, even disabling any button that is not allowed to be checked. To be added: if there is no result, then the result text field will be removed. The script will control the visible options in the window per instruction.

    There needs to be a second set of instructions that can be ran after the first set, the second set containing the conditions ie if_z, if_c, if_ae etc. Maybe add a second drop down menu for the conditionals to keep them separate.

    I am experimenting with a link to a drop box to the xojo projecxt, PC build, script folder and scripts, Download zip, extract. Run App found under builds, click "Instruction", select folder for the scripts. Click on script. Check WZ and WC to test, change the values and hit run.

    https://www.dropbox.com/s/lc3u2ei922dcz86/PasmSim.zip
    866 x 552 - 47K
Sign In or Register to comment.