source: xtideuniversalbios/trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Menupages/IdeControllerMenu.asm @ 57

Last change on this file since 57 was 57, checked in by aitotat, 13 years ago

Initial commit (Work in progress).

File size: 9.4 KB
Line 
1; File name     :   IdeControllerMenu.asm
2; Project name  :   XTIDE Universal BIOS Configurator v2
3; Created date  :   2.11.2010
4; Last update   :   3.11.2010
5; Author        :   Tomi Tilli
6; Description   :   "IDE Controller" menu structs and functions.
7
8; Section containing initialized data
9SECTION .data
10
11ALIGN WORD_ALIGN
12g_MenupageForIdeControllerMenu:
13istruc MENUPAGE
14    at  MENUPAGE.fnEnter,           dw  IdeControllerMenu_EnterMenuOrModifyItemVisibility
15    at  MENUPAGE.wMenuitems,        dw  8
16iend
17
18g_MenuitemIdeControllerBackToConfigurationMenu:
19istruc MENUITEM
20    at  MENUITEM.fnActivate,        dw  ConfigurationMenu_EnterMenuOrModifyItemVisibility
21    at  MENUITEM.szName,            dw  g_szItemBackToCfgMenu
22    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeBackToCfgMenu
23    at  MENUITEM.szHelp,            dw  g_szNfoIdeBackToCfgMenu
24    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
25    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGEBACK
26iend
27
28g_MenuitemIdeControllerMasterDrive:
29istruc MENUITEM
30    at  MENUITEM.fnActivate,        dw  MasterDrive
31    at  MENUITEM.szName,            dw  g_szItemIdeMaster
32    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeMaster
33    at  MENUITEM.szHelp,            dw  g_szNfoIdeMaster
34    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
35    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
36iend
37
38g_MenuitemIdeControllerSlaveDrive:
39istruc MENUITEM
40    at  MENUITEM.fnActivate,        dw  SlaveDrive
41    at  MENUITEM.szName,            dw  g_szItemIdeSlave
42    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeSlave
43    at  MENUITEM.szHelp,            dw  g_szNfoIdeSlave
44    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
45    at  MENUITEM.bType,             db  TYPE_MENUITEM_PAGENEXT
46iend
47
48g_MenuitemIdeControllerBusType:
49istruc MENUITEM
50    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
51    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
52    at  MENUITEM.szName,            dw  g_szItemIdeBusType
53    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeBusType
54    at  MENUITEM.szHelp,            dw  g_szNfoIdeBusType
55    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_BYTEVALUE
56    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOISE
57    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
58    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgBusType
59    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoise,              dw  g_szMultichoiseCfgBusType
60    at  MENUITEM.itemValue + ITEM_VALUE.rgwChoiseToValueLookup,     dw  g_rgwChoiseToValueLookupForBusType
61    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForBusType
62iend
63
64g_MenuitemIdeControllerCommandBlockAddress:
65istruc MENUITEM
66    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
67    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
68    at  MENUITEM.szName,            dw  g_szItemIdeCmdPort
69    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeCmdPort
70    at  MENUITEM.szHelp,            dw  g_szHelpIdeCmdPort
71    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
72    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
73    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
74    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCmdPort
75    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  0
76    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  -1
77iend
78
79g_MenuitemIdeControllerControlBlockAddress:
80istruc MENUITEM
81    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateHexInputForMenuitemInDSSI
82    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteHexValueStringToBufferInESDIfromItemInDSSI
83    at  MENUITEM.szName,            dw  g_szItemIdeCtrlPort
84    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeCtrlPort
85    at  MENUITEM.szHelp,            dw  g_szHelpIdeCtrlPort
86    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE
87    at  MENUITEM.bType,             db  TYPE_MENUITEM_HEX
88    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
89    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeCtrlPort
90    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  0
91    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  -1
92iend
93
94g_MenuitemIdeControllerEnableInterrupt:
95istruc MENUITEM
96    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateMultichoiseSelectionForMenuitemInDSSI
97    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteLookupValueStringToBufferInESDIfromItemInDSSI
98    at  MENUITEM.szName,            dw  g_szItemIdeEnIRQ
99    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeEnIRQ
100    at  MENUITEM.szHelp,            dw  g_szHelpIdeEnIRQ
101    at  MENUITEM.bFlags,            db  FLG_MENUITEM_VISIBLE | FLG_MENUITEM_MODIFY_MENU | FLG_MENUITEM_FLAGVALUE
102    at  MENUITEM.bType,             db  TYPE_MENUITEM_MULTICHOISE
103    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
104    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeEnIRQ
105    at  MENUITEM.itemValue + ITEM_VALUE.szMultichoise,              dw  g_szMultichoiseBooleanFlag
106    at  MENUITEM.itemValue + ITEM_VALUE.rgszValueToStringLookup,    dw  g_rgszValueToStringLookupForFlagBooleans
107    at  MENUITEM.itemValue + ITEM_VALUE.wValueBitmask,              dw  15
108iend
109
110g_MenuitemIdeControllerIdeIRQ:
111istruc MENUITEM
112    at  MENUITEM.fnActivate,        dw  Menuitem_ActivateUnsignedInputForMenuitemInDSSI
113    at  MENUITEM.fnFormatValue,     dw  MenuitemPrint_WriteUnsignedValueStringToBufferInESDIfromItemInDSSI
114    at  MENUITEM.szName,            dw  g_szItemIdeIRQ
115    at  MENUITEM.szQuickInfo,       dw  g_szNfoIdeIRQ
116    at  MENUITEM.szHelp,            dw  g_szHelpIdeIRQ
117    at  MENUITEM.bFlags,            db  FLG_MENUITEM_BYTEVALUE
118    at  MENUITEM.bType,             db  TYPE_MENUITEM_UNSIGNED
119    at  MENUITEM.itemValue + ITEM_VALUE.wRomvarsValueOffset,        dw  NULL
120    at  MENUITEM.itemValue + ITEM_VALUE.szDialogTitle,              dw  g_szDlgIdeIRQ
121    at  MENUITEM.itemValue + ITEM_VALUE.wMinValue,                  dw  2
122    at  MENUITEM.itemValue + ITEM_VALUE.wMaxValue,                  dw  15
123iend
124
125g_rgwChoiseToValueLookupForBusType:
126    dw  BUS_TYPE_8_DUAL
127    dw  BUS_TYPE_8_SINGLE
128    dw  BUS_TYPE_16
129    dw  BUS_TYPE_32
130g_rgszValueToStringLookupForBusType:
131    dw  g_szValueCfgBusTypeDual8b
132    dw  g_szValueCfgBusType16b
133    dw  g_szValueCfgBusType32b
134    dw  g_szValueCfgBusTypeSingle8b
135
136
137; Section containing code
138SECTION .text
139
140;--------------------------------------------------------------------
141; IdeControllerMenu_InitializeToIdevarsOffsetInBX
142;   Parameters:
143;       SS:BP:  Menu handle
144;   Returns:
145;       Nothing
146;   Corrupts registers:
147;       AX
148;--------------------------------------------------------------------
149ALIGN JUMP_ALIGN
150IdeControllerMenu_InitializeToIdevarsOffsetInBX:
151    lea     ax, [bx+IDEVARS.drvParamsMaster]
152    mov     [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
153
154    lea     ax, [bx+IDEVARS.drvParamsSlave]
155    mov     [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
156
157    lea     ax, [bx+IDEVARS.bBusType]
158    mov     [cs:g_MenuitemIdeControllerBusType+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
159
160    lea     ax, [bx+IDEVARS.wPort]
161    mov     [cs:g_MenuitemIdeControllerCommandBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
162
163    lea     ax, [bx+IDEVARS.wPortCtrl]
164    mov     [cs:g_MenuitemIdeControllerControlBlockAddress+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
165
166    lea     ax, [bx+IDEVARS.bIRQ]
167    mov     [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
168    mov     [cs:g_MenuitemIdeControllerIdeIRQ+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset], ax
169    ret
170
171
172;--------------------------------------------------------------------
173; IdeControllerMenu_EnterMenuOrModifyItemVisibility
174;   Parameters:
175;       SS:BP:  Menu handle
176;   Returns:
177;       Nothing
178;   Corrupts registers:
179;       All, except BP
180;--------------------------------------------------------------------
181ALIGN JUMP_ALIGN
182IdeControllerMenu_EnterMenuOrModifyItemVisibility:
183    push    cs
184    pop     ds
185    call    .EnableOrDisableIRQ
186    mov     si, g_MenupageForIdeControllerMenu
187    jmp     Menupage_ChangeToNewMenupageInDSSI
188
189;--------------------------------------------------------------------
190; .EnableOrDisableIRQ
191;   Parameters:
192;       SS:BP:  Menu handle
193;   Returns:
194;       Nothing
195;   Corrupts registers:
196;       AX, BX
197;--------------------------------------------------------------------
198ALIGN JUMP_ALIGN
199.EnableOrDisableIRQ:
200    mov     bx, [cs:g_MenuitemIdeControllerEnableInterrupt+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
201    call    Buffers_GetRomvarsValueToAXfromOffsetInBX
202    mov     bx, g_MenuitemIdeControllerIdeIRQ
203    test    ax, ax
204    jz      SHORT .DisableMenuitemFromCSBX
205    ; Fall to .EnableMenuitemFromCSBX
206
207;--------------------------------------------------------------------
208; .EnableMenuitemFromCSBX
209; .DisableMenuitemFromCSBX
210;   Parameters:
211;       CS:BX:  Ptr to MENUITEM
212;   Returns:
213;       Nothing
214;   Corrupts registers:
215;       Nothing
216;--------------------------------------------------------------------
217ALIGN JUMP_ALIGN
218.EnableMenuitemFromCSBX:
219    or      BYTE [cs:bx+MENUITEM.bFlags], FLG_MENUITEM_VISIBLE
220    ret
221
222ALIGN JUMP_ALIGN
223.DisableMenuitemFromCSBX:
224    and     BYTE [cs:bx+MENUITEM.bFlags], ~FLG_MENUITEM_VISIBLE
225    ret
226
227
228;--------------------------------------------------------------------
229; MENUITEM activation functions (.fnActivate)
230;   Parameters:
231;       SS:BP:  Ptr to MENU
232;   Returns:
233;       Nothing
234;   Corrupts registers:
235;       All, except segments
236;--------------------------------------------------------------------
237ALIGN JUMP_ALIGN
238MasterDrive:
239    mov     bx, [cs:g_MenuitemIdeControllerMasterDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
240    jmp     SHORT DisplayMasterSlaveMenu
241
242ALIGN JUMP_ALIGN
243SlaveDrive:
244    mov     bx, [cs:g_MenuitemIdeControllerSlaveDrive+MENUITEM.itemValue+ITEM_VALUE.wRomvarsValueOffset]
245    ; Fall to DisplayMasterSlaveMenu
246
247ALIGN JUMP_ALIGN
248DisplayMasterSlaveMenu:
249    call    MasterSlaveMenu_InitializeToDrvparamsOffsetInBX
250    jmp     MasterSlaveMenu_EnterMenuOrModifyItemVisibility
Note: See TracBrowser for help on using the repository browser.