Assembly language

  • #1

Main Question or Discussion Point

How to write assembly language program in DOS environment? I want to type my assembly language program in some interface and compile and link and execute it. How do I do that? Should I use one of those Masm/Nasm/Tasm assemblers or what?
 
Last edited:

Answers and Replies

  • #2
chiro
Science Advisor
4,790
132
How to write assembly language program in DOS mode? I want to type my assembly language program in some interface and compile and link and execute it. How do I do that?
Hey pair of strings and welcome to the forums.

I wrote DOS based assembly a long time ago (when DOS was the only thing for games), so I can give you some pointers.

If you want to write DOS based code, one thing you need to know is the DOS "interface" and by interface I mean the interrupt calls.

The interrupt calls are used for everything from opening files, to setting your video mode, to playing CD audio, to allocating memory, to basically everything!

Also you have to be aware of segmented memory model vs the flat memory model. When I did DOS programming back then, segments were the model over flat. Segments in my view are really stupid since segments actually overlap, where as with the flat model memory addresses are unique: don't ask me why they did the segmented model the way they did, but yeah that's just the way it is.

I can't help you out any more unless you be more specific about it is that you want to do. If you want to write library code for some platform like say BASIC (with CALL ABSOLUTE), then you just have to basically restore the state before you leave your call.

If you want to write an entire program in complete assembler, you will need to really get a good grasp of the DOS dev environment (i.e, the interrupts). You will probably have to implement some custom interrupt code for the keyboard and that requires writing an ISR and getting DOS to use that ISR when you're code is running.

If you want to do things like write a joystick or sound driver (to play wave files) you need to get specs for IO port calls and the like. Same if you want to do graphics stuff in 256 color mode.

Then on top of your code that deals with files, memory, input and so on, you need your program specific code.

Maybe you can tell me what you want to do so I can give you some specific advice. Also I'm wondering why you want to want to code in DOS: you can write code in assembly using something like windows, but I guess if you want the kind of low level control that the DOS environments offers (no protected memory!) then I can understand.
 
  • #3
I need a stand-alone interface which will help me to write my program at low level using assembly.
like the way i do to write a C program
c:\>cd tc
c:\>tc\cd bin
c:\>tc\bin\tc.exe
opens up an interface where I can type my program and do stuff.
Similarly, I need some interface where I can type assembly language program then compile it then link it and execute it, if I am right with the order.
I want to do this in DOS environment, not in OS
 
Last edited:
  • #4
33,728
5,421
It appears that you are using Borland's Turbo C. The last version of Turbo C that I had, included their assembler, tasm.exe, and their linker, tlink.exe. If you have those tools, you should be able to write your assembly code using the same interface that can be used to write C code, but you will need to assemble and link your code from the DOS command line.

You can debug your assembly code using their debugger, tdbug.exe or tdebug.exe. I think that's what it is called.
 
  • #5
rcgldr
Homework Helper
8,699
528
Microsoft Visual Studio includes a dos console (command) option under "tools" folder in the start / programs / ... folder. Once there you can use ML to assemble code. You don't get a toolbox like Programmers Workshop + Codeview though.

You could use the normal VS windows interface and create a dos console program, but you'd have to set a break point at the end of the program. or call a console input function at the end of the program to prevent the console window from closing when the program completes.
 
  • #6
thank you all of you, i have found the solution. thanks.
 

Related Threads on Assembly language

  • Last Post
Replies
13
Views
1K
  • Last Post
Replies
18
Views
8K
  • Last Post
Replies
4
Views
1K
  • Last Post
3
Replies
60
Views
14K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
16
Views
833
  • Last Post
Replies
5
Views
3K
  • Last Post
Replies
18
Views
5K
  • Last Post
Replies
12
Views
2K
Replies
122
Views
8K
Top