Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Question about "Bytes" column in disassembler

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
DreamingJ
How do I cheat?
Reputation: 0

Joined: 22 Jan 2020
Posts: 3

PostPosted: Wed Jan 22, 2020 8:56 pm    Post subject: Question about "Bytes" column in disassembler Reply with quote

Hi all, I've been watching a video tutorial by GH, specifically titled "Cheat Engine Tutorial Guide 1/3 Steps 1-5" (unfortunately I can't post URLs yet).

When he opens up the disassembler after the "find what writes to this address" window, it shows a window with 3 columns: "Address" , "Bytes" , and "Opcode". I attached a screenshot below.

My question is about the "Bytes column". What does this represent? Is it the hex representation for the 32 "1s and 0s" that are fed to the CPU as instructions (with the assembly representation of the instruction being in the "Opcode" column)? For example, one instruction might be any combination of 32 0s and 1s, but instead of representing a long sequence of 32 0s and 1s, cheat engine shortens it to hex? (I note 32 0s and 1s in a sequence of bits assuming it's 32-bit CPU)

In the bytes column for the first opcode, I see (take for example) "3B 45 F4". Does this mean this specific opcode uses 3 bytes, as each token "3B", "45", and "F4" use 8 bits each in binary form? However, what if the first token "3B" was 0x"3BAC". Would this specific opcode use more bytes then, as the binary representation of 0x3BAC uses more than 8 bits?

Lastly, he does a NOP operation on a mov [eax], edx instruction that had two different bytes listed in the Bytes column. Cheat engine placed two NOP operations, I'm guessing since 1 NOP operation only consists of 1 byte (0x90), but the original instruction to overwrite consisted of two bytes?

Please let me know if I'm mixing up terminology. Any help is appreciated, thank you!



CEscreen1.png
 Description:
 Filesize:  177.29 KB
 Viewed:  2266 Time(s)

CEscreen1.png


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 150

Joined: 06 Jul 2014
Posts: 4654

PostPosted: Wed Jan 22, 2020 11:18 pm    Post subject: Reply with quote

You more or less have it right.

Programs tell the CPU what to do by using machine code- a set of instructions representing simple actions like "move," "compare," "add," etc. Each line you see in the disassembler is an example of an instruction expressed in assembly language.

Machine code is stored in memory as a sequence of bytes, as shown in the "Bytes" column. Each byte is a sequence of 8 bits - 0 or 1 - that is commonly represented as two digits in base 16 (hexadecimal) for brevity. Some instructions take up more bytes in memory than others. e.g. "mov eax,[eax+00000478]" takes up 6 bytes while "mov edx,[ebp-10]" takes up 3 bytes.

Instructions are comprised of several parts- the most noteworthy being an opcode and operands. The opcode is what action the instruction does, and the operands are what the instruction uses to carry out its action. The opcode may consist of several bytes (e.g. F2* 0F 58 adds doubles) and may not necessarily be on the same granularity as bytes (e.g. 50+rd "push register" opcode uses 5 bits; 81/0 "add immediate" opcode uses 11 bits).
(*F2 is considered to be a "mandatory prefix" in this context, but that's pedantic and inconsequential)
For example, the byte 8B is an opcode that means "move data from a register or memory location into a register." The bytes that follow are the operands and specify the things being moved from and to. If the bytes that follow 8B are 55 F0, that means you're moving data from the memory location [ebp-10] into the register edx.

Opcodes can be grouped into classes based on similar functionality. These classes are given mnemonics to represent the common action the opcodes in the class perform: "mov" is used for opcodes that move data, "add" is used for opcodes that add data, etc.

So:
Code:
assembly language:  cmp eax,[ebp-0C]  easy for people to understand
     machine code:  3B 45 F4    how it's stored in memory
         mnemonic:  cmp         short for compare
           opcode:  3B          compare register with register or memory location
         operands:  45 F4       eax,[ebp-0C]

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites