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

Borlands Tasm and putting an EQUated value in a string

3 views
Skip to first unread message

R.Wieser

unread,
Jan 25, 2012, 6:38:53 AM1/25/12
to
Hello All,

I'm using Borlands TASM v5.x , and need to include a value into a string (a
formatting-string for an 'fscanf' function). The tricky thing about it is
that the value is EQUated, and the string DBed. Like this :

cBufSize equ 128
@@Buffer db cBufSize dup(?)
@@FormatString db '%128s',0 ;<-- This is what it is about
call fscanf,[@@hFile],offset @@FormatString,offset @@Buffer

The above works, but violates a rule: I'm using 'cBufSize' as well as the
(string-)value '128'. Its just asking for trouble ... Therefore I would
rather have the "128" in my code replaced with something which is derived
from cBufSize.

Well, there is a method, but its goes in a round-about way which I would
like to get rid of:

@@Temp catstr <'>,%cBufSize,<'>
@@FormatString db '%', @@Temp, 's',0

(something like "db %cBufSize" or "db catstr ...." does not work)

My question: Is there a way to directly turn a(n EQUated) value into a
string and use it in a DB line ?

Regards,
Rudy Wieser



Alf P. Steinbach

unread,
Jan 25, 2012, 9:24:19 AM1/25/12
to
I would recommend using C.

It might sound corny, but you can do stuff in C that you can't in assembly.

Then, in a turnabout of the usual, use or call them C things from assembly.

By the way, re languages, very few know assembly nowadays, and Borland's
v 5 toolset is really really old. Unless you're using the OO features of
TASM I recommend using a more modern assembler. There is one in the
Microsoft SDK (also installed when you install e.g. Visual C++ Express).

Cheers & hth.,

- Alf

R.Wieser

unread,
Jan 25, 2012, 5:32:29 PM1/25/12
to
Hello Alf,

> I would recommend using C.

Thank you, but no. I have no desire to switch languages just to tackle a
simple problem like this. If the solution I already created is the smallest
that can be made than so be it.

Besides, its not the actual language which is the problem, but just the
(inbuild) pre-processor and my knowledge about how to instruct it to do
something.

> It might sound corny, but you can do stuff in C that you can't in
assembly.

I get the feeling you are remembering that the wrong way around ...

Regards,
Rudy Wieser


-- Origional message:
Alf P. Steinbach <alf.p.stein...@gmail.com> schreef in berichtnieuws
jfp3am$da8$1...@dont-email.me...

Jeroen Mostert

unread,
Jan 26, 2012, 9:19:21 AM1/26/12
to
On 2012-01-25 23:32, R.Wieser wrote:
<snip>
> Besides, its not the actual language which is the problem, but just the
> (inbuild) pre-processor and my knowledge about how to instruct it to do
> something.
>
Indeed. Try comp.lang.asm.x86, you may have more luck finding people who can
answer this question. It's not Win32-specific.

>> It might sound corny, but you can do stuff in C that you can't in
> assembly.
>
> I get the feeling you are remembering that the wrong way around ...
>
Well, technically speaking, he's right, although you wouldn't think it.

I can't write an assembly program that will print "Hello, world!" on any
Linux system. I can't even write one that will do it on both Windows 3.0 and
Windows 7 Home Premium 64-bit. In C, this is not just no problem but usually
the first program you write to see if things work (and on Windows, in fact,
it's possible to write a more complicated program that pops up a window,
without changing the code).

--
J.

R.Wieser

unread,
Jan 26, 2012, 11:00:20 AM1/26/12
to
Helo Jeroen,

> Indeed. Try comp.lang.asm.x86, you may have more luck finding
> people who can answer this question. It's not Win32-specific.

Reading your own reply, neither is C(++), and still people are asking
questions about it here. :-)

And by the way, Tasm v5.0 is *very* Win32 specific.

But its a good suggestion. If do not get an answer here I can certainly try
there.

> I can't write an assembly program that will print "Hello, world!"
> on any Linux system

Don't attribute that to the language or the OS, but to your own knowledge of
both. <whistle> Besides, I know many people who can't do it on X86 either
...

> I can't even write one that will do it on both Windows 3.0 and
> Windows 7 Home Premium 64-bit.

Same problems apply to the different versions of Linux.

... Or you must mean that you can often (but not always) take your
*sourcefile* to a different platform, use a fully different,
tailored-to-the-OS C(++) compiler (with its own set of include, lib and
other OS-dependant files) and re-compile it to an executable there.

