Вы находитесь на странице: 1из 8

;;;;; imprime una cadena (impcad)

codigo segment
assume cs:codigo, ds:datos
entrada:

mov
mov
mov
mov
int
mov
int

ax, datos
ds,ax
dx, offset texto
ah, 09h
21h
ah,4ch
21h

codigo ends
datos segment
texto db "esta cadena ha sido", 0ah, 0dh
db "definida en un segmento de datos $"
datos ends
end entrada
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; imprime una cadena (men4)
CODIGO2 SEGMENT
ASSUME CS:CODIGO2, DS:CODIGO2
ENTRADA2: MOV AX,CS
MOV DS,AX
MOV DX, OFFSET TEXTO2
MOV AH,09H
INT 21H
MOV AH,4CH
INT 21H
TEXTO2 DB "IMPRIME CADENA, VERSION 2 ", 0AH,0DH,"$"
CODIGO2 ENDS
END ENTRADA2

;;;;;;;;;;;;;;;;;;;;;;;;;;
; compara dos cadenas ingresadas x teclado
datos segment
texto db "Ingrese cadena: $"
noigual db "cadenas no son iguales $"
siigual db "cadenas son iguales $"
buf db 40 dup (?)
buf1 db 40 dup (?)
datos ends
cod segment
assume cs:cod , ds:datos
ini: mov ax,datos
mov ds,ax

mov dx, offset texto


mov ah,09h
int 21h
mov
mov
mov
mov
int
mov cl,byte
mov
mov
int
mov
int

ah,0ah
dx,offset buf
bx,dx
byte ptr [bx],0fh
21h
ptr [bx+1]

ah,02h
dl,0ah
21h
dl,0dh
21h
mov dx, offset texto
mov ah,09h
int 21h

mov ah,0ah
mov dx,offset buf1
mov si,dx
mov byte ptr [si],0fh
int 21h
;mov al,byte ptr [si+1]
cmp byte ptr [si+1],cl
jne no_igual
add
add
repetir:
;
mov
mov

bx,2
si,2
al,byte ptr[bx]
dl,byte ptr[si]

cmp byte ptr[bx],dl


jne no_igual
inc si
inc bx
cmp buf1[si],0dh
je igual
jmp repetir
igual:
mov
mov
int
mov
int
mov
mov
int
jmp

ah,02h
dl,0ah
21h
dl,0dh
21h
dx, offset siigual
ah,09h
21h
fin

no_igual:
mov ah,02h

mov
int
mov
int
mov
mov
int
fin:
mov
int
cod ends
end

dl,0ah
21h
dl,0dh
21h
dx, offset noigual
ah,09h
21h
ah,4ch
21h
ini

;;;;;;;;;;;;;;;;;;;
; cuenta la cantidad de palabras
datos segment
texto db " Ingrese cadena: $"
texto1 db " La cantidad de palabras en la cadenas son: $"
buf db 180 dup (?)
datos ends
cod segment
assume cs:cod , ds:datos
ini: mov ax,datos
mov ds,ax
mov dx, offset texto
mov ah,09h
int 21h
mov
mov
mov
mov
int

ah,0ah
dx,offset buf
si,dx
byte ptr [si],20h;32
21h

mov ah,02h
mov dl,0ah
int 21h
mov dl,0dh
int 21h
mov cx,1
add si,2
bucle: mov al,byte ptr[si]
inc si
cmp buf[si],0dh
je fin
cmp al,20h
jne bucle
inc cx
jmp bucle
fin:
mov dx, offset texto1
mov ah,09h
int 21h
add cx,48
mov dl,cl
mov ah,2h

int
mov
int
cod ends
end

21h
ah,4ch
21h
ini

;;;;;;;;;;;;;;;;;;;;;;
compara con el 1,
datos segment
texto db "Ingrese numero de un digito comparado con 1: $"
buf db 4 dup (?)
datos ends
cod segment
assume cs:cod , ds:datos
ini: mov ax,datos
mov ds,ax
mov dx, offset texto
mov ah,09h
int 21h
mov
mov
mov
mov
int

ah,0ah
dx,offset buf
si,dx
byte ptr [si],2
21h

mov ch,0
mov cl,[si+2]
sub cl,"0"
cmp cx,1
jb menor
ja mayor
je igual
menor: mov
mov
int
mov
int
mov
mov
int

ah,02h
dl,0ah
21h
dl,0dh
21h
dl,3ch
ah,2h
21h

mayor: mov
mov
int
mov
int
mov
mov
int
jmp
igual: mov
mov
int

