19.04.2018 Views

Tutorial de ensamblador

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

IMPRIME msj<br />

GOTOXY 1,3<br />

IMPRIME msj1<br />

GOTOXY 1,5<br />

IMPRIME msj2<br />

GOTOXY 1,1<br />

IMPRIME mensaje1<br />

GOTOXY 1,4<br />

IMPRIME mensaje2<br />

GOTOXY 20,4<br />

LEE maximo_caracteres<br />

IMPRIME linea_en_blanco<br />

mov bx,0<br />

Nótese que los macros se llaman solamente mencionando su nombre. En<br />

caso <strong>de</strong> que se quieran enviar parámetros, se indican a un lado <strong>de</strong>l nombre <strong>de</strong>l<br />

MACRO.<br />

Invertir ca<strong>de</strong>na<br />

pushpila:<br />

mov al,ca<strong>de</strong>na[bx]<br />

push ax<br />

inc bl<br />

cmp bl,lencad<br />

jne pushpila<br />

mov bx,0<br />

poppila:<br />

pop ax<br />

mov girat[bx],al<br />

inc bl<br />

GOTOXY 24,9<br />

cmp bl,lencad<br />

jne poppila<br />

mov girat[bx],'$'<br />

imprime girat<br />

IMPRIME linea_en_blanco<br />

En pushpila: Se mueve la ca<strong>de</strong>na ingresada al acumulador en la parte baja.<br />

Se mueve todo el registro AX a la pila para almacenamiento temporal. Se<br />

incrementa el contador BL, se compara BL con la longitud <strong>de</strong> ca<strong>de</strong>na, si no es<br />

igual, es <strong>de</strong>cir, si el ciclo no se ha terminado, se repite pushpila, si sí, se limpia el<br />

registro BX.<br />

95

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!