From: sparky4 <sparky4@cock.li>
Date: Mon, 6 Jun 2016 14:24:49 +0000 (-0500)
Subject: ====i made a quick and dirty fix to the video issue wwww====
X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=e191e856ff22b2a47fe89c72778802048f5a0fb0;p=16.git

====i made a quick and dirty fix to the video issue wwww====
---

diff --git a/SCROLL.16L b/SCROLL.16L
index c1cf1cc5..a23fb37d 100755
--- a/SCROLL.16L
+++ b/SCROLL.16L
@@ -1,24 +1,30 @@
+WARNING: Failed to initialize DEBUG output
 starting timer	ok
 index=4096
-chkmap ok	Project 16 scroll.exe. This is just a test file!
-version May  9 2016 02:45:56
+chkmap ok	0 fps
+48 fps
+37 fps
+50 fps
+Project 16 scroll.exe. This is just a test file!
+version Jun  6 2016 09:16:37
 tx: 0
 ty: 0
-player.x: 160		player.y: 128
-player.tx: 10		player.ty: 8
-player.triggx: 10	player.triggy: 9
-player.hp: 4	player.q: 1	player.info.dir: 2	player.d: 2 pdir=0
-tile data value at player trigger position: 0
+player.x: 304		player.y: 128
+player.tx: 20		player.ty: 8
+player.triggx: 21	player.triggy: 8
+player.hp: 4	player.q: 1	player.info.dir: 2	player.d: 2 pdir=3
+tile data value at player trigger position: 1
 Virtual Screen: 352x272
 Screen: 320x240
 virtual tile resolution: 22x17
 tile resolution: 20x15 
 middle tile position: 10x8
-video memory remaining: 40447
-page 	[0]=(a000:0000) size=30208 sw=320  sh=240  width=352  height=272
-	[1]=(a000:7600) size=30208 sw=320  sh=240  width=352  height=272
-	[2]=(a000:ec00) size=30208 sw=320  sh=240  width=352  height=272
-mv[1].tx: 0	mv[1].ty: 0	panswitch=0
+video memory remaining: 65535
+page 	[0]=(a000:0000) size=23936	sw=320  sh=240  width=352  height=272
+	[1]=(a000:5d80) size=23936	sw=320  sh=240  width=352  height=272
+	[2]=(a000:bb00) size=1024	sw=64  sh=64  width=64  height=64
+	[3]=(a000:bf00) size=16640	sw=320  sh=208  width=320  height=208
+mv[1].tx: 0	mv[1].ty: 0	gvar.video.p=1
 
 
 detected CPU type: 386 or newer
diff --git a/scroll.16l b/scroll.16l
new file mode 100755
index 00000000..a23fb37d
--- /dev/null
+++ b/scroll.16l
@@ -0,0 +1,30 @@
+WARNING: Failed to initialize DEBUG output
+starting timer	ok
+index=4096
+chkmap ok	0 fps
+48 fps
+37 fps
+50 fps
+Project 16 scroll.exe. This is just a test file!
+version Jun  6 2016 09:16:37
+tx: 0
+ty: 0
+player.x: 304		player.y: 128
+player.tx: 20		player.ty: 8
+player.triggx: 21	player.triggy: 8
+player.hp: 4	player.q: 1	player.info.dir: 2	player.d: 2 pdir=3
+tile data value at player trigger position: 1
+Virtual Screen: 352x272
+Screen: 320x240
+virtual tile resolution: 22x17
+tile resolution: 20x15 
+middle tile position: 10x8
+video memory remaining: 65535
+page 	[0]=(a000:0000) size=23936	sw=320  sh=240  width=352  height=272
+	[1]=(a000:5d80) size=23936	sw=320  sh=240  width=352  height=272
+	[2]=(a000:bb00) size=1024	sw=64  sh=64  width=64  height=64
+	[3]=(a000:bf00) size=16640	sw=320  sh=208  width=320  height=208
+mv[1].tx: 0	mv[1].ty: 0	gvar.video.p=1
+
+
+detected CPU type: 386 or newer
diff --git a/scroll.smp b/scroll.smp
index 865f458d..97e7783a 100755
Binary files a/scroll.smp and b/scroll.smp differ
diff --git a/src/lib/16_timer.c b/src/lib/16_timer.c
index 0b5cf416..6d00448f 100755
--- a/src/lib/16_timer.c
+++ b/src/lib/16_timer.c
@@ -73,7 +73,7 @@ void shinkutxt(global_game_variables_t *gv)
 	if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))
 	{
 		//t=(((*(gv->clock))-gv->clock_start) /18.2);
-		sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv));
+		sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));
 		fprintf(stderr, "%s\n", gv->pee);
 		//(gv->clock_start)=*(gv->clock);
 		gv->kurokku.tiku=0;