ah,02h
dl,0ah
21h
dl,0dh
21h
dl,3eh
ah,2h
21h
fin
ah,02h
dl,0ah
21h

;sub ch,ch

mov
int
mov
mov
int
jmp

dl,0dh
21h
dl,3dh
ah,2h
21h
fin

fin:

mov ah,4ch
int 21h
cod ends
end ini
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;emite un mensaje ya definido en
; el segmento de datos (mensaje)
datos segment
texto db "esta cadena ha sido",0ah,0dh
db "definida en un segmento d datos$"
datos ends
cod segment
assume cs:cod , ds:datos
ini: mov ax,datos
mov ds,ax
mov dx, offset texto
mov ah,09h
int 21h
mov ah,4ch
int 21h
cod ends
end ini
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; compara dos numeros ya definidos
codigo segment
assume cs:codigo
inicio: mov ax,5
mov bx,3
cmp ax,bx
je igual
ja mayor
je igual
jb menor
mayor: mov dl,3eh
mov ah,2h
int 21h
jmp fin
igual: mov dl,3dh
mov ah,2h
int 21h
jmp fin
menor: mov dl,3ch
mov ah,2h
int 21h
fin:
mov ah,4ch

int 21h
codigo ends
end inicio
;;;;;;;;;;;;;;;;;;;;;;;
; imprimir del 0-9 linea por linea(numeros)
codigo segment
assume cs:codigo
inicio:
mov dl,30h
mov ah,2h
otra_vez:
int 21h
mov bl,dl
mov
int
mov
int

dl,0ah
21h
dl,0dh
21h

mov dl,bl
cmp dl,39h
je fin
inc dl
jmp otra_vez
fin:

mov ah,4ch
int 21h
codigo ends
end inicio
;;;;; ingresar un numero
; y saber si es primo o no (primox)
datos segment
texto db "Ingrese numero: $"
buf db 40 dup (?)
num dw 0
mensaje1 db "es primo",0ah,0dh,"$"
mensaje2 db "no es primo",0ah,0dh,"$"
datos ends
programa segment
assume cs:programa, ds:datos
comienzo:
mov ax,datos
mov ds,ax
mov dx, offset texto
mov ah,09h
int 21h
mov ah,0ah
mov dx,offset buf
mov si,dx
mov byte ptr [si],5
int 21h
mov ah,02h
mov dl,0ah
int 21h

mov dl,0dh
int 21h
mov cl,48
mov ax,0
mov dl,10
mov bx,0
add si,2
bucle: mov al,byte ptr[si]
sub al,cl
;
add bx,ax
inc si
cmp byte ptr[si],0dh
je finb
mul dl
mov bx,ax
mov ax,0
jmp bucle
finb:

add bx,ax
mov ax,bx

mov num,ax
siguiente:

primo:

no_primo:
fin:

mov bx,02h
cmp bx,num
je primo
mov dx,0h
mov ax,num
div bx
cmp dx,0h
je no_primo
inc bx
jmp siguiente
mov dx, offset mensaje1
mov ah,09h
int 21h
jmp fin
mov dx,offset mensaje2
mov ah,09h
int 21h
mov ah, 4ch
int 21h

programa ends
end comienzo
;;imprimr letras de la a-f
;prog2
codigo segment
assume cs:codigo
inicio: mov dl,41h
mov ah,2h
otra_vez:
int 21h
cmp dl,46h
je fin
inc dl
jmp otra_vez
fin:
mov ah,4ch
int 21h

codigo ends
end inicio
;;imprimir de a-g
;linea x linea (prog23)
codigo segment
assume cs:codigo
inicio:
mov dl,41h
mov ah,2h
otra_vez:
int 21h
mov bl,dl
mov
int
mov
int

dl,0ah
21h
dl,0dh
21h

mov dl,bl
cmp dl,47h
je fin
inc dl
jmp otra_vez
fin:
mov ah,4ch
int 21h
codigo ends
end inicio
;; raiz cuadrada de un
; numero ya definido (raiz)
datos segment
num dw 9
raiz dw 0
datos ends
programa segment
assume cs:programa, ds:datos
comienzo:
mov ax,datos
mov ds,ax
sig:
inc raiz
mov ax,raiz
mul ax
cmp ax,num
jbe sig
dec raiz
mov ax,raiz
add al,30h
mov dl,al
mov ah,2h
int 21h
fin:
mov ah, 4ch
int 21h
programa ends
end comienzo

Вам также может понравиться