Arkady V.Belousov escreveu:
>
> AB> Now the the real reason for the mail. Arkady said that the int*()
> AB> function do not pass on the flags correctly.
>
> They do not do this at all.
Yes. it leaves it uninitialized! Which is dangerous. (happend to me)
> AB> Alain asked me to show the way that I often call interrupts (for
> AB> efficiencies sake).
> AB> __emit__(0x1E); // push ds
> AB> _CX = 0x7100 | func;
> AB> _BX = FP_OFF(c);
> AB> _DS = FP_SEG(c);
> AB> _DX = _BX;
> AB> _FLAGS |= 1;
> AB> _AX = _CX;
> AB> geninterrupt(0x21);
> AB> __emit__(0x1F); // pop ds
> AB> Of course using asm{} is more efficient, but is not C++.
>
> This depends. First, yes - in OW asm{} forces saving all registers on
> stack (even if in asm{} no registers used), but TC/BC is smarter in this
> (they check, which registers mentioned in instructions).
IMHO, for portability, there could be an asm function to do those
things. It is just too bad that just one bit got left out of the
Standard/Borland functions...
> Second, see how much workarounds you apply (store firstly to _CX and
> _BX, then move to _DX and _AX) to avoid registers injuring. But with
> pseudo-variables you can't guarantee non-injuring - only reviewing listing
> may ensure, that with this compiler version your code compiled as expected.
> Whereas with asm{} you get only what you wrote - no more, no less.
I am used to BC31, which has asm{}, but unfortunately FreeDOS has to use
the older versions :(
Alain
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel