- implementation of the text mode snapshot function

This commit is contained in:
Volker Ruppert 2002-02-04 20:31:35 +00:00
parent 2d5a9bd459
commit 1d9861fc59
3 changed files with 42 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: gui.cc,v 1.25 2002-02-01 16:46:27 vruppert Exp $
// $Id: gui.cc,v 1.26 2002-02-04 20:31:35 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -227,7 +227,24 @@ bx_gui_c::power_handler(void)
void
bx_gui_c::snapshot_handler(void)
{
BX_INFO(( "# SNAPSHOT callback (unimplemented)." ));
Bit8u* text_snapshot = NULL;
unsigned line_addr, txHeight, txWidth;
FILE *OUTPUT;
bx_vga.get_text_snapshot(&text_snapshot, &txHeight, &txWidth);
if (txHeight > 0) {
OUTPUT = fopen("snapshot.txt", "w");
for (unsigned i=0; i<txHeight; i++) {
line_addr = i * txWidth * 2;
for (unsigned j=0; j<(txWidth*2); j+=2) {
if (OUTPUT) fputc(text_snapshot[line_addr+j], OUTPUT);
}
fprintf(OUTPUT, "\n");
}
fclose(OUTPUT);
} else {
BX_INFO(( "# SNAPSHOT callback (graphics mode unimplemented)." ));
}
}
void

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.cc,v 1.21 2002-01-24 20:30:45 vruppert Exp $
// $Id: vga.cc,v 1.22 2002-02-04 20:31:35 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1822,7 +1822,25 @@ bx_vga_c::mem_write(Bit32u addr, Bit8u value)
}
}
void
bx_vga_c::get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
unsigned *txWidth)
{
unsigned VDE, MSL;
if (!BX_VGA_THIS s.graphics_ctrl.graphics_alpha) {
*text_snapshot = &BX_VGA_THIS s.text_snapshot[0];
VDE = bx_vga.s.CRTC.reg[0x12] |
((bx_vga.s.CRTC.reg[0x07]<<7)&0x100) |
((bx_vga.s.CRTC.reg[0x07]<<3)&0x200);
MSL = bx_vga.s.CRTC.reg[0x09] & 0x1f;
*txHeight = (VDE+1)/(MSL+1);
*txWidth = BX_VGA_THIS s.CRTC.reg[1] + 1;
} else {
*txHeight = 0;
*txWidth = 0;
}
}
void
bx_vga_c::dump_status(void)

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////
// $Id: vga.h,v 1.6 2001-10-03 13:10:38 bdenney Exp $
// $Id: vga.h,v 1.7 2002-02-04 20:31:35 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
// Copyright (C) 2002 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
@ -185,6 +185,8 @@ private:
static void timer_handler(void *);
BX_VGA_SMF void timer(void);
BX_VGA_SMF void set_update_interval (unsigned interval);
BX_VGA_SMF void get_text_snapshot(Bit8u **text_snapshot, unsigned *txHeight,
unsigned *txWidth);
private:
BX_VGA_SMF void update(void);
BX_VGA_SMF void dump_status(void);