Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Using tasm
This may be off topic, but I couldn't find a TASM or Borland
newsgroup, so don't tell me I'm off topic unless you have a better
place....

I downloaded CBuilderX personal edition, and in the bin directory
found a file called tasm32.exe.  I had been wanting to learn tasm for
a while, so I decided to try it out.
I'm tried to assemble this code with tasm:

MAIN SEGMENT
ASSUME DS:MAIN,ES:MAIN,CS:MAIN,SS:MAIN

START:
MOV AH,02h
MOV DL,41h

INT 21h
INT 20h
MAIN ENDS
END START


I put it in a file called x.asm, and the command "tasm32 x.asm x.exe"
worked fine: tasm gave no errors and it produced x.exe.  But when
executed, x.exe did nothing.  I also tried assembling it into a .com
file, but to no avail.  Please help!



Report this thread to moderator Post Follow-up to this message
Old Post
PlasmaDragon
03-20-04 01:25 AM


Re: Using tasm
I just recreated the DOS program myself.

Its calling a DOS character writing function (ie, Function 2h of
Interrupt 21). In other words it's a DOS program. The
Interrupt 20h is used to end a DOS program.

All that app does is displays the letter A on the next line of a
DOS prompt screen. If you click on it through windows, it's
likely that you won't even see it display the letter A being
drawn.

If you run the program from inside a DOS prompt though, you
should see the letter 'A' printed to a blank line and then the DOS
prompt returns.

To assemble that using DEBUG, open a DOS prompt and then
type the following at the DOS prompt, the dashes are the DEBUG
prompts.

C:\>DEBUG
-n test.com
-rcx

-200
a 100
mov ah, 2
mov dl, 41
int 21
int 20
<press the enter key to make a blank line and get out of assembly>
-w
-q

C:\>

The commands for debug can be found by typing a ? at the - prompt.
The - is the standard prompt seen while using DEBUG.

Here's a brief commentary of the commands used above:
-a 100
This command tells debug to start assembling at line 100.
Line 100 is the default start line used in all .com programs.
The lines are all hex based numbers, as you'll see when using debug.

-n test.com
This command names the file as test.com.

-rcx
The RCX command is the way to put a number into the CX register.
The CX register needs a number because the next command uses
the CX to tell how many bytes to write to the drive.

-w
This command needs a number in the CX register so it knows how
many bytes are in the program and how many bytes need to be
written to the disk drive.

It also requires the file to have a name, thus you use the -n command
to name the file.

Int 21h is an old DOS function number. It is simply called Interrupt 21
and there are a ton of functions defined by placing a Function Number
into the AH register and using the other registers to specify various
parameters. In the Interrupt 21h, Function 2h, it requires a character
code to be placed into the DL register. This character code is
displayed on a blank line when Int 21 is called.

Int 20 is the DOS End command. It means the program is done doing
what it does, and it's used to return control to the DOS prompt.

Hope that helps.

--
Jim Carlock
http://www.microcosmotalk.com/
Post replies to the newsgroup.




Report this thread to moderator Post Follow-up to this message
Old Post
Jim Carlock
03-20-04 01:25 AM


Re: Using tasm
What's it supposed to do?

--
Jim Carlock
http://www.microcosmotalk.com/
Post replies to the newsgroup.


"PlasmaDragon" <PlasmaDragon@lycos.co.uk> wrote in message
news:15f1ff99.0403121241.716ccf1a@posting.google.com...
| This may be off topic, but I couldn't find a TASM or Borland
| newsgroup, so don't tell me I'm off topic unless you have a better
| place....
|
| I downloaded CBuilderX personal edition, and in the bin directory
| found a file called tasm32.exe.  I had been wanting to learn tasm for
| a while, so I decided to try it out.
| I'm tried to assemble this code with tasm:
|
| MAIN SEGMENT
|      ASSUME DS:MAIN,ES:MAIN,CS:MAIN,SS:MAIN
|
| START:
|     MOV AH,02h
|     MOV DL,41h
|
|     INT 21h
|     INT 20h
| MAIN ENDS
| END START
|
|
| I put it in a file called x.asm, and the command "tasm32 x.asm x.exe"
| worked fine: tasm gave no errors and it produced x.exe.  But when
| executed, x.exe did nothing.  I also tried assembling it into a .com
| file, but to no avail.  Please help!
|
|
|



Report this thread to moderator Post Follow-up to this message
Old Post
Jim Carlock
03-20-04 01:25 AM


Re: Using tasm
TASM createse .obj files from your source.  After you make the .obj you need
to use TLINK to create your .com or .exe file that you want.

Solidus




Report this thread to moderator Post Follow-up to this message
Old Post
Solidus
03-20-04 01:25 AM


Re: Using tasm
PlasmaDragon <PlasmaDragon@lycos.co.uk> schreef in berichtnieuws
15f1ff99.0403121241.716ccf1a@posting.google.com...

Hello PlasmaDragon,

> I downloaded CBuilderX personal edition, and in the bin directory
> found a file called tasm32.exe.  I had been wanting to learn tasm for
> a while, so I decided to try it out.
> I'm tried to assemble this code with tasm:

[Snip]

As Jim allready stated, the usage of the above INT's indicate you're
targetting a 16-bit DOS environment and not a 32-bit Windows one.

> I put it in a file called x.asm, and the command "tasm32 x.asm x.exe"
> worked fine: tasm gave no errors and it produced x.exe.

