Here is the general structure of a menu procedure:
X> Procedure ITEM If DREG(2) X=DREG(0) : Y=DREG(1) drawing instructions go here Endif DREG(0)=BX : Rem x coord of bottom right corner of menu item DREG(1)=BY : Rem y coord of bottom right corner of menu item Endproc
The dimensions of the menu item as it is displayed on screen are set using the coordinates BX and BY. These must be loaded into registers DREG(0) and DREG(1) before leaving your procedure because they are needed to create the final menu bar.
While inside your procedure, most AMOS Professional instructions can be performed, including other procedures. However, the following rules must be observed to avoid your Amiga crashing!
RESERVE
embedded command: reserve a local data area for a procedure
REserve number of bytes
REserve allocates the chosen number of bytes of memory for a menu item. This area can then be accessed from within your menu procedure using the address held in AREG(1). The data area that is reserved in this way is for the storage of variables. This area is local to the menu item that calls the procedure.
Automatic re-drawing of menus
The last two commands in this Chapter affect the automatic process which re-draws the selected
menu 50 times every second.
MENU CALLED
instruction: re-draw a menu item continually
Menu Called(single item parameters)
MENU CALLED engages the automatic re-drawing process. This command is normally used with a menu procedure to generate animated menu items, often with spectacular moving graphic effects.