Loading ...
Sorry, an error occurred while loading the content.

Re: [cosmacelf] Re: LCC1802 C Compiler With Floating Point Now Available

Expand Messages
  • bill rowe
    I should have said i lack a *good* idea;) That would not be that hard to implement ted - i ll have to lookat your call/return to see how you spare r6. I have
    Message 1 of 18 , Jun 9, 2013
    • 0 Attachment
      I should have said i lack a *good* idea;)
      That would not be that hard to implement ted - i'll have to lookat your call/return to see how you spare r6.

      I have in my head that i will implement a jump-shortener optimization pass going through and replacing long branches where possible before assembly. 

      On 2013-06-07, at 3:45 AM, "ted_rossin" <ted_rossin@...> wrote:

       

      Hi Bill,

      The example below is a conditional long branch. If the Zero flag is set, the code will jump to WhileTail and if not, it will skip over the long jump and continue on WhileTrueHead7. The example is implementing something like the following:

      While(!Done){
      blah
      blah
      blah
      }

      As far as how I calculated the size of the pagefit, I just hand calculated each case that the compiler needed to generate. Pretty lame. I think we had a discussion a few years back about how I could have made the assembler calculate the size by specifying a label so it could figure out the distance using computers instead of manually counting.

      For those not up on my .pagefit hack, it will make sure there are N bytes in the current page free. If not, it will pad out the page with single byte NOPs in my case SEX R7. If there are more than a few bytes left in the page it will stick a SEX R7 at the last byte and do a br 0xff to execute faster.

      --- In cosmacelf@yahoogroups.com, bill rowe <bill_rowe_ottawa@...> wrote:
      >
      > Ted: what about conditionals?
      >
      > I always admired "pagefit" by the way. How did you calculate the room you needed on the page?
      >
      >
      > On 2013-06-06, at 4:19 PM, "ted_rossin" <ted_rossin@...> wrote:
      >
      > > Thanks Bill,
      > >
      > > The Interrupt example runs on my simulator fine (maybe it will tear on real hardware due to long branches if any are in the output). I like the timer action.
      > >
      > > Is it possible to use the ugly technique I used for long branches where I dedicated R6 to a jump function like the call routine except that it saves no state for a return?
      > >
      > >
      > > 0097 .pagefit 7,0xe7
      > > 0098 0x0349 JmpExit:
      > > 0099 0x0349 0xd3 sep 3
      > > 0100 0x034a JmpFunc:
      > > 0101 0x034a 0x9e ld r14.1
      > > 0102 0x034b 0xb3 st r3.1
      > > 0103 0x034c 0x8e ld r14.0
      > > 0104 0x034d 0xa3 st r3.0
      > > 0105 0x034e 0x30 0x49 br JmpExit
      > >
      > > I used R6 to point to JmpFunc then perform a long jump (using no 3 cycle instructions) using sep 6:
      > >
      > > 0987 0x0600 0x3a 0x09 bnz WhileTrueHead7
      > > 0988 0x0602 0xf8 0x0c ld WhileTail7.1
      > > 0989 0x0604 0xbe st r14.1
      > > 0990 0x0605 0xf8 0x1a ld WhileTail7.0
      > > 0991 0x0607 0xae st r14.0
      > > 0992 0x0608 0xd6 sep 6 ; LongJump(R14=WhileTail7)
      > > 0993 0x0609 WhileTrueHead7:
      > >
      > > It is ugly but makes the 1861 happy.
      > >
      > >
      >

    Your message has been successfully submitted and would be delivered to recipients shortly.