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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Defining Labels with Inline Assembly

Status
Not open for further replies.

TheInsider

Programmer
Jul 17, 2000
796
CA
Hello,

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?

Thank you in advance,

Rob
 
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