0
|
1 ;=============================================================================
|
|
2 ;
|
|
3 ; File menu_processor.asm
|
|
4 ;
|
275
|
5 ; Routines to handle all OSTC graphic/text menus.
|
0
|
6 ;
|
|
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
|
|
8 ;=============================================================================
|
|
9 ; HISTORY
|
|
10 ; 2011-05-30 : [jDG] Creation.
|
|
11
|
|
12 ; Restart menu-system from first icon/line:
|
|
13 extern menu_processor_reset
|
|
14
|
|
15 ; Recal last (automatically) saved icon/line when returning from submenu.
|
|
16 extern menu_processor_pop
|
|
17
|
|
18 ; Rexecute the menu block
|
|
19 extern menu_processor
|
|
20
|
169
|
21 extern menu_processor_bottom_line
|
|
22
|
0
|
23 ;=============================================================================
|
|
24 ; Menus parameters
|
|
25
|
|
26 ;NOTE: should be idenric in .inc and .asm !
|
|
27 #define MENU_LINES_MAX .7 ; Number of lines per screen?
|
|
28 #define MENU_HEIGHT .27 ; Spacing on screen.
|
|
29 #define MENU_VCENTER .125 ; Position on screen.
|
|
30
|
|
31 ;=============================================================================
|
|
32
|
|
33 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items
|
|
34 local center
|
|
35 If nb_items > MENU_LINES_MAX
|
|
36 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
|
|
37 Else
|
|
38 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
|
|
39 Endif
|
|
40 If nb_items <= 0
|
|
41 Error "Zero items in menu ", x
|
|
42 Endif
|
|
43
|
|
44 extern txt
|
|
45 call menu_processor
|
|
46 ; Push 6 bytes of menu header data.
|
|
47 db nb_items, dynamic
|
|
48 db LOW(txt), HIGH(txt)
|
|
49 db UPPER(txt), center
|
|
50 ENDM
|
|
51
|
|
52 ;=============================================================================
|
|
53 ; Macro to generat (and check) menu vertical menu blocks with data.
|
|
54 ;
|
|
55 MENU_BEGIN MACRO menu_title, nb_items
|
|
56 COMMON_BEGIN_MENU 0, menu_title, nb_items
|
|
57 ENDM
|
|
58
|
|
59 MENU_BEGIN_DYNAMIC macro title_proc, nb_items
|
|
60 COMMON_BEGIN_MENU 1, title_proc, nb_items
|
|
61 ENDM
|
|
62
|
|
63 ;=============================================================================
|
|
64
|
|
65 ; Submenu
|
|
66 MENU_CALL MACRO txt, proc
|
|
67 extern txt
|
|
68 db 0, 0, 0, 0
|
|
69 db LOW(proc), HIGH(proc), UPPER(proc), 0
|
|
70 db LOW(txt), HIGH(txt)
|
|
71 ENDM
|
|
72
|
|
73 ; Generic option menu
|
|
74 MENU_OPTION MACRO txt, option, callback
|
|
75 extern txt
|
|
76 extern option
|
|
77 db 2, LOW(callback), HIGH(callback), UPPER(callback)
|
|
78 db LOW(option),HIGH(option),UPPER(option), 0
|
|
79 db LOW(txt), HIGH(txt)
|
|
80 ENDM
|
|
81
|
|
82 MENU_DYNAMIC MACRO callback, proc
|
|
83 extern callback
|
|
84 db 3, LOW(callback), HIGH(callback), UPPER(callback)
|
|
85 db LOW(proc), HIGH(proc), UPPER(proc), 0
|
|
86 db 0, 0
|
|
87 ENDM
|
|
88
|
|
89 MENU_END MACRO
|
|
90 ENDM |