court@rpi.edu (Court Demas) (04/27/91)
I've been rewriting a few of my C routines in assembler (with the
asm{} constuct), but I can't seem to create any labels in the code.
This is very annoying to say the least. I'm using Turbo C++ 1.01.
e.g.:
asm{
...
cmp ax,0
jz LAB1:
LAB1:
inc ax
...
}
It gives me error saying something about 'invalid assembler opcode' on the
'LAB1:' line. Any suggestions? thanks..
court
hollen@megatek.UUCP (Dion Hollenbeck) (04/29/91)
In article <_rwg.m=@rpi.edu> court@rpi.edu (Court Demas) writes: > > I've been rewriting a few of my C routines in assembler (with the > asm{} constuct), but I can't seem to create any labels in the code. > This is very annoying to say the least. I'm using Turbo C++ 1.01. > > e.g.: > > asm{ > ... > cmp ax,0 > jz LAB1: > > LAB1: > inc ax > ... > } > > It gives me error saying something about 'invalid assembler opcode' on the > 'LAB1:' line. Any suggestions? thanks.. This would be illegal with any assembler. While you MUST put a colon after the definition of a label you CAN'T put a colon on the reference to it. Should be: jz LAB1 The reason you are probably getting the error on the label line is that many compilers/assemblers think an error at end of line screws up the next line, but the previous line is OK. -- ----- Dion Hollenbeck (619) 455-5590 x2814 Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121 uunet!megatek!hollen or hollen@megatek.uucp