Created
May 13, 2015 21:20
-
-
Save andfoy/1e35aea9f4c5b3a0438e to your computer and use it in GitHub Desktop.
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
| unsigned char* bitmap = img -> informacion; //Se solicita el apuntador a los componentes de la imagen. | |
| int word_size = CHAR_SIZE; //Tamaño inicial de palabra | |
| int cant_char = 0; //Cantidad de caracteres extraídos | |
| int bitmap_pos = 0; //Índice del componente actual de la imagen | |
| int extracted_chunks = 0; //Paquetes recuperados por componente | |
| int num_chunks = CHAR_SIZE / n; //Número de paquetes que se pueden extraer de acuerdo al tamaño n solicitado | |
| int offset = CHAR_SIZE % n; //Sobrante sujeto al número de paquetes por n. | |
| ;Salvaguarda | |
| push eax | |
| push ebx | |
| push ecx | |
| push edx | |
| push edi | |
| mov esi, [bitmap] ; Char* | |
| lea edi, msg | |
| mov ebx, 0 ; Máscara de zeros → bl | |
| ;cl → Caracter actual | |
| procesar_imagen: | |
| mov ecx, [l] | |
| cmp [cant_char], ecx | |
| jge fin_procesar | |
| mov [extracted_chunks], 0 | |
| mov eax, [word_size] | |
| mov ecx, [n] | |
| mov edx, 0 | |
| div ecx | |
| mov [num_chunks], eax | |
| mov [offset], edx | |
| extract_chunks: | |
| cmp [extracted_chunks], eax | |
| jle fin_extract | |
| mov edx, [bitmap_pos] | |
| mov cl, [esi + edx] | |
| mov edx, 0 | |
| mov edx, 8 | |
| sub edx, [n] | |
| shl cl, dl | |
| shr cl, dl | |
| or bl, cl | |
| inc [bitmap_pos] | |
| mov edx, [num_chunks] | |
| sub edx, 1 | |
| cmp [extracted_chunks], edx | |
| je fin_extract | |
| mov edx, [n] | |
| shl bl, dl | |
| inc [extracted_chunks] | |
| jmp extract_chunks | |
| fin_extract: | |
| cmp [offset], 0 | |
| je no_offset | |
| mov edx, [bitmap_pos] | |
| mov cl, [esi + edx] | |
| mov edx, 0 | |
| mov edx, 8 | |
| sub edx, [n] | |
| shl cl, dl | |
| shr cl, dl | |
| mov edx, [offset] | |
| shl bl, dl | |
| push ecx | |
| neg edx | |
| add edx, [n] | |
| shr cl, dl | |
| or bl, cl | |
| mov edx, [bitmap_pos] | |
| mov byte ptr[edi + edx], bl | |
| mov ebx, 0 | |
| mov edx, 8 | |
| add edx, [offset] | |
| sub edx, [n] | |
| mov [word_size], edx | |
| mov edx, 0 | |
| mov eax, [word_size] | |
| push ecx | |
| mov ecx, [n] | |
| div ecx | |
| mov [offset], edx | |
| inc [bitmap_pos] | |
| pop ecx | |
| mov edx, 8 | |
| sub edx, [offset] | |
| cmp edx, [n] | |
| jge cond_2 | |
| or bl, cl | |
| jmp pre_proc | |
| cond_2: | |
| mov dl, cl | |
| shl dl, byte ptr [n] | |
| or bl, dl | |
| jmp pre_proc | |
| no_offset: | |
| mov edx, [cant_char] | |
| mov byte ptr [edi + edx], bl | |
| mov ebx, 0 | |
| push ecx | |
| mov ecx, [n] | |
| mov edx, 0 | |
| div ecx | |
| mov [offset], edx | |
| mov [word_size], 8 | |
| pop ecx | |
| pre_proc: | |
| inc [cant_char] | |
| mov [extracted_chunks], 0 | |
| jmp procesar_imagen | |
| fin_procesar: | |
| pop edi | |
| pop edx | |
| pop ecx | |
| pop ebx | |
| pop eax | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment