Assembly Tutorial Using TASM 2.0 AND TLINK 3.0


author: mywisdom


Before start you must download assembler and linker;

http://sowiesoft.com/.../TASM.zip


Since i'm on linux now (actually developing linux perl worm) but I'm
getting so bored , so let's recall back

my old memories with tasm maybe we're gonna get some ideas on worm


on linux we can use wine to run turbo assembler 2.0


----------------------

root@mywisdom-Vostro1310:/home/mywisdom/Downloads/dos# wine tasm.exe

Turbo Assembler  Version 2.0  Copyright (c) 1988, 1990 Borland
International

Syntax:  TASM [options] source [,object] [,listing] [,xref]

/a,/s         Alphabetic or Source-code segment ordering

/c            Generate cross-reference in listing

/dSYM[=VAL]   Define symbol SYM = 0, or = value VAL

/e,/r         Emulated or Real floating-point instructions

/h,/?         Display this help screen

/iPATH        Search PATH for include files

/jCMD         Jam in an assembler directive CMD (eg. /jIDEAL)

/kh#,/ks#     Hash table capacity #, String space capacity #

/l,/la        Generate listing: l=normal listing, la=expanded listing

/ml,/mx,/mu   Case sensitivity on symbols: ml=all, mx=globals, mu=none

/mv#          Set maximum valid length for symbols

/m#           Allow # multiple passes to resolve forward references

/n            Suppress symbol tables in listing

/o,/op        Generate overlay object code, Phar Lap-style 32-bit fixups

/p            Check for code segment overrides in protected mode

/q            Suppress OBJ records not needed for linking

/t            Suppress messages if successful assembly

/w0,/w1,/w2   Set warning level: w0=none, w1=w2=warnings on

/w-xxx,/w+xxx Disable (-) or enable (+) warning xxx

/x            Include false conditionals in listing

/z            Display source line with error message

/zi,/zd       Debug info: zi=full, zd=line numbers only

------------------------------


you dont have to use wine on blindows cmd: ms dos


* Some common used interrupts:


INT 21 H

- Interrupt 21 h function 09 h


This is one of most used interrupt, first we set 09h into ah register then
we set offset of previous declared msg into dx register. then we call dos
interrupt.


Here's sample of int 21 h function 09 h:

;fuck.asm

model small

stack 100h

data

msg db 'hei ',13,10,'$'

mov ah,9

mov dx,offset msg

int 21h

mov ah,4ch

int 21h

end


assemble:

----------------------------------

root@mywisdom-Vostro1310:/home/mywisdom/Downloads/dos# wine tasm fuck.asm

Turbo Assembler  Version 2.0  Copyright (c) 1988, 1990 Borland
International


Assembling file:   fuck.asm

Error messages:    None

Warning messages:  None

Passes:            1

Remaining memory:  431k

------------------------------------


and then linker using tlink 3.0:

----------------------------

root@mywisdom-Vostro1310:/home/mywisdom/Downloads/dos# wine tlink fuck.obj

Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

--------------------------


test running:

root@mywisdom-Vostro1310:/home/mywisdom/Downloads/dos# wine fuck

? ????????!?L?!hei


so what did above codes do?


;fuck.asm ---> this is a comment

model small -----------> direction here we declare that we use small
memory

stack 100h  -------> stack pointer declared as 100 h (100 h bytes=80h in
words)

data -----> segment

msg db 'hei ',13,10,'$'  -----> here we declare variable msg using define
bytes

mov ah,9 -----> register ah=09 hexa is required for int 21 h function 09h

mov dx,offset msg ----> move offset of msg to dx

int 21h                -------------> int 21 h -> call dos

mov ah,4ch       --------------> we use int 21 h function 4ch to return to
dos

int 21h                ------> int 21 h function 4ch will exit to dos

end                          ----> end of code