You are on page 1of 5

;Autor Marco Azpurua ;URL .model small .stack 64h .

DATA titulo DB "* CALCULADORA ARITMETICA LOGICA BASICA *$" solicitar dB "operacion:$" .code MOV AX,@DATA mov ds,ax ;marco principal mov ax,0600h mov bh,2Dh mov cx,0610h mov dx,123Fh int 10h ;posicionar el cursor para titulo mov dx,0814h mov ah,02h mov bh,00h int 10h ;escribir string de titulo mov ah,09h mov cx,01h mov dx,offset titulo; dir. base string CALCULADORA int 21h ;posicionar el cursor para texto mov dx,0A14h mov ah,02h mov bh,00h int 10h ;escribir string de solicitud de operacin mov ah,09h mov cx,01h mov dx,offset solicitar; dir string de solicitar operacin int 21h ;marco de datos mov ax,0600h mov bh,70h mov cx,0A20h mov dx,0B36h Int 10h ;marco de smbolo & mov ax,0600h mov bh,0D7h mov cx,1014h mov dx,1118h int 10h ;posicionar cursor mov dx,1016h mov ah,02h mov bh,00h int 10h ;escribir simbolo mov ah,02h mov cx,01h mov dl,26h; smbolo & int 21h

;marco de smbolo + mov ax,0600h mov bh,0D7h mov cx,1020h mov dx,1124h int 10h ;posicionar cursor mov dx,1022h mov ah,02h mov bh,00h int 10h ;escribir simbolo mov ah,02h mov cx,01h mov dl,2Bh; smbolo + int 21h ;marco de smbolo mov ax,0600h mov bh,0D7h mov cx,1028h mov dx,112Ch int 10h ;posicionar cursor mov dx,102Ah mov ah,02h mov bh,00h int 10h ;escribir simbolo mov ah,02h mov cx,01h mov dl,2Dh; smbolo int 21h ;marco de smbolo * mov ax,0600h mov bh,0D7h mov cx,1030h mov dx,1134h int 10h ;posicionar cursor mov dx,1032h mov ah,02h mov bh,00h int 10h ;escribir simbolo mov ah,02h mov cx,01h mov dl,2Ah; smbolo * int 21h ;marco de smbolo / mov ax,0600h mov bh,0D7h mov cx,1038h mov dx,113Ch int 10h ;posicionar cursor mov dx,103Ah mov ah,02h mov bh,00h int 10h ;escribir simbolo

mov ah,02h mov cx,01h mov dl,2Fh; smbolo / int 21h ;posicionar cursor mov dx,0A22h mov ah,02h mov bh,00h int 10h ;capturar operacin call CALC ;posicionar cursor mov dx,1400h mov ah,02h mov bh,00h int 10h mov ah,01h int 21h mov ah,4Ch int 21h ;funciones de la calculadora CALC: CALL CAPT; llamar a capturar operando PUSH AX; guarda dato 1 en pila MOV AH,01h; capturer operador INT 21h MOV DL,AL; lo guarda el DL CALL CAPT; llamar a capturar operando MOV BX,AX; guarda dato 2 en BX POP AX; recupera dato 1 ;comparacin del operador para llamar al procedimiento de la operacin escogida CMP DL,2Bh; (+) JZ SUMA ;salta a sumar CMP DL,2Dh;(-) JZ RESTA ; salta a restar CMP DL,2Ah;(*) JZ MULT;salta a multiplicar CMP DL,2Fh; (/) JZ DIVISION; salta a dividir CMP DL,26h;(&) JZ AND_LOGICA; salta a and RESULTADO: MOV AH,02h; posicin de retorno de calculo MOV DL,3Dh; (=) INT 21h; imprime caracter MOV DL,CL; acarreo o signo negativo INT 21h; imprime caracter MOV DL,BH; digito mas significativo INT 21h; imprime caracter MOV DL,BL; digito menos significativo INT 21h; imprime caracter RET; retornar a la interfase grfica que lo llamo ;capturar operando CAPT: MOV AH,01h INT 21h MOV BH,AL

INT MOV SUB RET

21h AH,BH AX,3030h

SUMA: MOV CL,00 ADD AX,BX CMP AL,0Ah JB DIGITO DAA INC AH DIGITO: MOV BL,AL MOV AL,AH CMP AL,0Ah JB DECENA DAA MOV CL,31h DECENA: MOV BH,AL AND BX,0F0Fh OR BX,3030h JMP RESULTADO resta: MOV CMP JGE XCHG MOV restar: SUB CMP JB DAS listo: MOV AND OR JMP ;nota: MULT: MOV MUL AAM MOV AND OR JMP CL,00 AX,BX restar AX,BX CL,2Dh AX,BX AL,0Ah listo BX,AX BX,0F0Fh BX,3030h RESULTADO multiplicaciones de operandos de un digito CL,00 BL BX,AX BX,0F0Fh BX,3030h RESULTADO

;divisiones de nmeros resultado de productos de un digito DIV es rervada no se us a como etiqueta DIVISION: MOV CL,00 AAD DIV BL MOV BL,AL OR BL,30h

JMP

RESULTADO

AND_LOGICA: AND BX,AX OR BX,3030h MOV CX,0000h JMP RESULTADO END

You might also like