But thats not what I would call "... you can do stuff in C that you can't in
assembly".

> (and on Windows, in fact, it's possible to write a more
> complicated program that pops up a window, without
> changing the code).

I'm sorry, but "write a more complicated program" in the same sentence as
"without changing the code" does not make much sense to me.

Regards,
Rudy Wieser


-- Origional message:
Jeroen Mostert <jmos...@xs4all.nl> schreef in berichtnieuws
4f2160f3$0$6936$e4fe...@news2.news.xs4all.nl...

Jeroen Mostert

unread,
Jan 26, 2012, 11:06:16 AM1/26/12
to
On 2012-01-26 17:00, R.Wieser wrote:
>> Indeed. Try comp.lang.asm.x86, you may have more luck finding
>> people who can answer this question. It's not Win32-specific.
>
> Reading your own reply, neither is C(++), and still people are asking
> questions about it here. :-)
>
I don't see how this invalidates my suggestion that you're more likely to
get questions about assembly answered in an assembly group. I didn't say you
*can't* ask the question here, but the group doesn't have all that many
members left to begin with, and the cross-section with people who know TASM
is probably even smaller.

> ... Or you must mean that you can often (but not always) take your
> *sourcefile* to a different platform, use a fully different,
> tailored-to-the-OS C(++) compiler (with its own set of include, lib and
> other OS-dependant files) and re-compile it to an executable there.
>
Yes, that's exactly what I mean.

> But thats not what I would call "... you can do stuff in C that you can't in
> assembly".
>
Why not? Is such a program not written in C? Can you write a similar program
in assembly language with anything approaching the same ease?

>> (and on Windows, in fact, it's possible to write a more
>> complicated program that pops up a window, without
>> changing the code).
>
> I'm sorry, but "write a more complicated program" in the same sentence as
> "without changing the code" does not make much sense to me.
>
I meant "without changing the code to incorporate platform-specific
changes". I *am* talking about two different "hello, world" programs.

--
J.

R.Wieser

unread,
Jan 26, 2012, 5:25:44 PM1/26/12
to
Hello Jeroen,

> I don't see how this invalidates my suggestion that
> you're more likely to get questions about assembly
> answered in an assembly group.

Than I apologize, I misunderstood.

> Why not? Is such a program not written in C?

And this has something to do with using syntax .... how exactly ?

> Can you write a similar program in assembly language
> with anything approaching the same ease?

Yes, sure. Just let someone else write an Assembler for another platform
which takes a Borland Assembler sourcefile and translates it to an
executable for that platform, and I can do the very same thing.

> I meant "without changing the code to incorporate
> platform-specific changes". I *am* talking about
> two different "hello, world" programs.

So, again nothing to do with programming ("in C"), just the compiler and the
C-APIs ("with C").


Can we go back to my origional question please ?

Regards
Rudy Wieser


-- Origional message:
Jeroen Mostert <jmos...@xs4all.nl> schreef in berichtnieuws
4f217a01$0$6872$e4fe...@news2.news.xs4all.nl...

Andy

unread,
Jan 26, 2012, 5:37:08 PM1/26/12
to
On Jan 26, 4:25 pm, "R.Wieser" <addr...@not.available> wrote:
> Hello Jeroen,
>
> > I don't see how this invalidates my suggestion that
> > you're more likely to get questions about assembly
> > answered in an assembly group.
>
> Than I apologize, I misunderstood.
>
> > Why not? Is such a program not written in C?
>
> And this has something to do with using syntax .... how exactly ?
>
> > Can you write a similar program in assembly language
> > with anything approaching the same ease?
>
> Yes, sure.   Just let someone else write an Assembler for another platform
> which takes a Borland Assembler sourcefile and translates it to an
> executable for that platform, and I can do the very same thing.
>
> > I meant "without changing the code to incorporate
> > platform-specific changes". I *am* talking about
> > two different "hello, world" programs.
>
> So, again nothing to do with programming ("in C"), just the compiler and the
> C-APIs ("with C").
>
> Can we go back to my origional question please ?
>
> Regards
> Rudy Wieser
>
> -- Origional message:
> Jeroen Mostert <jmost...@xs4all.nl> schreef in berichtnieuws
> 4f217a01$0$6872$e4fe5...@news2.news.xs4all.nl...
I am curious.

