;***************************************************************** ;FIRE MAN LIVES visitors are reading this?! COOOOOOOOOL!! =) ;***************************************************************** ;Well, I don't know what to put here :( No art, no comics, just text ;Get out before you begin to hate me or stay if you're interested in another ;side of my live... (hey, that words were cool) ;Mmmmhhhh .... I don't know how many artist or MM fans would ;like to talk about topics like these: ;math ;algorithm ;IF THEN ELSE, CASE, WHILE DO, REPEAT UNTIL ;loops ;binary numbers ;compile ;debugging ; (EKKKKKKKKKKKKKKKKKK!) (EEEEWWWWWWWWWLLLLLL!!!!) (I'M OUTTA HERE!!) ;Damn! I lost a lot of fans with that words ;_; That was fun =) ;Here they are. An artist and an engineer in the same body. With the same brain. ;One get impressed with cool animations, japanesse art and comics. The other ;jump from his chair when a program runs sucessfully, he can built a digital ;controller with just a Eprom and some 7447, loves to read the news about ;more powerful comunication networks and faster connections with frame relay... ;Gosh ... can they be the same person. Their engineer friends doesn't have any ;idea of manga, DBZ, Photoshop or are interested in fan art web sites. Their ;artists friends doesn't like the Fourier series, NRZL-code, ATM networks, or ;panamsat.com ... Sometimes is frustrasting ... sometimes is funny. I would ;like to write a comic about this guy ... It will be really cool. But, heck, this ;guy is ME!!! I don't want a comic about ME! O___________O ;But, don't get me wrong. I fell great as I am. I respect a lot artists and ;engineers. The bad thing is it takes more time to be perfect in both things ;that in only one per time. o_- But, what I learned with this experience on this ;live is that anyone can be whatever he wants if he likes it. You may think, ;"Oh, he's a frustated artist who was forced to study engineering". You are ;wrong. People like that exits and its sad cause they generally don't ever make ;it. Never became engineers. But I make it. Five years left and only one more ;to go and I'm an engineer. The improvised engineer students give up in the ;first three years. And I understand them. Most of them just hate maths, physics ;or chemical... it's a hard career. You must prepared to presion and no free ;time. Yeah... engineering is the "real thing" in my live for now. ;But it's not ;the only thing that makes me happy. Art, anime, animation, writing comics ;is totally different. It's so great and amazing to write a comic, to tell ;an history, to tell a message with images ... Damn, i just can express how ;amazing the art is ... and I loved to draw since I have knowledge... So, well, ;I admit that it's a little sad that I never studied art formally. I mean, my ;name in a institution or something. An art teacher, real techs... things like ;that. But that doesn't mean that I won't ever do it! WHAAAAHHAAAAAAAAHHAAAAAAA! ;YOU ARE WRONG AGAIN!! I'll study seriously art soon! I can't wait for the ;results. Everything in this live has its time. That's my lema. And I always ;had patience. So, let's just wait for more great days =) ; IRA/99 ;********************************************************************** ;Before you assemble and link this you should know that functions 1 and 2 ;kick ass (this means, they make what they are supossed to make, cause I ;programed them!) ;The other two fucntions sucks! (let's face it, my partner only put the impression!) ;And don't forget to change the .txt extension for an .asm extension ;********************************************************************** ;Heck! I writed Poor Iris and Ballandra's minicomic during the creation ;of this prrrrrrrrrogram!! ^_^ ;Macro para limpiar la pantalla CLEARSCREEN MACRO MOV AX,0600H MOV BH,07 MOV CX,0000 MOV DX,184FH INT 10H ENDM ;Macro para escribir un caracter ascii X en la posici¢n ;actual del cursor WRITECHAR MACRO X MOV DL,X MOV AH,2 INT 21H ENDM ; ;Macro para hacer sonar el parlante BEEP MACRO WRITECHAR 07 ENDM ;Lee el ascii de la posici¢n actual ;Devuelve AL=00h si no hay ning£n caracter le¡do LEERCHAR MACRO MOV AX,0600H MOV DL,0FFH INT 21H ENDM ;Muestra la cadena que debe estar previamente lista por ;la intstrucci¢n LEA DX,Nombre_de_la_cadena SHOWMSG MACRO MOV AH,09H INT 21H ENDM ; ; Posiciona el cursor, esto es: ; POSCUR COLUMNA, FILA (80x25) POSCUR MACRO X,Y MOV CX,Y MOV DX,X MOV AH,02 MOV BH,0 MOV DH,CL INT 10H ENDM ; ; Mensaje sencillo para Cara o Sello MSG MACRO LEA DX,SOC2 MOV AH,09 INT 21H ENDM ;Obtiene la hora del sistema OBTENER_RELOJ MACRO MOV AH,2CH INT 21H ENDM ; Muestra menjase X a la frecuencia de 1 Hz MSGE MACRO X LOCAL REPEAT,WHILE1,WHILE2 MOV BL,5 REPEAT: CLEARSCREEN WHILE1: OBTENER_RELOJ ROR DH,1 JNC WHILE1 POSCUR 33,12 LEA DX,SOC&X MOV AH,09 INT 21H WHILE2: OBTENER_RELOJ ROR DH,1 JC WHILE2 DEC BL JNZ REPEAT ENDM ; ; Ejecuta el Menor que MENORQUE MACRO FSTSW COMOAX AND COMOAX,4500H CMP COMOAX,0100H ENDM ; STACKSG SEGMENT PARA STACK 'STACK' DW 64 DUP(?) STACKSG ENDS ; DATASG SEGMENT PARA 'DATA' ;Data para el menu principal ESPOL DB 'ESCUELA SUPERIOR POLITECNICA DEL LITORAL$' LABO1 DB 'PROYECTO DE LABORATORIO DE MICROPROCESADORES$' INTEG DB 'INTEGRANTES GRUPO 10:$' IRA DB 'Iv n Rodr¡guez Asqui$' ; YEAH! This is me! BOZA DB 'Fernando Boza Gaybor$' PROMPI DB 'Presione cualquier tecla para continuar o q para salir$' MAINMENU DB '*************** MENU ***************$' MAINPROMPT DB 'Seleccione la funci¢n a evaluar o q para salir:$' MENU1 DB '1. Sello o Cara$' MENU2 DB '2. Valor Binario de Teclas ASCII$' MENU3 DB '3. C lculo de la funcion Sin X$' MENU4 DB '4. C lculo de la funci¢n Cos X$' ; Data para cara o sello SOCTITLE DB 'SELLO O CARA $' SOC0 DB 'MONEDA CARA $' SOC1 DB 'MONEDA SELLO $' SOC2 DB 'Pulse M para empezar o Q para salir $' ;Data para binario de ascii CHAR DB ? ;Caracter ingresado LINEA DB '................$' CNT DW 0 ;Contador SONDA DB 128 BINASCTITLE DB 'Binario de un caracter Ascii$' BINASC1 DB 'Ingrese una letra a representar en binario o pulse Q para salir$' ;Data para coseno y Seno de X TEMP1 DW ? TEN DD 10.0 SIGN DB ? SENTITLE DB 'Calcular Seno de X$' COSTITLE DB 'Calcular Coseno de X$' SENRULES DB 'Ingrese un angulo en grados o Q para salir$' A360 DD 360.0 A270 DD 270.0 A180 DD 180.0 A90 DD 90.0 A6 DD 6.0 A120 DD 120.0 SENO DD ? ANGLER DD ? ANGLEG DD ? TEMP DW ? WHOLE DW ? FRACT DD ? COMOAX DW ? CONTINUE DB 'Presione s para continuar o cualquier otra tecla para salir$' DATASG ENDS ;********************************************************** ;Comienza el segmento de Codigo ;********************************************************** CODESG SEGMENT PARA 'CODE' PRIN PROC FAR ASSUME CS:CODESG,DS:DATASG,SS:STACKSG,ES:DATASG PUSH DS SUB AX,AX PUSH AX MOV AX,DATASG MOV DS,AX MOV ES,AX CALL MENUINTRO ;Muestra pantalla de presentaci¢n CMP AL,'Q' JE BYE CMP AL,'q' JE BYE YEAH: CALL MENUREAL ;MUestra menu de opciones CALL CHOOSE ;Llama los procedimientos adecuados CMP AL,'Q' JE BYE CMP AL,'q' JE BYE JMP YEAH BYE: CLEARSCREEN ;Salir RET PRIN ENDP ;********************************************************** ; Muestra la informaci¢n de los integrantes del grupo ;********************************************************** MENUINTRO PROC NEAR CLEARSCREEN POSCUR 20,1 LEA DX,ESPOL SHOWMSG POSCUR 18,2 LEA DX,LABO1 SHOWMSG POSCUR 29,5 LEA DX,INTEG SHOWMSG POSCUR 30,7 LEA DX,IRA SHOWMSG POSCUR 30,8 LEA DX,BOZA SHOWMSG POSCUR 20,22 LEA DX,PROMPI SHOWMSG ULP: LEERCHAR JZ ULP RET MENUINTRO ENDP ;********************************************************** ; Menu para accesar a las funciones del programa ;********************************************************** MENUREAL PROC NEAR CLEARSCREEN POSCUR 22,3 LEA DX,MAINMENU SHOWMSG POSCUR 16,6 LEA DX,MAINPROMPT SHOWMSG POSCUR 24,8 LEA DX,MENU1 SHOWMSG POSCUR 24,9 LEA DX,MENU2 SHOWMSG POSCUR 24,10 LEA DX,MENU3 SHOWMSG POSCUR 24,11 LEA DX,MENU4 SHOWMSG RET MENUREAL ENDP ;********************************************************** ;ESCOJE UNA FUNCION ;********************************************************** CHOOSE PROC NEAR EEK: LEERCHAR JZ EEK CMP AL,'Q' JE OUTY CMP AL,'q' JE OUTY CMP AL,'1' JE DO_CARAOSE CMP AL,'2' JE DO_BINASC CMP AL,'3' JE DO_SENO CMP AL,'4' JE DO_COSENO JMP EEK ;Valida la entrada OUTY: RET DO_CARAOSE: CALL CARAOSE RET DO_BINASC: CALL BINASC RET DO_SENO: CALL SENOX RET DO_COSENO:CALL COSENO RET CHOOSE ENDP ;********************************************************** ;Saca juego de sello o cara ;********************************************************** CARAOSE PROC NEAR CLEARSCREEN POSCUR 33,0 LEA DX,SOCTITLE MOV AH,09 INT 21H POSCUR 22,5 MSG ;Muestra mensaje SOC2 LEER: LEERCHAR ;Lee caracter sin eco CMP AL,51H JZ QUIT CMP AL,71H JZ QUIT CMP AL,6DH JZ CARAOSELLO CMP AL,4DH JZ CARAOSELLO ;Prueba para q, Q, m y M JNZ LEER QUIT: CLEARSCREEN RET ; CARAOSELLO: OBTENER_RELOJ ;Deja el contador de segundos en DH ROR DH,1 ;Deja ultimo bit del reloj en CF JC IMPAR ;Pregunta por CF: CF=1 Impar, CF=0 Par PAR: MSGE 0 ;Selecciona menjage par JMP QUIT IMPAR: MSGE 1 ;Selecciona mensaje impar JMP QUIT CARAOSE ENDP ;********************************************************** ;Saca binario de Ascii ;********************************************************** BINASC PROC NEAR START: CLEARSCREEN POSCUR 26,1 LEA DX,BINASCTITLE SHOWMSG POSCUR 8,2 LEA DX,BINASC1 SHOWMSG MOV SI,5 BIGLAZO: CMP SI,24 JE START LEERCHAR JZ BIGLAZO MOV CHAR,AL ; Salva ascii del caracter leido POSCUR 25,SI ;Empieza armado de la salida WRITECHAR AL ;Escribe la tecla pulsada POSCUR 26,SI LEA DX,LINEA ;Escribe el sonjunto de puntos suspensivos SHOWMSG POSCUR 43,SI ;Mueve el cursor a la derecha de los puntos MOV CNT,0 LAZO: CMP CNT,8 ;Repite 8 veces (uno por cada bit en CHAR) JZ NEXT MOV AH,SONDA ;SONDA solo contiene un 1 TEST CHAR,AH ;Prueba que setea la bandera para el salto ;apropiado y esritura de 1 o 0 JNZ HAY1 HAY0: PUSH CNT ADD CNT,43 POSCUR CNT,SI WRITECHAR '0' POP CNT JMP INCRE HAY1: PUSH CNT ;Salva el contador porque lo debo alterar ADD CNT,43 ;para direccionar el cursor a lado de la POSCUR CNT,SI ;posici¢n anterior WRITECHAR '1' POP CNT ;Recupero contador INCRE: SHR SONDA,1 ;Mueve el 1 en SONDA a la siguiente posici¢n INC CNT JMP LAZO ;Siguiente vuelta NEXT: CMP CHAR,'Q' JE SALIRA CMP CHAR,'q' JE SALIRA INC SI MOV SONDA,128 JMP BIGLAZO SALIRA: RET BINASC ENDP ;********************************************************** ; Calcula el seno ;********************************************************** SENOX PROC NEAR CLEARSCREEN POSCUR 34,1 LEA DX,SENTITLE SHOWMSG POSCUR 19,2 LEA DX,SENRULES SHOWMSG MOV SI,1 POSCUR SI,12 FLDZ MOV SIGN,0 DIGITO1: LEERCHAR JZ DIGITO1 CMP AL,0DH JE DIGITO1 CMP AL,'Q' JE SALIR CMP AL,'q' JE SALIR CMP AL,'-' JE SIGNEG CMP AL,'+' JE SIGPOS CMP AL,'.' JE FRAC0 CMP AL,30H JB BEEP1 CMP AL,39H JA BEEP1 WRITECHAR AL FMUL TEN XOR AH,AH SUB AL,'0' MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 JMP DIGITO2 BEEP1: BEEP JMP DIGITO1 SALIR: RET P360ULP: JMP P360 FRAC0: JMP FRACC SIGNEG: MOV SIGN,0FFH SIGPOS: WRITECHAR AL MOV AX,0 MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 DIGITO2: LEERCHAR JZ DIGITO2 CMP AL,0DH JE P360ULP ;Sale a calcular el seno CMP AL,'.' JE FRACC CMP AL,30H JB BEEP2 CMP AL,39H JA BEEP2 WRITECHAR AL FMUL TEN XOR AH,AH SUB AL,'0' MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 JMP DIGITO2 BEEP2: BEEP JMP DIGITO2 FRACC: WRITECHAR AL FLD1 FDIV TEN INC SI POSCUR SI,12 FRAC2: LEERCHAR JZ FRAC2 CMP AL,0DH JE P360P ;Sale a calcular el seno CMP AL,30H JB BEEP3 CMP AL,39H JA BEEP3 WRITECHAR AL XOR AH,AH SUB AL,'0' MOV TEMP1,AX FMUL ST,ST(1) FADD ST(2),ST FCOMP FDIV TEN INC SI POSCUR SI,12 JMP FRAC2 BEEP3: BEEP JMP FRAC2 P360P: FCOMP P360: FCOM A360 MENORQUE ;si el angulo es menor que 360 JE P270 ;salte a p270 FSUB A360 ;si no reste 360 JMP P360 P270: FCOM A270 MENORQUE JE P180 FSUB A360 P180: FCOM A180 MENORQUE JE P90 FSUBR A180 P90: FCOM A90 MENORQUE JE RAD FSUBR A180 RAD: FLDPI FMUL FDIV A180 ;Angulo en radianes FST ANGLER FMUL ANGLER FMUL ANGLER FDIV A6 FSUBR ANGLER FLD ANGLER FMUL ANGLER FMUL ANGLER FMUL ANGLER FMUL ANGLER FDIV A120 FADD FWAIT CMP SIGN,0 JE POSI FCHS POSI: FST SENO FWAIT POSCUR 1,13 ;**************************************************** ; Rutina para mostrar la salida ; FSTCW TEMP OR TEMP,0C00H FLDCW TEMP FLD SENO FTST FSTSW COMOAX AND COMOAX,4500H CMP COMOAX,0100H JNE DISP1 MOV AL,'-' WRITECHAR AL DISP1: FABS FRNDINT FIST WHOLE FLD SENO FABS FSUB FABS FSTP FRACT FWAIT ;mostrar parte de n£mero entero MOV AX,WHOLE MOV CX,0 MOV BX,10 DISP2: INC CX XOR DX,DX DIV BX ADD DX,'0' ;convertir a ASCII PUSH DX OR AX,AX JNE DISP2 DISP3: POP AX WRITECHAR AL LOOP DISP3 MOV AL,'.' WRITECHAR AL ;mostrar parte de fraccion MOV AX,WORD PTR FRACT MOV DX,WORD PTR FRACT+2 MOV CX,8 DISP4: SHL AX,1 RCL DX,1 LOOP DISP4 OR DX,8000H XCHG AX,DX MOV BX,10 DISP5: MUL BX PUSH AX XCHG DX,AX ADD AL,'0' WRITECHAR AL POP AX OR AX,AX JNZ DISP5 ;mov ah,4ch ;int 21h POSCUR 1,16 LEA DX,CONTINUE SHOWMSG QS: LEERCHAR JZ QS CMP AL,'S' JE BSENO CMP AL,'s' JE BSENO JMP OUCH BSENO: JMP SENOX OUCH: RET ;***************************************************** SENOX ENDP ;********************************************************** ;Calcula el Coseno ;********************************************************** COSENO PROC NEAR CLEARSCREEN POSCUR 34,1 LEA DX,COSTITLE SHOWMSG POSCUR 19,2 LEA DX,SENRULES SHOWMSG MOV SI,1 POSCUR SI,12 FLDZ MOV SIGN,0 DIGITO1C: LEERCHAR JZ DIGITO1C CMP AL,0DH JE DIGITO1C CMP AL,'Q' JE SALIRC CMP AL,'q' JE SALIRC CMP AL,'-' JE SIGNEGC CMP AL,'+' JE SIGPOSC CMP AL,'.' JE FRAC0C CMP AL,30H JB BEEP1C CMP AL,39H JA BEEP1C WRITECHAR AL FMUL TEN XOR AH,AH SUB AL,'0' MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 JMP DIGITO2C BEEP1C: BEEP JMP DIGITO1C SALIRC: RET P360ULPC: JMP P360 FRAC0C: JMP FRACCC SIGNEGC: MOV SIGN,0FFH SIGPOSC: WRITECHAR AL MOV AX,0 MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 DIGITO2C: LEERCHAR JZ DIGITO2C CMP AL,0DH JE P360ULPC ;Sale a calcular el seno CMP AL,'.' JE FRACCC CMP AL,30H JB BEEP2C CMP AL,39H JA BEEP2C WRITECHAR AL FMUL TEN XOR AH,AH SUB AL,'0' MOV TEMP1,AX FIADD TEMP1 INC SI POSCUR SI,12 JMP DIGITO2C BEEP2C: BEEP JMP DIGITO2C FRACCC: WRITECHAR AL FLD1 FDIV TEN INC SI POSCUR SI,12 FRAC2C: LEERCHAR JZ FRAC2C CMP AL,0DH JE P360PC ;Sale a calcular el seno CMP AL,30H JB BEEP3C CMP AL,39H JA BEEP3C WRITECHAR AL XOR AH,AH SUB AL,'0' MOV TEMP1,AX FMUL ST,ST(1) FADD ST(2),ST FCOMP FDIV TEN INC SI POSCUR SI,12 JMP FRAC2 BEEP3C: BEEP JMP FRAC2C P360PC: FCOMP FADD A90 ;Desplaza 90 grados para sacar el Coseno P360C: FCOM A360 MENORQUE ;si el angulo es menor que 360 JE P270C ;salte a p270 FSUB A360 ;si no reste 360 JMP P360C P270C: FCOM A270 MENORQUE JE P180C FSUB A360 P180C: FCOM A180 MENORQUE JE P90C FSUBR A180 P90C: FCOM A90 MENORQUE JE RADC FSUBR A180 RADC: FLDPI FMUL FDIV A180 ;Angulo en radianes FST ANGLER FMUL ANGLER FMUL ANGLER FDIV A6 FSUBR ANGLER FLD ANGLER FMUL ANGLER FMUL ANGLER FMUL ANGLER FMUL ANGLER FDIV A120 FADD FWAIT CMP SIGN,0 JE POSIC FCHS POSIC: FST SENO FWAIT POSCUR 1,13 ;**************************************************** ; Rutina para mostrar la salida ; FSTCW TEMP OR TEMP,0C00H FLDCW TEMP FLD SENO FTST FSTSW COMOAX AND COMOAX,4500H CMP COMOAX,0100H JNE DISP1C MOV AL,'-' WRITECHAR AL DISP1C: FABS FRNDINT FIST WHOLE FLD SENO FABS FSUB FABS FSTP FRACT FWAIT ;mostrar parte de n£mero entero MOV AX,WHOLE MOV CX,0 MOV BX,10 DISP2C: INC CX XOR DX,DX DIV BX ADD DX,'0' ;convertir a ASCII PUSH DX OR AX,AX JNE DISP2C DISP3C: POP AX WRITECHAR AL LOOP DISP3C MOV AL,'.' WRITECHAR AL ;mostrar parte de fraccion MOV AX,WORD PTR FRACT MOV DX,WORD PTR FRACT+2 MOV CX,8 DISP4C: SHL AX,1 RCL DX,1 LOOP DISP4C OR DX,8000H XCHG AX,DX MOV BX,10 DISP5C: MUL BX PUSH AX XCHG DX,AX ADD AL,'0' WRITECHAR AL POP AX OR AX,AX JNZ DISP5C ; mov ah,4ch ; int 21h POSCUR 1,16 LEA DX,CONTINUE SHOWMSG QSC: LEERCHAR JZ QSC CMP AL,'S' JE BSENOC CMP AL,'s' JE BSENOC JMP OUCHC BSENOC: JMP COSENO OUCHC: RET ;***************************************************** COSENO ENDP CODESG ENDS END PRIN ;**************************************************************** ; I beated you ##$%%$& project! WHOOOOOO HOOO HOO!! ;(c) IRA ,and this is a copyrighy in the WHOLE sense XD