Changeset 50 in xtideuniversalbios
- Timestamp:
- Oct 9, 2010, 5:47:26 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/AssemblyLibrary.inc
r48 r50 15 15 %include "Debug.inc" 16 16 %include "DosFunctions.inc" 17 %include "File.inc" 17 18 %include "Math.inc" 18 19 -
trunk/Assembly_Library/Inc/Display.inc
r48 r50 2 2 ; Project name : AssemblyLibrary 3 3 ; Created date : 25.6.2010 4 ; Last update : 6.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for display library. … … 110 110 ; Display context flags 111 111 FLG_CONTEXT_ATTRIBUTES EQU (1<<0) ; Character output function uses attributes 112 FLG_CONTEXT_CGA EQU (1<<1) ; CGA detected so prevent CGA snow 112 113 113 114 -
trunk/Assembly_Library/Inc/DosFunctions.inc
r41 r50 2 2 ; Project name : AssemblyLibrary 3 3 ; Created date : 1.9.2010 4 ; Last update : 3.9.20104 ; Last update : 8.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Defines for MS-DOS functions. … … 30 30 ; DOS errors 31 31 ERR_DOS_DRIVE_NOT_READY EQU 15h 32 33 34 ; File attribute flags35 FLG_FILEATTR_READ_ONLY EQU (1<<0)36 FLG_FILEATTR_HIDDEN EQU (1<<1)37 FLG_FILEATTR_SYSTEM EQU (1<<2)38 FLG_FILEATTR_VOLUME_LABEL EQU (1<<3)39 FLG_FILEATTR_DIRECTORY EQU (1<<4)40 FLG_FILEATTR_ARCHIVE EQU (1<<5)41 32 42 33 -
trunk/Assembly_Library/Inc/Emulate.inc
r41 r50 2 2 ; Project name : Emulation library 3 3 ; Created date : 21.10.2009 4 ; Last update : 29.7.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Macros for emulating later x86 instruction with older … … 318 318 sub sp, %1 319 319 mov bp, sp 320 ;eENTER %1, 0321 ;sub bp, %1 ; SS:BP now points to struct322 320 %endmacro 323 321 … … 334 332 add sp, %1 335 333 pop bp 336 ;add bp, %1 ; Restore BP to what it was after eENTER337 ;eLEAVE338 334 %endmacro 339 335 -
trunk/Assembly_Library/Src/Display/CgaSnow.asm
r49 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 8.10.2010 4 ; Last update : 8.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for preventing CGA snow. … … 8 8 ; Section containing code 9 9 SECTION .text 10 11 ;-------------------------------------------------------------------- 12 ; CgaSnow_IsCgaPresent 13 ; Parameters: 14 ; DS: BDA segment (zero) 15 ; Returns: 16 ; CF: Set if CGA detected 17 ; Cleared if CGA not detected 18 ; Corrupts registers: 19 ; AX 20 ;-------------------------------------------------------------------- 21 ALIGN JUMP_ALIGN 22 CgaSnow_IsCgaPresent: 23 cmp WORD [BDA.wVidPort], CGA_STATUS_REGISTER - OFFSET_TO_CGA_STATUS_REGISTER 24 jne SHORT .CgaNotFound 25 call DisplayPage_GetColumnsToALandRowsToAH 26 cmp ah, [BDA.bVidRows] ; Video rows stored only by EGA and later 27 je SHORT .CgaNotFound ; Must be EGA or later 28 stc 29 ret 30 ALIGN JUMP_ALIGN 31 .CgaNotFound: 32 clc 33 ret 10 34 11 35 … … 29 53 ALIGN JUMP_ALIGN 30 54 CgaSnow_Stosb: 31 call Load AndVerifyStatusRegisterFromBDA32 j neSHORT .StosbWithoutWaitSinceUnknownPort55 call LoadCgaStatusRegisterAddressToDXifCgaPresent 56 jz SHORT .StosbWithoutWaitSinceUnknownPort 33 57 34 58 mov ah, al … … 44 68 CgaSnow_Stosw: 45 69 push bx 46 call Load AndVerifyStatusRegisterFromBDA47 j neSHORT .StoswWithoutWaitSinceUnknownPort70 call LoadCgaStatusRegisterAddressToDXifCgaPresent 71 jz SHORT .StoswWithoutWaitSinceUnknownPort 48 72 49 73 xchg bx, ax … … 71 95 ALIGN JUMP_ALIGN 72 96 CgaSnow_Scasb: 73 call Load AndVerifyStatusRegisterFromBDA74 j neSHORT .ScasbWithoutWaitSinceUnknownPort97 call LoadCgaStatusRegisterAddressToDXifCgaPresent 98 jz SHORT .ScasbWithoutWaitSinceUnknownPort 75 99 76 100 mov ah, al … … 98 122 ALIGN JUMP_ALIGN 99 123 CgaSnow_RepMovsb: 100 call Load AndVerifyStatusRegisterFromBDA101 j neSHORT .RepMovsbWithoutWaitSinceUnknownPort124 call LoadCgaStatusRegisterAddressToDXifCgaPresent 125 jz SHORT .RepMovsbWithoutWaitSinceUnknownPort 102 126 103 127 .MovsbNextByte: … … 115 139 116 140 ;-------------------------------------------------------------------- 117 ; Load AndVerifyStatusRegisterFromBDA141 ; LoadCgaStatusRegisterAddressToDXifCgaPresent 118 142 ; Parameters: 119 143 ; DS: BDA segment (zero) 120 144 ; Returns: 121 145 ; DX: CGA Status Register Address 122 ; ZF: Set if CGA Base Port found in BDA 146 ; ZF: Set if CGA not present 147 ; Cleared if CGA present 123 148 ; Corrupts registers: 124 149 ; Nothing 125 150 ;-------------------------------------------------------------------- 126 151 ALIGN JUMP_ALIGN 127 LoadAndVerifyStatusRegisterFromBDA: 128 mov dx, [BDA.wVidPort] 129 add dl, OFFSET_TO_CGA_STATUS_REGISTER 130 cmp dx, CGA_STATUS_REGISTER 131 je SHORT .CheckIfEgaOrLater 132 ret 133 134 ALIGN JUMP_ALIGN 135 .CheckIfEgaOrLater: 136 push ax 137 call DisplayPage_GetColumnsToALandRowsToAH 138 cmp ah, [BDA.bVidRows] ; Video rows stored only by EGA and later 139 lahf 140 xor ah, 1<<6 ; Invert ZF 141 sahf 142 pop ax 152 LoadCgaStatusRegisterAddressToDXifCgaPresent: 153 test BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_CGA 154 jz SHORT .NoCgaDetected 155 mov dx, CGA_STATUS_REGISTER 156 ALIGN JUMP_ALIGN, ret 157 .NoCgaDetected: 143 158 ret 144 159 -
trunk/Assembly_Library/Src/Display/DisplayContext.asm
r48 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 25.6.2010 4 ; Last update : 5.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for managing display context. … … 20 20 ALIGN JUMP_ALIGN 21 21 DisplayContext_Initialize: 22 call .DetectAndSetDisplaySegment 22 call .DetectAndSetDisplaySegment ; and .InitializeFlags 23 23 mov WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], DEFAULT_CHARACTER_OUTPUT 24 24 mov WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.wCursorShape], CURSOR_NORMAL 25 25 mov BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bAttribute], SCREEN_BACKGROUND_ATTRIBUTE 26 mov BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], FLG_CONTEXT_ATTRIBUTES27 28 26 xor ax, ax 29 27 call DisplayCursor_SetCoordinatesFromAX 30 jmp SHORTDisplayContext_SynchronizeToHardware28 jmp DisplayContext_SynchronizeToHardware 31 29 32 30 ;-------------------------------------------------------------------- … … 37 35 ; Nothing 38 36 ; Corrupts registers: 39 ; Nothing37 ; AX, DX 40 38 ;-------------------------------------------------------------------- 41 39 .DetectAndSetDisplaySegment: 42 mov WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], COLOR_TEXT_SEGMENT40 mov ax, COLOR_TEXT_SEGMENT 43 41 cmp BYTE [VIDEO_BDA.bMode], MDA_TEXT_MODE 44 jne SHORT .Return 45 sub WORD [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], COLOR_TEXT_SEGMENT - MONO_TEXT_SEGMENT 46 .Return: 42 jne SHORT .StoreSegmentToDisplayContext 43 mov ax, MONO_TEXT_SEGMENT 44 .StoreSegmentToDisplayContext: 45 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition+2], ax 46 ; Fall to InitializeFlags 47 48 ;-------------------------------------------------------------------- 49 ; .InitializeFlags 50 ; Parameters: 51 ; DS: BDA segment (zero) 52 ; Returns: 53 ; Nothing 54 ; Corrupts registers: 55 ; AX, DX 56 ;-------------------------------------------------------------------- 57 .InitializeFlags: 58 mov dl, FLG_CONTEXT_ATTRIBUTES 59 call CgaSnow_IsCgaPresent 60 jnc SHORT .DoNotSetCgaFlag 61 or dl, FLG_CONTEXT_CGA 62 .DoNotSetCgaFlag: 63 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], dl 47 64 ret 48 65 … … 188 205 ; Nothing 189 206 ; Corrupts registers: 190 ; Nothing207 ; BL 191 208 ;-------------------------------------------------------------------- 192 209 ALIGN JUMP_ALIGN 193 210 DisplayContext_SetCharOutputFunctionFromAXwithAttribFlagInBL: 211 and bl, FLG_CONTEXT_ATTRIBUTES 212 and BYTE [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], ~FLG_CONTEXT_ATTRIBUTES 213 or [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], bl 194 214 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fnCharOut], ax 195 mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.bFlags], bl196 215 ret 197 216 -
trunk/Assembly_Library/Src/File/FileIO.asm
r41 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 1.9.2010 4 ; Last update : 3.9.20104 ; Last update : 8.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for file access. 7 8 9 ; File access and sharing modes10 struc FILE_ACCESS11 .ReadOnly resb 112 .WriteOnly resb 113 .ReadAndWrite resb 114 endstruc15 16 ; Origin of file seek17 struc SEEK_FROM18 .startOfFile resb 119 .currentFilePosition resb 120 .endOfFile resb 121 endstruc22 23 7 24 8 ; Section containing code -
trunk/Assembly_Library/Src/LibraryTests.asm
r48 r50 224 224 .AskFileFromUser: 225 225 mov si, g_dialogInputOutput 226 mov WORD [si+ DIALOG_INPUT.fszItems], g_szBuffer226 mov WORD [si+FILE_DIALOG_IO.fszItemBuffer], g_szBuffer 227 227 mov BYTE [si+FILE_DIALOG_IO.bDialogFlags], FLG_FILEDIALOG_DIRECTORY | FLG_FILEDIALOG_NEW | FLG_FILEDIALOG_DRIVES 228 228 mov BYTE [si+FILE_DIALOG_IO.bFileAttributes], FLG_FILEATTR_DIRECTORY | FLG_FILEATTR_ARCHIVE 229 229 mov WORD [si+FILE_DIALOG_IO.fpFileFilterString], .szAllFiles 230 230 mov [si+FILE_DIALOG_IO.fpFileFilterString+2], cs 231 mov [si+STRING_DIALOG_IO.fpReturnBuffer+2], cs232 231 CALL_MENU_LIBRARY GetFileNameWithIoInDSSI 233 232 cmp BYTE [g_dialogInputOutput+FILE_DIALOG_IO.bUserCancellation], TRUE -
trunk/Assembly_Library/Src/Menu/Dialog/Dialog.asm
r48 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.8.2010 4 ; Last update : 7.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Common functions for many dialogs. … … 26 26 push ds 27 27 mov di, bp ; Backup parent MENU 28 eENTER_STRUCT DIALOG_size29 30 28 mov cx, DIALOG_size 29 eENTER_STRUCT cx 30 31 31 call Memory_ZeroSSBPwithSizeInCX 32 32 mov [bp+DIALOG.fpDialogIO], si -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r48 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 4.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 114 114 call LoadItemStringBufferToESDI 115 115 call SortDirectoryContentsStringFromESDIwithCountInCX 116 push ss 117 pop ds 118 mov si, bp 116 call Memory_CopySSBPtoDSSI 119 117 call Dialog_EventInitializeMenuinitFromDSSI 120 118 call GetInfoLinesToCXandDialogFlagsToAX … … 199 197 ALIGN JUMP_ALIGN 200 198 .ClearDLifInRootDirectory: 201 push es 202 pop ds 203 mov si, di 199 call Memory_CopyESDItoDSSI 204 200 call Directory_WriteCurrentPathToDSSI 205 201 mov dl, [si] … … 511 507 add di, BYTE FILE_DIALOG_IO.szFile 512 508 mov cx, FILENAME_BUFFER_SIZE-1 513 cld 514 rep movsb 509 call Memory_CopyCXbytesFromDSSItoESDI 515 510 xor ax, ax 516 511 stosb ; Terminate with NULL 517 jmp CloseFileDialogAfterSuccessfullSelection512 jmp SHORT CloseFileDialogAfterSuccessfullSelection 518 513 519 514 ;-------------------------------------------------------------------- -
trunk/Assembly_Library/Src/Util/Memory.asm
r46 r50 2 2 ; Project name : Assembly Library 3 3 ; Created date : 14.7.2010 4 ; Last update : 1.10.20104 ; Last update : 9.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for memory access. … … 67 67 ALIGN JUMP_ALIGN 68 68 Memory_ZeroSSBPwithSizeInCX: 69 push es 70 push di 69 71 push ax 70 71 call Memory_ExchangeSSBPwithESDI 72 call Memory_CopySSBPtoESDI 72 73 call Memory_ZeroESDIwithSizeInCX 73 call Memory_ExchangeSSBPwithESDI74 75 74 pop ax 75 pop di 76 pop es 76 77 ret 77 78 … … 82 83 ; ES:DI: Ptr to destination buffer 83 84 ; Returns: 84 ; Nothing85 ; DI: Updated by number of BYTEs stored 85 86 ; Corrupts registers: 86 87 ; AX … … 98 99 ; ES:DI: Ptr to destination buffer 99 100 ; Returns: 100 ; Nothing101 ; DI: Updated by number of BYTEs stored 101 102 ; Corrupts registers: 102 103 ; Nothing … … 105 106 Memory_StoreCXbytesFromAccumToESDI: 106 107 OPTIMIZE_STRING_OPERATION rep, stos 107 sub di, cx108 108 ret 109 109 110 110 111 111 ;-------------------------------------------------------------------- 112 ; Memory_ExchangeSSBPwithESDI113 112 ; Memory_ExchangeDSSIwithESDI 114 113 ; Parameters 115 114 ; Nothing 116 115 ; Returns: 117 ; SS:BP/DS:SI and ES:DI are exchanged.116 ; DS:SI and ES:DI are exchanged. 118 117 ; Corrupts registers: 119 118 ; Nothing 120 119 ;-------------------------------------------------------------------- 121 120 ALIGN JUMP_ALIGN 122 Memory_ExchangeSSBPwithESDI:123 xchg bp, di124 push ss125 push es126 pop ss127 pop es128 ret129 130 ALIGN JUMP_ALIGN131 121 Memory_ExchangeDSSIwithESDI: 132 xchg si, di133 122 push ds 134 123 push es 135 124 pop ds 136 125 pop es 126 xchg si, di 137 127 ret 138 128 … … 140 130 ;-------------------------------------------------------------------- 141 131 ; Memory_CopySSBPtoESDI 132 ; Memory_CopySSBPtoDSSI 133 ; Memory_CopyESDItoDSSI 142 134 ; Parameters 143 135 ; Nothing 144 136 ; Returns: 145 ; ES:DI: Same as SS:BP137 ; Copies farm pointer to different segment/pointer register pair 146 138 ; Corrupts registers: 147 139 ; Nothing … … 152 144 pop es 153 145 mov di, bp 146 ret 147 148 ALIGN JUMP_ALIGN 149 Memory_CopySSBPtoDSSI: 150 push ss 151 pop ds 152 mov si, bp 153 ret 154 155 ALIGN JUMP_ALIGN 156 Memory_CopyESDItoDSSI: 157 push es 158 pop ds 159 mov si, di 154 160 ret 155 161
Note:
See TracChangeset
for help on using the changeset viewer.