0
|
1 ;=============================================================================
|
|
2 ;
|
582
|
3 ; File menu_processor.asm REFACTORED VERSION V2.97
|
0
|
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
|
582
|
12 ; Restart menu-system from first icon/line
|
|
13 extern menu_processor_reset
|
0
|
14
|
582
|
15 ; Recall last (automatically) saved icon/line when returning from submenu
|
|
16 extern menu_processor_pop
|
|
17 extern menu_processor_double_pop
|
0
|
18
|
582
|
19 ; execute the menu block
|
|
20 extern menu_processor
|
|
21 extern menu_processor_bottom_line
|
169
|
22
|
0
|
23 ;=============================================================================
|
|
24 ; Menus parameters
|
|
25
|
|
26 ;NOTE: should be idenric in .inc and .asm !
|
582
|
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.
|
0
|
30
|
|
31 ;=============================================================================
|
|
32
|
582
|
33 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items
|
|
34 local center
|
|
35
|
|
36 If nb_items > MENU_LINES_MAX
|
|
37 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX
|
|
38 Else
|
|
39 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items
|
|
40 Endif
|
0
|
41
|
582
|
42 If nb_items <= 0
|
|
43 Error "Zero items in menu ", x
|
|
44 Endif
|
|
45
|
|
46 extern txt
|
|
47 call menu_processor
|
|
48
|
|
49 ; Push 6 bytes of menu header data.
|
|
50 db nb_items, dynamic
|
|
51 db LOW(txt), HIGH(txt)
|
|
52 db UPPER(txt), center
|
|
53 ENDM
|
0
|
54
|
|
55 ;=============================================================================
|
582
|
56
|
0
|
57 ; Macro to generat (and check) menu vertical menu blocks with data.
|
|
58
|
582
|
59 MENU_BEGIN MACRO menu_title, nb_items
|
|
60 COMMON_BEGIN_MENU 0, menu_title, nb_items
|
|
61 ENDM
|
|
62
|
|
63 MENU_BEGIN_DYNAMIC MACRO title_proc, nb_items
|
|
64 COMMON_BEGIN_MENU 1, title_proc, nb_items
|
|
65 ENDM
|
0
|
66
|
|
67 ;=============================================================================
|
|
68
|
|
69 ; Submenu
|
582
|
70
|
|
71 MENU_CALL MACRO txt, proc
|
|
72 extern txt
|
|
73 db 0, 0, 0, 0
|
|
74 db LOW(proc), HIGH(proc), UPPER(proc), 0
|
|
75 db LOW(txt), HIGH(txt)
|
0
|
76 ENDM
|
|
77
|
|
78 ; Generic option menu
|
582
|
79
|
|
80 MENU_OPTION MACRO txt, option, callback
|
|
81 extern txt
|
|
82 extern option
|
|
83 db 2, LOW(callback), HIGH(callback), UPPER(callback)
|
|
84 db LOW(option), HIGH(option), UPPER(option), 0
|
|
85 db LOW(txt), HIGH(txt)
|
|
86 ENDM
|
0
|
87
|
582
|
88 MENU_DYNAMIC MACRO callback, proc
|
|
89 extern callback
|
|
90 db 3, LOW(callback), HIGH(callback), UPPER(callback)
|
|
91 db LOW(proc), HIGH(proc), UPPER(proc), 0
|
|
92 db 0, 0
|
|
93 ENDM
|
0
|
94
|
582
|
95 MENU_END MACRO
|
|
96 ENDM |