void vga_clear_area(VGAText *vga, guchar attr, int top_left_x, int top_left_y, int cols, int rows) { gint16 cellword; int ofs, y, endrow; g_return_if_fail(vga != NULL); g_return_if_fail(VGA_IS_TEXT(vga)); /* FIXME: Endianness. No << 8 for big endian */ cellword = 0x0000 | ((gint16) attr << 8); /* Special case optimization */ if (cols == vga->pvt->cols) { ofs = top_left_y * cols; memsetword(vga->pvt->video_buf + ofs, cellword, cols * rows); } else { endrow = top_left_y + rows; for (y = top_left_y; y < endrow; y++) { ofs = (y * vga->pvt->cols + top_left_x); memsetword(vga->pvt->video_buf + ofs, cellword, cols); } } vga_mark_region_dirty(vga, top_left_x, top_left_y, cols, rows); }
void _setlbabase(unsigned long lba) { unsigned char sector[512]; int ret; _direct_access_cmd_sector * dacs; dacs=(_direct_access_cmd_sector *)sector; memsetword(§or, 0, 512/2); sprintf(dacs->DAHEADERSIGNATURE,"HxCFEDA"); dacs->cmd_code=1; dacs->parameter_0=(lba>>0)&0xFF; dacs->parameter_1=(lba>>8)&0xFF; dacs->parameter_2=(lba>>16)&0xFF; dacs->parameter_3=(lba>>24)&0xFF; dacs->parameter_4=0xA5; ret=writesector( 0,(unsigned char *)§or); if(!ret) { fatal("Write CTRL error"); } }