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