From: Dirk Wolfgang Glomp on
Am Sat, 17 Apr 2010 03:50:34 -0700 (PDT) schrieb iamsumesh:

> Hi,
>
> I am sumesh. new to assembly programming. i am using masm 6.15. i need
> to help in getting tutorial for assembly programming in dos using
> masm. and can i get some sample asm source code to start coding at
> beginning level.
>
> Sumesh.

MASM 6(ml.exe) can´t be use under a pure DOS enviroment it need windows.
To build a 16 Bit executable we need the link.exe from MASM 5. We can use
MASM 5(masm.exe) under DOS, but it doesn´t provide menmonics for MMX, XMM,
or 3Dnow opcodes. If we want to use those mnemonics then we must assemble
under windows using MASM 6, or we must handcoded these opcodes with MASM 5.
If our 16bit executable use direct hardware access that can´t be emulate
under windows, then we have to boot a pure DOS to enable those access.

Here is a tiny raw skeloton for example:
;-----------------------------------------------------
..MODEL SMALL
..386P
..387
; ---Here we can place some declarations of constants--
FOO = 123
;
CODE SEGMENT use16 'CODE'
assume cs:CODE,ds:DATEN,ss:STAPEL
org 100h

START: mov ax, DATEN
mov ds, ax

BEGIN: call BLURB

xor cl, cl ; no Error
BACK: mov al, cl ; ERRORLEVEL
mov ah, 4Ch
int 21h
;--------------
; Sub-Routines
;-------------------------------------
org START + ((($-START)/16)*16)+16 ; Code-Aligment
;-------------------------------------
BLURB:
ret
CODE ends
; ------DATA--------
DATEN SEGMENT use32 'DATA'
org 0
VALUE DD 12345678h
DATEN ends
; ------STACK--------
STAPEL SEGMENT use16 STACK 'STACK'
DB 10h dup (0)
STAPEL ends
end
;-----------------------------------------------------

MASM 5:
MASM /Z test.asm,test.obj,test.lst,test.crf
LINK /CP:1 test.obj,test.exe,test.map,,

MASM 6(with link.exe from MASM 5):
ML /c /Zm test.asm
LINK /CP:1 test.obj,test.exe,,,

....

Many thanks for the essential and indispensable list of DOS interrupts
made by Ralf Brown and helpers to realize the "RBIL":
http://www.pobox.com/~ralf
http://www.pobox.com/~ralf/files.html
ftp://ftp.cs.cmu.edu/afs/cs.cmu.edu/user/ralf/pub/

Dirk
From: Dirk Wolfgang Glomp on
Am Sun, 18 Apr 2010 08:09:02 +0200 schrieb Dirk Wolfgang Glomp:
> Here is a tiny raw skeloton for example:
> ;-----------------------------------------------------
> .MODEL SMALL
> .386P
> .387

For MASM 6 we can use:

..MODEL SMALL
..686P
..MMX

---[Download MASM 5]---
I use google to find some "masm51.zip":
http://microprocessados.lesc.ufc.br/downloads2.php?nomepasta=Laboratorio
http://microprocessados.lesc.ufc.br/downloads/Laboratorio/masm51.zip

This other one with the same filename contains only a dokumentation:
http://www.bbs.motion-bg.com/dl.php?file=431

Dirk
From: wolfgang kern on

"iamsumesh" wrote:

> Hi,

Hello Sumesh,

> I am sumesh. new to assembly programming. i am using masm 6.15. i need
> to help in getting tutorial for assembly programming in dos using
> masm. and can i get some sample asm source code to start coding at
> beginning level.

Perhaps an older MASM/TASM version may be better for 16-bit code.
But I'd recommend to use FASM, NASM or Ben's NBASM for ye olde DOS.
The internet archives are full with example-code and tutorials
of any kind (terse->explaining/.../->redundant verbose),
sorry for I haven't any link to this old stuff at hand yet,
just check on what other reply suggest.
A great help will be RBIL (Ralf Browns Interrupt List).
Most used BIOS and DOS functions are found in INT10/15/21(all hex).

__
wolfgang


From: Dirk Wolfgang Glomp on
Am Sat, 17 Apr 2010 18:24:42 -0400 schrieb Frank Kotler:

> Herbert Kleebauer wrote:
>
> ...
>> here a simple NASM example...
>
> ...
>> lop: bsr.l getc ; get char from stdin
>> cmp.l -1,r0 ; EOF
>> bne.b .10 ; branch if not
>> andq.l 0,r0
>> bsr.l exit
>
> Just for the record, Sumesh, this is *not* the usual Nasm syntax.
>
> If you're determined to use Masm... for dos... The old, obsolete, 16-bit
> "Art of Assembly" may interest you:
>
> <http://homepage.mac.com/randyhyde/webster.cs.ucr.edu/www.artofasm.com/DOS/index.html>
>
> If you're willing to consider something a little more "modern"... and
> "flexible"... Dr. Paul Carter's tutorial covers 32-bit programming for
> dos (DJGPP - Thanks, D.J.!), Windows, Linux... etc.
>
> http://www.drpaulcarter.com/pcasm
>
> Good luck with your studies!
>
> Best,
> Frank

For a first test of input and output using DOS softints it is also possible
to start debug.exe(mayby with WinXP). So we can execute some opcodes step
by step and have a break to see in the listed registers if our code is
functional or not.

http://www.armory.com/~rstevew/Public/Tutor/Debug/debug-manual.html

Dirk
From: iamsumesh on
Hi,

Thanks for all. Thanks for your help.

Sumesh.