Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
8XC196Kx,8XC196Jx,87C196CA microcontroller family user's manual.1995.pdf
Скачиваний:
70
Добавлен:
23.08.2013
Размер:
3.97 Mб
Скачать

MEMORY PARTITIONS

This listing shows the disassembled code:

2080H

;C814

| PUSH

WSR

2082H

;B14814

| LDB

WSR,#48H

2085H

;44E4E2E0

| ADD

E0H,E2H,E4H

2089H

;B21814

| LDB

WSR,[SP]

208CH

;65020018

| ADD

SP,#02H

2090H

;F0

| RET

 

2091H

;C814

| PUSH

WSR

2093H

;B14814

| LDB

WSR,#48H

2096H

;44EAE8E6

| ADD

E6H,E8H,EAH

209AH

;B21814

| LDB

WSR,[SP]

209DH

;65020018

| ADD

SP,#02H

20A1H

;F0

| RET

 

The C compiler can also take advantage of this feature if the “windows” switch is enabled. For details, see the MCS 96 microcontroller architecture software products in the Development Tools Handbook.

4.2.3Windowing and Addressing Modes

Once windowing is enabled, the windowed locations can be accessed both through the window using direct (8-bit) addressing and by the usual 16-bit addressing. The lower register file locations that are covered by the window are always accessible by indirect or indexed operations. To reenable direct access to the entire lower register file, clear the WSR. To enable direct access to a particular location in the lower register file, you can select a smaller window that does not cover that location.

When windowing is enabled:

a register-direct instruction that uses an address within the lower register file actually accesses the window in the upper register file;

an indirect, indexed, or zero-register instruction that uses an address within either the lower register file or the upper register file accesses the actual location in memory.

The following sample code illustrates the difference between register-direct and indexed addressing when using windowing.

PUSHA

 

; pushes the contents of WSR onto the stack

LDB

WSR, #12H

; select window 12H, a 128-byte block

 

 

; The next instruction uses register-direct addr

ADD

40H, 80H

; mem_word(40H)mem_word(40H) + mem_word(380H)

 

 

; The next two instructions use indirect addr

ADD

40H, 80H[0]

; mem_word(40H)mem_word(40H) + mem_word(80H +0)

ADD

40H, 380H[0]

; mem_word(40H)mem_word(40H) + mem_word(380H +0)

POPA

 

; reloads the previous contents into WSR

4-23

5

Standard and PTS

Interrupts

Соседние файлы в предмете Электротехника