Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enableing 386 instructions with Turbo c++ 3.1

297 views
Skip to first unread message

pkp...@ibm.net

unread,
Mar 3, 1995, 3:45:52 PM3/3/95
to
In <3j7io0$1...@ctc.ctc.edu>, stu...@svc.ctc.edu (Student) writes:

>How do I enable the 386 instruction set with tc++ 3.1, I want to encode a
>rep movsd, but the inline assembler will not recognize it!

You can't. Get TASM or Borland C++ (I think BC++ supports 386 inline).

Student

unread,
Mar 3, 1995, 12:13:36 PM3/3/95
to

Steven Metke

unread,
Mar 4, 1995, 10:41:12 PM3/4/95
to

I just tried it on 4.5 (only just got it) and rep movsd still doesn't
work, anyone know why?

BTW. I was the one in the origanal post, just didn't bother to login :)

Uwe Oehler

unread,
Mar 3, 1995, 1:12:36 PM3/3/95
to
Student (stu...@svc.ctc.edu) wrote:
: How do I enable the 386 instruction set with tc++ 3.1, I want to encode a
: rep movsd, but the inline assembler will not recognize it!

In Borland C++ I told the environment to compile to ASM code and use
TASM. This worked for me and allowed me to use the extra segment registers
and other 386 code in my inline assembly.

Options
- compiler
- Code generation
- Generate assembler source (may not be necessary)
- Compile via assembler

--

Dr. Iguana Uwe Oehler
O'Zone Software Dept. of Chemistry and Biochemistry
10-201 Silvercreek Pkwy N. University of Guelph, N1G 2W1
Guelph, Ontario, Canada, N1H 3T4 DrIg...@chembio.uoguelph.ca

E:DEMONSPOOLMAIL

unread,
Mar 10, 1995, 4:44:50 AM3/10/95
to
In article: <3jbbso$5...@news.halcyon.com> gry...@cnw.com (Steven Metke)
writes:

>
> pkp...@ibm.net wrote:
> > In <3j7io0$1...@ctc.ctc.edu>, stu...@svc.ctc.edu (Student) writes:
>
> > >How do I enable the 386 instruction set with tc++ 3.1, I want to encode
a
> > >rep movsd, but the inline assembler will not recognize it!
>
> > You can't. Get TASM or Borland C++ (I think BC++ supports 386 inline).
> I just tried it on 4.5 (only just got it) and rep movsd still doesn't
> work, anyone know why?

Borland haven't supported the 386 instruction set in inline code since
version 3.0 when it first appeared. However I have seen _EAX used in Origin
code (see Inline Assembler article in this news group). However, I am
curious to know why you are using rep movsd. Normally rep movsw will work
just as fast unless you've switched to protected mode due to processor
over-heads. The best way however is never to use the rep mov?? full stop as
it is much faster to code in your movs around other code so you don't
overload the data bus (ie inc-ing,etc... whilst the data bus takes care of
your data). 2 movs in succession will take typically 160ns. due to memory
speeds, much longer than the instruction timings normally given - always
check your EA (Effective Address) calculations. Also, the rep ??? commands
aren't recommended in protected mode as they take too long to execute. I
don't know too much about this area though.

Ian - ianr...@theridge.demon.co.uk

Albrecht, Matthew

unread,
Mar 11, 1995, 3:48:01 PM3/11/95
to
In <246732...@theridge.demon.co.uk> ianr...@theridge.demon.co.uk writes:

> In article: <3jbbso$5...@news.halcyon.com> gry...@cnw.com (Steven Metke)
> writes:
> >
> > pkp...@ibm.net wrote:
> > > In <3j7io0$1...@ctc.ctc.edu>, stu...@svc.ctc.edu (Student) writes:
> >
> > > >How do I enable the 386 instruction set with tc++ 3.1, I want to encode
> a
> > > >rep movsd, but the inline assembler will not recognize it!
> >
> > > You can't. Get TASM or Borland C++ (I think BC++ supports 386 inline).
> > I just tried it on 4.5 (only just got it) and rep movsd still doesn't
> > work, anyone know why?

I don't know why, but here's what I do:

ASM {
push ds
pop es
mov di,[blah]
mov si,[blah]
mov cx,0xF00D
db 243, 102, 165 //rep movsd
}

I just inserted the cpu value for the "rep movsd" instruction. In hex, it
would be:
db F3, 66, A5

If you want to find out what these 386 instruction values are, the fast method
is by checking w/ Turbo Debugger or just Debugger.

-Matt

0

unread,
Mar 13, 1995, 7:04:26 PM3/13/95
to


are you -sure- that BC++ supports inline 32bit code
I'm thinking of buying it, but I won't if it doesn't do this.
Is there anyone out there who has BC++ and has actually coded in
32bit????

Ed Michalski

unread,
Mar 15, 1995, 8:46:24 AM3/15/95
to
Albrecht, Matthew (Z3...@ttacs3.ttu.edu) wrote:
: In <246732...@theridge.demon.co.uk> ianr...@theridge.demon.co.uk writes:

: -Matt


I use Borland C++ 3.0 and can use rep movsd, but just have to use the -2
flag on the commandline.

-Ed

Scott Deming

unread,
Mar 19, 1995, 1:13:07 PM3/19/95
to

==========Ed Michalski, 03/15/95==========

[ stuff deleted ]

: I don't know why, but here's what I do:

: ASM {
: push ds
: pop es
: mov di,[blah]
: mov si,[blah]
: mov cx,0xF00D
: db 243, 102, 165 //rep movsd
: }

: I just inserted the cpu value for the "rep movsd" instruction. In hex, it
: would be:
: db F3, 66, A5

: If you want to find out what these 386 instruction values are, the fast
method
: is by checking w/ Turbo Debugger or just Debugger.

: -Matt

In order to get Borland to compile 386 instructions you have to use TASM. At
the begining of your program put:

asm .386

and in your "bcc" command line add the options "-B" and "-3"

Good luck.

--
Scott A. Deming
s...@mail.id.net

jason trowbridge

unread,
Mar 31, 1995, 3:00:00 AM3/31/95
to
Here's your answer (but yer not gonna like it...):

TC++ v3.1 cannot directly handle 386 instructions, only 286
instructions.
However, you can (somewhat) get around that.... Just use db 66h
before an instruction that you want to be a 386.
For that rep movsd, you would put
asm {
...
db 66h
rep movsw
...
}
This can also be used to access the 386 extended registers.
asm{
...
db 66h
mov ax, 0001h
dw 0002h
...
}
This is how you access the 386 registers. Annoying, isn't it!

-Jason
tro...@unm.edu
jrs...@prodigy.com


Keith Nagle

unread,
Apr 6, 1995, 3:00:00 AM4/6/95
to
There is a "better" way...

If you have (or can purchase, beg borrow or steal) TASM (turbo
Assembler), set the "compile via assembly" and the 386 code
generation switches (my neurons aren't connected to the exact
switch setting for 3.1 anymore). The compiler will still bitch
about not understanding things like ADD EAX, EBX - but the
assembler will handle it and you'll get 32-bit code that works
via in-line assembly.

0 new messages