X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Fdos_gfx.cpp;h=360137edaa436ca905a306b68281dec220c0bee3;hb=de087a68310f656a0d2317065eedc49cea9280b3;hp=74400d6072755464391964bacffd6b94bdfadb87;hpb=0e3ce00a37ac3af632f1dd8cc14a7e657ebb94bc;p=16.git diff --git a/16/dos_gfx.cpp b/16/dos_gfx.cpp index 74400d60..360137ed 100644 --- a/16/dos_gfx.cpp +++ b/16/dos_gfx.cpp @@ -45,7 +45,7 @@ #if !defined(__COMPACT__) # if !defined(__LARGE__) # if !defined(__HUGE__) -# error Large data model required! Try compiling with 'bcc -ml lib.c'. +# error Large data model required! Try compiling with 'wcc -0 -ml lib.c'. # endif # endif #endif @@ -145,7 +145,49 @@ void set320x200x256_X(void) /* By default we want screen refreshing and drawing operations to be based at offset 0 in the video segment. */ - actStart = visStart = 0; + actStart = visStart = 0; + + /* +-------------------- +HORIZONTAL SCROLLING +-------------------- +Horizontal scrolling is essentially the same as vertical scrolling, all +you do is increment or decrement the VGA offset register by 1 instead of +80 as with vertical scrolling. + +However, horizontal scrolling is complicated by two things + + 1. Incrementing the offset register by one actually scrolls by FOUR + pixels (and there are FOUR planes on the VGA, what a coincidence) + + 2. You can't draw the image off the screen and then scroll it on + because of the way the VGA wraps to the next row every 80 bytes + (80 bytes * 4 planes = 320 pixels), if you tried it, you would + actually be drawing to the other side of the screen (which is + entirely visible) + +I'll solve these problems one at a time. + +Firstly, to get the VGA to scroll by only one pixel you use the horizontal +pixel panning (HPP) register. This register resides at + + PORT: 3C0H + INDEX: 13h + +and in real life, you use it like this + +----------------- Pixel Panning --------------- +IN PORT 3DAH (this clears an internal + flip-flop of the VGA) +OUT 13H TO PORT 3C0H +OUT value TO PORT 3C0H (where "value" is the + number of pixels to offset) +----------------------------------------------- +*/ + inp(0x3DA) + outpw(0x3C0, 0x13); + outpw(0x3C0, 0x58); + } /* @@ -236,8 +278,8 @@ void set320x240x256_X(void) outpw(0x3D4, 0xAC11); /* vertical retrace end AND wr.prot */ outpw(0x3D4, 0xDF12); /* vertical display enable end */ outpw(0x3D4, 0xE715); /* start vertical blanking */ - outpw(0x3D4, 0x0616); /* end vertical blanking */ - + outpw(0x3D4, 0x0616); /* end vertical blanking */ + /* Update mode info, so future operations are aware of the resolution */ height = 240; @@ -267,25 +309,118 @@ void vScroll(int rows) // Scrolling = current start + (rows * bytes in a row) setVisibleStart(visStart + (rows * width)); } + +void scrolly(int bong) +{ + int boing=0; + if(bong<0) + boing=-1; + else if(bong>0) + boing=1; + else break; + + for(int i=0;i= (200 * 80) THEN OFFSET = 0 - DRAW TO ROW 200 - SET VGA OFFSET = OFFSET - DRAW TO ROW -1 (was row 0 before scroll) -END WHILE*//* -void scrolly(){ - int OFFSET = 0 - WHILE NOT FINISHED DO - OFFSET = OFFSET + 80 - IF OFFSET >= (240 * 80) THEN OFFSET = 0 - RAW TO ROW 240 - SET VGA OFFSET = OFFSET - DRAW TO ROW -1 (was row 0 before scroll) - } -} */ //--------------------------------------------------- // @@ -293,7 +428,7 @@ void scrolly(){ // // You need a font if you are going to draw text. // - +/* int far * getFont() { @@ -343,7 +478,7 @@ void drawText(int x, int y, int color, byte string) string++; } } - +*/ ///////////////////////////////////////////////////////////////////////////// // // // setvideo() - This function Manages the video modes // @@ -422,10 +557,12 @@ int ding(int q){ if(yy=0 && xx=0 && yy=0 && xx=0 && yy<(height*3))*/{ putColorBox_X(xx, yy, TILEWH, TILEWH, coor); //++++0000 putPixel_X(xx, yy, coor); }