Shop OBEX P1 Docs P2 Docs Learn Events
SXB 48 and Bank Select — Parallax Forums

SXB 48 and Bank Select

RS_JimRS_Jim Posts: 1,773
edited 2008-07-10 18:06 in General Discussion
I have been trying to put together a program for an SX-48 in SXB that includes the bank select macro.· I find that if I·put the _bank macro in as assembler code ie ASM _bank macro defination it will not properly carry all of the macro instructions to the assembler.· if I leave the macro out of the SX_B program it sees _bank as an error Bad Instruction.· How can I get SXB to accept the _bank macro, I hate to have to hand code every occurance where I wish to use bank.· confused.gif· What I am seeing is that the macro is carried to the assemble with missing information.· ie bank \1 is just carried as \1!

Comments

  • BeanBean Posts: 8,129
    edited 2008-07-06 20:46
    Jim,
    The compiler gets confused by the embedded "\" character in the macro. (This is fixed in the beta version).
    The workaround is to either put the assembly code in another file and use INCLUDE "Macros.src" or prefix each line with a "\" instead of using ASM...ENDASM

    DEVICE sx28, OSC4MHZ, TURBO, OPTIONX, STACKX
    FREQ 4_000_000
    IRC_CAL IRC_FAST
    
    PROGRAM Start NOSTARTUP
     
    Start:
    
     
    \_BANK   MACRO   1
    \        BANK    \1
    \        IF \1 & %10000000
    \         SETB    FSR.7
    \        ELSE
    \         CLRB    FSR.7
    \        ENDIF
    \        ENDM
     
    END
    
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson

    www.iElectronicDesigns.com

    ·
  • RS_JimRS_Jim Posts: 1,773
    edited 2008-07-07 13:20
    Thanks Bean:

    I did discover that SXB was a bit smarter than I thought, I removed the _ from Macro calls and found that SXB was compiling correctly.· As I understand your code, however, I need to put the macro code back in with the include file so that I properly change FSR.7.

    Thanks again
  • RsadeikaRsadeika Posts: 3,859
    edited 2008-07-07 16:49
    I was under the impression that SX/B handled the bank switching correctly for the SX48/52 proto boards. So, does that mean that you have to use the macro example in order to get the bank switching to work correctly? Now, I see why some of my programs were falling apart when I tried to do some bank switching; I guess I missed that notation in the documentation for the SX48/52 proto boards.

    Ray
  • BeanBean Posts: 8,129
    edited 2008-07-07 17:09
    Ray,
    SX/B does handle the bank switching if you are using SX/B code. It's when you want to add assembly code that you must handle it yourself.
    I assume this _BANK macro was part of some assembly library.

    It gets really tricky when you start doing bank switching within SX/B. You have to do alot of workarounds to get it to work. It's much easier in SX/B 2.0 because it allows you to declare variables at specific RAM location that will still be treated as a regular variable.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson

    "It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter

    www.iElectronicDesigns.com

    ·
  • RS_JimRS_Jim Posts: 1,773
    edited 2008-07-10 18:06
    Bean,
    your are correct in that the _macro code was from an assembly library. I got it working corectly with your help. Just a minor glitch in that I can not read a dip switch on Port C with the ppl set to on ad ddir set to in and latch set to 0. Got to go back and check what is happening. By the way, is there a way to print out a listing file?
    Thanks
    Jim
Sign In or Register to comment.