hschumann2/TempleOS-Source-Code
0847
1 2//This just shows how scrn memory works.3//See ::/Demo/Lectures/MiniGrLib.HC4 5U0 PlotXY(I64 x,I64 y)6{7//Scrn bits are revd8 LBts(text.vga_alias,y*GR_WIDTH+x^7);9}10 11U0 Main()12{13 I64 i;14 //This makes all 4 color planes active.15 OutU8(VGAP_IDX,VGAR_MAP_MASK);16 OutU8(VGAP_DATA,WHITE);17 MemSet(text.vga_alias,0,GR_WIDTH*GR_HEIGHT/8);18 19 OutU8(VGAP_IDX,VGAR_MAP_MASK);20 OutU8(VGAP_DATA,RED);21 for (i=0;i<200;i++)22 PlotXY(i,i);23 24 OutU8(VGAP_IDX,VGAR_MAP_MASK);25 OutU8(VGAP_DATA,GREEN);26 for (i=0;i<200;i++)27 PlotXY(100,i);28 29 OutU8(VGAP_IDX,VGAR_MAP_MASK);30 OutU8(VGAP_DATA,BLUE);31 for (i=0;i<200;i++)32 PlotXY(200-i,i);33/*If you want a mixed color sel multiple planes34but you have to be sure the unseled planes35are zero, so sel them and make them zero.36You can't do reads on VGA memory, by the way.37That means no read-modify-writes, too.38*/39 Busy(4000000);40 41 //TempleOS has a 4 plane memory duplicate of the scrn, gr.scrn_image,42 //and only writes actual changes. See GrUpdateVGAGraphics().43 //<CTRL-ALT-v> will flush scrn VGA cache.44 VGAFlush;45}46 47Main;48 49//See ::/Demo/Lectures/GraphicsCPULoad.HC.50 51 