Memory Flags & ASM: Understanding Hex Editors & x86 Assembly

  • Thread starter Thread starter martix
  • Start date Start date
  • Tags Tags
    Memory
Click For Summary

Discussion Overview

The discussion revolves around understanding memory flags in hex editors and the fundamentals of x86 assembly language. Participants explore concepts related to memory management, processor registers, and resources for learning assembly programming.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Homework-related

Main Points Raised

  • One participant inquires about the meaning of memory flags such as MEM_COMMIT, MEM_RESERVE, and PAGE_READWRITE, and their relevance in programming.
  • Another participant suggests looking into the VirtualAllocEx function and mmap() for further information on memory management.
  • A participant asks for clarification on what is meant by "grasping the registers concept," indicating a lack of understanding regarding data storage in registers.
  • It is explained that registers are the only storage inside the processor, and they are used for operations and function arguments, with a brief example of how addition is performed using registers.
  • Further elaboration is provided on the complexity of learning about registers, suggesting that knowledge of computer architecture and digital logic is beneficial.
  • One participant recommends specific books for learning assembly language and computer organization.
  • Another participant clarifies that MEM_COMMIT, MEM_RESERVE, and PAGE_READWRITE are constants used in programming, not flags in the assembly context, and explains the distinction between these constants and CPU flags.
  • A participant expresses that their interest in assembly language is secondary to their current focus on memory flags, indicating a preference for exploring memory management first.

Areas of Agreement / Disagreement

Participants express varying levels of understanding regarding memory flags and registers, with some providing resources and explanations while others indicate confusion. There is no consensus on the best approach to learning assembly language or the significance of certain memory flags.

Contextual Notes

Participants mention the importance of understanding different memory modes, instruction sets, and CPU organization, suggesting that these concepts are foundational for grasping the topic of registers and memory management.

Who May Find This Useful

This discussion may be useful for individuals interested in computer programming, particularly those beginning to learn about assembly language, memory management, and processor architecture.

martix
Messages
167
Reaction score
5
I'm fiddling around with a hex editor here and the processes have memory blocks that have certain flags like MEM_COMMIT, MEM_RESERVE, PAGE_READWRITE. That sort of stuff. And I was wondering what all these exactly mean.
Also I'd like some resources on x86 assembly. Something that really starts at the beginning of how and why things are the way they are. Because I'm having a little bit of trouble grasping the registers concept(among other things)...
 
Technology news on Phys.org
Can you say more about what you mean by "grasping the registers concept?"

- Warren
 
Well like what type of data goes where and why. Are they used just like an even faster memory than RAM or do they also have some special function? Are they the L1/L2 cache of the processor? Do you have to load everything in the registers manually? Does the compiler usually do that for you?
I mean I don't even know what to ask. I'm just starting so I basically know exactly SQUAT about ASM.
 
In simple terms registers are the only storge inside the processor.
To add 2 numbers you load the first number into register A, the second number into register B and call ADD_AB
They are also used to store arguments to functions, so under DOS to change directory you load register A with the address of a string in memory with the directory name and call a particiular software interupt.
 
martix said:
Well like what type of data goes where and why. Are they used just like an even faster memory than RAM or do they also have some special function? Are they the L1/L2 cache of the processor? Do you have to load everything in the registers manually? Does the compiler usually do that for you?
I mean I don't even know what to ask. I'm just starting so I basically know exactly SQUAT about ASM.

there's a lot that goes into learning about registers and their functions. This info can be found in any computer architecture book and most intro asm books. In order to appreciate this concept you'll have to get a grasp about different memory modes, instructions sets, CPU storage and organization, and so on. There are a few books that I can recommend, but you'll want to check your local library or school for a copy and gauge whether or not its language appeals to you.

Null, Linda (2003). The Essentials of Computer Organization and Architecture
Dandamudi, Sivarama (2005) Guide to Assembly language Programming in Linux

You may also find it in your best interest to have knowledge about digital logic. For non-electrical engineers, I would recommend The Science of Electronics: Digital by Thomas L. Floyd and David M. Buchla.
 
MEM_COMMIT, MEM_RESERVE, PAGE_READWRITE are examples of constants either defined by the program or defined by Windows. They will equate to some simple integer usually and used perhaps as parameters for APIs or other procedures etc. They make life simpler for the programmer so that he/she can read something meaningfull rather that just a number. They are not flags. Flags are hardware bits in a CPU register that mean something to the assembler program. For example, the "zero" flag is set upon an operation resulting in a zero result. That content of that flag will be picked up by another part of a program to test for some other action. There are about 17 different flags I think in a x86 CPU.
 
I wasn't talking about flags in assembly. It was on a separate note, something I found when exploring my memory with a hex editor(it said certain ranges of RAM have certain flags). Some appear to be self-explanatory, but others are not.
But basically thanks for the links. This book may be nice, but I doubt I'll be getting seriously into that stuff until I have to(which is still some time away).
Actually the ASM part of the thread was meant to be more on a side note, not the other way around.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
7K
Replies
4
Views
3K
  • · Replies 38 ·
2
Replies
38
Views
12K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 26 ·
Replies
26
Views
14K
  • · Replies 3 ·
Replies
3
Views
3K