Changeset 65 in xtideuniversalbios for trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm
- Timestamp:
- Dec 5, 2010, 6:52:11 PM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/XTIDE_Universal_BIOS_Configurator_v2/Src/Buffers.asm
r59 r65 2 2 ; Project name : XTIDE Universal BIOS Configurator v2 3 3 ; Created date : 6.10.2010 4 ; Last update : 19.11.20104 ; Last update : 5.12.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for accessing file and flash buffers. … … 41 41 42 42 call Buffers_GetFileBufferToESDI 43 jmp SHORT Buffers_IsXtideUniversalBiosSignatureInESDI 43 call Buffers_IsXtideUniversalBiosSignatureInESDI 44 jnz SHORT .NoFileOrBiosLoaded 45 jmp SHORT .IsSupportedVersionOfXtideUniversalBiosLoaded 44 46 .NoFileOrBiosLoaded: 45 47 or cl, 1 ; Clear ZF 46 48 ret 47 49 50 51 ALIGN JUMP_ALIGN 52 .IsSupportedVersionOfXtideUniversalBiosLoaded: 53 48 54 49 55 ;-------------------------------------------------------------------- … … 79 85 ; Nothing 80 86 ; Corrupts registers: 81 ; AX, BX, CX, DX87 ; AX, CX 82 88 ;-------------------------------------------------------------------- 83 89 ALIGN JUMP_ALIGN … … 85 91 and WORD [cs:g_cfgVars+CFGVARS.wFlags], ~(FLG_CFGVARS_FILELOADED | FLG_CFGVARS_ROMLOADED | FLG_CFGVARS_UNSAVED) 86 92 or WORD [cs:g_cfgVars+CFGVARS.wFlags], ax 87 ; Fall to .AdjustBiosImageSizeToSupportedEepromSize 88 89 ;-------------------------------------------------------------------- 90 ; .AdjustBiosImageSizeInCXtoSupportedEepromSize 91 ; Parameters: 92 ; CX: Size of loaded BIOS image 93 ; Returns: 94 ; CX: Size of BIOS image (and EEPROM required) 95 ; Corrupts registers: 96 ; AX, BX, DX 97 ;-------------------------------------------------------------------- 98 .AdjustBiosImageSizeInCXtoSupportedEepromSize: 99 mov bx, .rgwSupportedEepromSizes 100 mov dx, NUMBER_OF_SUPPORTED_EEPROM_SIZES-1 101 ALIGN JUMP_ALIGN 102 .CheckNextEepromSize: 103 cmp cx, [cs:bx] 104 je SHORT .StoreImageSizeFromCX 105 jb SHORT .AppendZeroesToTheEndOfBuffer 106 inc bx 107 inc bx 108 dec dx 109 jnz SHORT .CheckNextEepromSize 110 xor cx, cx 111 jmp SHORT .StoreImageSizeFromCX ; 0 = 65536 112 ALIGN WORD_ALIGN 113 .rgwSupportedEepromSizes: 114 dw 4<<10 115 dw 8<<10 116 dw 16<<10 117 dw 32<<10 118 119 ;-------------------------------------------------------------------- 120 ; .AppendZeroesToTheEndOfBuffer 121 ; Parameters: 122 ; CX: Size of loaded BIOS image 123 ; CS:BX: Ptr to EEPROM size 124 ; Returns: 125 ; CX: EEPROM size 126 ; Corrupts registers: 127 ; AX 128 ;-------------------------------------------------------------------- 129 ALIGN JUMP_ALIGN 130 .AppendZeroesToTheEndOfBuffer: 131 push es 132 push di 133 134 call Buffers_GetFileBufferToESDI 135 mov ax, [cs:bx] 136 sub ax, cx ; AX = zeroes to append 137 xchg ax, cx ; AX = BIOS image size, CX = zeroes to append 138 add di, ax 139 call Memory_ZeroESDIwithSizeInCX 140 mov cx, [cs:bx] 141 142 pop di 143 pop es 144 ; Fall to .StoreImageSizeFromCX 145 146 ;-------------------------------------------------------------------- 147 ; .StoreImageSizeFromCX 148 ; Parameters: 149 ; CX: Size of BIOS image (and EEPROM required) 150 ; Returns: 151 ; Nothing 152 ; Corrupts registers: 153 ; Nothing 154 ;-------------------------------------------------------------------- 155 ALIGN JUMP_ALIGN 156 .StoreImageSizeFromCX: 157 mov [cs:g_cfgVars+CFGVARS.wImageSize], cx 93 mov ax, (64<<10) / 2 ; 32768 WORDs 94 shr cx, 1 ; Bytes to WORDs 95 eCMOVZ cx, ax 96 mov [cs:g_cfgVars+CFGVARS.wImageSizeInWords], cx 158 97 ret 159 98 … … 204 143 205 144 ;-------------------------------------------------------------------- 145 ; Buffers_AppendZeroesIfNeeded 146 ; Parameters: 147 ; Nothing 148 ; Returns: 149 ; Nothing 150 ; Corrupts registers: 151 ; AX, CX, DI 152 ;-------------------------------------------------------------------- 153 ALIGN JUMP_ALIGN 154 Buffers_AppendZeroesIfNeeded: 155 push es 156 157 eMOVZX di, BYTE [cs:g_cfgVars+CFGVARS.bEepromType] 158 mov cx, [cs:di+g_rgwEepromTypeToSizeInWords] 159 sub cx, [cs:g_cfgVars+CFGVARS.wImageSizeInWords] ; CX = WORDs to append 160 jle SHORT .NoNeedToAppendZeroes 161 162 call Buffers_GetFileBufferToESDI 163 mov ax, [cs:g_cfgVars+CFGVARS.wImageSizeInWords] 164 shl ax, 1 165 add di, ax ; ES:DI now point first unused image byte 166 xor ax, ax 167 cld 168 rep stosw 169 ALIGN JUMP_ALIGN 170 .NoNeedToAppendZeroes: 171 pop es 172 ret 173 174 175 ;-------------------------------------------------------------------- 206 176 ; Buffers_GenerateChecksum 207 177 ; Parameters: … … 217 187 218 188 call Buffers_GetFileBufferToESDI 219 mov cx, [cs:g_cfgVars+CFGVARS.wImageSize] 189 mov cx, [cs:g_cfgVars+CFGVARS.wImageSizeInWords] 190 shl cx, 1 ; Words to bytes 220 191 dec cx ; Leave space for checksum byte 221 192 xor ax, ax … … 268 239 ;-------------------------------------------------------------------- 269 240 ; Buffers_GetFileBufferToESDI 241 ; Buffers_GetFlashComparisonBufferToESDI 270 242 ; Buffers_GetFileDialogItemBufferToESDI 271 243 ; Parameters: … … 277 249 ;-------------------------------------------------------------------- 278 250 ALIGN JUMP_ALIGN 251 Buffers_GetFlashComparisonBufferToESDI: 279 252 Buffers_GetFileDialogItemBufferToESDI: 280 253 call Buffers_GetFileBufferToESDI … … 285 258 pop di 286 259 ret 260 ALIGN JUMP_ALIGN 287 261 Buffers_GetFileBufferToESDI: 288 262 mov di, cs
Note:
See TracChangeset
for help on using the changeset viewer.