Where are you getting updated include and library files for such an
old program?

Andy

Jeroen Mostert

unread,
Jan 26, 2012, 6:33:31 PM1/26/12
to
On 2012-01-26 23:25, R.Wieser wrote:
>> Why not? Is such a program not written in C?
>
> And this has something to do with using syntax .... how exactly ?
>
I have no idea what you're getting at. I'll assume we're talking completely
past each other. The point wasn't all that interesting to begin with.

>> I meant "without changing the code to incorporate
>> platform-specific changes". I *am* talking about
>> two different "hello, world" programs.
>
> So, again nothing to do with programming ("in C"), just the compiler and the
> C-APIs ("with C").
>
Again, I don't understand what you mean and you don't understand what I mean.

> Can we go back to my origional question please ?
>
Well, no -- if I knew the answer to that one I would have said it. We've
been on tangents ever since.

It's been a pleasure miscommunicating, as always. :-)

--
J.

R.Wieser

unread,
Jan 28, 2012, 6:46:26 AM1/28/12
to
Hello Andy,

> Where are you getting updated include and library files
> for such an old program?

*Getting* ? No such thing I'm afraid.

I generate the LIB files directly from the DLL (sometimes together with a
DEF file for ordinal-only entries) using IMPLIB, and create basic a INC file
containing all function by examining the output of TDUMP. Adding the
arguments and their used records, constants, etc. is all handywork.

Luckily MS has got info for the arguments on quite a few function-calls.
Although for the constants, etc. I often take a peek in/copy from other
languages (including C's) header-files, as MS often forgets to mention the
values/strings they represent them ...

Regards,
Rudy Wieser


-- Origional message:
Andy <chocolate...@yahoo.com> schreef in berichtnieuws
e1afccb9-bd75-4efe...@j15g2000yqb.googlegroups.com...

R.Wieser

unread,
Jan 28, 2012, 6:54:10 AM1/28/12
to
Hello Jeroen,

> I have no idea what you're getting at. I'll assume we're
> talking completely past each other.

"Alf P. Steinbach" said, in his first reply:
"It might sound corny, but you can do stuff in C that you can't in
assembly."

To which I responded:
"I get the feeling you are remembering that the wrong way around ..."

Now you're up-to-date.

> The point wasn't all that interesting to begin with.

Sigh ... Than please do everyone a favour and don't engage in that part of
the conversation.

I still appreciate the suggestion for the other newsgroup though.

Regards,
Rudy Wieser


-- Origional message:
Jeroen Mostert <jmos...@xs4all.nl> schreef in berichtnieuws
4f21e2d5$0$6920$e4fe...@news2.news.xs4all.nl...

Jeroen Mostert

unread,
Jan 28, 2012, 7:11:14 AM1/28/12
to
On 2012-01-28 12:54, R.Wieser wrote:
>> The point wasn't all that interesting to begin with.
>
> Sigh ... Than please do everyone a favour and don't engage in that part of
> the conversation.
>
Sorry, I can't promise something as outrageous as keeping my mouth shut when
I could be hearing myself talk. It's not like you're paying me. :-)

--
J.

Bob Masta

unread,
Jan 28, 2012, 7:52:24 AM1/28/12
to
On Sat, 28 Jan 2012 12:46:26 +0100, "R.Wieser"
<add...@not.available> wrote:

