简体   繁体   中英

pointers seen on assembly or registries

How does a pointer look like in assembly, I know a instruction like 'mov' for lets say a pic, is converted to a sequence of bits, these bits activate the circuits to do the job, but a pointer, how is it managed to assembly and then manage to control circuits?. a simngle pointer is transformed in several assembly instructions, how do they look like?

Pointer is nothing but a unsigned integer indicating position in a memory (virtual address space to be precise).

The instruction

mov eax,[ebp ]

Moves value stored in a memory location whose address is stored in ebp into eax. Here ebp is a pointer.

Coming back to your question. Code is also data stored somewhere in memory and address of that memory is pointer. So using [] for dereferencing the pointer we can get that instruction(as done in above statement) and then cpu can interpret the code and execute.

Actually on 32bit x36 machines register eip stores a pointer which points to the memory which got current instruction which is getting executed.

Pointers are memory offsets. They look like integers with a width appropriate for the addressable size of the memory segment.

The main feature of assembly is that a pointer can be present as label so that assemblers compiler can translate it to instructions op-code.

Actually any pointer is composed from one or more unsigned integers. At 8 bit PIC16 MCPUs you must first set appropriate memory bank, after that you can write in to memory, the reason is that address op-code size is only 7-bit in case that you are using direct memory addressing. You can also use indirect memory addressing in that case you must use FSR register that is composed from two 8-bit registers FSRL and FSRH. After setting pointer in FSR register you can read the result in INDF register as byte of that address.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM