source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS/Src/Boot/BootMenuEvent.asm@ 90

Last change on this file since 90 was 88, checked in by Tomi Tilli, 14 years ago

Changes to XTIDE Universal BIOS:

  • Now uses new libraries (untested)
  • Non-working since code size is too large
File size: 5.2 KB
RevLine 
[88]1; Project name : XTIDE Universal BIOS
[3]2; Description : Boot Menu event handler for menu library callbacks.
3
4; Section containing code
5SECTION .text
6
[88]7struc ITEM_TYPE_REFRESH
8 .HardDisk resb 2
9 .FloppyDrive resb 2
10 .SpecialFunction resb 2
11endstruc
12
13
[3]14;--------------------------------------------------------------------
15; BootMenuEvent_Handler
[88]16; Common parameters for all events:
17; BX: Menu event (anything from MENUEVENT struct)
18; SS:BP: Menu library handle
19; Common return values for all events:
20; CF: Set if event processed
21; Cleared if event not processed
[3]22; Corrupts registers:
[88]23; All
[3]24;--------------------------------------------------------------------
25ALIGN JUMP_ALIGN
26BootMenuEvent_Handler:
[88]27 cmp bx, MENUEVENT.RefreshItemFromCX ; Above last supported item?
28 ja SHORT .EventNotHandled
29 jmp [bx+.rgfnEventSpecificHandlers]
30.EventNotHandled:
31.IdleProcessing:
32 clc
33 ret
[3]34
35ALIGN WORD_ALIGN
[88]36.rgfnEventSpecificHandlers:
37 dw .InitializeMenuinitFromDSSI
38 dw .EventCompleted
39 dw .IdleProcessing
40 dw .ItemHighlightedFromCX
41 dw .ItemSelectedFromCX
42 dw .KeyStrokeInAX
43 dw BootMenuPrint_TitleStrings
44 dw .RefreshInformation
45 dw .RefreshItemFromCX
[3]46
47
[88]48; Parameters:
49; DS:SI: Ptr to MENUINIT struct to initialize
50; Returns:
51; DS:SI: Ptr to initialized MENUINIT struct
[3]52ALIGN JUMP_ALIGN
[88]53.InitializeMenuinitFromDSSI:
54 push ds
55 call RamVars_GetSegmentToDS
56 call .GetDefaultMenuitemToDX
57 call BootMenu_GetMenuitemCountToCX
58 pop ds
59 mov [si+MENUINIT.wItems], cx
60 mov [si+MENUINIT.wHighlightedItem], dx
61 mov WORD [si+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES
62 mov BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH
63 call BootMenu_GetHeightToAHwithItemCountInCL
64 mov [si+MENUINIT.bHeight], ah
65 stc
[3]66 ret
67
[88]68ALIGN JUMP_ALIGN
69.GetDefaultMenuitemToDX:
70 mov dl, [cs:ROMVARS.bBootDrv] ; Default boot drive
71 call BootMenu_IsDriveInSystem
72 jnc SHORT .DoNotSetDefaultMenuitem
73 call DriveXlate_SetDriveToSwap
74 call BootMenu_ConvertDriveToMenuitem
75 mov dx, cx
76 ret
77ALIGN JUMP_ALIGN
78.DoNotSetDefaultMenuitem:
79 xor dx, dx ; Whatever appears first on boot menu
80 ret
[3]81
[88]82
83; Parameters:
84; CX: Index of new highlighted item
85; DX: Index of previously highlighted item or NO_ITEM_HIGHLIGHTED
[3]86ALIGN JUMP_ALIGN
[88]87.ItemHighlightedFromCX:
88 push cx
89 push dx
[3]90 call RamVars_GetSegmentToDS
91 call DriveXlate_Reset
92 call BootMenu_ConvertMenuitemToDriveOrFunction
[88]93 jc SHORT .UpdatePreviousAndNewMenuitem ; Selection changed to a function
[3]94 call DriveXlate_SetDriveToSwap
95
[88]96.UpdatePreviousAndNewMenuitem:
97 pop ax ; Update previous item
98 CALL_MENU_LIBRARY RefreshItemFromAX
99 pop ax ; Update new item
100 CALL_MENU_LIBRARY RefreshItemFromAX
101 CALL_MENU_LIBRARY RefreshInformation
102 stc
[3]103 ret
104
105
[88]106; Parameters:
107; AL: ASCII character for the key
108; AH: Keyboard library scan code for the key
[3]109ALIGN JUMP_ALIGN
[88]110.KeyStrokeInAX:
111 xor ah, ah ; ASCII drive letter now in AX
112 call BootMenu_ConvertHotkeyToMenuitem
113 cmp cx, [bp+MENUINIT.wItems]
114 jae SHORT .EventNotHandled ; Invalid key
115 xchg ax, cx
116 CALL_MENU_LIBRARY HighlightItemFromAX
117 ; Fall to .ItemSelectedFromCX
[3]118
119
[88]120; Parameters:
121; CX: Index of selected item
[3]122ALIGN JUMP_ALIGN
[88]123.ItemSelectedFromCX:
124 CALL_MENU_LIBRARY Close
125.EventCompleted:
126 stc
[3]127 ret
128
129
[88]130; Parameters:
131; CX: Index of item to refresh
132; Cursor has been positioned to the beginning of item line
[3]133ALIGN JUMP_ALIGN
[88]134.RefreshItemFromCX:
135 mov bx, .rgwItemTypeRefresh
136 jmp SHORT .RefreshItemOrInformationWithJumpTableInCSBX
[3]137
[88]138
139; Parameters:
140; CX: Index of highlighted item
141; Cursor has been positioned to the beginning of first line
[3]142ALIGN JUMP_ALIGN
[88]143.RefreshInformation:
144 mov bx, .rgwInformationItemTypeRefresh
145 ; Fall to .RefreshItemOrInformationWithJumpTableInCSBX
[3]146
147;--------------------------------------------------------------------
[88]148; RefreshItemOrInformationWithJumpTableInCSBX
[3]149; Parameters:
150; CX: Index of selected menuitem
[88]151; CS:BX: Ptr to ITEM_TYPE_REFRESH jump table
[3]152; Returns:
[88]153; CF: set since event processed
[3]154;--------------------------------------------------------------------
155ALIGN JUMP_ALIGN
[88]156.RefreshItemOrInformationWithJumpTableInCSBX:
157 cmp cl, NO_ITEM_HIGHLIGHTED
158 je SHORT .EventCompleted
159
[3]160 call RamVars_GetSegmentToDS
161 call BootMenu_ConvertMenuitemToDriveOrFunction
[88]162 jc SHORT .DrawFunction
[3]163 test dl, 80h ; Floppy drive?
[88]164 jz SHORT .DrawFloppyDrive
165 jmp [cs:bx+ITEM_TYPE_REFRESH.HardDisk]
[3]166ALIGN JUMP_ALIGN
[88]167.DrawFunction:
168 jmp [cs:bx+ITEM_TYPE_REFRESH.SpecialFunction]
[3]169ALIGN JUMP_ALIGN
[88]170.DrawFloppyDrive:
171 jmp [cs:bx+ITEM_TYPE_REFRESH.FloppyDrive]
[3]172
[88]173; Jump tables for .RefreshItemOrInformationWithJumpTableInCSBX
174ALIGN WORD_ALIGN
175.rgwItemTypeRefresh:
176istruc ITEM_TYPE_REFRESH
177 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitem
178 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitem
179 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_FunctionMenuitem
180iend
181.rgwInformationItemTypeRefresh:
182istruc ITEM_TYPE_REFRESH
183 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitemInformation
184 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitemInformation
185 at ITEM_TYPE_REFRESH.SpecialFunction, dw BootMenuPrint_ClearInformationArea
186iend
Note: See TracBrowser for help on using the repository browser.