P2 JMP/CALL addresses to COG/LUT/HUB

13»

Comments

  • I had forgotten about ORGF. I fill with longs using a variable size based on $.

    Yes, we’re just wanting to suppress the error, but the current compilers might not have the ability to continue.

    Could we have a FITH for testing the current hub address?

    One thing I’ve noticed over the past week is that there are some traps for making code executable as both hubexec AND cogexec. Jump and call and the DJNZ and variations - relative addressing doesn’t seem to work for both cog and hub - it’s an either or case. I didn’t look deeply, but it’s possible the relative addressing is in bytes for hub and longs for cog.
    This leads me to ponder, is it useful to be able to have hub code compiled for a different hub address. BTW, I’m sure Eric will be ducking for cover about now! We used to compile relocatable code and then link it to its final address.
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • exactly

    And in a COG we do not need it there the existing ORG and ORGF are fine.

    Mike
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • msrobotsmsrobots Posts: 2,819
    edited 2019-08-12 - 00:02:57
    completely unrelated - thinking over @JonnyMac's last project, we need a new SECtion for the define ifdef and stuff like that, maybe -e or other directives.

    So a spin program would start with
    DEF
    ….
    CON
    ...
    

    Just saying...

    Mike
    I am just another Code Monkey.
    A determined coder can write COBOL programs in any language. -- Author unknown.
    Press any key to continue, any other key to quit

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this post are to be interpreted as described in RFC 2119.
  • ersmithersmith Posts: 3,240
    edited 2019-08-12 - 00:32:38
    Cluso99 wrote: »
    This leads me to ponder, is it useful to be able to have hub code compiled for a different hub address. BTW, I’m sure Eric will be ducking for cover about now! We used to compile relocatable code and then link it to its final address.

    Well, fastspin does have -H and -E options for setting the base address of the executable code (so you can compile it to run at any fixed address). You could use that now for overlays. @msrobots used those switches for getting fastspin compiled code to work with TAQOZ.

    Truly relocatable code would be very useful, but that's a bit more work in the compiler (if you're just writing PASM you can already achieve this, of course :) ).

  • You could just type:

    ORGH $ < $400 ? $400 : $
  • cgracey wrote: »
    You could just type:

    ORGH $ < $400 ? $400 : $

    Wow Chip!
    You've been hiding that little gem from us.
    That "Verilog" style condition test works great!
    That changes my whole thinking on P2 assembler. :)
    Melbourne, Australia
  • Conditional compile ,neat!
    		drvh	#zzz == 1 ? yyy==1? 24:27 : yyy == 1? 25 : 26
    
    
    Melbourne, Australia
  • ... and it seems to have been in there since P2-Hot (oct 2013), at least

    Anything else you're not telling us about Pnut, Chip? : )
  • Tubular wrote: »
    ... and it seems to have been in there since P2-Hot (oct 2013), at least

    Anything else you're not telling us about Pnut, Chip? : )

    I don't think so. I just remembered that ternary operator.
  • TubularTubular Posts: 3,648
    edited 2019-08-12 - 05:44:33
    '*** Pnut for P2-Hot version - October 2013
    
    
    'test code - first case (yyy false)
    
     yyy = 0
     ytest = yyy ? 8 : 9
    
    
    'map output
    
    TYPE: 4B   VALUE: 00000000   NAME: YYY
    TYPE: 4B   VALUE: 00000009   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    
    'test code - second case (yyy true)
    
     yyy = 1
     ytest = yyy ? 8 : 9
    
    ' map output
    
    TYPE: 4B   VALUE: 00000001   NAME: YYY
    TYPE: 4B   VALUE: 00000008   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    
  • Tubular wrote: »
    '*** Pnut for P2-Hot version - October 2013
    
    
    'test code - first case (yyy false)
    
     yyy = 0
     ytest = yyy ? 8 : 9
    
    
    'map output
    
    TYPE: 4B   VALUE: 00000000   NAME: YYY
    TYPE: 4B   VALUE: 00000009   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    
    'test code - second case (yyy true)
    
     yyy = 1
     ytest = yyy ? 8 : 9
    
    ' map output
    
    TYPE: 4B   VALUE: 00000001   NAME: YYY
    TYPE: 4B   VALUE: 00000008   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    
    Tubular wrote: »
    '*** Pnut for P2-Hot version - October 2013
    
    
    'test code - first case (yyy false)
    
     yyy = 0
     ytest = yyy ? 8 : 9
    
    
    'map output
    
    TYPE: 4B   VALUE: 00000000   NAME: YYY
    TYPE: 4B   VALUE: 00000009   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    
    'test code - second case (yyy true)
    
     yyy = 1
     ytest = yyy ? 8 : 9
    
    ' map output
    
    TYPE: 4B   VALUE: 00000001   NAME: YYY
    TYPE: 4B   VALUE: 00000008   NAME: YTEST
    
    OBJ bytes:       0
    
    _CLKMODE: 00
    _CLKFREQ: 00B71B00
    
    

    Man, maybe I already finished Spin2, but I haven't remembered, yet.
  • Cluso99 wrote: »
    I...One thing I’ve noticed over the past week is that there are some traps for making code executable as both hubexec AND cogexec. Jump and call and the DJNZ and variations - relative addressing doesn’t seem to work for both cog and hub - it’s an either or case. I didn’t look deeply, but it’s possible the relative addressing is in bytes for hub and longs for cog.

    Relative-constant branches are encoded the same for cog and hub code.

    I can't remember at the moment if the same is true for absolute-constant branches. Anyone know?
  • Thanks Chip. I thought relative should have worked so maybe I had absolute coding, or another bug. I'll check it out later.

    Absolutes would be different address results though, depending on whether the code is in cog or hub space.
    So these wouldn't work for the same code designed to run in both spaces.

    Those hubexec time comparisons with cog are great news. No 4x penalty for lmm mode anymore :smiley:
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • cgracey wrote: »
    You could just type:

    ORGH $ < $400 ? $400 : $

    In fastspin that has to be:
    ORGH ($ < $400) ? $400 : $
    
    due to ambiguity around the "?" operator (fastspin still supports Spin1). But it otherwise works fine, so I guess we can shelve this discussion :).

    Thanks for remembering this Chip!
  • Wow, what a nifty feature :smiley:
    My Prop boards: P8XBlade2, RamBlade, CpuBlade, TriBlade
    Prop OS (also see Sphinx, PropDos, PropCmd, Spinix)
    Website: www.clusos.com
    Prop Tools (Index) , Emulators (Index) , ZiCog (Z80)
  • So, we can already do this using a C style conditional operator that PNUT and FastSpin already have...

    Interesting...
    Prop Info and Apps: http://www.rayslogic.com/
Sign In or Register to comment.