Shop OBEX P1 Docs P2 Docs Learn Events
PASM Disassembler released - Page 2 — Parallax Forums

PASM Disassembler released

2»

Comments

  • jazzedjazzed Posts: 11,803
    edited 2009-04-23 18:45
    Shazz writes >>
    >> 1 ... but what means the LONG $7d2800d3 between the 2 HUB RAM r/w instructions ?

    Having an instruction or two between HUB instructions is common because of the way HUB instructions work.
    Having an instruction from a MOVS #addr, #val or MOVD #addr, #val is also common because of the Propeller pipeline.

    >> 2 ... for the moment so, if any effect is added to the instruction, I will print all the effects

    Most people are used to reading "TEST d, s wz" instead of "AND d, s wz,nr" though it wouldn't matter to an assembler.

    >> 3 ... question, would it have sense in the disassembler to replace all source/dest $001, $002... by var1, var2,..

    You could do this, but if #$xxx, etc... happens to be a location modified by code, the list will be hard to follow.

    >> For the loader, where is the coginit ? and so the hub address ? how do you know it's 0x07 ?

    I've explained this in this thread ... ... in great detail the last time through.

    As far as the loader goes, i that will be mostly a mystery to me until I run parts in Gear. But I'm too busy for that.

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


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • ShazzShazz Posts: 52
    edited 2009-04-23 19:46
    all my apologies Jazzed ! Yep you already answered me with all the details !!! I'm really embarassed !
    I guess I learn so much while writing this disassembler that my brains overflow and I cannot sort/tidy/stock everything correctly. So again, all my apologies.

    So the inital cog loading is ok now, understood, so long $018 gives all the info needed ($2c353535):
    - byte $018 (PUSH #cog) = $35 so PUSH 0 (the long word $00000000 is pushed to the stack)
    - byte $019 (PUSH #dst) = $35 so PUSH 0
    - byte $01A (PUSH #par) = $35 so PUSH 0
    - byte $01B (COGISUB) = $2C so COGISUB (I guess this bytecode opcode calls COGINIT)

    So thanks to you & hippy's doc I understood that PUSH and COGISUB are spin bytecode opcodes, so this long contains a spin program... (you're probably laughing (or crying)... but I did not get it before ! (yep you told me : 'First PUB start is important because Spin starts PASM in a COG ....'). I really thought it was possible to do that directly from PASM without using the cog 0 interpreter)

    Thanks for the other points... understood too. I was wondering what I can do to have the listing generated easier to read... so every idea is welcome. I'll read again the whole thread in case of something I forgot. (again).

    So yes, even if this disassembler is pretty useless to everybody here.... it helps me a lot [noparse]:)[/noparse]
  • jazzedjazzed Posts: 11,803
    edited 2009-04-23 20:11
    Not to worry [noparse]:)[/noparse] 2AM epiphanies are cousins of 11AM brainfarts.
    Added: An old friend of mine once told me he was afraid to learn anything else lest he forget something important.

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


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230

    Post Edited (jazzed) : 4/23/2009 9:06:18 PM GMT
  • kuronekokuroneko Posts: 3,623
    edited 2009-04-23 23:58
    Shazz said...
    For the loader, where is the coginit ? and so the hub address ? how do you know it's 0x07 ? and finished at 0x034 ? Managed by Chip's booloader ? by default coginit(0,0,?,?) ? so all the EEPROM content (at least the beginning) including the header was copied in the cog ? Then cells 0 to 6 are used for storing stuff ?
    - the loader is started by the SPIN coginit (coginit(0, 0, 0)).
    - so hub 0x0000 - 0x07FF is loaded into cog 0, i.e. the jump at location 0 gives you 0x07 as entry point
    - locations 0x02 .. 0x06 are later used for storage
    Shazz said...

    Turbulence loader :
    Disassembling 46 longs from address 0x1c to 0xd4
    Address     Cell        Data        Conditions     Opcode    Destination Source      Effects
    ---------------------------------------------------------------------------------------------------------
    $0000002c   $0000000b   $5c4c0019   IF_NC          CALL                  #$019
    
    $00000090   $00000024   $00000c24                  WRBYTE    $006        $024
    $00000094   $00000025   $7d2800d3   IF_Z           MUXNZ     $000        $0d3        WC NR
    
    


    Not all CALLs are CALLs, some of them are just JMPs (depending on the zcri bits). E.g. the instruction at cog 0x0B is a JMP. Also, cog locations 0x024 and 0x025 are data (there is an unconditional JMP at 0x023).
  • ShazzShazz Posts: 52
    edited 2009-04-24 07:56
    @Jazzed : thanks for your kindness, not sure I deserve it everyday ! [noparse]:D[/noparse]
    @kuroneko : thanks too ! Yep I was thinking of the call/jmp/jmpret opcodes, here is the new result, does it looks well ?

    not sure how to manage cog 0x24-0x25

    --------------- Header ---------------
    Clock frequency         : 1551630343
    Clock mode              : XTAL1 PLL16x
    Checksum                : $a6
    Object Start Address    : $0010
    Variables Start Address : $7fc4
    Stack Start Address     : $7fcc
    Initial program counter : $0018
    Initial stack pointer   : $7fd0
    ------------- End Header -------------
    
    Disassembling 46 longs from address 0x1c to 0xd0
    Address     Cog Cell    Data        Conditions     Opcode    Destination Source      Effects
    ---------------------------------------------------------------------------------------------------------
    $0000001c   $00000007   $a0fc060b                  MOV       $003        #$00b              
    $00000020   $00000008   $5cfc6830                  JMPRET    $034        #$030              
    $00000024   $00000009   $a0bc0a04                  MOV       $005        $004               
    $00000028   $0000000a   $5cfc5a2b                  JMPRET    $02d        #$02b              
    $0000002c   $0000000b   $5c4c0019   IF_NC          JMP                   #$019              
    $00000030   $0000000c   $a0fc0608                  MOV       $003        #$008              
    $00000034   $0000000d   $5cfc6830                  JMPRET    $034        #$030              
    $00000038   $0000000e   $a0bc0c25                  MOV       $006        $025               
    $0000003c   $0000000f   $84bc0c04                  SUB       $006        $004               
    $00000040   $00000010   $a0fc0606                  MOV       $003        #$006              
    $00000044   $00000011   $5cfc6830                  JMPRET    $034        #$030              
    $00000048   $00000012   $80fc0802                  ADD       $004        #$002              
    $0000004c   $00000013   $00bfe006                  RDBYTE    PAR         $006               
    $00000050   $00000014   $80fc0c01                  ADD       $006        #$001              
    $00000054   $00000015   $80fc4a01                  ADD       $025        #$001              
    $00000058   $00000016   $003fe025                  WRBYTE    PAR         $025               
    $0000005c   $00000017   $e4fc0813                  DJNZ      $004        #$013              
    $00000060   $00000018   $5c7c0022                  JMP                   #$022              
    $00000064   $00000019   $a0fc0604                  MOV       $003        #$004              
    $00000068   $0000001a   $5cfc6830                  JMPRET    $034        #$030              
    $0000006c   $0000001b   $a0bc0c04                  MOV       $006        $004               
    $00000070   $0000001c   $80fc0c01                  ADD       $006        #$001              
    $00000074   $0000001d   $a0fc0608                  MOV       $003        #$008              
    $00000078   $0000001e   $5cfc6830                  JMPRET    $034        #$030              
    $0000007c   $0000001f   $80fc4a01                  ADD       $025        #$001              
    $00000080   $00000020   $003c0825                  WRBYTE    $004        $025               
    $00000084   $00000021   $e4fc0c1d                  DJNZ      $006        #$01d              
    $00000088   $00000022   $e4fc0a0a                  DJNZ      $005        #$00a              
    $0000008c   $00000023   $5c7c0035                  JMP                   #$035              
    $00000090   $00000024   $00000c24                  WRBYTE    $006        $024               
    $00000094   $00000025   $7d2800d3   IF_Z           MUXNZ     $000        $0d3        WC NR  
    $00000098   $00000026   $00bc0424                  RDBYTE    $002        $024               
    $0000009c   $00000027   $58fc0500                  MOVI      $002        #$100              
    $000000a0   $00000028   $80fc4801                  ADD       $024        #$001              
    $000000a4   $00000029   $2cfc4808                  SHL       $024        #$008              
    $000000a8   $0000002a   $68bc4802                  OR        $024        $002               
    $000000ac   $0000002b   $623c482f                  AND       $024        $02f        WZ NR  
    $000000b0   $0000002c   $29d44801   IF_NZ          SHR       $024        #$001       WC WR  
    $000000b4   $0000002d   $5c540000   IF_NZ          JMP                   #$000              
    $000000b8   $0000002e   $5c7c0026                  JMP                   #$026              
    $000000bc   $0000002f   $ff000000                  WAITVID   $000        $000        WZ WC NR
    $000000c0   $00000030   $a0fc0800                  MOV       $004        #$000              
    $000000c4   $00000031   $5cfc5a2b                  JMPRET    $02d        #$02b              
    $000000c8   $00000032   $34fc0801                  RCL       $004        #$001              
    $000000cc   $00000033   $e4fc0631                  DJNZ      $003        #$031              
    $000000d0   $00000034   $5c7c0000                  JMP                   #$000              
    
    

    Post Edited (Shazz) : 4/24/2009 8:02:03 AM GMT
  • kuronekokuroneko Posts: 3,623
    edited 2009-04-24 08:05
    Shazz said...
    @kuroneko : thanks too ! Yep I was thinking of the call/jmp/jmpret opcodes, here is the new result, does it looks well ?

    not sure how to manage cog 0x24-0x25
    Don't worry, there will always be ways to fool a disassembler. So there isn't really much point trying too hard. As long as the hex value is available I wouldn't complain.

    And yes, that listing looks fine. Can you post the update please?
  • ShazzShazz Posts: 52
    edited 2009-04-24 11:51
    Cool [noparse]:)[/noparse]

    here is the 0.5 :
    tmpstore.free.fr/propeller/PASMDisassembler_v0.5.zip

    JMP/CALL/JMPRET fixed, header should be ok
    ex :
    java -jar PASMDisassembler.jar -s 0x01C -e 0x0D0 -h turbulence.eeprom > loader.asm
    
    
  • ShazzShazz Posts: 52
    edited 2009-05-01 15:47
    here is the 0.6
    tmpstore.free.fr/propeller/PASMDisassembler_v0.6.zip
    tmpstore.free.fr/propeller/PASM.syn.

    for free, TextPad editor PASM syntax.

    changelog : fixed bug with header, -o implemented.

    ex :
    java -jar PASMDisassembler.jar -h -s 0x01C -e 0x0D0 -o test.pasm turbulence.eeprom
    
    
Sign In or Register to comment.