2 This is a little turbo C program that executes
3 several int10, and let you inspect the content
6 It is used to test the behavior of the vgabios
14 typedef unsigned char Bit8u
;
15 typedef unsigned short Bit16u
;
39 void int10ax0003(struct REGPACK
*regs
)
45 void int10ax02(struct REGPACK
*regs
)
51 printf("We are now at 24/17");
54 void int10ax03(struct REGPACK
*regs
)
59 printf("\nCursor is ax%04x cx%04x dx%04x\n",regs
->r_ax
,regs
->r_cx
,regs
->r_dx
);
62 void int10ax0501(struct REGPACK
*regs
)
69 printf("We are now on page 2");
72 void int10ax0602(struct REGPACK
*regs
)
79 printf("Scrolled 2 up");
82 void int10ax0702(struct REGPACK
*regs
)
89 printf("Scrolled 2 down");
92 void int10ax08(struct REGPACK
*regs
)
99 void int10ax09(struct REGPACK
*regs
)
104 for(attr
=0;attr
<16;attr
++)
105 {printf("%02x ",attr
);
106 regs
->r_ax
=0x0961+attr
;
107 regs
->r_bx
=0x0100+attr
;
114 void int10ax0a(struct REGPACK
*regs
)
124 void int10ax0f(struct REGPACK
*regs
)
132 void int10ax1b(struct REGPACK
*regs
)
133 {unsigned char table
[64];
134 unsigned char far
*ptable
;
142 regs
->r_es
=FP_SEG(ptable
);
143 regs
->r_di
=FP_OFF(ptable
);
144 printf("Read state info in %04x:%04x\n",regs
->r_es
,regs
->r_di
);
148 {if(i
%16==0)printf("\n%02x ",i
);
149 printf("%02x ",table
[i
]);
154 static unsigned char var
[64];
156 void int10ax13(struct REGPACK
*regs
)
157 {unsigned char far
*pvar
;
165 regs
->r_es
=FP_SEG(pvar
);
166 regs
->r_bp
=FP_OFF(pvar
);
167 pokeb(regs
->r_es
,regs
->r_bp
,'t');
168 pokeb(regs
->r_es
,regs
->r_bp
+1,'b');
169 printf("Writing from %04x:%04x\n",regs
->r_es
,regs
->r_bp
);
174 void switch_50(struct REGPACK
*regs
)
186 char exec_function(struct REGPACK
*regs
)
189 printf("--- Functions --------------------\n");
190 printf("a. int10 ax0003\t");
191 printf("b. int10 ax02\t");
192 printf("c. int10 ax03\t");
193 printf("d. int10 ax0501\n");
194 printf("e. int10 ax0602\t");
195 printf("f. int10 ax0702\t");
196 printf("g. int10 ax08\t");
197 printf("h. int10 ax09\t");
198 printf("i. int10 ax0a\n");
199 printf("j. int10 ax0f\t");
200 printf("k. int10 ax1b\t");
201 printf("l. int10 ax13\n");
203 printf("r. switch to 50 lines\n");
249 printf("No such function!\n");
259 void read_bios_area(BIOSAREA
*biosarea
)
261 biosarea
->initial
=peekb(0x40,0x10);
262 biosarea
->current
=peekb(0x40,0x49);
263 biosarea
->nbcols
=peek(0x40,0x4a);
264 biosarea
->regen
=peek(0x40,0x4c);
265 biosarea
->start
=peek(0x40,0x4e);
266 biosarea
->curpos
[0]=peek(0x40,0x50);
267 biosarea
->curpos
[1]=peek(0x40,0x52);
268 biosarea
->curpos
[2]=peek(0x40,0x54);
269 biosarea
->curpos
[3]=peek(0x40,0x56);
270 biosarea
->curpos
[4]=peek(0x40,0x58);
271 biosarea
->curpos
[5]=peek(0x40,0x5a);
272 biosarea
->curpos
[6]=peek(0x40,0x5c);
273 biosarea
->curpos
[7]=peek(0x40,0x5e);
274 biosarea
->curtyp
=peek(0x40,0x60);
275 biosarea
->curpage
=peekb(0x40,0x62);
276 biosarea
->crtc
=peek(0x40,0x63);
277 biosarea
->msr
=peekb(0x40,0x65);
278 biosarea
->cgapal
=peekb(0x40,0x66);
279 biosarea
->nbrows
=peekb(0x40,0x84);
280 biosarea
->cheight
=peek(0x40,0x85);
281 biosarea
->ctl
=peekb(0x40,0x87);
282 biosarea
->switches
=peekb(0x40,0x88);
283 biosarea
->modeset
=peekb(0x40,0x89);
284 biosarea
->dcc
=peekb(0x40,0x8a);
285 biosarea
->vsseg
=peek(0x40,0xa8);
286 biosarea
->vsoffset
=peek(0x40,0xaa);
289 void show_bios_area(BIOSAREA
*biosarea
)
291 printf("--- BIOS area --------------------\n");
292 printf("initial : %02x\t",biosarea
->initial
);
293 printf("current : %02x\t",biosarea
->current
);
294 printf("nbcols : %04x\t",biosarea
->nbcols
);
295 printf("regen : %04x\t",biosarea
->regen
);
296 printf("start : %04x\n",biosarea
->start
);
297 printf("curpos : %04x %04x %04x %04x %04x %04x %04x %04x\n",
298 biosarea
->curpos
[0], biosarea
->curpos
[1], biosarea
->curpos
[2], biosarea
->curpos
[3],
299 biosarea
->curpos
[4], biosarea
->curpos
[5], biosarea
->curpos
[6], biosarea
->curpos
[7]);
300 printf("curtyp : %04x\t",biosarea
->curtyp
);
301 printf("curpage : %02x\t",biosarea
->curpage
);
302 printf("crtc : %04x\t",biosarea
->crtc
);
303 printf("msr : %04x\n",biosarea
->msr
);
304 printf("cgapal : %04x\t",biosarea
->cgapal
);
305 printf("nbrows-1: %02x\t",biosarea
->nbrows
);
306 printf("cheight : %04x\t",biosarea
->cheight
);
307 printf("ctl : %02x\n",biosarea
->ctl
);
308 printf("switches: %02x\t",biosarea
->switches
);
309 printf("modeset : %02x\t",biosarea
->modeset
);
310 printf("dcc : %02x\t",biosarea
->dcc
);
311 printf("vs : %04x:%04x\n",biosarea
->vsseg
,biosarea
->vsoffset
);
314 void show_regs(struct REGPACK
*regs
)
316 printf("--- Registers --------------------\n");
317 printf("ax %04x\t",regs
->r_ax
);
318 printf("bx %04x\t",regs
->r_bx
);
319 printf("cx %04x\t",regs
->r_cx
);
320 printf("dx %04x\t",regs
->r_dx
);
321 printf("ds %04x\t",regs
->r_ds
);
322 printf("si %04x\t",regs
->r_si
);
323 printf("es %04x\t",regs
->r_es
);
324 printf("di %04x\n",regs
->r_di
);
327 void reset_videomode()
345 read_bios_area(&biosarea
);
348 show_bios_area(&biosarea
);
351 if(exec_function(®s
)!=0)break;