ASM/CDS/EJEMPLO2.ASM
2021-09-03 17:40:06 +02:00

55 lines
1.2 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

segmento SEGMENT
ASSUME DS:segmento
ORG 100h
principal PROC NEAR
call Borra
mov ah, 02h
mov dh, 11
mov dl, 30
mov bh, 00h
int 10h
mov ah, 09h
mov dx, OFFSET MensajeSaludo
int 21h
mov ah, 00h
int 16h
call Borra
mov ah, 4ch
int 21h
principal ENDP
Borra PROC NEAR
push ax ; Se almacenan en la pila los registros que va a utilizar
push bx ; la subrutina. El valor de SP disminuye en 4 * 2 = 8
push cx ; unidades
push dx
mov ax, 0600h ; Se borra la pantalla
mov bh, 07h
mov cx, 0000h
mov dx, 184fh
int 10h
pop dx ; Se recuperan los valores de los registros, de forma que
pop cx ; al volver el control de la ejecuci¢n al m¢dulo principal
pop bx ; stos almacenen los valores que pose¡an antes de la
pop ax ; llamada al procedimiento. SP se incrementa en 4 * 2 = 8
; unidades
ret
Borra ENDP
MensajeSaludo DB '­Hola Mundo!$'
segmento ENDS
END principal