1 | ; Project name : Assembly Library |
---|
2 | ; Description : Displays drive dialog. |
---|
3 | |
---|
4 | ; |
---|
5 | ; XTIDE Universal BIOS and Associated Tools |
---|
6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2023 by XTIDE Universal BIOS Team. |
---|
7 | ; |
---|
8 | ; This program is free software; you can redistribute it and/or modify |
---|
9 | ; it under the terms of the GNU General Public License as published by |
---|
10 | ; the Free Software Foundation; either version 2 of the License, or |
---|
11 | ; (at your option) any later version. |
---|
12 | ; |
---|
13 | ; This program is distributed in the hope that it will be useful, |
---|
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | ; GNU General Public License for more details. |
---|
17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
18 | ; |
---|
19 | |
---|
20 | ; Section containing code |
---|
21 | SECTION .text |
---|
22 | |
---|
23 | ;-------------------------------------------------------------------- |
---|
24 | ; DialogDrive_GetDriveWithIoInDSSI |
---|
25 | ; Parameters: |
---|
26 | ; DS:SI: Ptr to DRIVE_DIALOG_IO |
---|
27 | ; SS:BP: Ptr to parent MENU |
---|
28 | ; Returns: |
---|
29 | ; Nothing |
---|
30 | ; Corrupts registers: |
---|
31 | ; AX, BX, CX, DX, DI |
---|
32 | ;-------------------------------------------------------------------- |
---|
33 | ALIGN JUMP_ALIGN |
---|
34 | DialogDrive_GetDriveWithIoInDSSI: |
---|
35 | mov bx, DriveEventHandler |
---|
36 | mov BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], TRUE |
---|
37 | jmp Dialog_DisplayWithDialogInputInDSSIandHandlerInBX |
---|
38 | |
---|
39 | |
---|
40 | ;-------------------------------------------------------------------- |
---|
41 | ; DriveEventHandler |
---|
42 | ; Common parameters for all events: |
---|
43 | ; BX: Menu event (anything from MENUEVENT struct) |
---|
44 | ; SS:BP: Ptr to DIALOG |
---|
45 | ; Common return values for all events: |
---|
46 | ; CF: Set if event processed |
---|
47 | ; Cleared if event not processed |
---|
48 | ; Corrupts registers: |
---|
49 | ; All |
---|
50 | ;-------------------------------------------------------------------- |
---|
51 | ALIGN JUMP_ALIGN |
---|
52 | DriveEventHandler: |
---|
53 | jmp [cs:bx+.rgfnEventHandlers] |
---|
54 | |
---|
55 | |
---|
56 | ALIGN JUMP_ALIGN |
---|
57 | .InitializeMenuinitFromDSSI: |
---|
58 | call Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithItemZero |
---|
59 | call Drive_GetFlagsForAvailableDrivesToDXAX |
---|
60 | mov [bp+MENU.dwUserData], ax |
---|
61 | mov [bp+MENU.dwUserData+2], dx |
---|
62 | |
---|
63 | call Bit_GetSetCountToCXfromDXAX |
---|
64 | mov [bp+MENUINIT.wItems], cx |
---|
65 | |
---|
66 | dec cx ; Items initialized to one. Ignore it. |
---|
67 | add cl, [bp+MENUINIT.bHeight] |
---|
68 | CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH |
---|
69 | MIN_U cl, ah |
---|
70 | mov [bp+MENUINIT.bHeight], cl |
---|
71 | ret |
---|
72 | |
---|
73 | |
---|
74 | ALIGN JUMP_ALIGN |
---|
75 | .ItemSelectedFromCX: |
---|
76 | call ConvertDriveLetterToBLfromItemIndexInCX |
---|
77 | lds si, [bp+DIALOG.fpDialogIO] |
---|
78 | mov BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE |
---|
79 | mov [si+DRIVE_DIALOG_IO.cReturnDriveLetter], bl |
---|
80 | sub bl, 'A' |
---|
81 | mov [si+DRIVE_DIALOG_IO.bReturnDriveNumber], bl |
---|
82 | jmp MenuInit_CloseMenuWindow |
---|
83 | |
---|
84 | |
---|
85 | ALIGN JUMP_ALIGN |
---|
86 | .RefreshItemFromCX: |
---|
87 | push bp |
---|
88 | |
---|
89 | call ConvertDriveLetterToBLfromItemIndexInCX |
---|
90 | mov bp, sp |
---|
91 | push bx |
---|
92 | mov si, g_szDriveFormat |
---|
93 | CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI |
---|
94 | |
---|
95 | pop bp |
---|
96 | stc |
---|
97 | ret |
---|
98 | |
---|
99 | |
---|
100 | .rgfnEventHandlers: |
---|
101 | istruc MENUEVENT |
---|
102 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI |
---|
103 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu |
---|
104 | at MENUEVENT.IdleProcessing, dw Dialog_EventNotHandled |
---|
105 | at MENUEVENT.ItemHighlightedFromCX, dw Dialog_EventNotHandled |
---|
106 | at MENUEVENT.ItemSelectedFromCX, dw .ItemSelectedFromCX |
---|
107 | at MENUEVENT.KeyStrokeInAX, dw Dialog_EventNotHandled |
---|
108 | at MENUEVENT.RefreshTitle, dw Dialog_EventRefreshTitle |
---|
109 | at MENUEVENT.RefreshInformation, dw Dialog_EventRefreshInformation |
---|
110 | at MENUEVENT.RefreshItemFromCX, dw .RefreshItemFromCX |
---|
111 | iend |
---|
112 | |
---|
113 | |
---|
114 | ;-------------------------------------------------------------------- |
---|
115 | ; ConvertDriveLetterToBLfromItemIndexInCX |
---|
116 | ; Parameters: |
---|
117 | ; CX: Item index |
---|
118 | ; SS:BP: Ptr to DIALOG |
---|
119 | ; Returns: |
---|
120 | ; BL: Drive letter |
---|
121 | ; Corrupts registers: |
---|
122 | ; AX, CX, DX |
---|
123 | ;-------------------------------------------------------------------- |
---|
124 | ALIGN JUMP_ALIGN |
---|
125 | ConvertDriveLetterToBLfromItemIndexInCX: |
---|
126 | inc cx ; Index to count |
---|
127 | mov bl, 'A'-1 |
---|
128 | mov ax, [bp+MENU.dwUserData] |
---|
129 | mov dx, [bp+MENU.dwUserData+2] |
---|
130 | ALIGN JUMP_ALIGN |
---|
131 | .CheckNextBit: |
---|
132 | inc bx ; Increment drive letter |
---|
133 | shr dx, 1 |
---|
134 | rcr ax, 1 |
---|
135 | jnc SHORT .CheckNextBit |
---|
136 | loop .CheckNextBit |
---|
137 | ret |
---|