Muhammad Yasir
Muhammad Yasir

Reputation: 308

Why doesn't it Outputs the Value?

.model small
.stack 256
.data
Var db 50 ; default is decimal
.code
Start:
mov dl,Var
mov ah,2h
int 21h
mov ax,4c00h
int 21h
end Start

This code compiles rightly and links rigtly but when you run it like this. Considering Abc.asm C:\TASM>Abc.asm No Errors C:\TASM>tlink Abc.obj C:\TASM>Abc

C:\TASM> It Just doesn't print anything, But if i write code in this way it works and show 8 as output.

.model small
.stack 256
.data
Var db 50 ; default is decimal
.code
Start:
mov al,'8'
mov Var,al
mov dl,Var
mov ah,2h
int 21h
mov ax,4c00h
int 21h
end Start

Upvotes: 2

Views: 46

Answers (1)

Fifoernik
Fifoernik

Reputation: 9899

The first code snippet probably doesn't work because you didn't setup the DS segment register.
The second code snippet is somewhat independant of such an initialization. It'll work with whatever is in DS at the moment.

Upvotes: 1

Related Questions