Changeset 51 in xtideuniversalbios for trunk/Assembly_Library/Src/File
- Timestamp:
- Oct 11, 2010, 8:27:43 AM (14 years ago)
- google:author:
- aitotat
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.