I search for a answer for my question:
I am copying data from one address, e.g. 0xF000:0xFFF5, to [es:CopyPointer] (I don't know the exact value of CopyPointer's IP, so I am using this syntax). In FASM, I can't just
Code: Select all
mov si,[0xF000:0xFFF5]
Code: Select all
mov ax,0xF000
mov ds,ax
mov si,[ds:0xFFF5]
Code: Select all
push es
push ds
mov ax,ds ;the pointer "CopyPointer" is located in the
mov es,ax ;include files of my OS at the very *end* to prevent
mov ax,0xF000 ;memory overwriting - so let DS=ES
mov ds,ax
mov si,[ds:0xFFF5]
mov cx,8 ;length
mov di,CopyPointer ;MOVSB is always as DI taking the ES seg register
rep movsb ;REP MOVSB instead of MOVSD, for safety I think
pop ds
pop es
Code: Select all
mov esi,CopyPointer
call print_string
... this will display garbage or nothing at all.
NOTE: This code is in the first lines of my OS, so it's using real mode segmentation. After this and other things, it will jump into pmode.
Can you please tell me what the hell I'm doing wrong?
Regards inflater.