Line 21... |
Line 21... |
static void memsetw();
|
static void memsetw();
|
static void memcpyb();
|
static void memcpyb();
|
static void memcpyw();
|
static void memcpyw();
|
|
|
static void biosfn_set_video_mode();
|
static void biosfn_set_video_mode();
|
|
static void biosfn_set_cursor_shape();
|
static void biosfn_set_cursor_pos();
|
static void biosfn_set_cursor_pos();
|
static void biosfn_get_cursor_pos();
|
static void biosfn_get_cursor_pos();
|
static void biosfn_scroll();
|
static void biosfn_scroll();
|
static void biosfn_read_char_attr();
|
static void biosfn_read_char_attr();
|
static void biosfn_write_char_attr();
|
static void biosfn_write_char_attr();
|
Line 237... |
Line 238... |
; inc sp
|
; inc sp
|
ret
|
ret
|
|
|
#if defined(USE_BX_INFO) || defined(DEBUG)
|
#if defined(USE_BX_INFO) || defined(DEBUG)
|
msg_vga_init:
|
msg_vga_init:
|
.ascii "VGABios $Id: vgabios.c,v 1.8 2009-03-02 01:02:33 zeus Exp $"
|
.ascii "VGABios $Id: vgabios.c,v 1.9 2009-03-05 19:58:40 zeus Exp $"
|
.byte 0x0d,0x0a,0x00
|
.byte 0x0d,0x0a,0x00
|
#endif
|
#endif
|
ASM_END
|
ASM_END
|
|
|
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
Line 407... |
Line 408... |
break;
|
break;
|
default:
|
default:
|
SET_AL(0x20);
|
SET_AL(0x20);
|
}
|
}
|
break;
|
break;
|
|
case 0x01:
|
|
biosfn_set_cursor_shape(GET_CH(),GET_CL());
|
|
break;
|
case 0x02:
|
case 0x02:
|
biosfn_set_cursor_pos(GET_BH(),DX);
|
biosfn_set_cursor_pos(GET_BH(),DX);
|
break;
|
break;
|
case 0x03:
|
case 0x03:
|
biosfn_get_cursor_pos(GET_BH(),&CX,&DX);
|
biosfn_get_cursor_pos(GET_BH(),&CX,&DX);
|
Line 614... |
Line 618... |
|
|
// FIXME
|
// FIXME
|
write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MSR,0x00); // Unavailable on vanilla vga, but...
|
write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_MSR,0x00); // Unavailable on vanilla vga, but...
|
write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,0x00); // Unavailable on vanilla vga, but...
|
write_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,0x00); // Unavailable on vanilla vga, but...
|
|
|
|
if(vga_modes[line].class==TEXT)
|
|
{
|
|
biosfn_set_cursor_shape(0x06,0x07);
|
|
}
|
|
|
|
// Set cursor pos for page 0..7
|
|
for(i=0;i<8;i++)
|
|
biosfn_set_cursor_pos(i,0x0000);
|
|
|
// Write the fonts in memory
|
// Write the fonts in memory
|
if(vga_modes[line].class==TEXT)
|
if(vga_modes[line].class==TEXT)
|
{
|
{
|
ASM_START
|
ASM_START
|
;; copy and activate 8x16 font
|
;; copy and activate 8x16 font
|
Line 630... |
Line 643... |
ASM_END
|
ASM_END
|
}
|
}
|
}
|
}
|
|
|
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
|
static void biosfn_set_cursor_shape (CH,CL)
|
|
Bit8u CH;Bit8u CL;
|
|
{Bit16u cheight,curs,crtc_addr;
|
|
Bit8u modeset_ctl;
|
|
|
|
CH&=0x3f;
|
|
CL&=0x1f;
|
|
|
|
curs=(CH<<8)+CL;
|
|
write_word(BIOSMEM_SEG,BIOSMEM_CURSOR_TYPE,curs);
|
|
|
|
modeset_ctl=read_byte(BIOSMEM_SEG,BIOSMEM_MODESET_CTL);
|
|
cheight = read_word(BIOSMEM_SEG,BIOSMEM_CHAR_HEIGHT);
|
|
if((modeset_ctl&0x01) && (cheight>8) && (CL<8) && (CH<0x20))
|
|
{
|
|
if(CL!=(CH+1))
|
|
{
|
|
CH = ((CH+1) * cheight / 8) -1;
|
|
}
|
|
else
|
|
{
|
|
CH = ((CL+1) * cheight / 8) - 2;
|
|
}
|
|
CL = ((CL+1) * cheight / 8) - 1;
|
|
}
|
|
|
|
// CTRC regs 0x0a and 0x0b
|
|
crtc_addr=read_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS);
|
|
outb(crtc_addr,0x0a);
|
|
outb(crtc_addr+1,CH);
|
|
outb(crtc_addr,0x0b);
|
|
outb(crtc_addr+1,CL);
|
|
}
|
|
|
|
// --------------------------------------------------------------------------------------------
|
static void biosfn_set_cursor_pos (page, cursor)
|
static void biosfn_set_cursor_pos (page, cursor)
|
Bit8u page;Bit16u cursor;
|
Bit8u page;Bit16u cursor;
|
{
|
{
|
Bit8u xcurs,ycurs,current;
|
Bit8u current;
|
Bit16u nbcols,nbrows,address,crtc_addr;
|
Bit16u crtc_addr;
|
|
|
// Should not happen...
|
// Should not happen...
|
if(page>7)return;
|
if(page>7)return;
|
|
|
// Bios cursor pos
|
// Bios cursor pos
|
Line 646... |
Line 694... |
|
|
// Set the hardware cursor
|
// Set the hardware cursor
|
current=read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
current=read_byte(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
if(page==current)
|
if(page==current)
|
{
|
{
|
// Get the dimensions
|
|
nbcols=read_word(BIOSMEM_SEG,BIOSMEM_NB_COLS);
|
|
nbrows=read_byte(BIOSMEM_SEG,BIOSMEM_NB_ROWS)+1;
|
|
|
|
xcurs=cursor&0x00ff;ycurs=(cursor&0xff00)>>8;
|
|
|
|
// Calculate the address knowing nbcols nbrows and page num
|
|
address=SCREEN_IO_START(nbcols,nbrows,page)+xcurs+ycurs*nbcols;
|
|
|
|
// CRTC regs 0x0e and 0x0f
|
// CRTC regs 0x0e and 0x0f
|
crtc_addr=read_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS);
|
crtc_addr=read_word(BIOSMEM_SEG,BIOSMEM_CRTC_ADDRESS);
|
outb(crtc_addr,0x0e);
|
outb(crtc_addr,0x0e);
|
outb(crtc_addr+1,(address&0xff00)>>8);
|
outb(crtc_addr+1,(cursor&0xff00)>>8);
|
outb(crtc_addr,0x0f);
|
outb(crtc_addr,0x0f);
|
outb(crtc_addr+1,address&0x00ff);
|
outb(crtc_addr+1,cursor&0x00ff);
|
outw(0xb800,cursor);
|
|
}
|
}
|
}
|
}
|
|
|
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
static void biosfn_get_cursor_pos (page,shape, pos)
|
static void biosfn_get_cursor_pos (page,shape, pos)
|