I’m trying to use assembly in C code using C variables.
My code looks like this:
__asm { INT interruptValue };
Where ‘interruptValue’ is a variable I get from the user (e.g 15 or 15h).
When I try to compile I get:
Assembler error: ‘Invalid instruction
operands’
I don’t know what is the correct type for interruptValue . I tried long\int\short\char\char* but none of them worked.
The INT opcode does not allow to specify a variable (register or memory) as an argument. You have to use a constant expression like
INT 13hIf your really want to call variable interrupts (and I cannot imagine any case for doing so), use something like a switch statement to decide which interrupt to use.
Something like this:
EDIT:
This is a simple dynamic aproach: