Changeset 66 in xtideuniversalbios
- Timestamp:
- Dec 6, 2010, 7:09:51 PM (14 years ago)
- google:author:
- aitotat
- Location:
- trunk/Assembly_Library
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Assembly_Library/Inc/File.inc
r51 r66 2 2 ; Project name : Assembly Library 3 3 ; Created date : 8.10.2010 4 ; Last update : 10.10.20104 ; Last update : 6.12.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : File library defines. … … 31 31 32 32 33 ; Max number of bytes to read/write per DOS call when transferring DX:CX bytes 34 SPLIT_SIZE_FOR_LARGE_TRANSFERS EQU (32<<10) 35 36 33 37 %endif ; FILE_INC -
trunk/Assembly_Library/Src/File/FileIO.asm
r51 r66 2 2 ; Project name : Assembly Library 3 3 ; Created date : 1.9.2010 4 ; Last update : 10.10.20104 ; Last update : 6.12.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for file access. … … 49 49 ret 50 50 51 52 ;-------------------------------------------------------------------- 53 ; FileIO_ReadDXCXbytesToDSSIusingHandleFromBX 54 ; Parameters: 55 ; BX: File handle 56 ; DX:CX: Number of bytes to read 57 ; DS:SI: Ptr to destination buffer 58 ; Returns: 59 ; AX: DOS error code if CF set 60 ; CF: Clear if successfull 61 ; Set if error 62 ; Corrupts registers: 63 ; AX 64 ;-------------------------------------------------------------------- 65 ALIGN JUMP_ALIGN 66 FileIO_ReadDXCXbytesToDSSIusingHandleFromBX: 67 push bp 68 mov bp, FileIO_ReadCXbytesToDSSIusingHandleFromBX 69 call SplitLargeReadOrWritesToSmallerBlocks 70 pop bp 71 ret 51 72 52 73 ;-------------------------------------------------------------------- … … 77 98 78 99 ;-------------------------------------------------------------------- 100 ; FileIO_WriteDXCXbytesFromDSSIusingHandleFromBX 101 ; Parameters: 102 ; BX: File handle 103 ; DX:CX: Number of bytes to write 104 ; DS:SI: Ptr to source buffer 105 ; Returns: 106 ; AX: DOS error code if CF set 107 ; CF: Clear if successfull 108 ; Set if error 109 ; Corrupts registers: 110 ; AX 111 ;-------------------------------------------------------------------- 112 ALIGN JUMP_ALIGN 113 FileIO_WriteDXCXbytesFromDSSIusingHandleFromBX: 114 push bp 115 mov bp, FileIO_WriteCXbytesFromDSSIusingHandleFromBX 116 call SplitLargeReadOrWritesToSmallerBlocks 117 pop bp 118 ret 119 120 ;-------------------------------------------------------------------- 79 121 ; File position is updated so next write will start where 80 122 ; previous write stopped. … … 100 142 xchg si, dx 101 143 ret 144 145 146 ;-------------------------------------------------------------------- 147 ; SplitLargeReadOrWritesToSmallerBlocks 148 ; Parameters: 149 ; BX: File handle 150 ; BP: Ptr to transfer function 151 ; DX:CX: Number of bytes to transfer 152 ; DS:SI: Ptr to transfer buffer 153 ; Returns: 154 ; AX: DOS error code if CF set 155 ; CF: Clear if successfull 156 ; Set if error 157 ; Corrupts registers: 158 ; AX 159 ;-------------------------------------------------------------------- 160 ALIGN JUMP_ALIGN 161 SplitLargeReadOrWritesToSmallerBlocks: 162 push ds 163 push si 164 push dx 165 push cx 166 167 xchg ax, cx ; DX:AX now holds bytes to transfer 168 mov cx, SPLIT_SIZE_FOR_LARGE_TRANSFERS 169 div cx ; AX = Number of full transfers 170 push dx ; Bytes for last transfer 171 test ax, ax 172 jz SHORT .TransferRemainingBytes 173 xchg dx, ax ; DX = Number of full transfers 174 175 ALIGN JUMP_ALIGN 176 .TransferNextBytes: 177 call Registers_NormalizeDSSI 178 call bp ; Transfer function 179 jc SHORT .ErrorOccurredDuringTransfer 180 dec dx 181 jnz SHORT .TransferNextBytes 182 .TransferRemainingBytes: 183 pop cx ; CX = Bytes for last transfer 184 jcxz .ReturnErrorCodeInAX ; No remaining bytes 185 call Registers_NormalizeDSSI 186 call bp 187 .ReturnErrorCodeInAX: 188 pop cx 189 pop dx 190 pop si 191 pop ds 192 ret 193 .ErrorOccurredDuringTransfer: 194 pop cx ; Remove bytes for last transfer 195 jmp SHORT .ReturnErrorCodeInAX 102 196 103 197 -
trunk/Assembly_Library/Src/Util/Registers.asm
r64 r66 2 2 ; Project name : Assembly Library 3 3 ; Created date : 24.10.2010 4 ; Last update : 24.10.20104 ; Last update : 6.12.2010 5 5 ; Author : Tomi Tilli 6 6 ; Description : Functions for register operations. 7 7 8 ;-------------------------------------------------------------------- 9 ; NORMALIZE_FAR_POINTER 10 ; Parameters: 11 ; %1:%2: Far pointer to normalize 12 ; %3: Scratch register 13 ; %4: Scratch register 14 ; Returns: 15 ; %1:%2: Normalized far pointer 16 ; Corrupts registers: 17 ; %3, %4 18 ;-------------------------------------------------------------------- 19 %macro NORMALIZE_FAR_POINTER 4 20 mov %4, %2 ; Copy offset to scratch reg 21 and %2, BYTE 0Fh ; Clear offset bits 15...4 22 eSHR_IM %4, 4 ; Divide offset by 16 23 mov %3, %1 ; Copy segment to scratch reg 24 add %3, %4 ; Add shifted offset to segment 25 mov %1, %3 ; Set normalized segment 26 %endmacro 27 28 8 29 ; Section containing code 9 30 SECTION .text 31 32 ;-------------------------------------------------------------------- 33 ; Registers_NormalizeDSSI 34 ; Registers_NormalizeESDI 35 ; Parameters 36 ; DS:SI or ES:DI: Ptr to normalize 37 ; Returns: 38 ; DS:SI or ES:DI: Normalized pointer 39 ; Corrupts registers: 40 ; Nothing 41 ;-------------------------------------------------------------------- 42 ALIGN JUMP_ALIGN 43 Registers_NormalizeDSSI: 44 push dx 45 push ax 46 NORMALIZE_FAR_POINTER ds, si, ax, dx 47 pop ax 48 pop dx 49 ret 50 51 ALIGN JUMP_ALIGN 52 Registers_NormalizeESDI: 53 push dx 54 push ax 55 NORMALIZE_FAR_POINTER es, di, ax, dx 56 pop ax 57 pop dx 58 ret 59 10 60 11 61 ;-------------------------------------------------------------------- … … 85 135 pop ax 86 136 ret 87 88 89 ALIGN JUMP_ALIGN90 Registers_SetCFifCXisZero:91
Note:
See TracChangeset
for help on using the changeset viewer.