Strange ...  My (Tasm32, v5.0) assembler returns : "fatal : 16-bit segments
not supported".

In other words : you should not even be getting *any* output at all .....

> But when executed, x.exe did nothing.

Ofcourse not.  You might have given the output-file a .EXE -extention, but
that does not mean that the contents of that file are what you might expect
of an .EXE-file.

As Solidus allready remarked : what you have is an .OBJ-file, renamed to an
.EXE-file..   It's like you would put a sticker on your bike saying that
it's a car, and than expect it would be able to run 100 mph ...  It just
does not work that way :-)


Converting a Source-file is a two-step process :  First you convert the file
into an OBJ (why ?  Because you can combine multiple .OBJ-files into a
single .EXE), and then you *link* (using tlink) the .OBJ into a .EXE or
.COM -file.


You need to use Tasm (no "32" to it :-) and TLink for that.  The command's
to do it are :
tasm /ml {yourfile}
followed by
tlink {yourfile}

"{yourfile}" equals the name of your source-file *without* it's extenti
on.

Regards,
Rudy Wieser






Report this thread to moderator Post Follow-up to this message
Old Post
R.Wieser
03-20-04 01:25 AM


Re: Using tasm
PlasmaDragon wrote:
> This may be off topic, but I couldn't find a TASM or Borland
> newsgroup, so don't tell me I'm off topic unless you have a better
> place....

If it's assembly language related, then it's "on-topic"...as simple as
that in this group...which is also known to go wildly off-topic all
the time, anyway, that even if you were totally off-topic, no-one
would probably notice, anyhow ;)...

Beth :)



Report this thread to moderator Post Follow-up to this message
Old Post
Beth
03-20-04 01:25 AM


Re: Using tasm
Rudy wrote:
> Strange ...  My (Tasm32, v5.0) assembler returns : "fatal : 16-bit
segments
> not supported".
>
> In other words : you should not even be getting *any* output at all
......
[ snip ]
> You need to use Tasm (no "32" to it :-) and TLink for that.

Depends; Some versions of "TASM32" happily assemble both 16-bit and
32-bit code without complaint as they can do both...so, I guess if
TASM32 isn't complaining when he compiles the 16-bit code then it's a
version that supports both he's got there...

But you _do_ need to select "TLINK" or "TLINK32" as is appropriate to
16-bit or 32-bit code with all the versions I've seen...I don't
think - at least haven't seen - a version of TLINK by Borland that
also does this "dual mode" kind of thing and your comments _are_
useful in that context about selecting the correct version of TLINK or
TLINK32, depending on whether you're targetting 16-bit or 32-bit...

Beth :)



Report this thread to moderator Post Follow-up to this message
Old Post
Beth
03-20-04 01:25 AM


Re: Using tasm
(snip)

> Here's a brief commentary of the commands used above:
> -a 100
> This command tells debug to start assembling at line 100.
> Line 100 is the default start line used in all .com programs.
> The lines are all hex based numbers, as you'll see when using debug.
>
> -n test.com
> This command names the file as test.com.
>
> -rcx
> The RCX command is the way to put a number into the CX register.
> The CX register needs a number because the next command uses
> the CX to tell how many bytes to write to the drive.
>

i used to think the same thing... until i ran the following...

a 100
mov ax,201
mov bx,7c00
mov cx,1
mov dx,80
int 13
jb 100
int 3

g =100
rcx
200
n bootsect.bat
w

....here, debug will either give you an "insufficient disk space" message,
or it will write 7C000200h bytes to disk...

so... while it's usually true that you focus on CX... remember that BX plays
a role too... debug will write a number of bytes equal to the 32-bit number
BX:CX

> -w
> This command needs a number in the CX register so it knows how
> many bytes are in the program and how many bytes need to be
> written to the disk drive.

again... BX:CX.. not just CX



Report this thread to moderator Post Follow-up to this message
Old Post
Bx.C
03-20-04 01:25 AM


Re: Using tasm
"Beth" <BethStone21@hotmail.NOSPICEDHAM.com> wrote in message
news:ybv4c.579$_Q2.45@newsfep3-gui.server.ntli.net...
> PlasmaDragon wrote: 
>
> If it's assembly language related, then it's "on-topic"...as simple as
> that in this group...which is also known to go wildly off-topic all
> the time, anyway, that even if you were totally off-topic, no-one
> would probably notice, anyhow ;)...
>
> Beth :)
>
>

but... in case you ARE looking for a borland or tasm specific newsgroup....

borland.public.tasm

(borland has their own subset of newsgroups.... so you can look through the
borland.* for anything else you might have and use)



Report this thread to moderator Post Follow-up to this message
Old Post
Bx.C
03-20-04 01:25 AM


Re: Using tasm
I couldn't find tlink, but I could find something called ilink32 in
the same directory.  I thought "close enough" and tried to use it to
link the obj file, but then I got a message saying "Fatal: unsupported
16-bit segment(s) in module x.asm".  So I think the problem is that
tasm32 is making 16-bit code.  How do I force it to make 32-bit code?
Thanks in advance.



Report this thread to moderator Post Follow-up to this message
Old Post
PlasmaDragon
03-20-04 01:25 AM


Sponsored Links




Last Thread Next Thread Next
Pages (3): [1] 2 3 »
Search this forum -> 
Post New Thread

A86 Assembler archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:21 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.