Professional Documents
Culture Documents
GRUPO: 301302_38
INGENIERA DE SISTEMAS
MAYO 2017
INTRODUCCIN
MEN
1. Datos del autor
2. Suma de dos nmeros
3. Resta de dos nmeros
4. Multiplicacin de dos nmeros
5. Divisin de dos nmeros
6. Validar si un nmero es positivo o negativo
CODIGO:
Data segment
Data ends
pila segment stack
pila ends
code segment
assume cs:code,ds:data,ss:pila
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
xor dx,dx
mov ax,0600h
mov ah,09h
mov dx,offset mens1
int 21h
mov ah,09h
mov dx,offset mens2
int 21h
mov ah,09h
mov dx,offset mens4
int 21h
mov ah,09h
mov dx,offset mens5
int 21h
mov ah,09h
mov dx,offset mens6
int 21h
mov ah,09h
mov dx,offset mens7
int 21h
mov ah,09h
mov dx,offset mens8
int 21h
mov ah,09h
mov dx,offset mens9
int 21h
mov ah,09h
mov dx,offset mens10
int 21h
;lee
mov ah,01h
int 21h
;ajustar el teclado
xor ah,ah
sub al,30h
mov cx,2
;verifica opcion
cmp al,1
jz autor
cmp al,2
jz suma
cmp al,3
jz resta
cmp al,4
jz mult
cmp al,5
jz divi
cmp al,6
jz posneg
cmp al,7
jz fin
autor:
mov ah,09h
mov dx,offset mens3
int 21h
jmp menu
suma:
mov ah,09h
mov dx,offset mens11
int 21h
;lee teclado
mov ah,01h
int 21h
;verificar si es negativo
cmp al,2dh
je signo
;ajustar teclado
sub al,30h
add result,al
jmp return1
signo:
mov ah,01h
int 21h
sub al,30h
neg al
add result,al
je return1
return1: loop suma
imp1:
cmp result,00
jl imp2
mov ah,02h
mov dl,10
int 21h
mov ah,02h
mov dl,13
int 21h
mov ah,09h
mov dx,offset mens12
int 21h
jmp imprime
imp2:
neg result
mov ah,02h
mov dl,10
int 21h
mov ah,02h
mov dl,13
int 21h
mov ah,09h
mov dx,offset mens12
int 21h
mov ah,02h
mov dl,'-'
int 21h
jmp imprime
imprime:
mov ah,0
mov al,result
mov cl,10
div cl
add al,30h
add ah,30h; pasa a decimal
mov bl,ah
mov dl,al
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
mov cx,2
jmp menu
resta:
mov ah,09h
mov dx,offset mens11
int 21h
;lee teclado
mov ah,01h
int 21h
;verificando si es negativo
cmp al,2dh
je signor
sub al,30h
cmp cx,2
je etiqueta1
sub result,al
jmp return2
etiqueta1:
mov result,al
jmp return2
signor:
mov ah,01h
int 21h
sub al,30h
neg al
cmp cx,2
je etiqueta1
sub result,al
je return2
return2:
loop resta
jmp imp1
mult:
mov ah,09h
mov dx,offset mens11
int 21h
;lee teclado
mov ah,01h
int 21h
;verificando si es negativo
cmp al,2dh
je signom
sub al,30h
cmp cx,2
je etiqueta2
mov ah,0
mul result
jmp return3
etiqueta2:
mov result,al
jmp return3
signom:
mov ah,01h
int 21h
sub al,30h
neg al
cmp cx,2
je etiqueta2
mov ah,0
mul result
jmp return3
return3:
loop mult
mov result,al
jmp imp1
mov signox,0
posneg:
mov ah,09h
mov dx,offset mens11
int 21h
;lee teclado
mov ah,01h
int 21h
;verificar si es negativo
cmp al,2dh
je signo
jmp menu
divi:
mov ah,09h
mov dx,offset mens11
int 21h
;lee teclado
mov ah,01h
int 21h
;verificando si es negativo
cmp al,2dh
je signod
sub al,30h
cmp cx,2
je etiqueta3
cmp al,0
mov ah,0
mov numero,al
mov al,result
div numero
jmp return4
etiqueta3:
mov result,al
jmp return4
signod:
mov ah,01
int 21h
sub al,30h
inc signox
cmp cx,2
je etiqueta3
mov ah,0
mov numero,al
mov al,result
div numero
jmp return4
return4:loop divi
mov quotient,al
mov residue,ah
mov result,al
jmp imp3
imp3:
mov ah,02h
mov dl,10
int 21h
mov ah,02h
mov dl,13
int 21h
mov ah,09h
mov dx,offset mens12
int 21h
jmp imprimedivi
imprimedivi:
mov al,result
mov ch,30h
add al,ch
add ah,ch
mov bl,ah
mov ah,9
mov dx,offset mens13
int 21h
cmp signox,1
jz cambio
jmp termina
cambio:
mov dl,"-"
mov ah,02h
int 21h
mov signox,0
termina:
mov dx,0
add quotient,30h
mov dl,quotient
mov ah,02h
int 21h
mov ah,9
mov dx,offset mens14
int 21h
mov dx,0
add residue,30h
mov dl,residue
mov ah,02h
int 21h
jmp menu
fin: ret
menu endp
code ends
end menu
Pantallazos:
CONCLUSIONES