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

Last change on this file since 380 was 293, checked in by krille_n_@…, 13 years ago

Commit 1/2 (Library, Configurators and Serial Server):

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