19.04.2018 Views

Tutorial de ensamblador

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

mov ah,09h<br />

int 21h<br />

mov [si],byte ptr"$"<br />

mov dx,offset buf<br />

mov ah,09h<br />

int 21<br />

invertir:<br />

<strong>de</strong>c si<br />

mov al,[si]<br />

mov [di],al<br />

inc di<br />

loop invertir<br />

mov [di],byte ptr"$"<br />

mov dx,offset nuevalinea<br />

mov ah,09h<br />

int 21h<br />

mov dx,offset mensaje3<br />

mov ah,09h<br />

int 21h<br />

mov dx,offset fub<br />

mov ah,09h<br />

int 21h<br />

mov ax,4c00h<br />

int 21h<br />

co<strong>de</strong> ends<br />

end main<br />

Preparar las variables para invertir<br />

xor si,si<br />

xor di,di<br />

xor cx,cx<br />

lea si,buf<br />

lea di,fub<br />

Los registros SI, DI y CX (contadores) son limpiados con el operador lógico<br />

XOR. LEA SI, BUF es para preparar para la captura <strong>de</strong> caracteres por el usuario.<br />

LEA DI, FUB carga en DI el índice <strong>de</strong> FUB.<br />

45

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

Saved successfully!

Ooh no, something went wrong!