Shop OBEX P1 Docs P2 Docs Learn Events
Propeller simulator in java — Parallax Forums

Propeller simulator in java

AleAle Posts: 2,363
edited 2008-07-02 07:49 in Propeller 1
Hallo everyone,

I was working in a Propeller Simulator and as it sort of works, I decided to share it with you all (I was going to share it with you anyways roll.gif ).

It needs java (re or sdk) v1.5 to run. I tested it under linux, it should work under other oses also, ykmv.

I know that GEAR exists, but sadly It needs m$ soft and It is unusable under Mono (after you install a sh*t load of libraries), and has plenty of bugs, and the dissasembler needs a bit of work (The rest is good!).

Why another simulator ?, why not ?, my goal is an assembler development tool, compiling/downloading/testing with the real hardware, is a bit too inconvenient. A *good* simulator helps a lot.

Have fun.

Comments (avoid trashing comments, please), patches and suggestions (constructive ones) are welcome.

NOTE: It has bugs, it is not finished, it makes no coffee, I hope it does not leaks memory.

Gru
«1

Comments

  • LeonLeon Posts: 7,620
    edited 2007-07-26 15:01
    Just downloaded it and tried it on my laptop (WinXP). It seems to run OK but I couldn't find any suitable files to try it on, I'll create one and try it properly. It's rather slow on my laptop, but that's just Java.

    Leon


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • LeonLeon Posts: 7,620
    edited 2007-07-26 17:49
    I've assembled a simple program with propasm, but it won't load into the simulator. I don't get an error message. The program is blinker.txt, one of the propasm examples.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • AleAle Posts: 2,363
    edited 2007-07-26 18:24
    Leon,

    you have to compile the file and create a .binary from the Hex view in the Propeller Tool. Spin code is discarded and only a DAT section is loaded. (In my laptop, pentium M 1.7, with 1G RAM runs ok).
  • potatoheadpotatohead Posts: 10,260
    edited 2007-07-26 18:27
    Open Propeller tool

    Open target file to be simulated.

    Hit f8, then bonk on the "show hex" button.

    The screen will get wider.

    The function you need is on the right, "save binary file".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
  • LeonLeon Posts: 7,620
    edited 2007-07-26 18:44
    Thanks, both of you. I just simulated a simple program OK.

    I found a bug. I'll PM Ale about it, with some suggestions.

    Leon


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • AleAle Posts: 2,363
    edited 2007-07-26 21:14
    My email is in the included sources (for Netbeans IDE v5 or 5.5), but here it is anyways : hppacito (at) yahoo dot com (replace accordingly :-D)
  • AleAle Posts: 2,363
    edited 2007-07-31 15:11
    Hallo everyone,

    as promised, another update:

    Built-in Editor (no syntax highlight) with load/save.

    Built-in Compiler (use compile button), (does not save compiled code, but it saves source as text files)

    Binary files can be transferred to the editor, use the "copy to editor" item from the Edit menu.
    Labels are placed for jumps/calls/data

    Dxxx : data label
    Lxxx : control transfer label

    Multiple bug fix, compiler/disassembler/simulator.

    Have fun

    ps: Is anybody testing this ?

    edit: to reflect new additions

    Post Edited (Ale) : 8/1/2007 12:06:07 PM GMT
  • AleAle Posts: 2,363
    edited 2007-08-03 12:28
    Well,

    another update:

    - Memory dump.
    - Plain binary load/save (only the first 496 longs)
    - Symbols in assembler view, editor, memory dump

    A compiled file (in assembler view) can be transferred to the editor, appropriate symbols will be created for Data and Labels (as described previously), this edited, later compiled file can now be saved as a plain binary file (not a Propeller Tool compiled file, i.e. with header and a bit of Spin built in), and reloaded.

    I Attempted to do syntax highlight, but sadly I did not succeed yet. Javax.swing is IMHO sometimes utterly complicated, the rest is plain complicated.

    Well, have fun.

    Post Edited (Ale) : 8/3/2007 12:37:19 PM GMT
  • BradCBradC Posts: 2,601
    edited 2007-08-05 04:34
    Ok, maybe I'm doing something pretty dumb. I'm on Linux and I've got both jre1.6 and 6 installed (I've tried both with the same result).

    brad@bkmac:~/pPropellerSim/dist$ /usr/lib/jvm/java-1.5.0-sun/bin/java -jar "pPropellerSim.jar"
    Exception in thread "main" java.lang.NullPointerException
    at javax.swing.text.StyleConstants.setForeground(StyleConstants.java:544)
    at ppropellersim.AsmEditor.<init>(AsmEditor.java:46)
    at ppropellersim.PropellerFrame.<init>(PropellerFrame.java:80)
    at ppropellersim.Main.main(Main.java:42)

    Did I mention I have absolutely zero experience with Java? I have just installed netbeans also as I thought I might be able to open the
    project dir in that and sort it out myself, but alas I appear to be incapable of getting it going [noparse]:([/noparse]

    I know I'm doing something dumb. Care to smack me with a clue-bat ?
  • AleAle Posts: 2,363
    edited 2007-08-05 06:53
    Thanks BradC,

    the build was broken. You can either compile it with the IDE, so load the project, set it as main project and use the option "Clean and Build main project" from the Build menu.
    The project is on "/home/pacito/prg/projects/pPropellerSim" on my dev machine. You may need to "resolve references".

    or

    You can download it again, I rebuilt it and uploaded it again.

    Sorry for the inconvenience smile.gif

    Ale
  • MightorMightor Posts: 338
    edited 2007-08-05 07:00
    Hi there Ale,

    Have you considered hosting the project on a place like SourceForge or Berlios? It takes about 2-3 days to apply for project space on SF. I have no experience with starting a new project at Berlios, I've only ever worked on someone else's project there.

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
    | "Wait...if that was a compliment, why is my fist of death tingling?"
    | - Alice from Dilbert
  • BradCBradC Posts: 2,601
    edited 2007-08-05 08:40
    Feeling a bit silly.. I've had a poke around that page and can't find it anywhere.

    brad@bklaptop2:~$ wget http://www.geocities.com/hppacito/ppropellersim/pPropellerSim-0.4.zip
    --12:41:36-- http://www.geocities.com/hppacito/ppropellersim/pPropellerSim-0.4.zip
    => `pPropellerSim-0.4.zip'
    Resolving www.geocities.com... 66.218.77.68
    Connecting to www.geocities.com|66.218.77.68|:80... connected.
    HTTP request sent, awaiting response... 404 Not Found
    12:41:41 ERROR 404: Not Found.
  • LeonLeon Posts: 7,620
    edited 2007-08-05 08:41
    How do I download the new version?

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • AleAle Posts: 2,363
    edited 2007-08-05 12:02
    Well,

    seems that somehow, geocities ate my file, it said "uploaded successfully" but the file was not there !, very strange.

    The link at the top of the thread points to the latest version, I tested and works (ykmv).

    Migthor, I haven't thought about that yet -), I'll see what can I do, good suggestion.

    Post Edited (Ale) : 8/5/2007 12:09:55 PM GMT
  • BradCBradC Posts: 2,601
    edited 2007-08-05 13:05
    Ok, got it and now have it working

    waitcnt does not wait for the appropriate CNT value (or warp it which would be just as good).

    If the sim hits an rdlong it goes off into never never land for a while (100% cpu)

    A problem I have with gear also, it'd be lovely to be able to externally set bits in the INA register to simulate inputs.

    I could also see uses for being able to alter the COG memory values on the fly, so you can tweak values in loops while they are
    running and fun stuff like that. Maybe even change the processor state between steps (well, state of C and Z perhaps, this proc does
    not really *have* a lot of state)

    Other than that, I think I'm going to find this quite a bit of fun to play with.
  • AleAle Posts: 2,363
    edited 2007-08-05 15:31
    Somewhere in the readme I said that waitxx do not work yet.
    rdlong goes to nirvana ? I'll see that also.

    I did not implement it yet, but in the memory dump view, the contents could be modified.

    I was thinking also on some way to modify the state of inputs, maybe some descriptive file of waveforms like this PIC simulator i saw once or the WebISE by XIlinx. I'm still thinking how to implement it, but something for sure will come smile.gif

    I have also to improve the debugger, with breakpoints usw. smile.gif

    thanks

    Post Edited (Ale) : 8/5/2007 3:36:42 PM GMT
  • AleAle Posts: 2,363
    edited 2007-08-08 13:16
    Another update:

    Symbols in the Assembler view, for labels (not only data). The symbols in the editor now are used in the assembler view.

    Memory Dump, contents of the memory can be changed on-the-fly, with Hexa numbers (without $), or with an assembly instruction ! (I wanted to do that for a long time).
    In this later case, symbols can be used but not defined:

    my_sym add data1,data2

    will generate the code 80bc0604, but the newly defined symbol my_sym is going to be ignored. If someone wants it, just ask, can be easily added.

    RDxx/WRxx were fixed, and WAITCNT is now implemented. Some bug fixes for instructions were also done.

    Breakpoints are implemented and (I believe) functional, just not available, because of some strange behaviour of pop-up-menus !, I'll fix that soon.

    some more descriptions are in available in /pPropellerSim/doc/readme.txt

    (did I tell you that the keyboard of the Macbook drives me nuts ?, the lack of useful keys and the unfamiliar key-combinations...)
    Have fun

    Ale
  • AleAle Posts: 2,363
    edited 2007-08-13 11:05
    Hallo everyone,

    Another release of pPropellerSim (v0.6)

    This release adds/fixes:

    - Breakpoints (Read/Write/execute)
    - Run, runto, stepover
    - jump instructions
    - dissasembler
    - Symbols in assembler view
    - conditions are displayed in a shortened version of (I believe) my creation, to save space for the labels

    Now, as the project is hosted by Sourceforge, as kindly suggested by Mightor, it can be accessed at:

    http://sourceforge.net/projects/ppropellersim

    And I can be contacted at ale500 (
  • MightorMightor Posts: 338
    edited 2007-08-13 11:42
    Ale,

    Grats on the SourceForge project approval! I hope you didn't have to wait too long to get it. I think it might be a good idea to mention on the SF main page of your project that it requires Java v1.5 to run. I know you mention it in the OP, but you never know if people are going to link to that page from outside these forums [noparse]:)[/noparse]

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | Any sufficiently advanced technology is indistinguishable from magic.
  • AleAle Posts: 2,363
    edited 2007-08-13 11:58
    Mightor,

    They approved it in two or three days, but took me a while little longer to add something useful to the release smile.gif. I mention the requirement of Java 1.5 in the readme file, maybe I should also in the Release notes that can be seen in the download page. Do anybody read that ? smile.gif, Now a home page for the project should be made... well, more to do. I hope people would find it useful... I do smile.gif.

    Next release will contain:

    Hub memory inspector, with the possibility to modify the contents (and load/save), and more importantly: expressions in the assembler. Now only numbers or symbols are handled, so add 3+4,5 will not work. That is going to be a big leap forward. And last, will come syntax highlight, if I ever discover how to make it work.

    Thanks again

    Ale
  • AleAle Posts: 2,363
    edited 2007-08-15 12:56
    Ok,

    I got syntax highlight working. Is not the great addition, but it works yeah.gif

    I will add:

    cog memory dump and load/save.
    configuration (last position, lat used files).
    Expressions in the assembler smilewinkgrin.gif

    Ale
  • AleAle Posts: 2,363
    edited 2007-08-25 07:08
    Another update (v0.7.1):

    - Cog memory dump with load/save/fill/search function (in separate frame).
    - Configuration, last used files, last used directories, position, colors (can only be modified, for the time being, in the .conf file).
    - Compiler/editor bug fixes
    - Better documentation

    Enjoy !
  • BradCBradC Posts: 2,601
    edited 2007-08-25 13:09
    I've had it do odd things if I repeatedly click the run button or step while it's waiting for waitcnt..

    It tends not to stand up well to general UI abuse.

    Example..
    If i click the run button twice I lose the ability to stop it, step it or trace it.

    Love the ability to edit the registers on the fly, 'specially the ina reg in cog memory. Very useful.

    It's shaping up very nicely! Great work!
  • AleAle Posts: 2,363
    edited 2007-08-25 17:25
    BradC:

    I'll see to the "UI" abuse. I tend to ignore it, because... I treat it with respect smile.gif !, I should also just press all keys together to see what happens... that would be fun

    thanks
  • BradCBradC Posts: 2,601
    edited 2007-08-26 06:57
    You'll excuse the "abuse" of your software. I've been writing software for 1d10t's for so long that I tend to have motor memory for deliberately doing things that may break software as part of my UI testing runs.

    Generally when I've broken and fixed as much as I can, I give it to a friend of mine who is a software QA dude, and he breaks even more things [noparse]:)[/noparse]
  • AleAle Posts: 2,363
    edited 2007-12-10 14:02
    Hei, everyone.

    I made some enhancements to the simulator, usabiliy enhancements. And corrected a couple of bugs. Descriptions are as usual in the Changelog and readme.txt files in the doc directory. The release notes explain how to run it. Well it did not change smile.gif

    Most notable:
    Breakpoints are now set in the Asm view instead of the Cog memory dump.
    It now says where the cursor is, useful to see where the errors are once compiled.
    CNT returns the right value when read
    A Long constant now can have values greater than 511 smile.gif

    The source for the programmer are also included, but disabled, because so far I did not make them work :-(, java io is a bit ... flacky :-(

    Have fun.

    Ale
  • SapiehaSapieha Posts: 2,964
    edited 2007-12-10 17:19
    Hi Ale

    Registers window to small.

    Se attachment

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.

    Sapieha
    917 x 515 - 130K
  • kittmasterkittmaster Posts: 77
    edited 2007-12-10 17:35
    one thing i'd like to add is that the debugger needs the option to change the colors. The line of execution is dark brown while the rest of the text is very close in color contrast. Hard to see where the current line of execution is.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-10 17:48
    Sapieha said...

    Hi Ale

    Registers window to small.

    Se attachment

    Registers contents are typically displayed in hex, that way you can allocate a fixed width of screen to display it's contents, this would·deal with Sapieha's complaint.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • mosquito56mosquito56 Posts: 387
    edited 2007-12-10 18:20
    Hate to sound totally dumb but:
    · How do I run the java program on a windows xp platform? The only experience I have with java is running a· page that is java enabled. Might be a good idea to put basic windows install txt?
    · Also, I couldn't get the newer version to download. I notice there were 0 downloads on the sourceforge page.
    · I am currently using GEAR and am looking for something a little faster for video and T.V.
    Don

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Mosquito: An animal which buzzes in your ear and never stops. He may byte you, he may nibble you, but you will know you were bit.
Sign In or Register to comment.