Skip to main content
Visitor II
May 12, 2004
Question

Define Global Constants

  • May 12, 2004
  • 3 replies
  • 767 views
Posted on May 12, 2004 at 10:48

Define Global Constants

    This topic has been closed for replies.

    3 replies

    brian4Author
    Visitor II
    May 7, 2004
    Posted on May 07, 2004 at 15:21

    Hi an assembler question.

    How do I set a constant so that it can be used in all my asm files

    In my main.asm file I have

    #define timeint 10

    which works fine when the sub that uses timeint is in my main.asm file

    I want to create another file called inputs.asm which will have a sub within that will need to use timeint.

    apart from adding #define timeint 10 to every asm file is there a common file.

    Tried adding it in my include file but not sure of the Syntax.

    I am sure there must be a way.

    Regards

    Brian
    Visitor II
    May 12, 2004
    Posted on May 12, 2004 at 09:40

    Brian,

    The simplest way is to use a header file (myheader.inc)

    eg. in your header file

    #define timeint 10 ; note the space before start of line

    making sure to include this header wherever needed

    #include ''myheader.inc''

    ld A, #timeout

    Hope this helps

    Regards

    sjo
    brian4Author
    Visitor II
    May 12, 2004
    Posted on May 12, 2004 at 10:48

    Thanks,

    I knew it would be simple, but I could not find it documented

    Re Brian