Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // YOUR CODE STARTS HERE
- push ebp
- mov ebp, esp
- push ebx
- push ecx
- mov esi, image //ESI = base address of image
- mov ebx, 0 //EBX = row index counter
- mov ecx, 0 //ECX = column index counter
- OuterLoop: //loop through all row indexes
- cmp ebx, dim
- jae EndOuterLoop
- jmp InnerLoop
- InnerLoop: //loop through all column indexes
- cmp ecx, dim
- jae EndInnerLoop
- //calculate offset
- mov eax, dim
- mul ebx
- add eax, ecx
- mov dl, byte ptr[esi + eax]
- cmp dl, threshold
- jae OverThreshold
- mov byte ptr[esi + eax], 0x00
- xor eax, eax
- inc ecx
- jmp InnerLoop
- OverThreshold:
- mov byte ptr[esi + eax], 0xFF
- xor eax, eax
- inc ecx
- jmp InnerLoop
- EndInnerLoop:
- xor ecx, ecx
- inc ebx
- jmp OuterLoop
- EndOuterLoop:
- pop ecx
- pop ebx
- mov esp, ebp
- pop ebp
- ret
- // YOUR CODE ENDS HERE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement