Programas en ensamblador
saltolinea macro ; brinco de pagina
mov ah,02h
mov dl,0ah
int 21h
endm
LeerCaracter macro; permite leer caracter
mov ah,07h
int 21h
endm
data segment
n1 db ?n2 db ?
ends
code segment
inicio:
LeerCaracter
saltolinea
cmp al,27; salir
je salir
jne inicio
salir:
mov ah,00hmov al,03h
int 10h
.exit
Ends
2
impetiqueta macro
mov ah, 9h
int 21h
endm
leecaract macro
mov ah, 01h
int 21h
endm
saltolineamacro ; brinco de pagina
mov ah,02h
mov dl,0ah
int 21h
endm
data segment
msg1 db "CALCULAR EL FACTORIAL",13,10, "$"
pg1 db "DIGITA EL NUMERO QUE DESEAS: ",13,10, "$"result db "EL FACTORIAL ES:",13,10,"$"
numero dw ?
factorial dw ?
ends
Stack segment
dw 128 dup (?)
ends
code segment
inicio:
mov ax,data
mov ds,axmov es,ax
lea dx, msg1
impetiqueta
lea dx, pg1
impetiqueta
leecaract
mov ah, 00h
sub ax,30h
mov cx,ax
mov factorial,01
fact:cmp cx,01
jbe fin
mov ax,factorial
mul cx
mov factorial,ax
loop fact
.exit
fin:
saltolinea
lea dx,resultimpetiqueta
add factorial, 30h
mov dx,factorial
mov ah,02h
int 21h
ends
3
imprime macro
mov ah,09h
int 21h
endm
datasegment
ORDEN db "PROGRAMA QUE COMPARA 2 NUMEROS E IMPRIME EL MAYOR",13,10,"$"
DIG1 DB "INSERTA EL PRIMER DIGITO :",13,10,"$"
DIG2 DB "INSERTA EL SEGUNDO DIGITO:",13,10,"$"VAR1 DB ?
VAR2 DB ?
compcn DB "EL MAYOR ES :$"
ends
stack segment
dw 128 dup(0)
ends
code segment
inicia:
mov ax,data
mov ds,ax
mov...
Regístrate para leer el documento completo.