UMBC | CMSC 391 -- Programming Microcontrollers |
Moving data from a direct address to itself is not predicable and could lead to errors.
address | SFR name |
---|---|
080 | P0 |
081 | SP |
082 | DPL |
083 | DPH |
087 | PCON |
088 | TCON |
089 | TMOD |
08A | TL0 |
08B | TL1 |
08C | TH0 |
08D | TH1 |
090 | P1 |
098 | SCON |
099 | SBUF |
0A0 | P2 |
0A8 | IE |
0B0 | P3 |
0B8 | IP |
0D0 | PSW |
0E0 | A |
0F0 | B |
Note:Where there are gaps, there is no memory and those addresses do not work as expected!
Note:I have put a leading zero on all addresses. I only have to do it for addresses in the range of 0A0h to 0FFh, but there is no problem if I put a zero in front of all of them for consistence sake.
address | SFR name |
---|---|
A | 0E0 |
B | 0F0 |
DPH | 083 |
DPL | 082 |
IE | 0A8 |
IP | 0B8 |
P0 | 080 |
P1 | 090 |
P2 | 0A0 |
P3 | 0B0 |
PCON | 087 |
PSW | 0D0 |
SBUF | 099 |
SCON | 098 |
SP | 081 |
TCON | 088 |
TMOD | 089 |
TH0 | 08C |
TH1 | 08D |
TL0 | 08A |
TL1 | 08B |
2000: .org 0x2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Equates ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Code ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; begin: ;;A is at 0E0h, so are they ;; interchangable? 2000: 75 E0 0F mov 0E0h, #15 ; 3 bytes, 2 cycles 2003: 74 0F mov A, #15 ; 2 bytes, 1 cycle ;; What about B? 2005: 75 F0 0F mov 0F0h, #15 2008: 75 F0 0F mov B, #15 ;; Serial I/O buffer 200B: E5 99 mov A, SBUF 200D: 85 20 99 mov SBUF, #32 ; Output a blank character 2010: 85 41 99 mov SBUF, 'A' 2013: 22 ret ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Data ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;