Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is possible to do this?
#1
Hi : ) I want to do something like this

iniSuperSub:
SUB mySuperSub()
....
...
....
END SUB
endSuperSub:

SUB otherSub()
ASM
defs 6144-(@endSuperSub - @iniSuperSub),0
END ASM
END SUB

The compiler says -> Error: illegal preprocessor character '@'

I want to do in assembler -> defs (6144 - size mySuperSub ), 0

There is some way to do something like this?

Thanks
Reply
#2
Not sure why do you need that, but the compiler reallocates functions and subs at the end of the program, so @endSuperSub - @iniSuperSub = 0
You have to put the labels within the function body.

Within an ASM context, don't use @. Use just the label name, prefixing it with '_'.

So use:
Code:
SUB mySuperSub()
  REM this label goes *inside* the sub or it will not work as you expect
iniSuperSub:
...
...
...
  REM this label goes *inside* the sub or it will not work as you expect
endSuperSub:
END SUB

SUB otherSub()
  ASM
    defs 6144-(_endSuperSub - _iniSuperSub),0
  END ASM
END SUB

Also, not sure if defs will work here instead of db or dw...
Reply
#3
I'ts not working either with "_"

Well i try to figure out, how manage better, where to put things

I need space in at exactly number of memory and i don't know if there are directives like in assembler ORG

to control better, where are every thing Smile

I'm looking the generated memory map but is a little mess Smile

If i want per example, n bytes of space beginning on 43456

Can i do that with some directive?
Reply
#4
When doing things like this, just compile with --asm flag to see the resulting asm file, and examine it.
I was wrong: you have to prefix ("mangle") you labels in ASM, with __LABEL__. So this should work:
Code:
SUB mySuperSub()
  REM this label goes *inside* the sub or it will not work as you expect
iniSuperSub:
...
...
...
  REM this label goes *inside* the sub or it will not work as you expect
endSuperSub:
END SUB

SUB otherSub()
  ASM
    defs 6144-(__LABEL__endSuperSub - __LABEL__iniSuperSub),0
  END ASM
END SUB
Reply
#5
Yes this __LABEL__ before works Smile

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)