1

.Suppose there are 2*2KB RAM chips starting from address 01000h and therefore ending at address 01fffh. The processor is 8086, so there is 16 bit data bus. As memory is byte organized , to accomodate all 16 bits we divide it into even bank and odd bank. So even bank will have addresses like 01000h, 01002h,01004h ..... 01ffeh ; Data buses D0-D7 and odd bank will have addresses like 01001h, 01003h,01005h ..... 01fffh ; Data buses D8-D15

So is this operation MOV [01201h],AL valid? I have this doubt because the address is a odd bank and Data bus for AL is D0-D7 .

Any suggestions are helpful. Thanks

  • 3
    Yes, it is valid. The CPU takes care of translating byte accesses to the appropriate data pins. – fuz Mar 18 '21 at 12:56
  • 1
    8086 even allows loading a word from an odd address, doing two separate byte accesses, just like modern x86 not having any alignment requirements for operands narrower than 16 bytes. – Peter Cordes Mar 18 '21 at 12:56
  • @PeterCordes please elaborate . I agree it accepts loading from an odd address but only to D8-D15 data bus lines. – Harsh Lodha Mar 18 '21 at 13:22
  • 1
    `mov ax, [1]` is a legal instruction, and so is `mov [1], ax`. On a CPU without a cache and only a 16-bit bus like 8086, takes two memory-bus operations, one for the low byte of one word, and the other for the high byte of the other word. On 8088 (8-bit bus), word load/store always takes bus transfers, even for aligned words. And fun fact: on Pentium, an unaligned word fully contained in one 4-byte dword could still be transferred in a single operation (and [is actually guaranteed to be atomic](https://stackoverflow.com/questions/36624881)) – Peter Cordes Mar 18 '21 at 13:29
  • https://electronics.stackexchange.com/questions/498591/accessing-odd-address-memory-locations-in-8086 might be helpful. It looks like the data would go on D8-D15, A0 would be high, and BHE low. A0 high means that the low bank is disabled, so address `01200` doesn't get written with whatever garbage is on D0-D7. So there has to be circuitry able to connect AL to D8-D15. You seem to be assuming there isn't, but I don't know why you think that. – Nate Eldredge Mar 18 '21 at 15:39

0 Answers0