I am trying to write 0xAA to Address location 0x5555. The following code is working. May someone kindly explain in details how C167 controller interpret it? Why is #09555H used???
MOV DPP2,#0001H
MOV R12,#09555H
MOVB RL1,#00AAH
MOV [R12],RL1
Thank you for you information, Mike. This is written in Assembly code which was obtained from the web site, and not from the compiler. Somehow, the bit 15-14 had to be set to 10B. On similar situation where address 0x2AAA is to be written, R12 is loaded with #AAAAH!! Probably the addressing is different when in SMALL model, as what you had mentioned. I am not able to get any information from the C167 manual. Maybe you can help.
You can read about addressing modes of the C167 in "C166 Instruction Set Manual". This document in PDF format is here: http://www.infineon.com/cgi/ecrm.dll/ecrm/scripts/public_download.jsp?oid=8056&parent_oid=-8137 Basically, what happens is the following. Bits 15 and 14 of R12 (which was used as a pointer in your example) select which of the four DPPs to use. 10 binary means DPP2. Then the physical address is calculated according to the formula Addr = (DPP2 << 14) + (R12 & 0x3FFF) In your case it yields 0x5555, as expected. There is a DPP override mechanism, which uses EXTP and EXTS instructions. You can find details in the C166 Instruction Set Manual, or you can use compiler generated code as an example. - Mike