Hi,
I wrote a function to copy data around from real memory to above 1MB, using movsd. When I move data from linear address 0000 5000h to 0170 0000h (I am just testing the function - values are arbitary) it works fine.
When I try and copy from 0170 0000h to 0004 1000h the computer seems to freeze, but NOT at the movsd instruction, but at the retn instruction.
This is really weird. The code below works fine when going from real to extended memory, but when I try and copy the other way it seems to crash, AFTER its printed out the '!'. (I know the return value is trashed but don't really care atm).
Any suggestions on what might be wrong?
Unreal mode function:
align 16
;-----------------------
; UnrealCopy
;
; Copies numDwords from linear src to dest
;
; int UnrealCopy(ptr *dest, ptr *src, int numDwords)
; Returns the number of dwords copied.
; Automatically removes paramaters passed on stack.
; Preserves registers except EAX and EFLAGS.
;
%define uNumDwords [bp+12]
%define uSrc [bp+08]
%define uDest [bp+04]
;
UnrealCopy:
enter 16, 0
push ds
push es
push esi
push edi
push ecx
; Setup ds, es, ecx, esi, edi
xor ax, ax
mov ds, ax
mov es, ax
mov ecx, uNumDwords
mov esi, uSrc
mov edi, uDest
; Do it
cld
a32 rep movsd
mov eax, uNumDwords
; DEBUG START
push ebx
mov ax, 0x0E00 + '!'
mov bx, 7
int 0x10
pop ebx
; DEBUG END
pop ecx
pop edi
pop esi
pop es
pop ds
leave
retn 12 ; Automatically remove params off stack
; End UnrealCopy
;-----------------------