Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- section .data
- Snippet db "KANGAROO"
- section .text
- global _start
- _start:
- nop
- ; Put your experiments between the two nops...
- mov ebx,Snippet ; ebx has the copy of memory address of Snippet
- mov eax,8 ; immediate addressing .. eax has the value 0x8
- DoMore: add byte [ebx],32 ; whatever the Memory address that is inside ebx is pointing to,[ebx] has the data of that
- memory address. And added 32 to the ascii value (one byte of that data). Now the character
- is in lowercase.
- inc ebx ; incrementing ebx memory address by 1 so that in the next loop [ebx] can
- point to first "A" of "kANGAROO". So, this concludes that every byte has
- its own memory address and registers are array of memory
- dec eax ; For ZF register
- jnz DoMore ; ZF ! set go to DoMore
- ; Put your experiments between the two nops...
- nop
- ;=========================================================================
- ;Questions:
- ; 1. [ebx] should contain "KANG" only as it is 32 bit only in size, but, how were we able to change whole
- ; "KANGAROO" to lowercase when the letters we had were only 4 ?
- ; -> My answer to this question is :
- ; yes 32 bit register can only contain 4 characters. If we see the line/instruction
- ; .
- ; .
- ; -- inc ebx
- ; .
- ; .
- ; what we are doing here is increasing memory location by one, so that memory location inside ebx
- ; increase by 1 byte, so that it points to the second letter "A" from "KANGAROO". So, while
- ; accessing it with line/instruction
- ; .
- ; --add byte [ebx],32
- ; .
- ; we are adding number 32 to ascci value of "A" as memory location inside ebx starts from (memory
- ; location of "K"+1 byte)="A" and [ebx] has the value "ANGA".
- ;
- ;
- ;
- ;
- ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement