Okay I'm stuck here. I don't get it, what do I have to do with these outportb instructions?PatrickV wrote:You can move the cursor with inline assembly in your c file. This is one of the ways you can do this
Code: Select all
void move_csr(void) { unsigned temp; /* The equation for finding the index in a linear * chunk of memory can be represented by: * Index = [(y * width) + x] */ temp = csr_y * 80 + csr_x; /* This sends a command to indicies 14 and 15 in the * CRT Control Register of the VGA controller. These * are the high and low bytes of the index that show * where the hardware cursor is to be 'blinking'. To * learn more, you should look up some VGA specific * programming documents. A great start to graphics: * http://www.brackeen.com/home/vga */ outportb(0x3D4, 14); outportb(0x3D5, temp >> 8); outportb(0x3D4, 15); outportb(0x3D5, temp); }
outportb(0x3D4, 14);
outportb(0x3D5, temp >> ;
outportb(0x3D4, 15);
outportb(0x3D5, temp);
Copying that exactly is not going to work. The code in red is the part you need to look at
In the wiki article about this it says
So I have to do like this?Note, this quick example assumes 80x25 screen mode. Also note that the base port (here assumed to be 0x3D4) should be read from the BIOS data area.
Code: Select all
unsigned short address = inportw (0x0463) // (2 bytes, taken as a word) base IO port for video
and then
outportb (address, 14)
outportb (address+1, temp>>8)
outportb (address, 15)
outportb (address+1, temp)
Code: Select all
static __inline__ unsigned short inportw(unsigned short port)
{
unsigned short ret;
asm volatile ("inw %1,%0":"=a"(ret):"Nd"(port));
return ret;
}