;Written in FASM cli mov dx,PORT+1 mov ax,0 out dx,ax mov dx,PORT+3 mov ax,0x80 out dx,ax mov dx,PORT+0 mov ax,0x03 out dx,ax mov dx,PORT+1 mov ax,0 out dx,ax mov dx,PORT+3 mov ax,3 out dx,ax mov dx,PORT+2 mov ax,0xc7 out dx,ax mov dx,PORT+4 mov ax,0x0b out dx,ax mov dx,PORT mov ax,'H' out dx,ax halt: hlt jmp halt PORT=0x3f8I have been running it in VirtualBox. I set up the VM to log all serial port output to a text file, and the file is always blank afterward. Then, I set up the VM to open a pipe for I/O over that. I made a little program to read the pipe. The VM opens the pipe, but no data is put in it. These together make me think it is something wrong with the code. Can someone help?
11 replies to this topic
#1
Posted 07 December 2010 - 05:10 PM
Hi, I've been trying to program for the serial ports, but I just can't seem to get it to work.
Latinamne loqueris?
|
|
|
#2
Posted 09 December 2010 - 04:21 PM
You're not setting the DLAB right; you need to read in the entire value and or it in, otherwise you're trashing whatever else is in the line control register.
Serial Ports - OSDev Wiki
Serial Ports - OSDev Wiki
sudo rm -rf /
#3
Posted 09 December 2010 - 04:47 PM
Still doesn't work. My code is actually the same code as their example on that page, which is why I am so stumped as to why it doesn't work.
Latinamne loqueris?
#4
Posted 14 December 2010 - 01:39 AM
You may want to check first if your serial port address is really at 0x3f8. It can be changed through BIOS. So check your BIOS.
#5
Posted 14 December 2010 - 06:09 PM
Yes, I am sure because I am running it in VirtualBox and have made sure that the port is set up att 0x3f8
Latinamne loqueris?
#6
Posted 14 December 2010 - 10:12 PM
#7
Posted 15 December 2010 - 12:44 PM
I didn't put an STI in there because I don't want to use interrupts for the serial port.
Latinamne loqueris?
#8
Posted 15 December 2010 - 07:18 PM
CLI followed by HLT at any point will make the processor hang indefinitely. CLI just disables external interrupts, not software interrupts you trigger yourself.
sudo rm -rf /
#9
Posted 16 December 2010 - 06:04 AM
Well, that was the whole point of the HLT loop. And I know that CLI just disables external interrupts. I didn't want to deal with interrupts from the serial port controller or whatever it is called.
Latinamne loqueris?
#10
Posted 16 December 2010 - 11:14 AM
I just noticed something...you should be writing bytes out the ports, not words
sudo rm -rf /
#11
Posted 16 December 2010 - 11:42 AM
Oops LOL.... It works now. I wasn't really paying attention I guess. Thanks!
Latinamne loqueris?
#12
Posted 16 December 2010 - 03:08 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