>Hello Andy,
>
>> Where are you getting updated include and library files
>> for such an old program?
>
>*Getting* ? No such thing I'm afraid.
>
>I generate the LIB files directly from the DLL (sometimes together with a
>DEF file for ordinal-only entries) using IMPLIB, and create basic a INC file
>containing all function by examining the output of TDUMP. Adding the
>arguments and their used records, constants, etc. is all handywork.
>
>Luckily MS has got info for the arguments on quite a few function-calls.
>Although for the constants, etc. I often take a peek in/copy from other
>languages (including C's) header-files, as MS often forgets to mention the
>values/strings they represent them ...

I know you are using TASM, but you might want to download
MASM32 just to get the headers and include files, which have
most of the constants... probably everything through WinXP,
at least.

Best regards,


Bob Masta

DAQARTA v6.02
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Sound Level Meter
Frequency Counter, FREE Signal Generator
Pitch Track, Pitch-to-MIDI
Science with your sound card!

Alf P. Steinbach

unread,
Jan 28, 2012, 12:21:02 PM1/28/12
to
On 25.01.2012 23:32, R.Wieser wrote:
> Hello Alf,
>
>> > I would recommend using C.
> Thank you, but no. I have no desire to switch languages just to tackle a
> simple problem like this. If the solution I already created is the smallest
> that can be made than so be it.
>
> Besides, its not the actual language which is the problem, but just the
> (inbuild) pre-processor and my knowledge about how to instruct it to do
> something.
>
>> > It might sound corny, but you can do stuff in C that you can't in
> assembly.
>
> I get the feeling you are remembering that the wrong way around ...

Nope.

For example, and relevant to your case, C has a better preprocessor.

By the way, please don't quote the irrelevant stuff, as you did.

R.Wieser

unread,
Jan 28, 2012, 1:30:09 PM1/28/12
to
Hello Alf,

> > I get the feeling you are remembering that the wrong way around ...
>
> Nope.

Yep. Again : "with C" != "in C". Also see the below.

> For example, and relevant to your case, C has a better preprocessor.

And you base that "better" on ... what exactly ? Do you even *know*
Borlands Tasms pre-processor ?

I currently have exactly two problems with Borland Tasms preprocessor, and
this message is about one. And I'm not even sure if it *is* a problem, or
just something I do not yet know (same for the other one actually).

> By the way, please don't quote the irrelevant stuff, as you did.

Next time quote the relevant parts of the message you're talking about, so
the person you are talking to (me in this case) knows what you are
referrring to and does not have to guess ...

Regards,
Rudy Wieser


-- Origional message
Alf P. Steinbach <alf.p.stein...@gmail.com> schreef in berichtnieuws
jg1aq1$s4n$1...@dont-email.me...

R.Wieser

unread,
Jan 28, 2012, 1:33:46 PM1/28/12
to
Hello Bob,

> I know you are using TASM, but you might want to
> download MASM32 just to get the headers and
> include files, which have most of the constants...
> probably everything through WinXP, at least.

Thanks for the suggestion. Yes, they might be similar enough that a bit of
text-manipulation could convert the Masm way of defining structures and
constants to what I'm using.

Regards,
Rudy Wieser


-- Origional message
Bob Masta <N0S...@daqarta.com> schreef in berichtnieuws
4f23ede...@news.eternal-september.org...

Alf P. Steinbach

unread,
Jan 29, 2012, 2:54:20 PM1/29/12
to
On 28.01.2012 19:30, R.Wieser wrote:
> Hello Alf,
>
>>> I get the feeling you are remembering that the wrong way around ...
>>
>> Nope.
>
> Yep. Again : "with C" != "in C". Also see the below.
>
>> For example, and relevant to your case, C has a better preprocessor.
>
> And you base that "better" on ... what exactly ? Do you even *know*
> Borlands Tasms pre-processor ?


It would solve the problem you are claiming to have.

In that sense it's clearly better than what you're struggling with.

Although it seems you're just a troll, so I'm sorry wasting others' time
by replying to you.


>
> I currently have exactly two problems with Borland Tasms preprocessor, and
> this message is about one. And I'm not even sure if it *is* a problem, or
> just something I do not yet know (same for the other one actually).
>
>> By the way, please don't quote the irrelevant stuff, as you did.
>
> Next time quote the relevant parts of the message you're talking about,

I did.

And again you quoted a lot of irrelevant stuff.

That's another sign of a troll.


Bye, hopefully forever,

- Alf

R.Wieser

unread,
Jan 30, 2012, 10:54:26 AM1/30/12
to
Alf,

> It would solve the problem you are claiming to have.

Yes, thats a great idea ! Whenever you have a (minor) problem just drop
whatever you have and just grab something else !

At least that way you will be sure to go nowhere fast. :-)

> > Next time quote the relevant parts of the message you're talking about,
>
> I did.

So the fact that I mentioned that I said I would have to guess to what you
where referring to when you mentioned "irrelevant stuff" means nothing to
you ?


Or are you actually playing the very game you are accusing me of, trolling ?

That would explain quite a bit, including the evasive replies, selective
quoting, and the not following of your own "don't quote irrelevant stuff"
rule.

> Bye, hopefully forever,

Thats fully upto you.

Regards,
Rudy Wieser


-- Origional message:
Alf P. Steinbach <alf.p.stein...@gmail.com> schreef in berichtnieuws
jg485d$ivk$1...@dont-email.me...
0 new messages