Page 1 of 1

The wrong when debug use bochs

Posted: Sat Sep 02, 2006 2:09 am
by tresss
I writed the code like this:

Code: Select all

  push ax			;debug 0x8277
  mov ecx,0xFFFF
Wait_Send_Loop:
  mov dx,FdcMsr
  in al,dx
  and al,0xc0
  cmp al,0x80


but I debug it in bochs and get result following:

Code: Select all

push ax
mov ecx,0x0000ffff
mov dx,0x03f4		;is ok
in al,0x24		;that's wrong,It's should be in al,0x03f4
...
...

Why?what' wrong? the bochs or other?

Posted: Mon Sep 04, 2006 2:27 am
by hailstorm
I think you are executing 16 bits code in a 32 bits code segment.
I tried to 'debug' your code, but because I didn't have time to setup a pm environment i did the following:
I created a bootsector starting your code. I compiled the code as 16 bits and everything went ok. Then, I compiled the code as 32 bits. I got the same kind of results you get when you are debugging in bochs. In your case however, you are executing in 16 bit code in 32 bit environment. The in al, 0x24 is actually a combination of the statements "in al, dx" and "and al, 0xc0".

I hope this helps a bit.

Posted: Mon Sep 18, 2006 3:02 am
by tresss
ok...thanks

I agree with you.


I change it into:

Code: Select all

xor ax,ax
in ax,dx
thanks