Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I write my first program in DOS mode ?

Tutorials

How do I write my first program in DOS mode ?

by  straiph  Posted    (Edited  )
This tutorial uses TASM. Others may vary slightly.
A DOS compatible shell or mode is required.

1, Create a text file called TEST.ASM in the directory where TASM.EXE & TLINK.EXE are located.

2, Copy the following text into TEST.ASM

.model tiny
.stack
.data
m1 db "Hello$"
.code
main proc
mov ax,0B800h
mov ds,ax ;data segment base=0B8000h
mov bx,09Eh ;top right corner
mov al,02Ah ;an asterisk
mov ah,01Fh ;white foreground, blue background
mov [bx],ax ;put word into screen memory
push seg m1
pop ds
mov ah, 09
lea dx, m1
int 21h
mov ax, 4c00h
int 21h
main endp
end main

3, Open a DOS prompt and goto the previously stated directory.

4, type 'TASM TEST.ASM' and press return, it should create a TEST.OBJ file with no errors.

5, type 'TLINK TEST.OBJ' and press return, it should create a TEST.EXE file with no errors.

6, type TEST and press return, results should be a clear screen with Hello at top left and a white asterisk with a blue background located at top right.

7, Pat yourself on the back with a big smile while feelings last or until nausea.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top