Posted: Sat Feb 23, 2019 3:53 pm Post subject: Auto Assembler: Represent a Byte Value
Please forgive my ignorance, I am learning how memory addresses, opcodes, bytes, etc., all work.
There is an address with the opcode edx that I want to change to 0. But replacing edx with 0 wants to replace a byte with an integer (4 bytes). Can I represent a byte value of 0 instead of an integer so that I do not need to allocate new memory for this operation?
Original opcodes:
Code:
// 3 bytes (89 50 18)
mov [eax+18],edx
Target opcodes:
Code:
// changing the above to this makes it 7 bytes
mov [eax+18],00
In the memory viewer, I see addresses with opcodes like the following:
Code:
// 3 bytes (83 E8 01)
sub eax,01
Not sure why in this case the 01 represents a byte instead of an integer.
In the sub instruction, that particular opcode sign-extends the 8-bit immediate operand to 32-bits and then does the subtraction. There's no analogous mov opcode with the same types of operands. _________________
I don't know where I'm going, but I'll figure it out when I get there.
You can't. That instruction doesn't exist. There is no mov instruction that extends an 8-bit immediate value (imm8) and moves it into a 32-bit register or memory location (r/m32). mov reference
It's usually possible to optimize other code away to make room for a few more bytes of space. _________________
I don't know where I'm going, but I'll figure it out when I get there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum