source: xtideuniversalbios/trunk/Assembly_Library/Src/Menu/Dialog/DialogDrive.asm @ 596

Last change on this file since 596 was 596, checked in by krille_n_, 6 years ago

Changes:

  • Made changes to HotkeyBar.asm to give the Boot Menu and Hotkey Bar a more consistent look. It will probably seem a bit strange at first to people used to the classic theme.
  • Added the missing parts of USE_NEC_V that should have been committed with the rest in r593.
  • Removed DEFINES_ALL_FEATURES from the BIOS makefile. It didn't work anymore and never really made sense anyway. Added all the official builds to 'make unused' instead which actually uncovered some unused code in the Tiny build.
  • XTIDECFG will no longer load color themes from unrecognized versions of the BIOS.
  • Other fixes in comments and some minor optimizations.
File size: 4.1 KB
Line 
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-2013 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
21SECTION .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;--------------------------------------------------------------------
33ALIGN JUMP_ALIGN
34DialogDrive_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;--------------------------------------------------------------------
51ALIGN JUMP_ALIGN
52DriveEventHandler:
53    jmp     [cs:bx+.rgfnEventHandlers]
54
55
56ALIGN JUMP_ALIGN
57.InitializeMenuinitFromDSSI:
58    xor     ax, ax
59    call    Dialog_EventInitializeMenuinitFromDSSIforSingleItemWithHighlightedItemInAX
60    call    Drive_GetFlagsForAvailableDrivesToDXAX
61    mov     [bp+MENU.dwUserData], ax
62    mov     [bp+MENU.dwUserData+2], dx
63
64    call    Bit_GetSetCountToCXfromDXAX
65    mov     [bp+MENUINIT.wItems], cx
66
67    dec     cx          ; Items initialized to one. Ignore it.
68    add     cl, [bp+MENUINIT.bHeight]
69    CALL_DISPLAY_LIBRARY GetColumnsToALandRowsToAH
70    MIN_U   cl, ah
71    mov     [bp+MENUINIT.bHeight], cl
72    ret
73
74
75ALIGN JUMP_ALIGN
76.ItemSelectedFromCX:
77    call    ConvertDriveLetterToBLfromItemIndexInCX
78    lds     si, [bp+DIALOG.fpDialogIO]
79    mov     BYTE [si+DRIVE_DIALOG_IO.bUserCancellation], FALSE
80    mov     [si+DRIVE_DIALOG_IO.cReturnDriveLetter], bl
81    sub     bl, 'A'
82    mov     [si+DRIVE_DIALOG_IO.bReturnDriveNumber], bl
83    jmp     MenuInit_CloseMenuWindow
84
85
86ALIGN JUMP_ALIGN
87.RefreshItemFromCX:
88    push    bp
89
90    call    ConvertDriveLetterToBLfromItemIndexInCX
91    mov     bp, sp
92    push    bx
93    mov     si, g_szDriveFormat
94    CALL_DISPLAY_LIBRARY FormatNullTerminatedStringFromCSSI
95
96    pop     bp
97    stc
98    ret
99
100
101.rgfnEventHandlers:
102istruc MENUEVENT
103    at  MENUEVENT.InitializeMenuinitFromDSSI,   dw  .InitializeMenuinitFromDSSI
104    at  MENUEVENT.ExitMenu,                     dw  Dialog_EventExitMenu
105    at  MENUEVENT.IdleProcessing,               dw  Dialog_EventNotHandled
106    at  MENUEVENT.ItemHighlightedFromCX,        dw  Dialog_EventNotHandled
107    at  MENUEVENT.ItemSelectedFromCX,           dw  .ItemSelectedFromCX
108    at  MENUEVENT.KeyStrokeInAX,                dw  Dialog_EventNotHandled
109    at  MENUEVENT.RefreshTitle,                 dw  Dialog_EventRefreshTitle
110    at  MENUEVENT.RefreshInformation,           dw  Dialog_EventRefreshInformation
111    at  MENUEVENT.RefreshItemFromCX,            dw  .RefreshItemFromCX
112iend
113
114
115;--------------------------------------------------------------------
116; ConvertDriveLetterToBLfromItemIndexInCX
117;   Parameters:
118;       CX:     Item index
119;       SS:BP:  Ptr to DIALOG
120;   Returns:
121;       BL:     Drive letter
122;   Corrupts registers:
123;       AX, CX, DX
124;--------------------------------------------------------------------
125ALIGN JUMP_ALIGN
126ConvertDriveLetterToBLfromItemIndexInCX:
127    inc     cx          ; Index to count
128    mov     bl, 'A'-1
129    mov     ax, [bp+MENU.dwUserData]
130    mov     dx, [bp+MENU.dwUserData+2]
131ALIGN JUMP_ALIGN
132.CheckNextBit:
133    inc     bx          ; Increment drive letter
134    shr     dx, 1
135    rcr     ax, 1
136    jnc     SHORT .CheckNextBit
137    loop    .CheckNextBit
138    ret
Note: See TracBrowser for help on using the repository browser.