Shop OBEX P1 Docs P2 Docs Learn Events
BS2 to BS2E question how do I call the routines in the 2nd 2k page — Parallax Forums

BS2 to BS2E question how do I call the routines in the 2nd 2k page

mmmm Posts: 56
edited 2005-02-28 02:31 in BASIC Stamp
I have a program that is presently using 95% of my BS2's memory and want to port it over to a BS2E as I need to add another 25% more code.

I've transfered the main BS2 code to the first page of my BS2E program with the proper directive to link a 2nd 2 K page. The tokenizer shows that they are linked together, but now my problem is how do I actually call the added routines in the 2nd 2K page from the main program ?




Mike

Comments

  • NewzedNewzed Posts: 2,503
    edited 2005-02-27 19:01
    In your main program, whenever you want to go to bank 1, which is the second bank, you write:

    RUN 1

    This will take you to the start of bank 1 and it will run whatever program you have written.· When you are finished you need to tell bank 1:

    RUN 0

    This will take you back to your main program.· If you want to go to a certain spot in your main program, then in bank 1 you would write:

    com = 1
    RUN 0

    At the very beginning of bank 0 you would write:
    if com = 1 THEN whatever label.

    These are called flags.· You can use as many as you want.· com·can be a number or a letter.· If you use a letter you must write:

    com = "a" and
    if com·"a" THEN.................

    Numbers are easier.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester?

    http://hometown.aol.com/newzed/index.html
    ·
  • GadgetmanGadgetman Posts: 2,436
    edited 2005-02-27 19:39
    Don't forget a very important point:

    Define the same variables, in the same order, on both pages.
    If not...

    The variables are assigned places in memory by size first(first Word size, then Byte size, and so on)

    A VERY good article is this Nuts&volts column:
    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv87.pdf
  • Jim McCorisonJim McCorison Posts: 359
    edited 2005-02-27 21:45
    Now if we only had include files for PBASIC.

    Actually, having typed that, let me change it too... Can we PLEEEEEESE have include files? Boy would that make some things nicer.


    Mike,

    Just to clarify a minor point. There is nothing magic about the variable name "com". That is a convention used by Sid, and I think Jon. You can use that name, or what ever makes sense to your way of thinking.

    Jim
  • mmmm Posts: 56
    edited 2005-02-28 02:31
    Thanks everybody,

    sorry I didn't include files but the power has been out all day and I was using a wireless laptop link. I didn't have my stamp editor running nor did I have my online manual.

    I was trying to remember the command from memory while I was marking up a hard copy of my saved program all the time waiting for the power to come back on.


    Mike
Sign In or Register to comment.