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

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

Changes to XTIDE Universal BIOS:

  • Boot menu finally works but timeout and drive numbers not yet implemented.
File size: 5.1 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
10endstruc
11
12
[3]13;--------------------------------------------------------------------
14; BootMenuEvent_Handler
[88]15; Common parameters for all events:
16; BX: Menu event (anything from MENUEVENT struct)
17; SS:BP: Menu library handle
18; Common return values for all events:
19; CF: Set if event processed
20; Cleared if event not processed
[3]21; Corrupts registers:
[88]22; All
[3]23;--------------------------------------------------------------------
24ALIGN JUMP_ALIGN
25BootMenuEvent_Handler:
[127]26 cmp bx, BYTE MENUEVENT.RefreshItemFromCX ; Above last supported item?
[88]27 ja SHORT .EventNotHandled
[127]28 jmp [cs:bx+.rgfnEventSpecificHandlers]
[88]29.EventNotHandled:
30 clc
31 ret
[3]32
33ALIGN WORD_ALIGN
[88]34.rgfnEventSpecificHandlers:
[124]35 dw .InitializeMenuinitFromDSSI ; MENUEVENT.InitializeMenuinitFromDSSI
36 dw .EventCompleted ; MENUEVENT.ExitMenu
37 dw .EventNotHandled ; MENUEVENT.IdleProcessing
38 dw .ItemHighlightedFromCX ; MENUEVENT.ItemHighlightedFromCX
39 dw .ItemSelectedFromCX ; MENUEVENT.ItemSelectedFromCX
40 dw .KeyStrokeInAX ; MENUEVENT.KeyStrokeInAX
41 dw BootMenuPrint_TitleStrings ; MENUEVENT.RefreshTitle
42 dw .RefreshInformation ; MENUEVENT.RefreshInformation
43 dw .RefreshItemFromCX ; MENUEVENT.RefreshItemFromCX
[3]44
45
[88]46; Parameters:
47; DS:SI: Ptr to MENUINIT struct to initialize
48; Returns:
49; DS:SI: Ptr to initialized MENUINIT struct
[3]50ALIGN JUMP_ALIGN
[88]51.InitializeMenuinitFromDSSI:
52 push ds
53 call RamVars_GetSegmentToDS
54 call .GetDefaultMenuitemToDX
[124]55 call BootMenu_GetMenuitemCountToAX
[88]56 pop ds
[124]57 mov [si+MENUINIT.wItems], ax
[88]58 mov [si+MENUINIT.wHighlightedItem], dx
59 mov WORD [si+MENUINIT.wTitleAndInfoLines], BOOT_MENU_TITLE_AND_INFO_LINES
60 mov BYTE [si+MENUINIT.bWidth], BOOT_MENU_WIDTH
[124]61 call BootMenu_GetHeightToAHwithItemCountInAL
[88]62 mov [si+MENUINIT.bHeight], ah
63 stc
[3]64 ret
65
[88]66ALIGN JUMP_ALIGN
67.GetDefaultMenuitemToDX:
68 mov dl, [cs:ROMVARS.bBootDrv] ; Default boot drive
69 call BootMenu_IsDriveInSystem
70 jnc SHORT .DoNotSetDefaultMenuitem
71 call DriveXlate_SetDriveToSwap
[124]72 jmp BootMenu_GetMenuitemToDXforDriveInDL
[88]73ALIGN JUMP_ALIGN
74.DoNotSetDefaultMenuitem:
75 xor dx, dx ; Whatever appears first on boot menu
76 ret
[3]77
[88]78
79; Parameters:
80; CX: Index of new highlighted item
81; DX: Index of previously highlighted item or NO_ITEM_HIGHLIGHTED
[3]82ALIGN JUMP_ALIGN
[88]83.ItemHighlightedFromCX:
84 push cx
85 push dx
[3]86 call RamVars_GetSegmentToDS
87 call DriveXlate_Reset
[130]88 call BootMenu_GetDriveToDXforMenuitemInCX
[3]89 call DriveXlate_SetDriveToSwap
[88]90 pop ax ; Update previous item
91 CALL_MENU_LIBRARY RefreshItemFromAX
92 pop ax ; Update new item
93 CALL_MENU_LIBRARY RefreshItemFromAX
94 CALL_MENU_LIBRARY RefreshInformation
95 stc
[3]96 ret
97
98
[88]99; Parameters:
100; AL: ASCII character for the key
101; AH: Keyboard library scan code for the key
[3]102ALIGN JUMP_ALIGN
[88]103.KeyStrokeInAX:
[92]104 cmp ah, ROM_BOOT_HOTKEY_SCANCODE
105 jne SHORT .CheckDriveHotkeys
[95]106 jmp Int19hMenu_RomBoot
[92]107ALIGN JUMP_ALIGN
108.CheckDriveHotkeys:
[130]109 call BootMenu_GetMenuitemToAXforAsciiHotkeyInAL
110 cmp ax, [bp+MENUINIT.wItems]
[92]111 jae SHORT .EventCompleted ; Invalid key
[88]112 CALL_MENU_LIBRARY HighlightItemFromAX
113 ; Fall to .ItemSelectedFromCX
[3]114
115
[88]116; Parameters:
117; CX: Index of selected item
[3]118ALIGN JUMP_ALIGN
[88]119.ItemSelectedFromCX:
120 CALL_MENU_LIBRARY Close
121.EventCompleted:
122 stc
[3]123 ret
124
125
[88]126; Parameters:
127; CX: Index of item to refresh
128; Cursor has been positioned to the beginning of item line
[3]129ALIGN JUMP_ALIGN
[88]130.RefreshItemFromCX:
131 mov bx, .rgwItemTypeRefresh
132 jmp SHORT .RefreshItemOrInformationWithJumpTableInCSBX
[3]133
[88]134
135; Parameters:
136; CX: Index of highlighted item
137; Cursor has been positioned to the beginning of first line
[3]138ALIGN JUMP_ALIGN
[88]139.RefreshInformation:
140 mov bx, .rgwInformationItemTypeRefresh
141 ; Fall to .RefreshItemOrInformationWithJumpTableInCSBX
[3]142
143;--------------------------------------------------------------------
[88]144; RefreshItemOrInformationWithJumpTableInCSBX
[3]145; Parameters:
146; CX: Index of selected menuitem
[88]147; CS:BX: Ptr to ITEM_TYPE_REFRESH jump table
[3]148; Returns:
[88]149; CF: set since event processed
[3]150;--------------------------------------------------------------------
[88]151.RefreshItemOrInformationWithJumpTableInCSBX:
152 cmp cl, NO_ITEM_HIGHLIGHTED
153 je SHORT .EventCompleted
154
[3]155 call RamVars_GetSegmentToDS
[130]156 call BootMenu_GetDriveToDXforMenuitemInCX
[128]157 test dl, dl ; Floppy drive?
158 jns SHORT .DrawFloppyDrive
[88]159 jmp [cs:bx+ITEM_TYPE_REFRESH.HardDisk]
[3]160ALIGN JUMP_ALIGN
[88]161.DrawFloppyDrive:
162 jmp [cs:bx+ITEM_TYPE_REFRESH.FloppyDrive]
[3]163
[88]164; Jump tables for .RefreshItemOrInformationWithJumpTableInCSBX
165ALIGN WORD_ALIGN
166.rgwItemTypeRefresh:
167istruc ITEM_TYPE_REFRESH
168 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitem
169 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitem
170iend
171.rgwInformationItemTypeRefresh:
172istruc ITEM_TYPE_REFRESH
173 at ITEM_TYPE_REFRESH.HardDisk, dw BootMenuPrint_HardDiskMenuitemInformation
174 at ITEM_TYPE_REFRESH.FloppyDrive, dw BootMenuPrint_FloppyMenuitemInformation
175iend
Note: See TracBrowser for help on using the repository browser.