首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 汇编语言 >

一小段linux内核看不懂解决方法

2012-06-19 
一小段linux内核看不懂static inline void set_origin(void){cli()outb_p(12,0x3d4)outb_p(0xff&((origi

一小段linux内核看不懂
static inline void set_origin(void)
{
cli();
outb_p(12,0x3d4);
outb_p(0xff&((origin-SCREEN_START)>>9),0x3d5);
outb_p(13,0x3d4);
outb_p(0xff&((origin-SCREEN_START)>>1),0x3d5);
sti();
}

outb_p(0xff&((origin-SCREEN_START)>>9),0x3d5);

origin-SCREEN_START 是16位偏移。

右移8位就是 偏移高位部分。

但是这里是右移9位。为什么还要除以个2?

[解决办法]
Port 0x3C4, 0x3CE, 0x3D4
These are the most used indexed registers. The index byte is written to the port given, then the data byte can be read/written from port+1. Some programs use a single word access instead of two byte accesses for writing, which does effectively the same. (take care of byte ordering when doing so)
Port 0x3D4 has some extra requirements - it requires bit 0 of the Miscellaneous Output Register to be set before it responds to this address (if cleared, these ports appears at 0x3B4). Also, registers 0-7 of 0x3D4 are write protected by the protect bit (bit 7 of index 0x11)

热点排行