I got a question that most likely will appear in tomorrow's test

Well the problem is I have a physical adress of 12345h and I need to get something from there into some variant at the size of 1 byte, not that it matters...the thing is I dunno what to do with the 20b adress I have here...

I figured I need to sub from it the ds and then I will get the logical adress but I couldn;t figure out how to do that as for it;s too big to work with ...I could work with 1 bit at a time , but since I dunno what ds' value is I can;t do that...or I think I can;t....

Any idea how to extract the logical adress?
physical adress: 12345h

Recommended Answers

All 6 Replies

Well,

to state a serious answer more information is needed: Processor, assembly, mermory organisation (aka memory model), and for we can access memory portions of 1 byte, 1 word, 1 dword (32Bit) you should also know what really should be accessed from abs. address 12345H. We also need to know whether you are dealing with Little or Big Endian. You want to get a variant structure? In assembly it's also possible depending on the (macro) assembler you are working with.

Unfortunately, without this pieces of information one cannot answer seriously. (Possibly, your teacher also didn't think of all those stuff too)

-- tesu

Okies well the assembly I am using is 8086 where registers are 16b (ah and al are 8b each).
I am not sure what u meant by Endian though...

What I was asked ,is to fetch anumber from a locaion of the physical adress of 12345h...

the number I am willing to fetch is the size of 1 byte.

Well I think logical adress should b 16b. But when I check in my emulator it turns out to b 20b....(ds=710 and physical adress is 12345h so I did 12345h-710h(assuming it goes in hex too, emulator doesn;t state it) the result is 11c35h.

So doesn;t logical adress have to b 16b always?
Isn;t ds the starting point so physical adress-ds=logical adress?

how do I point there if it's bigger than 16b ._.;

It doesn;t matter how I hold the numbers...wheter it;s dword and such though we only learned about word and byte.

I hope I gave enough information

Ok it;s little-endian
pc 8086 assembly.

Hi
Thank you for this further information. Now it s easy to compute the offset. In 8086 real mode logical offset and segment addresses are both 16bits long. Physical address is 20Bits long (there are 20 Address lines). Segment address is binary left shifted by 4 places, that is multiply segement address by 10H. Then the offset is added to get the physical address. Therefore,

Phys. Adr = Seg.Adr * 10H + Offset

12345H = 0710H * 10H + Offset
12345H - 07100H = Offset
Offset = 0B245H

I hope this answer will help you for tomorrow's test

-- tesu

Thanks alot ^.^
It helps a bunch!
thanks again.

No thanks:)

Finally you need the instruction to transfer one byte from memory location [710H:0B245H] into a 8 bit register:

MOV AL, DS:[0B245H]

Usually prefix ds: is not necessary but depending on the assembly you are using, for example weak MS MASM, this prefix is still necessary for syntax reasons.

-- tesu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.