You are on page 1of 4

LABORATORIO N 8: PANTALLA Y TECLADO

1. Analizar el siguiente programa indicando que interrupciones de pantalla


se han realizado.
; a short program to check how
; set and get pixel color works
name "pixel"
org 100h
mov ah, 0 ; set display mode function.
mov al, 13h ; mode 13h = 320x200 pixels, 256 colors.
int 10h
; set it!
mov cx, 10 ; column
mov dx, 20 ; row
mov al, 15 ; white
mov ah, 0ch ; put pixel
int 10h
xor al, al ; al = 0
mov cx, 10 ; column
mov dx, 20 ; row
mov ah, 0dh ; get pixel
int 10h
; pause the screen for dos compatibility:
;wait for keypress
mov ah,00
int 16h
; return to text mode:
mov ah,00 ; set display mode function.
mov al,03 ; normal text mode 3
int 10h ; set it!
ret
2. Realizar un programa que realice lo siguiente:
Visualizar en el centro de la pantalla el resultado de la suma de los
valores 45H y 60H
3. Analizar el siguiente programa e indicar lo que realiza, cuales son las
subrutinas y que realizan cada una, y las interrupciones de visualizacin
en pantalla
; this example shows how to print string.
; the string is defined just after the call instruction.
; this example does not use emu8086.inc library.
name "print"
org 100h
; set these values to registers for no particular reason,
; we just want to check that the procedure does not destroy them.
mov si, 1234h
mov ax, 9876h
; 0Dh,0Ah - is the code
;
for standard new
;
line characters:

; 0Dh - carriage return.


; 0Ah - new line.
call printme
db 'hello', 0
; gets here after print:
mov cx, 1
call printme
db ' world!', 0Dh,0Ah, 0
; gets here after print:
mov cx, 2
call printme
db 'hi there!', 0Ah
db "what's up?", 0Dh,0Ah
db 'printing!', 0
; printme returns here:
xor cx, cx
call printme
db 0xd,0xa,"press any key...", 0
; wat for any key....
mov ah, 0
int 16h
ret ; return to os.
;*******************************
; this procedure prints a null terminated
; string at current cursor position.
; the zero terminated string should
; be defined just after
; the call. for example:
;
; call printme
; db 'hello world!', 0
;
; address of string is stored in the
; stack as return address.
; procedure updates value in the
; stack to make return
; after string definition.
printme:
mov
cs:temp1, si ; protect si register.
pop
si
; get return address (ip).
push ax
; store ax register.
next_char:
mov
al, cs:[si]
inc
si
; next byte.
cmp
al, 0
jz
printed
mov
ah, 0eh
; teletype function.
int
10h
jmp
next_char
; loop.
printed:

pop
ax
; re-store ax register.
; si should point to next command after
; the call instruction and string definition:
push si
; save new return address into the stack.
mov
si, cs:temp1 ; re-store si register.
ret
; variable to store original
; value of si register.
temp1 dw ?
;*******************************
4. Realizar un programa que entre por teclado la palabra idat y se visualice
en pantalla
5. Analizar el siguiente programa e indicar que es lo que realiza que
interrupciones de pantalla y teclado a utilizado
name "charchar"
org 100h
print_new_line macro
mov dl, 13
mov ah, 2
int 21h
mov dl, 10
mov ah, 2
int 21h
endm
mov dx, offset msg1
mov ah, 9
int 21h
; input the string:
mov dx, offset s1
mov ah, 0ah
int 21h
; get actual string size:
xor cx, cx
mov cl, s1[1]
print_new_line
mov bx, offset s1[2]
print_char:
mov dl, [bx]
mov ah, 2
int 21h
print_new_line
inc bx
loop print_char
; wait for any key...
mov ax, 0
int 16h
ret

msg1 db "ENTER THE STRING: $"


s1
db 100,?, 100 dup(' ')
end
6. Ingresar por teclado dos valores y sumarlos el resultado sacarlo por
pantalla

You might also like