ack/plat/msdos386/libsys/rename.s
tkchia cba54b205b plat/msdos386: refactor, firm up, and optimize
- refactor code for transfer buffer reads/writes, real mode
   int 0x21 calls, and assembler segment declarations
 - define transfer buffer size in one place
 - beef up error checking for transfer buffer operations
   (prevent buffer overflows)
 - also optimize such operations to transfer dword by dword
   where feasible
2022-08-26 17:31:28 +00:00

43 lines
510 B
ArmAsm

#
! $Source$
! $State$
! $Revision$
#include "libsysasm.h"
! Rename a file.
.define _rename
_rename:
push edi
! Destination filename.
mov eax, 4+8(esp)
#define DEST_NAME_OFFSET (TRANSFER_BUFFER_SIZE / 2)
mov edx, DEST_NAME_OFFSET
mov ecx, edx
call .sys_sncpyout
jc 9f
xchg edi, eax
! Source filename.
mov eax, 4+4(esp)
xor edx, edx
call .sys_sncpyout
jc 9f
xchg edx, eax
! Make the DOS call.
movb ah, 0x56
call .sys_dpmidos
pop edi
jmp .sys_zret
9:
pop edi
jmp .sys_toolongret