15955282f6
- ensure es = ds = ss upon exit of each C runtime function - clear upper 16 bits of ebx before setting them to 0x0021, when invoking interrupt_ptr to simulate a RM int 0x21 - make _sys_exists use the transfer buffer (which it needs) - make _sys_rawread properly handle an end-of-file read (zero bytes read) - make argument to _sys_seterrno short --- after a failed int 0x21 call, only the lower 16 bits of eax hold the MS-DOs error code - _sys_rawlseek accepts only 3 longword arguments, not 4 (the offset is only 1 longword) - other minor fixes
57 lines
638 B
ArmAsm
57 lines
638 B
ArmAsm
#
|
|
! $Source$
|
|
! $State$
|
|
! $Revision$
|
|
|
|
! Declare segments (the order is important).
|
|
|
|
.sect .text
|
|
.sect .rom
|
|
.sect .data
|
|
.sect .bss
|
|
|
|
.sect .text
|
|
|
|
! Rename a file.
|
|
|
|
.define _rename
|
|
_rename:
|
|
mov ebx, esp
|
|
push esi
|
|
push edi
|
|
|
|
! Source filename.
|
|
|
|
mov esi, 4(ebx)
|
|
movzx edi, (transfer_buffer_ptr)
|
|
mov es, (pmode_ds)
|
|
cld
|
|
1:
|
|
lodsb
|
|
stosb
|
|
testb al, al
|
|
jnz 1b
|
|
|
|
! Destination filename.
|
|
|
|
mov eax, edi
|
|
mov esi, 8(ebx)
|
|
1:
|
|
lodsb
|
|
stosb
|
|
testb al, al
|
|
jnz 1b
|
|
|
|
! Make the DOS call.
|
|
|
|
o16 mov dx, (transfer_buffer_ptr)
|
|
o16 mov di, ax
|
|
movb ah, 0x56
|
|
mov ebx, 0x210000
|
|
callf (interrupt_ptr)
|
|
pop edi
|
|
pop esi
|
|
push ss
|
|
pop es
|
|
jmp .sys_zret
|