diff --git a/src/lib/modex16.c b/src/lib/modex16.c
index 38db05d8..e3e557bf 100755
--- a/src/lib/modex16.c
+++ b/src/lib/modex16.c
@@ -342,6 +342,8 @@ modexClearRegion(page_t *page, int x, int y, int w, int h, byte  color) {
       right=0x0f;
     }
 
+	//printf("modexClearRegion(x=%u, y=%u, w=%u, h=%u, left=%u, right=%u)\n", x, y, w, h, left, right);
+
     __asm {
 	    PUSHF
 	    PUSH ES
@@ -409,14 +411,21 @@ modexCopyPageRegion(page_t *dest, page_t *src,
 {
     word doffset = (word)dest->data + dy*(dest->stridew) + dx/4;
     word soffset = (word)src->data + sy*(src->stridew) + sx/4;
-    word scans   = vga_state.vga_stride;
+    word scans   = vga_state.vga_stride+8;				//++++0000 the quick and dirty fix of the major issue with p16 video display wwww
     word nextSrcRow = src->stridew - scans - 1;
     word nextDestRow = dest->stridew - scans - 1;
     byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08};  /* clips for rectangles not on 4s */
-    byte rclip[] = {0x0f, 0x01, 0x03, 0x07};
+    byte rclip[] = {0x00, 0x01, 0x03, 0x07};
     byte left = lclip[sx&0x03];
     byte right = rclip[(sx+width)&0x03];
 
+	/* handle the case which requires an extra group */
+	if((sx & 0x03) && !((sx+width) & 0x03)) {
+		right=0x0f;
+	}
+
+//	printf("modexCopyPageRegion(src->stridew=%u, dest->stridew=%u, sx=%u, sy=%u, dx=%u, dy=%u, width=%u, height=%u, left=%u, right=%u)\n", src->stridew, dest->stridew, sx, sy, dx, dy, width, height, left, right);
+
     __asm {
 	    PUSHF
 	    PUSH ES
@@ -1172,8 +1181,8 @@ void modexprintmeminfo(video_t *v)
 	{
 		printf("	[%u]=", i);
 		printf("(%Fp)", (v->page[i].data));
-		printf(" size=%u", v->page[i].pagesize);
-		printf(" sw=%lu  sh=%lu ", (unsigned long)v->page[i].sw, (unsigned long)v->page[i].sh);
+		printf(" size=%u	", v->page[i].pagesize);
+		printf("sw=%lu  sh=%lu ", (unsigned long)v->page[i].sw, (unsigned long)v->page[i].sh);
 		printf(" width=%lu  height=%lu", (unsigned long)v->page[i].width, (unsigned long)v->page[i].height);
 		printf("\n");
 	}
diff --git a/src/scroll.c b/src/scroll.c
index 90a3ba3f..7c77673d 100755
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -250,13 +250,12 @@ void main(int argc, char *argv[])
 	 modexPalUpdate(map.tiles->data, &paloffset, 0, 0);
 	printf("2paloffset	=	%d\n", paloffset/3);
 	 modexpdump(mv[0].page); modexpdump(mv[1].page);
-		 IN_UserInput(1,1);
+		IN_UserInput(1,1);
 	}
 #endif
 #endif
 	//pan switch
 	if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);}	//f12
-	//TSR
 	if(IN_KeyDown(87))	//f11
 	{
 		pageflipflop=!pageflipflop;
@@ -269,10 +268,10 @@ void main(int argc, char *argv[])
 // 			int 21h
 // 		}
 	}
-	if(IN_KeyDown(68))	//s
+	if(IN_KeyDown(68))	//f10
 	{
 		gvar.kurokku.fpscap=!gvar.kurokku.fpscap;
-		 IN_UserInput(1,1);
+		IN_UserInput(1,1);
 	}
 	//TODO fmemtest into page
 	/*if(IN_KeyDown(4+1))	//4
diff --git a/test.16l b/test.16l
new file mode 100755
index 00000000..a9884720
--- /dev/null
+++ b/test.16l
@@ -0,0 +1,10 @@
+WARNING: Failed to initialize DEBUG output
+modexCopyPageRegion(src->stridew=88, dest->stridew=88, sx=0, sy=0, dx=0, dy=0, width=352, height=272, left=15, right=0)
+Project 16 test.exe. This is just a test file!
+version Jun  6 2016 08:47:42
+video memory remaining: 65535
+page 	[0]=(a000:0000) size=23936	sw=320  sh=240  width=352  height=272
+	[1]=(a000:5d80) size=23936	sw=320  sh=240  width=352  height=272
+	[2]=(a000:bb00) size=1024	sw=64  sh=64  width=64  height=64
+	[3]=(a000:bf00) size=16640	sw=320  sh=208  width=320  height=208
+tx=1	ty=1	player.d=2