Mercurial > public > hwos_code
comparison src/menu_processor.inc @ 0:11d4fc797f74
init
author | heinrichsweikamp |
---|---|
date | Wed, 24 Apr 2013 19:22:45 +0200 |
parents | |
children | dcf3e08f31ac |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:11d4fc797f74 |
---|---|
1 ;============================================================================= | |
2 ; | |
3 ; File menu_processor.asm | |
4 ; | |
5 ; Routines to handle all OSTC3 graphic/text menus. | |
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 | |
21 ;============================================================================= | |
22 ; Menus parameters | |
23 | |
24 ;NOTE: should be idenric in .inc and .asm ! | |
25 #define MENU_LINES_MAX .7 ; Number of lines per screen? | |
26 #define MENU_HEIGHT .27 ; Spacing on screen. | |
27 #define MENU_VCENTER .125 ; Position on screen. | |
28 | |
29 ;============================================================================= | |
30 | |
31 COMMON_BEGIN_MENU MACRO dynamic, txt, nb_items | |
32 local center | |
33 If nb_items > MENU_LINES_MAX | |
34 center set MENU_VCENTER - (MENU_HEIGHT/2) * MENU_LINES_MAX | |
35 Else | |
36 center set MENU_VCENTER - (MENU_HEIGHT/2) * nb_items | |
37 Endif | |
38 If nb_items <= 0 | |
39 Error "Zero items in menu ", x | |
40 Endif | |
41 | |
42 extern txt | |
43 call menu_processor | |
44 ; Push 6 bytes of menu header data. | |
45 db nb_items, dynamic | |
46 db LOW(txt), HIGH(txt) | |
47 db UPPER(txt), center | |
48 ENDM | |
49 | |
50 ;============================================================================= | |
51 ; Macro to generat (and check) menu vertical menu blocks with data. | |
52 ; | |
53 MENU_BEGIN MACRO menu_title, nb_items | |
54 COMMON_BEGIN_MENU 0, menu_title, nb_items | |
55 ENDM | |
56 | |
57 MENU_BEGIN_DYNAMIC macro title_proc, nb_items | |
58 COMMON_BEGIN_MENU 1, title_proc, nb_items | |
59 ENDM | |
60 | |
61 ;============================================================================= | |
62 | |
63 ; Submenu | |
64 MENU_CALL MACRO txt, proc | |
65 extern txt | |
66 db 0, 0, 0, 0 | |
67 db LOW(proc), HIGH(proc), UPPER(proc), 0 | |
68 db LOW(txt), HIGH(txt) | |
69 ENDM | |
70 | |
71 ; Generic option menu | |
72 MENU_OPTION MACRO txt, option, callback | |
73 extern txt | |
74 extern option | |
75 db 2, LOW(callback), HIGH(callback), UPPER(callback) | |
76 db LOW(option),HIGH(option),UPPER(option), 0 | |
77 db LOW(txt), HIGH(txt) | |
78 ENDM | |
79 | |
80 MENU_DYNAMIC MACRO callback, proc | |
81 extern callback | |
82 db 3, LOW(callback), HIGH(callback), UPPER(callback) | |
83 db LOW(proc), HIGH(proc), UPPER(proc), 0 | |
84 db 0, 0 | |
85 ENDM | |
86 | |
87 MENU_END MACRO | |
88 ENDM |