Board index » cppbuilder » Assembly Compiling by BCB5

Assembly Compiling by BCB5


2004-11-26 03:16:31 PM
cppbuilder80
Hi
1-Can we compile an assembly Code by BCB5?
2-Can we in GUI Form mode by C++ Codes?
3-How at GUI and Command Line?
Thx
 
 

Re:Assembly Compiling by BCB5

Quote
1-Can we compile an assembly Code by BCB5?
Yes, but it will call an external assembler to handle the
inline assembly code. Depending upon the version of BCB5
that you have, you may have TASM32.EXE. That is the
default assembler that the compiler will call. Starting
with version 6, BCB6, a Built-in ASseMbler was added, BASM,
so for all but the most complex inline assembly instructions
the compiler handles it directly without an external
assembler.
Because the mode is to convert to an assembly source file
which is then passed to an external assembler, when the
BCB5 compiler first encounters inline assembly it must
restart compilation in 'construct a *.ASM file' mode
instead of normal compilation mode. This slows down
compilation and generates a warning. The manner in which
you avoid that happening is to place this pragma on a line
by itself at the top of the source file:
#pragma inline
Quote
2-Can we in GUI Form mode by C++ Codes?
In all versions of BCB, including BCB6, that pragma can be
used to force the compiler to use the external assembler
and you do not need to have inline assembly code for it to
do that (for example: it could be a program using the VCL
and have no inline assembly).
Quote
3-How at GUI and Command Line?
The command line compiler will also handle your project.
In older versions of the compiler, just use the project
file (the ProjectName.BPR file) with make.exe
make -f ProjectName.BPR
(where the space after the '-f' is optional)
In newer versions of the compiler (I don't remember if
this appeared in BCB5 or BCB5) you must first create a make
file from the project file.
Bpr2Mak ProjectName.BPR
make -f ProjectName.MAK
(where the space after the '-f' and the
extension '.MAK' are both optional)
If building from the command line by hand, you need to
know what options to give to the compiler and linker and
the syntax used for their command lines. You can see
that by doing this:
Start the help
Click on the Index tab
Type BCC32 into the edit control
Click the Display button
For help on the linker do the above with ILINK32 in the
edit control.
A set of simple, hello world class example programs
showing straight Win32 programs built from the command
line is available here:
www.mulroy.org/hello.zip
There are console mode and GUI mode programs. The examples
include single programs and programs using implicitly linked
DLLs (dynamic linked libraries) and explicitly linked DLLs
and shows building with batch files and with make files.
. Ed
Quote
Pedram wrote:
Hi
1-Can we compile an assembly Code by BCB5?
2-Can we in GUI Form mode by C++ Codes?
3-How at GUI and Command Line?
 

Re:Assembly Compiling by BCB5

Well, from my understanding, BASM has been a part of Borland C++ since
version 4.5 (maybe back to the 3.1 days?)... The limitation of BASM is that
it cannot handle IDEAL mode syntax or some of the more advanced features of
Turbo Assembler. BASM also *cannot handle 32-bit ASM instructions*. That
is what causes the Compiler to call TASM on the module (the presence of
32-bit instructions). If you don't have any of those, the inline assembler
in the compiler should be able to handle your code without spawning Turbo
Assembler.
From Borland C++ 5.02 Help:
<snip>
The Borland C++ inline assembler supports:
All 8086/8087 and 80286/80287 instructions
- Opcodes
- Most Turbo Assembler expression operators
- Turbo Assembler's define byte, define word, and define double word
directives (DB, DW, and DD)
The inline assembler also implements a large subset of the syntax supported
by Turbo Assembler and Microsoft's Macro Assembler.
Note: If you plan to do a lot of assembly language programming, you can use
TASM (the stand-alone assembler) to create entire modules coded in assembly
language. These .OBJ file modules can then be linked into your C++
applications. TASM, sold separately from Borland C++, supports all 80x86
processors and contains complete documentation on the assembler and assembly
language.
<end snip>
Unfortunately, BASM isn't documented so well in BCB's helpfiles or
documentation (BC++ series docs were really good).
"Ed Mulroy [TeamB]" < XXXX@XXXXX.COM >wrote in message
Quote

>1-Can we compile an assembly Code by BCB5?

Yes, but it will call an external assembler to handle the
inline assembly code. Depending upon the version of BCB5
that you have, you may have TASM32.EXE. That is the
default assembler that the compiler will call. Starting
with version 6, BCB6, a Built-in ASseMbler was added, BASM,
so for all but the most complex inline assembly instructions
the compiler handles it directly without an external
assembler.

Because the mode is to convert to an assembly source file
which is then passed to an external assembler, when the
BCB5 compiler first encounters inline assembly it must
restart compilation in 'construct a *.ASM file' mode
instead of normal compilation mode. This slows down
compilation and generates a warning. The manner in which
you avoid that happening is to place this pragma on a line
by itself at the top of the source file:

#pragma inline


>2-Can we in GUI Form mode by C++ Codes?

In all versions of BCB, including BCB6, that pragma can be
used to force the compiler to use the external assembler
and you do not need to have inline assembly code for it to
do that (for example: it could be a program using the VCL
and have no inline assembly).

>3-How at GUI and Command Line?

The command line compiler will also handle your project.
In older versions of the compiler, just use the project
file (the ProjectName.BPR file) with make.exe

make -f ProjectName.BPR
(where the space after the '-f' is optional)

In newer versions of the compiler (I don't remember if
this appeared in BCB5 or BCB5) you must first create a make
file from the project file.

Bpr2Mak ProjectName.BPR
make -f ProjectName.MAK
(where the space after the '-f' and the
extension '.MAK' are both optional)

If building from the command line by hand, you need to
know what options to give to the compiler and linker and
the syntax used for their command lines. You can see
that by doing this:

Start the help
Click on the Index tab
Type BCC32 into the edit control
Click the Display button

For help on the linker do the above with ILINK32 in the
edit control.

A set of simple, hello world class example programs
showing straight Win32 programs built from the command
line is available here:

www.mulroy.org/hello.zip

There are console mode and GUI mode programs. The examples
include single programs and programs using implicitly linked
DLLs (dynamic linked libraries) and explicitly linked DLLs
and shows building with batch files and with make files.


. Ed

>Pedram wrote:
>Hi
>1-Can we compile an assembly Code by BCB5?
>2-Can we in GUI Form mode by C++ Codes?
>3-How at GUI and Command Line?

 

{smallsort}