Module #4: Main Menu

;The following "$" commands must be included in every module

$NOMOD51 ; Omit assembler predefined registers.

$INCLUDE(reg515.inc) ; Include 515/535 microcontroller definitions.

NAME TOPMENU ; Optional parameter; if no name is provided,

; the filename will be used by default.

PUBLIC DISPMENU ; Lets other modules access this section of code

; from "public domain" utilizing the EXTRN command.

; Makes subroutines LCDINIT and LCDOUT in the

; lcd.a51 module available to module main.a51.

EXTRN CODE (LCDOUT)

;***********************************************************************************

TOPMENU SEGMENT CODE ; Reserve RAM space for the generic code

; segment, TOPMENU. The name segment name is referred

; to by the following RSEG directive.

RSEG TOPMENU ; Selects the MAIN code segement, and makes it

; "active" at this point in assembled code.

; The selected segment remains "active" until

; a different segment is specified.

USING 0 ; Indicates to the assembler that register

; bank 0 will be used, but does not actually

; select register bank 0 .

; The module main.a51 should be used primarily to call subroutines in the

; various modules in the project, as opposed to incorporating detailed functions

; within module main.a51 (i.e., main.a51 should be relatively short).

DISPMENU:

;PUT MAIN MENU CODE HERE FOR DISPLAYING ALERT, SAVE, LOAD

MOV DPTR,#LINE1 ; initialize pointer

DISPLOOP:

CLR A

MOVC A,@A+DPTR

JZ NEXTLINE

CALL LCDOUT

INC DPTR

SJMP DISPLOOP

LOOPEXIT:

RET

NEXTLINE:

MOV DPTR,#LINE2

SJMP DISPLOOP

LINE1:

db "(1) Alert (2) Save (3) Load ",0

LINE2:

RET

END