In/Out - Bochs problem

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
Hornet

In/Out - Bochs problem

Post by Hornet »

Hello.
I'm using the following code to control the lock LEDs:

Code: Select all

mov dx, 0x60
mov ax, 0xED
out dx, ax
mov ax, 0xFF
out dx, ax
This code works in VMware and on my Computer. But Bochs is exiting with the following message:
[KBD ] kbd: io write to address 00000060, len=2!

Can anyone help me?
Hornet (german)
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:In/Out - Bochs problem

Post by distantvoices »

bochs protests, when you want to say out [port],ax f. ex. I've had this error in my implementation too.

use al instead. this will work i think. It has to do with the registers length.

p. ex.

mov al,0x20
out 0x20,al

hope this helps.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:In/Out - Bochs problem

Post by Pype.Clicker »

when you use "out dx,ax", what is actually done is sending al on IO[dx] and ah on IO[dx+1]. This is probably not what you want to do. If this was not a typo, I suggest you go back to the keyboard definitions and read it once again.

out 0x60,eax ; out 0x60,ax and out 0x60,al have definitely *NOT* the same behaviour.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:In/Out - Bochs problem

Post by distantvoices »

Have peeked in to my own holy grail of assembly and found out:

al = 8 bit length

ax=16 bit length

eax=32 bit length

Some ports only accept a value which is 8 bits long - in these cases bochs kicks the code out and refuses to continue work. It is a box - what do you expect it to do else?*ggg*
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Post Reply