Thread View: comp.lang.misc
4 messages
4 total messages
Started by Rich Edwards
Sat, 23 Sep 1995 16:24
Accessing registers in Microsoft Visual C++???
Author: Rich Edwards
Date: Sat, 23 Sep 1995 16:24
Date: Sat, 23 Sep 1995 16:24
22 lines
997 bytes
997 bytes
Hi there!
I was wondering if Microsoft C compilers have an equivalent to
Borland's register pseudovariables. I'm trying to compile IPX/SPX
functions written for the Borland compiler in Microsoft's compiler, but
I'm receiving compiler errors.
For example, the following code:
_BX = 0x0010;
_AL = 0x00;
if (_AL == 0)
return 0;
compiles in Borland, but I get an error "undeclared variable" message
w/ Microsoft.
I checked Microsoft's Knowledge base but found nothing.
Any help would be appreciated.
Thanks.
chappie@ix.netcom.com
Rich
Re: Accessing registers in Microsoft Visual C++???
Author: Joel Rubin
Date: Sat, 23 Sep 1995 21:45
Date: Sat, 23 Sep 1995 21:45
44 lines
1658 bytes
1658 bytes
In article <441ccm$mqu@ixnews7.ix.netcom.com>, chappie@ix.netcom.com
says...
>
>Hi there!
>I was wondering if Microsoft C compilers have an equivalent to
>Borland's register pseudovariables. I'm trying to compile IPX/SPX
>functions written for the Borland compiler in Microsoft's compiler, but
>I'm receiving compiler errors.
>
>For example, the following code:
>
> _BX = 0x0010;
> _AL = 0x00;
>
> if (_AL == 0)
> return 0;
>
>compiles in Borland, but I get an error "undeclared variable" message
>w/ Microsoft.
>I checked Microsoft's Knowledge base but found nothing.
>Any help would be appreciated.
>Thanks.
>
>chappie@ix.netcom.com
>Rich
In Microsoft C(++) you have to use in-line assembler instead.
_asm {
mov bx,10
mov al,0
cmp al,0
jne not_zero
}
return 0;
not_zero: ...
(Yes, I know you can do this more efficiently--I'm trying to copy the
logic of the "C".)
As with Borland, you can avoid the {} and put _asm in front of every
line. Unlike Borland, there is no option for using a full assembler with
the inline stuff.
Re: Accessing registers in Microsoft Visual C++???
Author: kim sang woo
Date: Tue, 26 Sep 1995 01:44
Date: Tue, 26 Sep 1995 01:44
27 lines
1420 bytes
1420 bytes
Rich Edwards (chappie@ix.netcom.com) wrote: : Hi there! : I was wondering if Microsoft C compilers have an equivalent to : Borland's register pseudovariables. I'm trying to compile IPX/SPX : functions written for the Borland compiler in Microsoft's compiler, but : I'm receiving compiler errors. : For example, the following code: : _BX = 0x0010; : _AL = 0x00; this is not supported by VC++ and other compilers as well. The best way to rewrite this is use external assembler function. This is one of reason why I never use inline assembler in my C code. : if (_AL == 0) : return 0; : compiles in Borland, but I get an error "undeclared variable" message : w/ Microsoft. : I checked Microsoft's Knowledge base but found nothing. : Any help would be appreciated. : Thanks. : chappie@ix.netcom.com : Rich
Re: Accessing registers in Microsoft Visual C++???
Author: Thomas R Goerz
Date: Fri, 29 Sep 1995 13:42
Date: Fri, 29 Sep 1995 13:42
33 lines
1834 bytes
1834 bytes
Andreas Jonsson (sa324@utb.shv.hb.se) wrote:
: >> I was wondering if Microsoft C compilers have an equivalent to
: >> Borland's register pseudovariables. I'm trying to compile IPX/SPX
: >> functions written for the Borland compiler in Microsoft's compiler, but
: >> I'm receiving compiler errors.
: >>
: >> For example, the following code:
: >>
: >> _BX = 0x0010;
: >> _AL = 0x00;
: >
: >Microsoft doesn't have this -- only Borland has it.
:
: How could I do it in Microsoft VC 1.5++?
:
:
: ----------------------------------------------------------------
: ! Andreas Jonsson, Berghalla, S-516 92 ASPERED, SWEDEN !
: ! E-mail: sa324@utb.shv.hb.se macki@enter.hb.se !
: !--------------------------------------------------------------!
: ! Computer Science Applied to System Analysis and Design !
: ! University of Boras, Sweden !
: ----------------------------------------------------------------
:
I forget the exact syntax, but something like this should work:
__asm {
mov bx,0x0010
mov al,0x00
}
This is how you do inline assembly in Microsoft C++
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads