[54] | 1 | ; Project name : Assembly Library
|
---|
| 2 | ; Description : Displays drive dialog.
|
---|
| 3 |
|
---|
[376] | 4 | ;
|
---|
[526] | 5 | ; XTIDE Universal BIOS and Associated Tools
|
---|
| 6 | ; Copyright (C) 2009-2010 by Tomi Tilli, 2011-2013 by XTIDE Universal BIOS Team.
|
---|
[376] | 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.
|
---|
[526] | 12 | ;
|
---|
[376] | 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
|
---|
[526] | 16 | ; GNU General Public License for more details.
|
---|
[376] | 17 | ; Visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
---|
| 18 | ;
|
---|
[54] | 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, SI, 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 | 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 |
|
---|
| 75 | ALIGN 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 |
|
---|
| 86 | ALIGN 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:
|
---|
| 102 | istruc MENUEVENT
|
---|
| 103 | at MENUEVENT.InitializeMenuinitFromDSSI, dw .InitializeMenuinitFromDSSI
|
---|
[58] | 104 | at MENUEVENT.ExitMenu, dw Dialog_EventExitMenu
|
---|
[54] | 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
|
---|
| 112 | iend
|
---|
| 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 | ;--------------------------------------------------------------------
|
---|
| 125 | ALIGN JUMP_ALIGN
|
---|
| 126 | ConvertDriveLetterToBLfromItemIndexInCX:
|
---|
| 127 | inc cx ; Index to count
|
---|
| 128 | mov bl, 'A'-1
|
---|
| 129 | mov ax, [bp+MENU.dwUserData]
|
---|
| 130 | mov dx, [bp+MENU.dwUserData+2]
|
---|
| 131 | ALIGN 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
|
---|