source: xtideuniversalbios/trunk/Configurator/Src/Menupages/IdeControllerMenu.asm@ 90

Last change on this file since 90 was 2, checked in by Tomi Tilli, 15 years ago
File size: 8.6 KB
RevLine 
[2]1; File name : IdeControllerMenu.asm
2; Project name : XTIDE Univeral BIOS Configurator
3; Created date : 23.4.2010
4; Last update : 27.4.2010
5; Author : Tomi Tilli
6; Description : Menu for configuring IDEVARS.
7
8; Section containing initialized data
9SECTION .data
10
11; -Back to previous menu
12; +Master Drive
13; +Slave Drive
14; Command Block (base port) address (01F0h)
15; Control Block address (03F0h)
16; Bus type (16-bit)
17; Enable Interrupt (Y)
18; IRQ (14)
19
20ALIGN WORD_ALIGN
21g_MenuPageIdeVars:
22istruc MENUPAGE
23 at MENUPAGE.bItemCnt, db 8
24iend
25istruc MENUPAGEITEM ; Back to previous menu
26 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateLeaveSubmenu
27 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
28 at MENUPAGEITEM.szName, dw g_szPreviousMenu
29 at MENUPAGEITEM.szInfo, dw g_szNfoIdeBack
30 at MENUPAGEITEM.szHelp, dw g_szNfoIdeBack
31 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
32 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_BACK
33iend
34g_MenuPageItemIdeMaster:
35istruc MENUPAGEITEM ; Master Drive
36 at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateMasterOrSlaveMenu
37 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
38 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageDrvParams
39 at MENUPAGEITEM.szName, dw g_szItemIdeMaster
40 at MENUPAGEITEM.szInfo, dw g_szNfoIdeMaster
41 at MENUPAGEITEM.szHelp, dw g_szNfoIdeMaster
42 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
43 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
44iend
45g_MenuPageItemIdeSlave:
46istruc MENUPAGEITEM ; Slave Drive
47 at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateMasterOrSlaveMenu
48 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
49 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageDrvParams
50 at MENUPAGEITEM.szName, dw g_szItemIdeSlave
51 at MENUPAGEITEM.szInfo, dw g_szNfoIdeSlave
52 at MENUPAGEITEM.szHelp, dw g_szNfoIdeSlave
53 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
54 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
55iend
56g_MenuPageItemIdeBusType:
57istruc MENUPAGEITEM ; Bus type
58 at MENUPAGEITEM.fnActivate, dw MainPageItem_ActivateSubmenuForGettingLookupValue
59 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_LookupString
60 at MENUPAGEITEM.pSubMenuPage, dw g_MenuPageBusType
61 at MENUPAGEITEM.rgszLookup, dw g_rgszBusTypeValueToString
62 at MENUPAGEITEM.szName, dw g_szItemIdeBusType
63 at MENUPAGEITEM.szInfo, dw g_szNfoIdeBusType
64 at MENUPAGEITEM.szHelp, dw g_szNfoIdeBusType
65 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
66 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_NEXT
67iend
68g_MenuPageItemIdeCmdPort:
69istruc MENUPAGEITEM ; Command Block (base port) address
70 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetHexWordFromUser
71 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
72 at MENUPAGEITEM.szName, dw g_szItemIdeCmdPort
73 at MENUPAGEITEM.szInfo, dw g_szNfoIdeCmdPort
74 at MENUPAGEITEM.szHelp, dw g_szHelpIdeCmdPort
75 at MENUPAGEITEM.szDialog, dw g_szDlgIdeCmdPort
76 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
77 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_HEX_WORD
78iend
79g_MenuPageItemIdeCtrlPort:
80istruc MENUPAGEITEM ; Control Block address (03F0h)
81 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetHexWordFromUser
82 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
83 at MENUPAGEITEM.szName, dw g_szItemIdeCtrlPort
84 at MENUPAGEITEM.szInfo, dw g_szNfoIdeCtrlPort
85 at MENUPAGEITEM.szHelp, dw g_szHelpIdeCtrlPort
86 at MENUPAGEITEM.szDialog, dw g_szDlgIdeCtrlPort
87 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
88 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_HEX_WORD
89iend
90g_MenuPageItemIdeEnIRQ:
91istruc MENUPAGEITEM ; Enable interrupt
92 at MENUPAGEITEM.fnActivate, dw IdeControllerMenu_ActivateEnableInterrupt
93 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
94 at MENUPAGEITEM.wValueMask, dw 000Fh
95 at MENUPAGEITEM.szName, dw g_szItemIdeEnIRQ
96 at MENUPAGEITEM.szInfo, dw g_szNfoIdeEnIRQ
97 at MENUPAGEITEM.szHelp, dw g_szHelpIdeEnIRQ
98 at MENUPAGEITEM.szDialog, dw g_szDlgIdeEnIRQ
99 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
100 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_FLAG
101iend
102g_MenuPageItemIdeIRQ:
103istruc MENUPAGEITEM ; IRQ
104 at MENUPAGEITEM.fnActivate, dw MenuPageItem_GetByteFromUser
105 at MENUPAGEITEM.fnNameFormat, dw MenuPageItemFormat_NameForAnyType
106 at MENUPAGEITEM.wValueMin, dw 2
107 at MENUPAGEITEM.wValueMax, dw 15
108 at MENUPAGEITEM.szName, dw g_szItemIdeIRQ
109 at MENUPAGEITEM.szInfo, dw g_szNfoIdeIRQ
110 at MENUPAGEITEM.szHelp, dw g_szHelpIdeIRQ
111 at MENUPAGEITEM.szDialog, dw g_szDlgIdeIRQ
112 at MENUPAGEITEM.bFlags, db FLG_MENUPAGEITEM_VISIBLE
113 at MENUPAGEITEM.bType, db TYPE_MENUPAGEITEM_UNSIGNED_BYTE
114iend
115
116
117; Section containing code
118SECTION .text
119
120;--------------------------------------------------------------------
121; Stores IDEVARS specific pointers to IDE Controller Menu
122; MENUPAGEITEM structs.
123;
124; IdeControllerMenu_SetIdevarsOffset
125; Parameters:
126; AX: Offset to IDEVARS
127; DS: CS
128; Returns:
129; Nothing
130; Corrupts registers:
131; BX, CX
132;--------------------------------------------------------------------
133ALIGN JUMP_ALIGN
134IdeControllerMenu_SetIdevarsOffset:
135 eMOVZX cx, BYTE [g_MenuPageIdeVars+MENUPAGE.bItemCnt]
136 dec cx
137 mov bx, g_MenuPageItemIdeMaster+MENUPAGEITEM.pValue
138ALIGN JUMP_ALIGN
139.StoreIdevarsLoop:
140 mov [bx], ax
141 add bx, MENUPAGEITEM_size
142 loop .StoreIdevarsLoop
143
144 ; Add offsets to values
145 add WORD [g_MenuPageItemIdeMaster+MENUPAGEITEM.pValue], BYTE IDEVARS.drvParamsMaster
146 add WORD [g_MenuPageItemIdeSlave+MENUPAGEITEM.pValue], BYTE IDEVARS.drvParamsSlave
147 add WORD [g_MenuPageItemIdeBusType+MENUPAGEITEM.pValue], BYTE IDEVARS.bBusType
148 add WORD [g_MenuPageItemIdeCmdPort+MENUPAGEITEM.pValue], BYTE IDEVARS.wPort
149 add WORD [g_MenuPageItemIdeCtrlPort+MENUPAGEITEM.pValue], BYTE IDEVARS.wPortCtrl
150 add WORD [g_MenuPageItemIdeEnIRQ+MENUPAGEITEM.pValue], BYTE IDEVARS.bIRQ
151 add WORD [g_MenuPageItemIdeIRQ+MENUPAGEITEM.pValue], BYTE IDEVARS.bIRQ
152 ret
153
154
155;--------------------------------------------------------------------
156; IdeControllerMenu_ActivateMasterOrSlaveMenu
157; Parameters:
158; DS:SI Ptr to MENUPAGE
159; DS:DI Ptr to MENUPAGEITEM
160; SS:BP: Ptr to MENUVARS
161; Returns:
162; CF: Set if menuitem changed
163; Cleared if no changes
164; Corrupts registers:
165; AX, BX, CX, DX
166;--------------------------------------------------------------------
167ALIGN JUMP_ALIGN
168IdeControllerMenu_ActivateMasterOrSlaveMenu:
169 mov ax, [di+MENUPAGEITEM.pValue] ; AX=Offset to DRVPARAMS
170 call DrvParamsMenu_SetDrvParamsOffset
171 call DrvParamsMenu_SetMenuitemVisibility
172 jmp MainPageItem_ActivateSubmenu
173
174
175;--------------------------------------------------------------------
176; IdeControllerMenu_ActivateEnableInterrupt
177; Parameters:
178; DS:SI Ptr to MENUPAGE
179; DS:DI Ptr to MENUPAGEITEM
180; SS:BP: Ptr to MENUVARS
181; Returns:
182; CF: Set if menuitem changed
183; Cleared if no changes
184; Corrupts registers:
185; AX, BX, CX, DX
186;--------------------------------------------------------------------
187ALIGN JUMP_ALIGN
188IdeControllerMenu_ActivateEnableInterrupt:
189 call MenuPageItem_GetBoolFromUser
190 jc SHORT IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges
191 ret
192
193
194;--------------------------------------------------------------------
195; IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges
196; Parameters:
197; DS:SI: Ptr to MENUPAGE
198; SS:BP: Ptr to MENUVARS
199; Returns:
200; CF: Cleared since no need to draw changes
201; Corrupts registers:
202; AX, BX, CX, DX
203;--------------------------------------------------------------------
204ALIGN JUMP_ALIGN
205IdeControllerMenu_SetMenuitemVisibilityAndDrawChanges:
206 call IdeControllerMenu_SetMenuitemVisibility
207 call MenuPage_InvalidateItemCount
208 clc ; No need to redraw Full Mode menuitem
209 ret
210
211;--------------------------------------------------------------------
212; Enables or disables menuitems based on current configuration.
213;
214; IdeControllerMenu_SetMenuitemVisibility
215; Parameters:
216; DS: CS
217; Returns:
218; Nothing
219; Corrupts registers:
220; BX
221;--------------------------------------------------------------------
222ALIGN JUMP_ALIGN
223IdeControllerMenu_SetMenuitemVisibility:
224 jmp SHORT IdeControllerMenu_EnableOrDisableIrqSelect
225
226ALIGN JUMP_ALIGN
227IdeControllerMenu_EnableOrDisableIrqSelect:
228 mov bx, [g_MenuPageItemIdeIRQ+MENUPAGEITEM.pValue]
229 cmp BYTE [bx], 0 ; Interrupts disabled?
230 je SHORT .DisableIrqMenuitem
231 or BYTE [g_MenuPageItemIdeIRQ+MENUPAGEITEM.bFlags], FLG_MENUPAGEITEM_VISIBLE
232 ret
233ALIGN JUMP_ALIGN
234.DisableIrqMenuitem:
235 and BYTE [g_MenuPageItemIdeIRQ+MENUPAGEITEM.bFlags], ~FLG_MENUPAGEITEM_VISIBLE
236 ret
Note: See TracBrowser for help on using the repository browser.