source: xtideuniversalbios/trunk/Configurator/Src/Libraries/menu/menu.asm@ 75

Last change on this file since 75 was 2, checked in by Tomi Tilli, 14 years ago
File size: 21.4 KB
RevLine 
[2]1; File name : menu.asm
2; Project name : Menu library
3; Created date : 9.11.2009
4; Last update : 20.4.2010
5; Author : Tomi Tilli
6; Description : ASM library to menu system.
7;
8; Menu.asm contains function to be called from
9; user code. Functions in other menu source files
10; are only to be called by menu library itself!
11
12; Optional features.
13%define USE_MENU_DIALOGS ; All dialogs
14;%define USE_MENU_SETSEL ; Menu_SetSel
15%define USE_MENU_TOGGLEINFO ; Menu_ToggleInfo
16%define USE_MENU_INVITEMCNT ; Menu_InvItemCnt
17
18; Include other menu source files.
19%include "menudraw.asm"
20%include "menucrsr.asm"
21%include "menuloop.asm"
22%ifdef USE_MENU_DIALOGS
23 %include "menumsg.asm"
24 %include "menudlg.asm"
25 %include "menuprog.asm"
26 %include "menufile.asm"
27%endif
28
29;--------------- Equates -----------------------------
30
31; Menu Initialization Variables.
32; Menu must always be initialized to stack.
33struc MENUVARS
34 ; Menu size set by user
35 .wSize:
36 .bWidth resb 1 ; Menu full width in chars (borders included)
37 .bHeight resb 1 ; Menu full height in chars (borders included)
38 .wTopDwnH:
39 .bTitleH resb 1 ; Title height in chars (borders not included, 0=disabled)
40 .bInfoH resb 1 ; Info height in chars (borders not included, 0=disabled)
41
42 ; Menu callback system set by user
43 .fnEvent resb 2 ; Offset to event callback function
44
45 ; Menu library internal variables.
46 ; Do not modify from outside menu library!
47 .wTimeInit resb 2 ; System time ticks for autoselect (0=disabled)
48 .wTimeout resb 2 ; System time ticks left for autoselect
49 .wTimeLast resb 2 ; System time ticks when last read
50 .wInitCrsr: ; Initial cursor coordinates
51 .bInitX resb 1
52 .bInitY resb 1
53
54 ; Item related variables
55 .wItemCnt resb 2 ; Total number of items in menu
56 .wItemSel resb 2 ; Index of currently selected (pointed) menuitem
57 .wItemTop resb 2 ; Index of first visible menuitem
58 .bVisCnt resb 1 ; Maximum number of visible menuitems
59 .bFlags resb 1 ; Menu flags
60
61 ; User specific variables start here.
62 ; 4-byte user pointer is stored here if menu created with Menu_Enter.
63 ; Data is user specific if menu was created directly with Menu_Init.
64 .user resb 0
65endstruc
66
67; Screen row count (can be used to limit max menu height)
68CNT_SCRN_ROW EQU 25 ; Number of rows on screen
69
70; Menu flags
71FLG_MNU_EXIT EQU (1<<0) ; Set when menu operation is to be stopped
72FLG_MNU_NOARRW EQU (1<<1) ; Do not draw item selection arrow
73FLG_MNU_HIDENFO EQU (1<<2) ; Hide menu information
74
75; Menu update and invalidate flags
76MFL_UPD_TITLE EQU (1<<0) ; Update title string(s)
77MFL_UPD_NFO EQU (1<<1) ; Update info string(s)
78MFL_UPD_ITEM EQU (1<<2) ; Update item string(s)
79MFL_UPD_NOCLEAR EQU (1<<4) ; Do not clear old chars (prevents flickering)
80
81
82;--------------------------------------------------------------------
83; Event callback function prototype.
84;
85; MENUVARS.fnEvent
86; Parameters:
87; BX: Callback event
88; CX: Menuitem index (usually index of selected Menuitem)
89; DX: Event parameter (event specific)
90; SS:BP: Ptr to MENUVARS
91; Other regs: Undefined
92; Returns:
93; AH: Event specific or unused. Set to 0 if unused.
94; AL: 1=Event processed
95; 0=Event not processed (default action if any)
96; Other regs: Event specific or unused.
97; Corrupts registers:
98; BX, CX, DX
99;--------------------------------------------------------------------
100EVNT_MNU_EXIT EQU 0 ; Menu will quit
101 ; Ret AH: 1 to cancel exit
102 ; 0 to allow menu exit
103EVNT_MMU_SELCHG EQU 1 ; Menuitem selection changed (with arrows)
104EVNT_MNU_SELSET EQU 2 ; Menuitem selected (with Enter)
105EVNT_MNU_KEY EQU 3 ; Keyboard key pressed
106 ; DH: BIOS Scan Code
107 ; DL: ASCII Char (if any)
108EVNT_MNU_UPD EQU 4 ; Menu needs to be updated (use currect cursor position)
109 ; DL: MFL_UPD_TITLE set to update title string
110 ; MFL_UPD_NFO set to update info string
111 ; MFL_UPD_ITEM Set to update menuitem string
112 ; CX: Index of Menuitem to update
113EVNT_MNU_GETDEF EQU 5 ; Request menuitem to be selected by default
114 ; Ret CX: Index of menuitem to select
115EVNT_MNU_INITDONE EQU 6 ; Menu has been initialized (created) but not yet drawn
116
117
118
119;-------------- Private global variables -------------
120; Section containing initialized data
121;SECTION .data
122
123
124;-------------- Public functions ---------------------
125; Section containing code
126SECTION .text
127
128
129;--------------------------------------------------------------------
130; Enters menu or submenu. Menu_Init does not have to be called
131; if this function is used to enter menu or submenu.
132; Menu_Init need to be called only when creating stack frame manually.
133; Manual creation allows custom menu position and user defined variables.
134;
135; Menu_Enter
136; Parameters:
137; AL: Menu width with borders included
138; AH: Menu height with borders included
139; BL: Title line count (0=disable title)
140; BH: Info line count (0=disable info)
141; CL: Number of menuitems in top menu
142; CH: Menu flags
143; DX: Selection timeout in milliseconds (0=timeout disabled)
144; DS:SI: User specific far pointer (will be stored to MENUVARS.user)
145; CS:DI: Pointer to menu event handler function
146; Returns:
147; CX: Index of last pointed Menuitem (not necessary selected with ENTER)
148; FFFFh if cancelled with ESC
149; Corrupts registers:
150; AX, BX, DX
151;--------------------------------------------------------------------
152ALIGN JUMP_ALIGN
153Menu_Enter:
154 ; Create stack frame
155 eENTER MENUVARS_size+4, 0
156 sub bp, MENUVARS_size+4 ; Point to MENUVARS
157
158 ; Initialize menu variables
159 mov [bp+MENUVARS.wSize], ax
160 mov [bp+MENUVARS.wTopDwnH], bx
161 mov [bp+MENUVARS.fnEvent], di
162 mov [bp+MENUVARS.user], si
163 mov [bp+MENUVARS.user+2], ds
164
165 ; Prepare to call Menu_Init
166 push dx ; Store timeout
167 call MenuCrsr_GetCenter ; Get centered coordinates to DX
168 pop ax ; Restore timeout to AX
169 xor bx, bx ; Zero BX
170 xchg bl, ch ; Menu flags to BL, Item count to CX
171 call Menu_Init
172
173 ; Destroy stack frame
174 add bp, MENUVARS_size+4 ; Point to old BP
175 eLEAVE ; Destroy stack frame
176 ret
177
178
179;--------------------------------------------------------------------
180; Initialize Menu.
181; This function returns only after Menu_Exit has been called from
182; event callback function (MENUVARS.fnEvent).
183; Caller must clean MENUVARS from stack once this function returns!
184;
185; Multiple menus can be created to implement submenus.
186;
187; Menu_Init
188; Parameters:
189; AX: Selection timeout (ms, 0=timeout disabled)
190; BL: Menu flags
191; CX: Number of menuitems in top menu
192; DX: Top left coordinate for menu
193; SS:BP: Ptr to MENUVARS
194; Returns:
195; CX: Index of last pointed Menuitem (not necessary selected with ENTER)
196; FFFFh if cancelled with ESC
197; Corrupts registers:
198; AX, BX, DX
199;--------------------------------------------------------------------
200ALIGN JUMP_ALIGN
201Menu_Init:
202 ; Initialize internal variables
203 call Menu_StartTimeout
204 xor ax, ax ; Zero AX
205 mov [bp+MENUVARS.wInitCrsr], dx
206 mov [bp+MENUVARS.wItemCnt], cx
207 mov [bp+MENUVARS.wItemSel], ax
208 mov [bp+MENUVARS.wItemTop], ax
209 mov [bp+MENUVARS.bFlags], bl
210
211 ; Calculate number of visible menuitems
212 eMOVZX ax, [bp+MENUVARS.bHeight] ; Load menu total height
213 times 2 dec ax ; Decrement top and borders
214 or ah, [bp+MENUVARS.bTitleH] ; Load title height
215 jz .CheckInfo ; If no title, check if info
216 sub al, ah ; Subtract title lines
217 dec ax ; Decrement item border
218ALIGN JUMP_ALIGN
219.CheckInfo:
220 xor ah, ah ; Zero AH
221 or ah, [bp+MENUVARS.bInfoH] ; Load info height
222 jz .StoreVisible ; If no info, jump to store
223 sub al, ah ; Subtract info lines
224 dec ax ; Decrement item border
225ALIGN JUMP_ALIGN
226.StoreVisible:
227 mov [bp+MENUVARS.bVisCnt], al ; Store max visible menuitems
228
229 ; Get default menuitem
230 mov bx, EVNT_MNU_GETDEF
231 call MenuLoop_SendEvent
232 test al, al ; Default menuitem returned?
233 jz .InitDone ; If not, continue
234 mov [bp+MENUVARS.wItemSel], cx ; Store default
235 eMOVZX ax, [bp+MENUVARS.bVisCnt] ; Load one past last to be displayed
236 cmp cx, ax ; Visible selection?
237 jb .InitDone ; If so, continue
238 mov [bp+MENUVARS.wItemTop], cx ; Set selected to topmost
239
240 ; Send EVNT_MNU_INITDONE event
241ALIGN JUMP_ALIGN
242.InitDone:
243 mov bx, EVNT_MNU_INITDONE
244 call MenuLoop_SendEvent
245
246 ; Draw menu
247 call MenuCrsr_Hide ; Hide cursor
248 mov cx, -1 ; Invalidate all menuitems
249 mov dl, MFL_UPD_TITLE | MFL_UPD_ITEM | MFL_UPD_NFO
250 call Menu_Invalidate
251
252 ; Enter menu loop until Menu_Exit is called
253 call MenuLoop_Enter
254 call MenuCrsr_Show ; Show cursor again
255 mov cx, [bp+MENUVARS.wItemSel] ; Load return value
256 ret
257
258
259;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
260; Below functions are called only from event callback function ;
261; (MENUVARS.fnEvent) ;
262;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
263
264;--------------------------------------------------------------------
265; Sets wanted menuitem selected and draws changes.
266;
267; Menu_SetSel
268; Parameters:
269; CX: Index of menuitem to set selected
270; SS:BP: Ptr to MENUVARS for menu to refresh
271; Returns:
272; Nothing
273; Corrupts registers:
274; AX, BX, CX, DX
275;--------------------------------------------------------------------
276%ifdef USE_MENU_SETSEL
277ALIGN JUMP_ALIGN
278Menu_SetSel:
279 cmp cx, [bp+MENUVARS.wItemCnt] ; Valid menuitem index?
280 jae .Return ; If not, return
281 mov [bp+MENUVARS.wItemSel], cx ; Store new selected index
282
283 ; Scroll if necessary
284 mov ax, [bp+MENUVARS.wItemTop] ; Load index of topmost visible
285 MIN_U ax, cx ; AX = new topmost visible
286 mov [bp+MENUVARS.wItemTop], ax ; Store new topmost
287 add al, [bp+MENUVARS.bVisCnt] ; AX to one past...
288 adc ah, 0 ; ...last visible
289 cmp cx, ax ; After last visible?
290 jb .SendSelChg ; If not, continue
291 mov [bp+MENUVARS.wItemTop], cx ; New selection to topmost
292
293 ; Send EVNT_MMU_SELCHG message
294ALIGN JUMP_ALIGN
295.SendSelChg:
296 mov bx, EVNT_MMU_SELCHG
297 call MenuLoop_SendEvent
298
299 ; Redraw changes
300 mov cx, -1 ; Invalidate all menuitems
301 mov dl, MFL_UPD_ITEM
302 call Menu_Invalidate
303.Return:
304 ret
305%endif
306
307
308;--------------------------------------------------------------------
309; Shows or hides menu information at the bottom of menu.
310;
311; Menu_ShowInfo Enables menu information
312; Menu_HideInfo Disables menu information
313; Menu_ToggleInfo Enables or disables menu information
314; Parameters:
315; SS:BP: Ptr to MENUVARS for menu
316; Returns:
317; Nothing
318; Corrupts registers:
319; AX, BX, DX
320;--------------------------------------------------------------------
321%ifdef USE_MENU_TOGGLEINFO
322ALIGN JUMP_ALIGN
323Menu_ShowInfo:
324 test BYTE [bp+MENUVARS.bFlags], FLG_MNU_HIDENFO
325 jnz Menu_ToggleInfo
326 ret
327ALIGN JUMP_ALIGN
328Menu_HideInfo:
329 test BYTE [bp+MENUVARS.bFlags], FLG_MNU_HIDENFO
330 jz Menu_ToggleInfo
331 ret
332ALIGN JUMP_ALIGN
333Menu_ToggleInfo:
334 xor BYTE [bp+MENUVARS.bFlags], FLG_MNU_HIDENFO
335 ; Fall to Menu_RefreshMenu
336%endif
337
338
339;--------------------------------------------------------------------
340; Refreshes menu. This function must be called when
341; call to submenu Menu_Enter (or Menu_Init) returns.
342;
343; Menu_RefreshMenu
344; Parameters:
345; SS:BP: Ptr to MENUVARS for menu to refresh
346; Returns:
347; Nothing
348; Corrupts registers:
349; AX, BX, DX
350;--------------------------------------------------------------------
351ALIGN JUMP_ALIGN
352Menu_RefreshMenu:
353 push cx
354 call MenuCrsr_Hide ; Hide cursor
355 call Menu_RestartTimeout ; Restart selection timeout
356 call Menu_GetTime ; Get system time ticks to CX:DX
357 mov [bp+MENUVARS.wTimeLast], dx ; Store last time updated
358 call Keys_ClrBuffer ; Clear keyboard buffer
359 call MenuDraw_ClrScr ; Clear screen
360 mov cx, -1 ; Invalidate all menuitems
361 mov dl, MFL_UPD_TITLE | MFL_UPD_NFO | MFL_UPD_ITEM
362 call Menu_Invalidate ; Redraw everything
363 pop cx
364 ret
365
366
367;--------------------------------------------------------------------
368; Destroy menu by causing Menu_Init to return.
369;
370; Menu_Exit
371; Parameters:
372; SS:BP: Ptr to MENUVARS
373; Returns:
374; CF: Set if user cancelled exit
375; Cleared if user allowed exit
376; Corrupts registers:
377; AX, BX, CX, DX
378;--------------------------------------------------------------------
379ALIGN JUMP_ALIGN
380Menu_Exit:
381 mov bx, EVNT_MNU_EXIT
382 call MenuLoop_SendEvent
383 rcr ah, 1 ; AH bit 0 to CF
384 jc .Return ; Do not exit if AH non-zero
385 or BYTE [bp+MENUVARS.bFlags], FLG_MNU_EXIT ; (Clear CF)
386ALIGN JUMP_ALIGN
387.Return:
388 ret
389
390
391;--------------------------------------------------------------------
392; Invalidate any menu string.
393; Menu then sends EVNT_MNU_UPD events when necessary.
394;
395; Menu_InvItemCnt Changes total item count and invalidates
396; Parameters: (in addition to Menu_Invalidate)
397; CX: New Total item count
398; Menu_Invalidate
399; Parameters:
400; DL: Invalidate flags (any combination is valid):
401; MFL_UPD_NOCLEAR Set to prevent clearing old chars
402; MFL_UPD_TITLE Invalidate menu title string
403; MFL_UPD_NFO Invalidate menu info string
404; MFL_UPD_ITEM Invalidate menuitem strings
405; CX: Index of Menuitem to update
406; -1 to update all menuitems
407; SS:BP: Ptr to MENUVARS
408; Returns:
409; Nothing
410; Corrupts registers:
411; AX, BX, CX, DX
412;--------------------------------------------------------------------
413%ifdef USE_MENU_INVITEMCNT
414ALIGN JUMP_ALIGN
415Menu_InvItemCnt:
416 xor ax, ax
417 mov [bp+MENUVARS.wItemCnt], cx
418 mov [bp+MENUVARS.wItemSel], ax
419 mov [bp+MENUVARS.wItemTop], ax
420 mov cx, -1 ; Invalidate all items
421 or dl, MFL_UPD_ITEM | MFL_UPD_NFO
422%endif
423ALIGN JUMP_ALIGN
424Menu_Invalidate:
425 push di
426 mov di, dx
427 test di, MFL_UPD_ITEM ; Invalidate Menuitems?
428 jz .InvTitle ; If not, jump to invalidate Title
429 cmp cx, -1 ; Redraw all menuitems?
430 je .InvAllItems ; If so, jump to draw
431 call MenuCrsr_PointNthItem ; Set cursor position
432 call MenuDraw_Item ; Draw single menuitem
433 jmp .InvTitle ; Jump to invalidate Title
434ALIGN JUMP_ALIGN
435.InvAllItems:
436 test di, MFL_UPD_NOCLEAR ; Keep background?
437 jnz .DrawAllItems ; If not, jump to draw
438 call MenuDraw_ItemBorders ; Draw item borders
439ALIGN JUMP_ALIGN
440.DrawAllItems:
441 call MenuDraw_AllItemsNoBord ; Draw items without borders
442
443ALIGN JUMP_ALIGN
444.InvTitle:
445 test di, MFL_UPD_TITLE ; Invalidate Title?
446 jz .InvInfo ; If not, jump to invalidate Info
447 test di, MFL_UPD_NOCLEAR ; Keep background?
448 jnz .DrawTitle ; If not, jump to draw
449 call MenuDraw_TitleBorders ; Draw borders
450ALIGN JUMP_ALIGN
451.DrawTitle:
452 call MenuDraw_TitleNoBord ; Draw title without borders
453
454ALIGN JUMP_ALIGN
455.InvInfo:
456 test di, MFL_UPD_NFO ; Invalidate Info?
457 jz .Return ; If not, return
458 test di, MFL_UPD_NOCLEAR ; Keep background?
459 jnz .DrawInfo ; If not, jump to draw
460 call MenuDraw_InfoBorders ; Draw borders
461ALIGN JUMP_ALIGN
462.DrawInfo:
463 call MenuDraw_InfoNoBord ; Draw info without borders
464ALIGN JUMP_ALIGN
465.Return:
466 pop di
467 ret
468
469
470;--------------------------------------------------------------------
471; Starts or stops menu selection timeout.
472;
473; Menu_StopTimeout ; Stops timeout
474; Menu_StartTimeout ; Starts timeout with new value
475; Menu_RestartTimeout ; Restarts timeout with previous value
476; Parameters:
477; AX: New timeout value in ms (for Menu_StartTimeout only)
478; SS:BP: Ptr to MENUVARS
479; Returns:
480; Nothing
481; Corrupts registers:
482; AX
483;--------------------------------------------------------------------
484ALIGN JUMP_ALIGN
485Menu_StopTimeout:
486 xor ax, ax
487ALIGN JUMP_ALIGN
488Menu_StartTimeout:
489 push dx
490 push bx
491 xor dx, dx
492 mov bx, 55 ; 1 timer tick = 54.945ms
493 div bx ; DX:AX / 55
494 mov [bp+MENUVARS.wTimeInit], ax ; Store timer tick count
495 mov [bp+MENUVARS.wTimeout], ax
496 pop bx
497 pop dx
498 ret
499ALIGN JUMP_ALIGN
500Menu_RestartTimeout:
501 mov ax, [bp+MENUVARS.wTimeInit]
502 mov [bp+MENUVARS.wTimeout], ax
503 ret
504
505
506;--------------------------------------------------------------------
507; Returns system time in clock ticks. One tick is 54.95ms.
508;
509; Menu_GetTime
510; Parameters:
511; Nothing
512; Returns:
513; AL: Midnight flag, set if midnight passed since last read
514; CX:DX: Number of clock ticks since midnight
515; Corrupts registers:
516; AH
517;--------------------------------------------------------------------
518ALIGN JUMP_ALIGN
519Menu_GetTime:
520 xor ah, ah ; Get System Time
521 int 1Ah
522 ret
523
524
525;--------------------------------------------------------------------
526; Checks if Menuitem is currently visible.
527;
528; Menu_IsItemVisible
529; Parameters:
530; AX: Menuitem index
531; SS:BP: Ptr to MENUVARS
532; Returns:
533; CF: Set if Menuitem is visible
534; Cleared if Menuitem is not visible
535; Corrupts registers:
536; Nothing
537;--------------------------------------------------------------------
538ALIGN JUMP_ALIGN
539Menu_IsItemVisible:
540 push dx
541 mov dx, [bp+MENUVARS.wItemTop] ; Load index of first visible
542 cmp ax, dx ; First visible menuitem?
543 jb .RetFalse ; If below, return false
544 add dl, [bp+MENUVARS.bVisCnt] ; Inc to one past...
545 adc dh, 0 ; ...last visible menuitem
546 cmp ax, dx ; Over last visible?
547 jae .RetFalse ; If so, return false
548 pop dx
549 ret ; Return with CF set
550ALIGN JUMP_ALIGN
551.RetFalse:
552 pop dx
553 clc
554 ret
555
556
557;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
558; Optional Dialog functions start here ;
559;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
560%ifdef USE_MENU_DIALOGS
561
562;--------------------------------------------------------------------
563; Shows message dialog to display string.
564; String can be multiple lines but line feeds will be determined
565; by menu system.
566;
567; Menu_ShowMsgDlg
568; Parameters:
569; BL: Dialog width with borders included
570; SS:BP: Ptr to MENUVARS
571; ES:DI: Ptr to STOP terminated string to display
572; Returns:
573; Nothing
574; Corrupts registers:
575; AX, BX, CX, DX
576;--------------------------------------------------------------------
577ALIGN JUMP_ALIGN
578Menu_ShowMsgDlg:
579 call MenuMsg_ShowMessage
580 jmp Menu_RefreshMenu
581
582
583;--------------------------------------------------------------------
584; Shows dialog that asks unsigned DWORD from user.
585;
586; Menu_ShowDWDlg
587; Parameters:
588; BL: Dialog width with borders included
589; CX: Numeric base (10=dec, 16=hex...)
590; SS:BP: Ptr to MENUVARS
591; ES:DI: Ptr to STOP terminated string to display
592; Returns:
593; DX:AX: User inputted data
594; CF: Set if user data inputted successfully
595; Cleared is input cancelled
596; Corrupts registers:
597; BX, CX
598;--------------------------------------------------------------------
599ALIGN JUMP_ALIGN
600Menu_ShowDWDlg:
601 mov dx, MenuDlg_DWEvent ; Offset to event handler
602 call MenuDlg_Show
603 push ax
604 push dx
605 pushf
606 call Menu_RefreshMenu
607 popf
608 pop dx
609 pop ax
610 ret
611
612
613;--------------------------------------------------------------------
614; Shows dialog that asks Y/N input from user.
615;
616; Menu_ShowYNDlg
617; Parameters:
618; BL: Dialog width with borders included
619; SS:BP: Ptr to MENUVARS
620; ES:DI: Ptr to STOP terminated string to display
621; Returns:
622; AX: 'Y' if Y pressed
623; 'N' if N pressed
624; Zero if ESC pressed
625; CF: Set if Y pressed
626; Cleared if N or ESC pressed
627; Corrupts registers:
628; BX, CX, DX
629;--------------------------------------------------------------------
630ALIGN JUMP_ALIGN
631Menu_ShowYNDlg:
632 mov dx, MenuDlg_YNEvent ; Offset to event handler
633 call MenuDlg_Show
634 push ax
635 pushf
636 call Menu_RefreshMenu
637 popf
638 pop ax
639 ret
640
641
642;--------------------------------------------------------------------
643; Shows dialog that asks any string from user.
644;
645; Menu_ShowStrDlg
646; Parameters:
647; BL: Dialog width with borders included
648; CX: Buffer length with STOP included
649; SS:BP: Ptr to MENUVARS
650; ES:DI: Ptr to STOP terminated string to display
651; DS:SI: Prt to buffer to receive string
652; Returns:
653; AX: String length in characters without STOP
654; CF: Set if string inputted successfully
655; Cleared if user cancellation
656; Corrupts registers:
657; BX, CX, DX
658;--------------------------------------------------------------------
659ALIGN JUMP_ALIGN
660Menu_ShowStrDlg:
661 mov dx, MenuDlg_StrEvent ; Offset to event handler
662 call MenuDlg_Show
663 push ax
664 pushf
665 call Menu_RefreshMenu
666 popf
667 pop ax
668 ret
669
670
671;--------------------------------------------------------------------
672; Shows progress bar dialog.
673;
674; Menu_ShowProgDlg
675; Parameters:
676; BL: Dialog width with borders included
677; BH: Dialog height with borders included
678; SS:BP: Ptr to MENUVARS
679; ES:DI: Far ptr to user specified task function
680; DS:SI: User specified far pointer
681; Returns:
682; AX: User specified return code
683; Corrupts registers:
684; BX, CX, DX
685;--------------------------------------------------------------------
686ALIGN JUMP_ALIGN
687Menu_ShowProgDlg:
688 call MenuProg_Show
689 push ax
690 call Menu_RefreshMenu
691 pop ax
692 ret
693
694
695;--------------------------------------------------------------------
696; Shows dialog that user can use to select file.
697;
698; Menu_ShowFileDlg
699; Parameters:
700; BL: Dialog width with borders included
701; SS:BP: Ptr to MENUVARS
702; ES:DI: Ptr to STOP terminated info string
703; DS:SI: Ptr to file search string (* and ? wildcards supported)
704; Returns:
705; DS:SI: Ptr to DTA for selected file
706; CF: Set if file selected successfully
707; Cleared if user cancellation
708; Corrupts registers:
709; AX, BX, CX, DX
710;--------------------------------------------------------------------
711ALIGN JUMP_ALIGN
712Menu_ShowFileDlg:
713 call MenuFile_ShowDlg
714 pushf
715 call Menu_RefreshMenu
716 popf
717 ret
718
719
720%endif ; USE_MENU_DIALOGS
Note: See TracBrowser for help on using the repository browser.