Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inline Assember Labels

Status
Not open for further replies.

TheInsider

Programmer
Jul 17, 2000
796
CA
Hello,

I'm not sure if this is a C++ or TASM question so I posted it in both forums... I just downloaded a copy of Borland C++ 1.01 from the Borland Museum. Great compiler, but when I use the ASM{} directive to define Assembly code, I get "Error: Undefined label 'label1' in function clear_screen" if I try to define a label!
Code:
int clear_screen(void){
    asm{
        mov ax, 0A000h
        mov es, ax

        mov di, 00h

        label1:

            mov es:[di], 00h

            inc di

            cmp di, 0FA00h
            jl label1
    }

    return(0);
}
I've also tried _label1: and just _label1 with no ":". No matter what it completely ignores my label definition line. What is the correct syntax?... in pure assembly the above should work -- at least in MASM and Arrowsoft Assembler. (I haven't used TASM in 5 or 6 years)

Thank you in advance,

Rob
 
Try using something starting in @. I can't really remember, but Borland pascals of that era I think insisted on it in their inline assembler. Just possible other Borland products did the same.
 
Thank you for the reply. I forgot to mention in the post above that unfortunately I tried @ and @@ already and it complained about those as well.
 
OK, I think I found the only solution to this problem:
Code:
asm {
...
}
label1:;
asm{
...
}
It's kind of sad that I have to exit the ASM block completely to define a label, but it seems to work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top