Created
July 8, 2019 20:32
-
-
Save aldoea/34585e053fe2e92d39da890018bf6fd9 to your computer and use it in GitHub Desktop.
Code of Parcial II Lenguajes de Interfaz exam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TITLE "EXAMEN 2" | |
INCLUDE Irvine32.inc | |
INCLUDE Macros.inc | |
.data | |
bienvenidamsj BYTE "Examen segundo parcial, bienvenido",0 | |
input BYTE 31 DUP(?) | |
ACounter SDWORD 0 | |
CCounter SDWORD 0 | |
BCounter SDWORD 0 | |
MaxCs SDWORD 2 | |
IsBegining SDWORD 0 | |
.code | |
main PROC | |
Start: | |
mov edx,OFFSET bienvenidamsj | |
call WriteString | |
Call Crlf | |
mWriteln "Introduzca la cadena: " | |
mReadString input | |
mWrite "Cadena introducida:" | |
mWriteSpace | |
mWriteString input | |
Call Crlf | |
mov ecx, eax | |
mov esi, 0 | |
FOREACHCHAR: | |
movzx eax, input[esi] | |
cmp IsBegining, 0 | |
jz FIRST | |
cmp eax, 97 | |
jz ISA | |
cmp eax, 99 | |
jz ISC | |
cmp eax, 98 | |
jz ISB | |
jnz ERROR | |
LOOP FOREACHCHAR | |
FIRST: | |
mov IsBegining, 1 | |
cmp eax, 97 | |
jz ISA | |
jmp ERROR | |
ISA: | |
inc ACounter | |
inc esi | |
LOOP FOREACHCHAR | |
jmp EVAL | |
ISB: | |
mov ebx, CCounter | |
cmp ebx, MaxCs | |
jnz ERROR | |
inc BCounter | |
inc esi | |
LOOP FOREACHCHAR | |
jmp EVAL | |
ISC: | |
inc CCounter | |
mov ebx, CCounter | |
cmp ebx, MaxCs | |
JNLE ERROR | |
inc esi | |
LOOP FOREACHCHAR | |
jmp EVAL | |
EVAL: | |
xor edx, edx | |
mov eax, ACounter | |
div BCounter | |
cmp edx, 0 | |
jnz ERROR | |
cmp eax, 2 | |
jnz ERROR | |
mWriteln "Correcto" | |
call WaitMsg | |
call Clrscr | |
exit | |
ERROR: | |
mWriteln "Cadena invalida" | |
call WaitMsg | |
call Clrscr | |
exit | |
main ENDP | |
END main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment