TurboAssembler Debugger

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Turbo Assembler & Debugger

Programming Process

program.asm
Assembler

program.o
Linker

program.exe
Page  12

Hello World Program


.model small
.stack 200h ; defines the stack size, the default is 1024 bytes
.data
msg db "Hello world!$"
.code
start:

mov ax,@data

mov ds,ax
lea dx,msg
mov ah,09h ;print string
int 21h
mov ax,4c00h ;exit to the operating system with no error
int 21h
end start
Page  13

Directives

 Lines that start with a "." are used to provide the assembler with
information. The word(s) behind it say what kind of info.
 .model small In this case it just tells the assembler the program is small
and doesn't need a lot of memory.
 .stack This one tells the assembler that the "stack" segment starts
here. The stack is used to store temporary data. It isn't used in the
program, but it must be there, because we make an .EXE file and these
files MUST have a stack.
 .data indicates that the data segment starts here and that the stack
segment ends there.
 .code indicates that the code segment starts there and the data
segment ends there.
 end start tells the assembler that the program is finished. It also tells
the assembler where to start the program.
Page  14

Generating Executable File

Page  15

>tasm /zi hello.asm


>tlink /v hello.obj

Assembler Errors
.model small
.stack 200h
.data
msg db "Hello world!$"
.code
start:
mov ax,@data
mov ds,ax
lea dx,msg
mov es,1234
mov ah,09h
int 21h
mov ax,4c00h
int 21h
end start
Page  16

Using Turbo Debugger


>Td hello.exe

Page  17

Turbo Debugger Windows


1. Memory containing program code

Page  18

Turbo Debugger Windows (contd)


2. Memory containing data

Page  19

You can write data directly into memory from the Dump window

Turbo Debugger Windows (contd)


3. Registers

Page  20

Turbo Debugger Windows (contd)


4. Flags

Page  21

Using Breakpoints

Page  22

Displaying User Window

Page  23

Common Shortcuts For Turbo Debugger

Function

Page  24

Shortcut

Zooming in and out

Alt + Enter

Run

F9

Trace into

F7

Step over

F8

Place a breakpoint

Alt + F2

Remove a breakpoint

F2

You might also like