Shop OBEX P1 Docs P2 Docs Learn Events
PASM simulator / debugger? — Parallax Forums

PASM simulator / debugger?

Agent420Agent420 Posts: 439
edited 2009-09-10 15:51 in Propeller 1
I hesitate to post a request for what must surely have been discussed numerous times, but the terms 'simulator' and 'debugger' simply return too many threads to hunt though...

I'm having some trouble trying to determine why one of my hacked vga drivers is not functioning correctly.· I browsed through the stickies and just downloaded PASD, which I will try later at home.· I would almost prefer a simulator where I can more easily test code fragments, but a good debugger will do for this task.

I have tried Gear, but beyond being rather limited in functionality, it apparently has some quirks and does not correctly simulate some elements properly - for one, it does not seem to decrement cog system registers such as par, which is used in several of the vga drivers for a loop counter.·Also, it is a real pain single stepping through waitcnts and such.

I have also tried to use pPropellerSim, but I just can't seem to get it to work for some reason... it just keeps hanging when I start the project.

ViewPort is nice, but apprently only debugs Spin code.

So... are there any other pasm simulators / debuggers recommended to try?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Post Edited (Agent420) : 9/9/2009 6:55:17 PM GMT

Comments

  • jazzedjazzed Posts: 11,803
    edited 2009-09-09 18:55
    BMA now offers realtime run to breakpoint. I still need to write a friggin' GUI though [noparse]:)[/noparse]

    For the time being Ariba's PASD is probably your best bet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve

    Propeller Tools Post Edited (jazzed) : 9/27/2009 8:50:52 PM GMT
  • SRLMSRLM Posts: 5,045
    edited 2009-09-09 19:45
    I learned PASM with PASD. It's quite nice. propeller.wikispaces.com/PASD
  • AleAle Posts: 2,363
    edited 2009-09-09 20:28
    Agent:

    try this version please.

    Use the option "compile to cog" from the editor. (waitvid is not implemented!, sorry)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
  • mirrormirror Posts: 322
    edited 2009-09-09 22:10
    Agent420 said...
    I hesitate to post a request for what must surely have been discussed numerous times, but the terms 'simulator' and 'debugger' simply return too many threads to hunt though...

    I'm having some trouble trying to determine why one of my hacked vga drivers is not functioning correctly. I browsed through the stickies and just downloaded PASD, which I will try later at home. I would almost prefer a simulator where I can more easily test code fragments, but a good debugger will do for this task.

    I have tried Gear, but beyond being rather limited in functionality, it apparently has some quirks and does not correctly simulate some elements properly - for one, it does not seem to decrement cog system registers such as par, which is used in several of the vga drivers for a loop counter. Also, it is a real pain single stepping through waitcnts and such.

    I have also tried to use pPropellerSim, but I just can't seem to get it to work for some reason... it just keeps hanging when I start the project.

    ViewPort is nice, but apprently only debugs Spin code.

    So... are there any other pasm simulators / debuggers recommended to try?

    Have you tried the version of GEAR at: http://forums.parallax.com/showthread.php?p=839483

    One of the example plugins included with GEAR is a VGA Monitor - which allows testing of video drivers. The biggest ownside of GEAR is that it is very (very) slow. On my system it takes minutes to draw a single frame of video output.

    As to accuracy of the simulation, I believe it is as correct as practically possible. PASM code and all the related timers and counters should be cycle accurate (as far as I know). Spin code runs faster (less clock cycles elapsed) on GEAR that in real hardware, but this is not generally a problem as you can't really write time critical code in Spin.

    To single step through a waitcnt, put a breakpoint on the line (or instruction) following it.

    GEAR is best at simulating snippets of code. Although having said that, I've done some fairly large simulations.
  • Agent420Agent420 Posts: 439
    edited 2009-09-10 12:53
    I was using Gear v1.11 obtained from SourceForge, which appears out of date...· I note version v09_06_05·does seem to have several improvements, so I'll give it another look; I'm not sure the older version had the breakpoints, or I did not see them referenced.

    Regarding the par register issue I mentioned earlier, I'm not sure it falls under bug status as the Propeller manual does specify those registers are read only, but I note that Chip does use some of the special purpose registers as generic variables in several of his vga driver demos, and they are in fact 'writable'.· In VGA 1280x1024 Tile Driver v0.9, part of the VGA_Tile_Driver_Demo2 app included with the Prop Tool, the par register is used several times as a loop counter.· Even the most recent version of Gear does not modify that register; I created a simple test program that uses the par register as Chip does to loop 10 times, but Gear never finishes the loop and inspecting the par $1F0 address shows no changes to the value.

    This was causing much confusion when I was attempting to use Gear to debug my code, which is based on these drivers.

    On a side note, this is my first real foray into pasm, and though these vga drivers are rather complex they make use of a lot of cool tricks and are worth studying.

    I did not get a chance yet to play with PASD, hopefully I will later tonight.

    Thanks for the input.
    Propeller Manual said...
    attachment.php?attachmentid=73717

    Note 1: For Propeller Assembly, only accessible as a source register (i.e.,
    [font=Parallax,Parallax size=2][font=Parallax,Parallax size=2]mov [/font][/font][font=Times New Roman,Times New Roman][font=Times New Roman,Times New Roman]dest[/font][/font], [font=Times New Roman,Times New Roman][font=Times New Roman,Times New Roman]source[/font][/font]). See the Assembly language sections for [font=Parallax,Parallax size=2][font=Parallax,Parallax size=2]PAR[/font][/font], page 331; [font=Parallax,Parallax size=2][font=Parallax,Parallax size=2]CNT[/font][/font], page 282, and [font=Parallax,Parallax size=2][font=Parallax,Parallax size=2]INA, INB[/font][/font], page 297.

    ' vga 1280x1024 driver ' Build line display code
                            mov     par,#xtiles
    :wv                     mov     linecode+0,linecode_wv
                            add     :wv,d1
                            add     linecode_wv,#1
                            cmp     par,#1          wz
    :sc     if_nz           mov     linecode+1,linecode_sc
            if_nz           add     :sc,d1
            if_nz           add     linecode_sc,d1
                            djnz    par,#:wv
    



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Agent420) : 9/10/2009 1:34:05 PM GMT
    633 x 47 - 1K
  • Agent420Agent420 Posts: 439
    edited 2009-09-10 15:31
    Ale said...
    Agent:

    try this version please.

    Use the option "compile to cog" from the editor. (waitvid is not implemented!, sorry)

    Thanks - this seems to work better, I am able to load and step a small test program.

    Is it correct that I should have replaced the existing pPropellerSim.jar file in the \dist folder?· It did not run from where I saved it, perhaps a path issue.

    Anyway, I note that the par register issue described above also fails here, resulting in a "Destination is Read Only" error.· This is probably not a big deal as the par register typically would not be used as a destination (other than Chip pulling some clever tricks in his vga code)... most programmers would probably not use these registers in that manner; it just happens that I was using his vga driver as a foundation and it contained those references.

    edit -

    It is also curious that the Propeller Tool compiler allows the use of par as a destination, perhaps because it in fact can be.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Agent420) : 9/10/2009 3:36:12 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2009-09-10 15:39
    The actual PAR register can't be used as a destination. Neither can any other registers marked "read-only" in the documentation. When you use them in the destination field of an instruction, the underlying memory location is actually used rather than the hardware register. It's a tricky way to get a few extra memory locations in a cog program. Instruction fetches use the actual memory location as well.
  • Agent420Agent420 Posts: 439
    edited 2009-09-10 15:51
    I learn something new everyday ;-)

    And as·I mentioned, those vga drivers are chock full of programming tricks.

    I am nearly ready to post the first go around of my Prop InVGAgers app, and I'll include additional comments that describe some of these (as best I can figure them out smile.gif )...· I think I've done some clever hacking of the cursor coding, and certainly his vga drivers make great templates for synchronized multi-cog apps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Post Edited (Agent420) : 9/10/2009 4:34:04 PM GMT
Sign In or Register to comment.