UDATA_OVR Example

MPASM Assembler

UDATA_OVR Example

Directives highlighted in this example are:

  • udata_ovr

Program Functional Description

This program demonstrates the utility of the udata_ovr directive, which is used when generating an object file. This directive declares the beginning of a section of overlayed uninitialized data.

Commented Code Listing

list p=16f877 ;Select the device.

#include <p16f877.inc> ;Include standard header file

;for the selected device.

same_var udata_ovr H'20' ;Declares an overlayed

;uninitialized data section

;named'same_var' starting at

var1 res 1 ;location H'20'.

same_var udata_ovr H'20' ;Declares an overlayed

;uninitialized data section

var2 res 1 ;with the same name as the one

;declared above. Thus variables

;var1 and var2 are allocated

;at the same address.

RST CODE H'0' ;The code section named RST is

;placed at H'0'.The instruction

;'goto start' is placed in code

;section RST.

goto start ;Jumps to the location labelled

;'start'.

INTRT CODE H'4' ;The code section named INTRT is

;placed at H'4'. The instruction

;'goto service_int' is placed in

;code section INTRT.

goto service_int ;Jumps to the location labelled

;'service_int'.

PGM CODE ;This is the begining of the code

;section named PGM. It is a

;relocatable code section

;since no absolute address is given

;along with directive 'CODE'

start

banksel var1 ;Any operation on var1 affects

movlw H'FF' ;var2 also since both variables

movwf var1 ;are overlaid.

comf var2

goto $

service_int

retfie

end


Microchip Technology Inc.
Microchip's Web Site
Voice: (480) 792-7200
Fax: (480) 899-9210
Microchip's E-mail Address
PreviousNext