Files
Work/fileio/SCRAPS.TXT
2024-08-07 09:16:27 -04:00

25 lines
1.6 KiB
Plaintext

if 0
; LOCAL @@FWRITEsimpleWrite,@@FWRITEuseBuffer
push ebx ; macro uses ebx, must preserve it
cmp [FileInfo ptr[esi]].FileInfo@@mBufferIndex,MaxLength ; compare buffer index to MaxLength
jl @@FWRITEsimpleWrite ; if it's less then insert char into buffer
lea ebx,[FileInfo ptr[esi]].FileInfo@@mszBuffer
WRITEFILE [FileInfo ptr[esi]].FileInfo@@mhFileHandle,ebx,MaxLength
mov [FileInfo ptr[esi]].FileInfo@@mBufferIndex,0000h ; set buffer index to zero
lea eax,[FileInfo ptr[esi]].FileInfo@@mszBuffer
mov [FileInfo ptr[esi]].FileInfo@@mlpBufferPointer,eax ; move address of buffer to lpBufferPointer
@@FWRITEsimpleWrite: ; simple write sync address
cmp [FileInfo ptr[esi]].FileInfo@@mlpBufferPointer,0000h ; is buffer pointer null?
jne @@FWRITEuseBuffer ; if not then just use it
lea eax,[FileInfo ptr[esi]].FileInfo@@mszBuffer
mov [FileInfo ptr[esi]].FileInfo@@mlpBufferPointer,eax ; move address of buffer to lpBufferPointer
@@FWRITEuseBuffer: ; use buffer sync address
mov cl,byte ptr[edi] ; move byte to write to cl
mov eax,[FileInfo ptr[esi]].FileInfo@@mlpBufferPointer ; move address of buffer to eax
mov byte ptr[eax],cl ; move byte into buffer
inc [FileInfo ptr[esi]].FileInfo@@mlpBufferPointer ; increment buffer pointer
inc [FileInfo ptr[esi]].FileInfo@@mBufferIndex ; increment buffer index
pop ebx ; restore ebx register
mov eax,01h ; set return code
endif