I am an assembly newbie and I am trying to write an assembly routine to write data to EEPROM of a 8051 variant. (Specifically, AT89C51CC03)

In the datasheet, it says that I need to write to the column latches first. For this, I need to fill DPTR register with the address I want to write (2 bytes). As I am working mainly with C, I needed a way to pass the address from C code to the assembly routine. The following link explains the convention:


which says that pointer parameters are assigned to R2(MSB) and R1(LSB).

My question is, how can I move the contents of these 1 byte registers to DPTR, which is a two byte register? I have a feeling that if I use MOV, I will overwrite the first byte I have written. And the instruction set manual only provides an example for passing immediate values, not from registers.


It seems they're Special Function Registers (SFRs) called DPH and DPL, which should be accessible in 8-bit mode, see here and here (starting page 20).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.