lab 12

5
LABORATORIO 12 MACROS Y PROCEDIMIENTOS 1.- Del siguiente código, describir la funcionalidad de cada una de las opciones 2.- modificar las macros de las formas vistas en clases 3. modificar el programa para usar las 3 formas de procedimientos vistos. POSCI macro col, fil local fin push ax push bx push dx mov dl,col ; dl = columna cmp dl,0 jl fin cmp dl,79 jg fin mov dh,fil ; dh = fila cmp dh,0 jl fin cmp dh,24 jg fin mov bh,0 ; mov ah,2 ; int 10h ; fin: pop dx pop bx pop ax endm LIMPIA macro push ax push bx push cx push dx mov cH,1 MOV CL,61 mov dh,24 mov dl,79 mov bh,10H mov al,0

description

lab

Transcript of lab 12

LABORATORIO 12

MACROS Y PROCEDIMIENTOS

1.- Del siguiente código, describir la funcionalidad de cada una de las opciones

2.- modificar las macros de las formas vistas en clases

3. modificar el programa para usar las 3 formas de procedimientos vistos.

POSCI macro col, fil local fin push ax push bx push dx mov dl,col ; dl = columna cmp dl,0 jl fin cmp dl,79 jg fin mov dh,fil ; dh = fila cmp dh,0 jl fin cmp dh,24 jg fin mov bh,0 ; mov ah,2 ; int 10h ; fin: pop dx pop bx pop ax endm LIMPIA macro push ax push bx push cx push dx mov cH,1 MOV CL,61 mov dh,24 mov dl,79 mov bh,10H mov al,0

mov ah,06h int 10h pop dx pop cx pop bx pop ax endm DELAY macro time local au,abc push dx push cx MOV DX,time AU: MOV CX,0FFFFH ABC: LOOP ABC DEC DX CMP DX,0 JNE AU pop cx pop dx endm MONITOR equ 0b800h rx equ 80 ry equ 25 pila segment stack db 200 dup (' ') pila ends data segment c db 0CH a db 07 canon db 0dbh atr0 db 03 x_co db 20 y_co db 24 x_c db 20 y_c db 20 x_iv db 01h y_iv db 01h x_i db 01h y_i db 01h x_b db ? y_b db ? BALIN DB 7FH CL_SC DB 2000 DUP(' '),'$' MEN_SA DB 'RECORD','$'

data ends codigo segment assume cs:codigo,ss:pila,ds:data star: mov ax,data mov ds,ax LEA DX,CL_SC MOV AH,09H INT 21H LIMPIA POSCI 65,10 LEA DX,MEN_SA INT 21H POSCI 68D,14D mov ax,MONITOR mov es,ax inicio: MOV AL,01H MOV Y_IV,AL repit: mov dx,0 mov ax,2*rx mul ds:y_co ; mov di,ax ; mov dx,0 mov ax,2 mul ds:x_co ; add di,ax ; mov al,canon mov es:[di],al mov al,atr0 mov es:[di]+1,al DELAY 50 mov dx,0 mov ax,2*rx mul ds:y_iv mov si,ax mov dx,0 mov ax,2 mul ds:x_iv add si,ax mov al,c mov es:[si],al mov al,a mov es:[si]+1,al DELAY 10d mov al,20h mov es:[si],al add x_iv,1

mov ah,0bh int 21h cmp al,0ffh jnz falso mov ax,0 int 16h cmp ah,4dh je derecha cmp ah,4bh je izquierda cmp ah,48h je balas jmp INICIO derecha: MOV AL,20H MOV ES:[DI],AL ADD X_CO,1 CMP X_CO,60 JLE FALSO ; JMP SALTO2 IZQUIERDA: MOV AL,20H MOV ES:[DI],AL SUB X_CO,1 CMP X_CO,1 JGE FALSO JMP DERECHA BALAS: MOV AL,Y_CO DEC AL DEC AL MOV Y_B,AL MOV ah,X_CO MOV X_B,ah JMP PA_SO FALSO : JMP FAL_SO PA_SO: BALA_0: mov dx,0 mov ax,2*rx mul ds:y_B mov si,ax

mov dx,0 mov ax,2 mul ds:x_B add si,ax mov al,BALIN mov es:[si],al mov al,a mov es:[si]+1,al DELAY 10 jmp siggg repi1: MOV AL,20H MOV ES:[SI],AL jmp repit siggg: MOV BL,Y_B MOV BH,Y_IV MOV AL,X_B MOV AH,X_IV CMP AL,AH JE MENSAJE CMP BL,BH JE MENSAJE mov al,20h mov es:[si],al DEC BL mov y_b,bl CMP y_b,0 JE REPI1 JMP BALA_0 MENSAJE: POSCI 68d,14D FAL_SO: cmp x_iv,60 jle repi1 add y_iv,1 mov x_iv,1 cmp y_iv,20 jle repi1 jmp inicio codigo ends end star