Tulisan Dasar Cracking
Selamat Datang................. Cracker..........
Bahasa Assembler :

Alamat Variable
There is LEA (Load Effective Address) instruction and alternative OFFSET operator. Both OFFSET and LEA can be used to get the offset address of the variable.
LEA is more powerful because it also allows you to get the address of an indexed variables. Getting the address of the variable can be very useful in some situations, for example when you need to pass parameters to a procedure.



Reminder:
In order to tell the compiler about data type,
these prefixes should be used:

BYTE PTR - for byte.
WORD PTR - for word (two bytes).

For example:
BYTE PTR [BX]     ; byte access.
    or
WORD PTR [BX]     ; word access.
Emu8086 supports shorter prefixes as well:

b. - for BYTE PTR
w. - for WORD PTR

sometimes compiler can calculate the data type automatically, but you may not and should not rely on that when one of the operands is an immediate value.



Here is first example:


ORG 100h

MOV    AL, VAR1              ; check value of VAR1 by moving it to AL.

LEA    BX, VAR1              ; get address of VAR1 in BX.

MOV    BYTE PTR [BX], 44h    ; modify the contents of VAR1.

MOV    AL, VAR1              ; check value of VAR1 by moving it to AL.

RET

VAR1   DB  22h

END


Here is another example, that uses OFFSET instead of LEA:


ORG 100h

MOV    AL, VAR1              ; check value of VAR1 by moving it to AL.

MOV    BX, OFFSET VAR1       ; get address of VAR1 in BX.

MOV    BYTE PTR [BX], 44h    ; modify the contents of VAR1.

MOV    AL, VAR1              ; check value of VAR1 by moving it to AL.

RET

VAR1   DB  22h

END

Both examples have the same functionality.

These lines:
LEA BX, VAR1
MOV BX, OFFSET VAR1

are even compiled into the same machine code: MOV BX, num
num is a 16 bit value of the variable offset.

Please note that only these registers can be used inside square brackets (as memory pointers): BX, SI, DI, BP!
(see previous part of the tutorial).

WebMaster
Terus      Kembali
Komentar dan Mailing List
Crack One Software Every Day Make You The Real Cracker