The wrong when debug use bochs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

The wrong when debug use bochs

Post 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?
http://english.writeos.com

My English is not very good
User avatar
hailstorm
Member
Member
Posts: 110
Joined: Wed Nov 02, 2005 12:00 am
Location: The Netherlands

Post 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.
tresss
Posts: 21
Joined: Thu Jul 06, 2006 10:52 pm

Post by tresss »

ok...thanks

I agree with you.


I change it into:

Code: Select all

xor ax,ax
in ax,dx
thanks
http://english.writeos.com

My English is not very good
Post Reply