Paste: Subtraction

Author: r1nu-
Mode: assembly-x86
Date: Wed, 1 Jul 2009 23:57:13
Plain Text |
jmp start
msg:db "Enter the first number",13,10,"$"
msg2:db "Enter the second number",13,10,"$"

start
;ask for first number
mov ah,09;
lea dx,msg
int 21h

;read first number
mov ah,01;
int 21h
mov dl,al;
push dx ;the data will go in dl

;prompt for second number
mov ah,09;
lea dx,msg2 ;load second message
int 21h

;read second number
mov ah,01 ;keyboard input
int 21h

sub al,30h ;convert ascii to actual integer
pop dx
add dl,al

;display the subtraction of the two numbers
mov ah,2
sub dl,al
int 21h
int 20h
;end program

Annotation: Subtraction

Author: r1nu-
Mode: assembly-x86
Date: Wed, 1 Jul 2009 23:58:41
Plain Text |
jmp start
msg:db "Enter the first number",13,10,"$"
msg2:db "Enter the second number",13,10,"$"

start:
;ask for first number
mov ah,09;
lea dx,msg
int 21h

;read first number
mov ah,01;
int 21h
mov dl,al;
push dx ;the data will go in dl

;prompt for second number
mov ah,09;
lea dx,msg2 ;load second message
int 21h

;read second number
mov ah,01 ;keyboard input
int 21h

sub al,30h ;convert ascii to actual integer
pop dx
add dl,al

;display the subtraction of the two numbers
mov ah,2
sub dl,al
int 21h
int 20h
;end program

New Annotation

Summary:
Author:
Mode:
Body: