hi all,

hope someone of you remember something od the old real mode addressing mode .....

I'm using 'model large' in a 16 bit dll and i need to write to a data address and then read it to veify if has been right writed..




.model large, windows pascal
.386

.data
MyString db 10 dup (0)

.code
entry:
mov ax,@data
mov ds,ax


' to write memory, inside a near proc i'm doing

lea di,MyString
mov byte ptr ds:[di],0

'to verify i would do
mov al,byte ptr ds:[di]
cmp al,0 ... and so on




Now i'm writing in a wrong address (or readig for verify at wrong address). I think the addressing ds: is not working ....

If some help, thanks B7
Posted on 2001-12-05 01:01:16 by Bit7
if you work under win16 (Win3.11) you have a 16:32 addressing mode. You need to access edi instead of di:



lea edi,MyString
mov byte ptr ds:[edi],0
mov al, ds:[edi]
Posted on 2001-12-05 05:33:53 by beaster
thanks beaster !

Can i assume that ds remain always set as my data segment, declared at the beginning of .code, or have i to do again mov ds,@data inside my near proc ?


Thanks, Bit7
Posted on 2001-12-05 11:11:30 by Bit7
ds is preserved by win API functions, and you must preserve
it as well, like ebx, edi and esi. Calling your own procs, ds
leaves untouched.

If you get some pointers from windows (f.e. GlobalAlloc) you
get new selectors and need to swap them around.
Posted on 2001-12-10 06:32:28 by beaster