Parallel port output

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
bkilgore

Parallel port output

Post by bkilgore »

I don't currently have a filesystem, so I don't have any way of logging long outputs from my OS (run in bochs). I saw that bochs has a feature where it will enable parallel port 1 and output the data to a file. I was hoping to be able to use this as a kind of "serial console" for my OS so I could send long outputs to the file and then look over them instead of using a quick fix where i switch to an idle task using the keyboard to pause the output. My question is, how do I send text to the parallel port?

I've been looking over the parallel port information at the operating system resource center, but most of it is about the hardware and how you can change the state of the wires of the port. It also talks about only being able to write 4 bits at a time to the port. So I was wondering if anyone knows how to get simple text to be output to the parallel port?

Thanks.

- Brandon
bkilgore

Re:Parallel port output

Post by bkilgore »

Nevermind... :)


I was going through the bochs source and figured it out.

Basically, to write a char to the bochs parallel port and get it to print to the file, you send this:

Code: Select all

outportb(0x37a, 0x04|0x08);
outportb(0x378, (unsigned char)c);
outportb(0x37a, 0x01);
for each character c you want printed. So i just incorporated that into my write_char function with an ifdef around it, and I get full debugging to a text file. Very Nice! :)
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:Parallel port output

Post by Pype.Clicker »

nice done. I was planning to hack bochs and add such a feature on a port that would do nothing on a real pc (i first thought of the serial port, but it looked too complicated for a simple debug :), but having it through the parallel port is just a natural way to come around :)
Tim

Re:Parallel port output

Post by Tim »

There are several debugging ports in Bochs, including 0xE9. Refer to the source code for a list.
Post Reply