From: enigma AT erols DOT com (enigma) Newsgroups: comp.os.msdos.djgpp Subject: copying from real more to pm... Date: Sun, 16 Mar 1997 22:36:24 GMT Organization: djgpp, i luv u ;) Lines: 36 Message-ID: <332c7487.7195759@news.erols.com> NNTP-Posting-Host: dam-as11s58.erols.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp ok.. this has been bugging me for a little why... i'm trying to copy memory from a real pointer to a protected mode pointer. well, i got the copying of bytes to work, but my func for copying unsigned words isn't working. i could use a little help here folks code: #define RM_TO_LINEAR(addr) (((addr & 0xFFFF0000) >> 12) + (addr & 0xFFFF)) UWORD *PMcopyWordtoLocal(UWORD *RMptr) { UWORD buffer[256], *p; UWORD count = 0; ULONG addr; addr = RM_TO_LINEAR((ULONG)RMptr); _farsetsel(_dos_ds); while (_farnspeekw(addr) != 0xFFFF) { buffer[count++] = _farnspeekw(addr++); addr++; } buffer[count] = 0xFFFF; p = (UWORD *)malloc(count); memcpy(p,buffer,count); return p; } feel free to criticize my code as much as necessary. style, bugs,etc.. just gimme my mistake ;) mint enigma AT erols DOT com