V
V
Vadim kyklaed2018-06-14 22:41:56
C++ / C#
Vadim kyklaed, 2018-06-14 22:41:56

How is memory addressing done?

Hello, the question is probably elementary, for example, the address in memory is 0x40, how to understand what kind of address it is?
and an expression with the address
x =0 , y = 0
0x40 * y + x = 0 \
but for example if
x =8 , y = 0
0x40 * y + x = ??
how to calculate it correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Cheremisin, 2018-06-14
@kyklaed

1) these are zero addresses. You need to look at what you have in the documentation at these addresses. Perhaps the interrupt table
2) your formula shifts addresses by 64 bytes, starting from zero. Hexadecimal 0x40 = 64 decimal!
3) depending on the controller, there may be direct addressing, or maybe through translation through the MMU, then you need to look at what moment and with what address translation settings the MMU works
4) you always need to remember about the type of bit length of the address. In the classic case, calling *unsigned char and *unsigned int or *unsigned short can have completely different effects. See the documentation, they usually write the register type and its bit depth!
5) some controllers have both full-fledged bit registers and bit fields mapped to addresses for the convenience of the programmer. For example, a 32-bit register can have 32 8-bit registers in memory mapped to the bits of the main register.
In general, in any case, smoke the documentation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question