Menu

Goto across pages

Help
Mikorians
2017-08-01
2017-08-01
  • Mikorians

    Mikorians - 2017-08-01

    I've smacked into stack issues with the 16F887.
    I NEED to use Goto across page boundaries
    instead of CALL.
    The only examples I've seen are:
    Pagesel $ (current page)
    Pagesel BASPROGSTART

    So:
    asm Pagesel xxxxx
    asm Goto Label

    BUT where do I put my label?
    and how do I know what page it's on?

     
  • Anobium

    Anobium - 2017-08-01

    Just put labels wherever you want in your source code and use goto.

    Got any source that would help us understand the issue?

     
  • Mikorians

    Mikorians - 2017-08-01

    It's only that I've used a lot of memory and need to couple a few one-time use
    subs together.
    So please clarify: All capital labels and 'asm Goto LABEL' will work?

     

    Last edit: Mikorians 2017-08-01
    • Chris Roper

      Chris Roper - 2017-08-01

      Not sure what you mean by one-time use subs but if you are referring to a sub that is only ever called once then rather inline the code with a macro.

      example:

      do this
      MyJob
      do that
      
      sub MyJob
          do theother
      end sub
      

      would call the subroutine MyJob.
      But it could be written as:

      do this
      MyJob
      do that
      
      macro MyJob
          do theother
      end mecro
      

      will replace the word MyJob with the contents of the macro.

      So please clarify: All capital labels and 'asm Goto LABEL' will work?

      There should be no need for the asm keyword, GCBASIC recognises assembler nemonics.

       
  • Mikorians

    Mikorians - 2017-08-01

    Used in this 'Illegal' connotation, GCBASM throws Symbol not defined back at me.

    Sub OneBigSub
    '...
    Goto SecondSub
    BackToOne:
    End Sub

    Sub Another
    SecondSub:
    '...
    Goto BackToOne
    End Sub

     
  • Anobium

    Anobium - 2017-08-01

    Sorry. I do not understand.

    But, my guess. . ..   define labels and use GOTO. Great Cow BASIC will handle the associated ASM.

     
  • Mikorians

    Mikorians - 2017-08-01

    Got it:

    1. I had no call to the 2nd sub, so the sub wasn't compiled
    2. I had to put the asm pagesel before my regular goto.
      Works now!
     
  • Mikorians

    Mikorians - 2017-08-01

    I used to just put a couple of asm nop
    to eliminate the odd bad org overwrite 2048.
    Now with everything in 'Sub packets', I thought
    Gcb would find it easier to pack them in, but now
    I've tried 20 nops after my first goto and its overlapping all 3 pages
    2048, 4096, and 6xxx.
    Hm.
    Its really too big to post.
    Advice, experience ?

     
  • Chris Roper

    Chris Roper - 2017-08-01

    You could try a more modern device.
    The most recent 40PIN device is the PIC16F18877
    with 4,096 Bytes of RAM and 56KB Flash it should get over any paging issues and code size probelms.

     
  • Mikorians

    Mikorians - 2017-08-01

    Thank you for your recommendation.
    There are 8 subprocessors in my system and I am
    experimenting with the 18F4680 (actually).
    But we aren't yet ready for that.
    Software tip?

     
  • Mikorians

    Mikorians - 2017-08-01

    Here's a tip: Busted up Subs > 512 bytes

     
  • Mikorians

    Mikorians - 2017-08-02

    OK. MORE Bad Org Overwrites!
    We've fought these for a few years now and have
    usually won. But:
    This is now really making it hard to code here.
    It's GUESSWORK where my nops have to go.
    Or whether I need fewer.
    I've gone back and forth from the .ASM
    source, looking at which code lies near the boundaries.

    IS there like, a strict command line option because
    we're all ready to throw our hands up at this coding quagmire.

     
  • Mikorians

    Mikorians - 2017-08-02

    Thanks for the Macro tip!

    Hm. I can now see what this compiler is up against working
    with 2048 bytes of page space. Please forgive our frustration.
    Your own must be just as bad.
    Our solution was to go back to the larger blocks of code (near 2K).
    It forced the little ones back into line again, and now
    we can goto across pages.

    We do still wish that the little ones were better behaved.
    But 1 or 2 'asm nop's at the end or start of a big block kicks 'em out.

     

    Last edit: Mikorians 2017-08-02

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.