tasm


why do we use 0dh,0ah after msg1 db in this statement :msg1 db 0dh, 0ah, “ENTER A CHOICE $”;


DATA segment
msg1 db 0dh, 0ah, "ENTER A CHOICE $";
msg2 db 0dh, 0ah, "1.Addition $";
msg3 db 0dh, 0ah, "2.Subtraction $";
msg4 db 0dh, 0ah, "3.Exit $";
msg5 db 0dh, 0ah, "Enter the first number $";
msg6 db 0dh, 0ah, "Enter the second number $";
msg7 db 0dh, 0ah, "Result $";
msg8 db 0dh, 0ah, "Enter a valid input $";
msg9 db 0dh, 0ah, "$";
buffer Db ?;
ten dw 0010;
hun dw 0100;
tho dw 1000;
rem dw ?;
DATA ends
CODE segment
assume CS:CODE,DS:DATA
start:
him proc
MOV AX,DATA;
MOV DS,AX;
MOV DX, OFFSET msg1;
MOV AH, 09H;
INT 21h;
MOV DX, OFFSET msg2;
MOV AH, 09H;
INT 21h;
MOV DX, OFFSET msg3;
MOV AH, 09H;
INT 21h;
MOV DX, OFFSET msg4;
MOV AH, 09H;
INT 21h;
MOV DX, OFFSET msg9;
MOV AH, 09H;
INT 21h;
mov ah, 01h;
int 21h;
cmp al, 33h;
je ex;
cmp al, 31h;
je addfunc;
cmp al, 32h;
je subfunc;
cmp al, 33h;
jg errfunc
cmp al, 31h;
jl errfunc
proc read
mov ah,01
int 21h
sub al,48
mul ten
mov buffer,al
mov ah,01
int 21h
sub al,48
add buffer,al
ret ;number in buffer
endp
errfunc proc
mov dx, offset msg8
mov ah, 09h
int 21h
call him
endp
ex proc
MOV AH,4CH
INT 21H
endp
addfunc proc
MOV DX, OFFSET msg5;
MOV AH, 09H;
INT 21h;
call read
mov cl,buffer
MOV DX, OFFSET msg6;
MOV AH, 09H;
INT 21h;
call read
mov bl,buffer
MOV DX, OFFSET msg7;
MOV AH, 09H;
INT 21h;
add cl,bl;
mov al,cl
mov ah,00
call write
call him
endp
subfunc proc
MOV DX, OFFSET msg5;
MOV AH, 09H;
INT 21h;
call read
mov cl,buffer
MOV DX, OFFSET msg6;
MOV AH, 09H;
INT 21h;
call read
mov bl,buffer
MOV DX, OFFSET msg7;
MOV AH, 09H;
INT 21h;
sub cl,bl;
mov al,cl
mov ah,00
call write
call him
endp
proc write;assuming value is stored in ax
mov dx,0000
div tho
mov rem,dx
add al,48
mov dl,al
mov ah,02h
int 21h
mov ax,rem
mov dx,0000
div hun
mov rem,dx
add al,48
mov dl,al
mov ah,02h
int 21h
mov ax,rem
mov dx,0000
div ten
mov rem,dx
add al,48
mov dl,al
mov ah,02h
int 21h
mov ax,rem
mov dx,0000
add al,48
mov dl,al
mov ah,02h
int 21h
ret
endp
endp
CODE ends
end start
MS-DOS needs two characters to perform a cursor jump to the beginning of the next line: 0dh(Carriage Return, abbr. CR) & 0ah (Line Feed, abbr. LF), usually abbreviated as CrLf. The first character causes the cursor just to jump to the beginning of the line, the second character let the cursor move to the next line. You can play with the definitions (omit 0ah, omit 0dh, omit both) and observe the result.
The CrLf at the beginning of msg1 wouldn't be necessary for the first use, but msg1 is part of a loop. result ... has no CrLf at its end, so msg must have it at its start.

Related Links

How do you code subtraction in TASM
How to do inverse subtraction in TASM?
Display Negative numbers in TASM
getch() in TASM
why do we use 0dh,0ah after msg1 db in this statement :msg1 db 0dh, 0ah, “ENTER A CHOICE $”;
TASM problems with output
TASM Can't locate .asm file Error: **Fatal** Command line: Can't locate file: filename.asm
TASM giving no output after compile
I can't figure out how to delete a row in my tasm assembly homework
How to read and write A FAT in WinXP [duplicate]
Turbo Assembler [closed]
8086 programming using TASM: pc to pc communication

Categories

HOME
eclipse
oracle12c
eslint
dns
powerpoint
swt
yahoo-finance
access
parameters
limit
hpc
crystal-reports-2013
frontend
webix
arangodb
syntaxnet
openpyxl
gson
github-enterprise
pega
searchview
microsoft-dynamics-nav
kendo-mobile
hta
exploit
object-storage
google-api-client
syntax-highlighting
motion-detection
cppreference
android-sugarorm
sammy.js
apic
xcode7.3
google-earth-engine
cd
sessionstorage
flatmap
z-notation
recurrent-neural-network
apns-php
health-monitoring
css-position
tasm
dbnull
http-request
photos
httrack
user-defined-fields
insight
excel-dna
neon
mapinfo
gogs
jbase
custom-errors
opl
qt5.2
forwarding
microsoft-reporting
flock
.bash-profile
atoi
telepat
kubuntu
adehabitathr
dbaccess
sql-scripts
easyrtc
device-tree
memset
android-framework
mt4j
light
cocoalibspotify-2.0
inappsettingskit
kogrid
scmmanager
resource-management
saleslogix
ilasm
expression-blend-4
mysql-error-1205
rmdir
resharper-6.0
globals
addchild
openfaces
cfwindow
lobo-cobra
escrow
fault-tolerance
application-planning
entitykey
soappy
netbeans6.1

Resources

Encrypt Message