Changeset 51 in xtideuniversalbios for trunk/Assembly_Library
- Timestamp:
- Oct 11, 2010, 8:27:43 AM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/File.inc
r50 r51 2 2 ; Project name : Assembly Library 3 3 ; Created date : 8.10.2010 4 ; Last update : 8.10.20104 ; Last update : 10.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : File library defines. … … 17 17 ; Origin of file seek 18 18 struc SEEK_FROM 19 .startOfFile resb 1 20 .currentFilePosition resb 1 21 .endOfFile resb 1 19 .startOfFile resb 1 ; 00h 20 .currentFilePosition resb 1 ; 01h 21 .endOfFile resb 1 ; 02h 22 22 endstruc 23 23 -
trunk/Assembly_Library/Src/File/FileIO.asm
r50 r51 2 2 ; Project name : Assembly Library 3 3 ; Created date : 1.9.2010 4 ; Last update : 8.10.20104 ; Last update : 10.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for file access. … … 28 28 int DOS_INTERRUPT_21h 29 29 xchg si, dx 30 mov bx, ax ; Copy file handle to BX 30 31 ret 31 32 … … 68 69 ALIGN JUMP_ALIGN 69 70 FileIO_ReadCXbytesToDSSIusingHandleFromBX: 70 xchg dx, si ; DS:DX now points to sourcebuffer71 xchg dx, si ; DS:DX now points to destination buffer 71 72 mov ah, READ_FROM_FILE_OR_DEVICE 72 73 int DOS_INTERRUPT_21h … … 102 103 103 104 ;-------------------------------------------------------------------- 105 ; FileIO_GetFileSizeToDXAXusingHandleFromBXandResetFilePosition: 106 ; Parameters: 107 ; BX: File handle 108 ; Returns: 109 ; DX:AX: Signed file size (if CF cleared) 110 ; AX: DOS error code (if CF set) 111 ; CF: Clear if successfull 112 ; Set if error 113 ; Corrupts registers: 114 ; Nothing 115 ;-------------------------------------------------------------------- 116 ALIGN JUMP_ALIGN 117 FileIO_GetFileSizeToDXAXusingHandleFromBXandResetFilePosition: 118 push cx 119 120 ; Get file size to DX:AX 121 xor cx, cx 122 xor dx, dx 123 mov al, SEEK_FROM.endOfFile 124 call FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX 125 jc SHORT .ReturnFileError 126 push dx 127 push ax 128 129 ; Reset file position 130 xor dx, dx 131 mov al, SEEK_FROM.startOfFile 132 call FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX 133 pop ax 134 pop dx 135 136 .ReturnFileError: 137 pop cx 138 ret 139 140 141 ;-------------------------------------------------------------------- 104 142 ; FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX: 105 143 ; Parameters: 106 144 ; AL: SEEK_FROM.(origin) 107 145 ; BX: File handle 108 ; DX:AX: Seek offset (signed)146 ; CX:DX: Signed offset to seek starting from AL 109 147 ; Returns: 110 ; AX: DOS error code if CF set 148 ; DX:AX: New file position in bytes from start of file (if CF cleared) 149 ; AX: DOS error code (if CF set) 111 150 ; CF: Clear if successfull 112 151 ; Set if error … … 116 155 ALIGN JUMP_ALIGN 117 156 FileIO_SeekFromOriginInALtoOffsetInDXAXusingHandleFromBX: 118 push dx119 push cx120 121 mov cx, dx ; DOS wants high word in CX122 xchg dx, ax ; DOS wants low word in DX123 157 mov ah, SET_CURRENT_FILE_POSITION 124 158 int DOS_INTERRUPT_21h 125 126 pop cx127 pop dx128 159 ret -
trunk/Assembly_Library/Src/Menu/Dialog/DialogFile.asm
r50 r51 2 2 ; Project name : Assembly Library 3 3 ; Created date : 6.9.2010 4 ; Last update : 9.10.20104 ; Last update : 10.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Displays file dialog. … … 523 523 ALIGN JUMP_ALIGN 524 524 .ChangeToUpdir: 525 push cs 526 pop ds 525 527 mov si, g_szUpdir 526 528 jmp SHORT .ChangeDirectoryToDSSI -
trunk/Assembly_Library/Src/Menu/Dialog/LineSplitter.asm
r46 r51 148 148 ALIGN JUMP_ALIGN 149 149 .RemoveEmptyLinesAtTheEndIfAnyExists: 150 mov al, [si-2] ; Load character before NULL 151 cmp al, SOH 152 je SHORT .RemoveEmptyLineAtTheEndOfString 153 cmp al, LF 150 cmp BYTE [si-2], SOH ; Character before NULL 154 151 je SHORT .RemoveEmptyLineAtTheEndOfString 155 152 ret … … 203 200 mov si, di ; SI points to start of first line 204 201 mov al, STX ; Last control character to scan for 205 inc cx ; Increment CX to get length for first line202 inc cx ; Increment CX to line count 206 203 cld 207 204 ALIGN JUMP_ALIGN 208 205 .LineScanLoop: 209 206 scasb ; cmp al, [es:di]. Increment DI 210 jb SHORT .LineScanLoop ; Non control character211 212 ; Our end of line characters or NULL character207 jb SHORT .LineScanLoop ; Ignore all above STX 208 209 ; NULL, SOH or STX 213 210 dec cx ; Decrement lines to scan through 214 211 jz SHORT .WantedLineFound … … 223 220 .EndOfString: 224 221 lahf ; Load FLAGS low to AH 225 lea cx, [di-1] ; We don't want control character to be printed226 sub cx, si ; String length to CX222 lea cx, [di-1] ; CX = offset to NULL, SOH or STX 223 sub cx, si ; CX = string length 227 224 sahf ; Store AH to FLAGS low 228 225 ret -
trunk/Assembly_Library/Src/Menu/MenuCharOut.asm
r48 r51 2 2 ; Project name : Assembly Library 3 3 ; Created date : 15.7.2010 4 ; Last update : 8.10.20104 ; Last update : 10.10.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Character out function for printing withing menu window. … … 80 80 ALIGN JUMP_ALIGN 81 81 MovePartialWordToNewTextLineAndPrintCharacterFromAX: 82 cmp al, ' ' 83 j eSHORT .MoveCursorInDItoBeginningOfNextLine82 cmp al, ' ' ; Space or any control character 83 jb SHORT .MoveCursorInDItoBeginningOfNextLine 84 84 push si 85 85 push cx
Note:
See TracChangeset
for help on using the changeset viewer.