Shop OBEX P1 Docs P2 Docs Learn Events
Propeller II programing questions to Chip — Parallax Forums

Propeller II programing questions to Chip

SapiehaSapieha Posts: 2,964
edited 2013-08-03 06:32 in Propeller 2
Hi Chip.

Is That possible/correct?
        setspa       #$0                 'Set SPA
        SETINDA      #MySpace            'Set INDA
        REPS         #16,#1              'REPS 16 times one instruction
        pusha        INDA++ 




Will be periodically updated with My most recent
Prop2_Docs.txt.pdf
Updated 2013_01_10
«134567

Comments

  • ctwardellctwardell Posts: 1,716
    edited 2012-12-17 10:50
    I think you need one instruction between the REPS and the instructions you want to repeat. It does not count in the number of instructions to repeat.
    As far as using INDA++ with pusha I haven't looked at that yet.

    C.W.
  • cgraceycgracey Posts: 14,206
    edited 2012-12-17 11:22
    Sapieha wrote: »
    Hi Chip.

    Is That possible/correct?
            SETSPA       #$0                 'Set SPA
            REPS         #16,#1              'REPS 16 times one instruction
            SETINDA      #MySpace            'Set INDA
            PUSHA        INDA++ 
    
    
    

    You bet! Just recode it as C.W. pointed out (I made the change in your code above).
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-17 11:25
    Hi Chip

    Thanks

    I'm sure more that questions come in this thread
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-17 13:20
    Hi Chip.

    I posted that in other thread -- But I think it was not so nice described -- So You maybe don't saw that.

    My Question are in code -- If You have any more question on that ask Please.

    It is possible to You made that extra directive in PNut
    '
    '  ORGHUB    Directive    Question
    '
    ' Space betwen 00E80 and part 1in object file with 00000000 (Long's NOP)
    
        orghub $01000        'Part 1
    '
    DAT
        org 
    ' 
    ' Corrected by Chip
    '
            SETSPA       #$0              'Set SPA
            REPS         #16,#1           'REPS 16 times one instruction
            SETINDA      #PC8080          'Set INDA 'MOVED DOWN FOR correct function of REPS
            PUSHA        INDA++
            RET
    '
    ' End part 1
    ' Space betwen part 1 and part 2 filled in object file with 00000000 (Long's NOP)
    '
    '
    ' Start of part 2
    '
        orghub $01100        'Part 2
    '
    DAT
    PCBYTES    long    65535            'FFFF
    PC8080     long    0
    '
    ' End part 2
    
    
    
    
  • cgraceycgracey Posts: 14,206
    edited 2012-12-17 13:38
    Yes, I will do this probably in the next week, or so. I want to make the compiler map go from $00E80 to $1FFFF, and then make a loader to transfer it all in. The assembler needs to be augmented so that hub addresses can be declared. This way, you could build the whole hub RAM image and load it.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-17 13:39
    Hi Chip.


    BIG Thanks.


    Ps. Don't change HEX files behavior Thanks --- Good for blobs for all types of compilers.


    cgracey wrote: »
    Yes, I will do this probably in the next week, or so. I want to make the compiler map go from $00E80 to $1FFFF, and then make a loader to transfer it all in. The assembler needs to be augmented so that hub address can be declared.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-17 13:54
    Hi Chip.

    One more addition if possible.

    Directive that places last in Source file
    Initial Start ---- INITSTART XXXXX

    That Loader can execute at end of loading.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-17 16:12
    Hi Chip
    Hi All

    Chip if it will not be to much --- Can You revise this PDF -- And maybe make suggestions What more needs in it.
    Eles what errors You have found.

    Thanks

    Frist post updated with my most recent ---- Prop2_Docs.txt.pdf
    http://forums.parallax.com/showthread.php?144683-Propeller-II-programing-questions-to-Chip&p=1151411&viewfull=1#post1151411

    As complete as I can find on forum all parts.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-12-17 21:02
    Sapieha: Just been looking at your pdf and noticed these things...

    No CNT register in Block Diagram [64 bits]
  • cgraceycgracey Posts: 14,206
    edited 2012-12-17 21:26
    Cluso99 wrote: »
    Sapieha: Just been looking at your pdf and noticed these things...

    No CNT register in Block Diagram [64 bits]

    I've been working on documentation for the 64-bit hub counter today. Should be ready tomorrow.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-12-17 23:55
    cgracey wrote: »
    I've been working on documentation for the 64-bit hub counter today. Should be ready tomorrow.
    Thanks Chip. Looking forward to this.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 19:31
    Hi Chip.


    Why PUSHA #1 compiles but POPA #1 not in PNut
    Look in code
    '
    '  POPA    instruction    Question
    '
    DAT
        org                'HUB            Long
    '                      1 2 3 4         4 3 2 1
    '
            PUSHA        PCBYTES
            PUSHA        #1
            PUSHA        INDA++
        RET
    '
    ' Read XX longs from CLUT to COG
    '
            POPA        PCBYTES
            POPA        #1            '? Expected constant, unary operator, or "("
            POPA        INDA++
        RET
    '
    '
    PC8080    long    0
    PCBYTES    long    65535            'FFFF
    
    
  • AribaAriba Posts: 2,690
    edited 2012-12-20 19:35
    Sapieha

    PUSH is a write operation, but POP is a read. You cannot read a value from CLUT and store it to an immediate, only into a cog register.
    You can certainly write an immediate value into the CLUT.

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 19:39
    Hi Andy.

    But still immediate value cat point to any COG register

    Ariba wrote: »
    Sapieha

    PUSH is a write operation, but POP is a read. You cannot read a value from CLUT and store it to an immediate, only into a cog register.
    You can certainly write an immediate value into the CLUT.

    Andy
  • AribaAriba Posts: 2,690
    edited 2012-12-20 19:45
    Then it's not an immediate value, but a pointer to a cog address.
    It's the same as you would write: MOV #123,reg
    You can have an immediate value only as source not as destination.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 19:52
    Hi Ariba.

    If You look on machine code of both instructions
    Both use only DDDDDDDDD field as pointer ---- but PUSHA use D field even as nnnnnnnnn for #Imediate mode


    Ariba wrote: »
    Then it's not an immediate value, but a pointer to a cog address.
    It's the same as you would write: MOV #123,reg
    You can have an immediate value only as source not as destination.
  • AribaAriba Posts: 2,690
    edited 2012-12-20 20:07
    Many of the new Prop2 instructions use the D- and S-field not in its originally sense.
    In case of PUSH the D field holds a source register or value.

    On Prop1 we had that also with RDBYTE and WRBYTE, where WRBYTE uses the D-field for a source.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 20:20
    Hi Ariba.


    That give inconsistency in programming -- Look again in my previous posted code then instructions I post now
    
    000011 ZC1 1 CCCC DDDDDDDDD 000011010        POPA    D        read [--SPA] into D, MSB into C   1
                                                                 ''Decrement SPA and then store CLUT[SPA] in register “D (0-511)”.
    
    
    000011 000 1 CCCC DDDDDDDDD 010101010        PUSHA   D        write D into [SPA++]              1 **
                                                                 'Store register “D (0-511)” in CLUT[SPA] and then increment SPA.
    000011 001 1 CCCC nnnnnnnnn 010101010        PUSHA   #n       write n into [SPA++]              1 **
             |                                             'Store register “n (0-511)” in CLUT[SPA] and then increment SPA.
             |
             |
             |  Bit that control # Immediate value
    
    

    Ariba wrote: »
    Many of the new Prop2 instructions use the D- and S-field not in its originally sense.
    In case of PUSH the D field holds a source register or value.

    On Prop1 we had that also with RDBYTE and WRBYTE, where WRBYTE uses the D-field for a source.
  • AribaAriba Posts: 2,690
    edited 2012-12-20 20:46
    Sapieha wrote: »
    Hi Ariba.


    That give inconsistency in programming -- Look again in my previous posted code then instructions I post now
    
    000011 ZC1 1 CCCC DDDDDDDDD 000011010        POPA    D        read [--SPA] into D, MSB into C   1
                                                                 ''Decrement SPA and then store CLUT[SPA] in register “D (0-511)”.
    
    
    000011 000 1 CCCC DDDDDDDDD 010101010        PUSHA   D        write D into [SPA++]              1 **
                                                                 'Store register “D (0-511)” in CLUT[SPA] and then increment SPA.
    000011 001 1 CCCC nnnnnnnnn 010101010        PUSHA   #n       write n into [SPA++]              1 **
             |                                             'Store register “n (0-511)” in CLUT[SPA] and then increment SPA.
             |
             |
             |  Bit that control # Immediate value
    
    

    It gives inconsistency in programming an Assembler, but if you only are the user of an Assembler, pogrammed by someone else then the bit encoding does not really matter.
    I think making an Assembler for the Prop2 is much more challenging than it was for the Prop1. And I fear I need to do that some day...

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 21:06
    Hi Andy.


    For me Logically it is 2 counterpart/inverse instructions.

    And if I can write/use one in some ways --- I want me that its counterpart/inverse version have same possibility's.
  • AribaAriba Posts: 2,690
    edited 2012-12-20 21:26
    Sapieha wrote: »
    Hi Andy.


    For me Logically it is 2 counterpart/inverse instructions.

    And if I can write/use one in some ways --- I want me that its counterpart/inverse version have same possibility's.

    Have you ever seen a Spin line like that?
    1 := varB
    
    What should that do? You can not overwrite a literal number with the value of a variable. But you can use both on the source side:
    varA := varB
       varA := 1
    

    And it's the same with PUSH and POP, one has a source argument and can use immediate and direct addressing, the otherone has a destination argument and can only use direct addressing.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 21:32
    Hi Andy.

    I still see You don't have analysed Binary code for that 2 instructions.
  • AribaAriba Posts: 2,690
    edited 2012-12-20 21:50
    You showed me that the PUSH instruction can have the i-bit 0 or 1 while for the POP instruction the i-bit is always 1.
    An I try to explain you why this is so. It would make more sense if the i-bit is always 0, but you can not have both states.

    Can you say me what you expect what each of these 2 instructions will do? :
    1)   POPA reg17
    2)   POPA #reg17
    
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 22:07
    Hi Ariba.

    Lets say -- I don't understand.

    But # stands for direct register number.

    If I can Write POPA 1 and it compiles -- In reality it stands for write/read by #1 number of COG register and in that way it is used in PUSHA

    that give inconsistency in write code

    Ariba wrote: »
    You showed me that the PUSH instruction can have the i-bit 0 or 1 while for the POP instruction the i-bit is always 1.
    An I try to explain you why this is so. It would make more sense if the i-bit is always 0, but you can not have both states.

    Can you say me what you expect what each of these 2 instructions will do? :
    1)   POPA reg17
    2)   POPA #reg17
    
  • potatoheadpotatohead Posts: 10,261
    edited 2012-12-20 22:18
    Wouldn't one of them pop the register address and the other pop the contents of the register?

    (I'm not at my DE2...)
  • cgraceycgracey Posts: 14,206
    edited 2012-12-20 22:21
    How did you guys get the idea that you can pop an immediate? you can only pop into a D register, as what is getting popped must go somewhere.
  • AribaAriba Posts: 2,690
    edited 2012-12-20 22:26
    @potatohead

    They do not both exist, I try to explain Sapieha why the # version makes no sense. You can not pop a value from the CLUT into an immediate value only into a cog register.
    But I think I'm now out of ideas how to explain.

    Andy
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 22:27
    Hi Chip.

    It is not any idea --- Maybe it is that I don't understand -- but for me notation of that 2 versions looks not correct.
            POPA        PCBYTES
            POPA        1            Compiles -- Is it that version NOT indirect to?
    '        POPA       #1           Don't  '? Expected constant, unary operator, or "("
        nop
            POPA        INDA++
        NOP
    
    
    cgracey wrote: »
    How did you guys get the idea that you can pop an immediate? you can only pop into a D register, as what is getting popped must go somewhere.
  • SapiehaSapieha Posts: 2,964
    edited 2012-12-20 22:41
    Hi Chip.

    My thinking was If I can use that in

    PUSHA #n ---- write n into [SPA++] --- So now my question -- What I I PUSH in this case
    Register number #n --- Else Indirect value in #n ?
  • cgraceycgracey Posts: 14,206
    edited 2012-12-20 22:47
    Sapieha wrote: »
    Hi Chip.

    My thinking was If I can use that in

    PUSHA #n ---- write n into [SPA++] --- So now my question -- What I I PUSH in this case
    Register number #n --- Else Indirect value in #n ?

    Any of these work:

    PUSHA #0 'push constant 0
    PUSHA register 'push contents of register
    PUSHA INDA++ 'push register[INDA++]
Sign In or Register to comment.