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