From: Robert Lowe <pngwen@acm.org>
Date: Mon, 8 Sep 2014 01:48:12 +0000 (-0400)
Subject: added paging to controls
X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=33c9df2b46a82c4ba3f8219e5eb0454e71bf97ec;p=16.git

added paging to controls
---

33c9df2b46a82c4ba3f8219e5eb0454e71bf97ec
diff --cc 16/modex16/scroll.c
index 09b91f76,43edbcd5..89a06aeb
--- a/16/modex16/scroll.c
+++ b/16/modex16/scroll.c
@@@ -1,8 -1,9 +1,9 @@@
  #include "modex16.h"
  #include <stdio.h>
 -#include <stdlib.h>
 +#include <stdlib.h>
+ #include "dos_kb.h"
  
- word far *clock= (word far*) 0x046C; /* 18.2hz clock */
+ //word far *clock= (word far*) 0x046C; /* 18.2hz clock */
  
  typedef struct {
      bitmap_t *data;
@@@ -48,18 -48,21 +49,21 @@@ void mapDrawCol(map_view_t *mv, int tx
  void main() {
      int show1=1;
      int tx, ty;
 -    int x, y;
 -	//int ch=0x0;
 -	byte ch;
 +    int x, y;
++	//int ch=0x0;
++	byte ch;
+ 	int q=0;
 -    page_t screen;
 +    page_t screen,screen2;
      map_t map;
 -    map_view_t mv;
 -    byte *ptr;
 -
 -    setkb(1);
 -
 +    map_view_t mv, mv2;
 +    map_view_t *draw, *show, *tmp;
 +    byte *ptr;
 +    
      /* create the map */
-     map = allocMap(80,60);
+     map = allocMap(40,30);
      initMap(&map);
      mv.map = &map;
 +    mv2.map = &map;
  
      /* draw the tiles */
      ptr = map.data;
@@@ -67,47 -70,64 +71,57 @@@
      screen = modexDefaultPage();
      screen.width = 352;
      mv.page = &screen;
 +    screen2=modexNextPage(mv.page);
 +    mv2.page = &screen2;
      mapGoTo(&mv, 0, 0);
 +    mapGoTo(&mv2, 0, 0);
      modexShowPage(mv.page);
 -
 -	while(!keyp(1))
 -	{
 -    // scroll all the way to the right
 -    //for(x=0; x<(map.width*16-SCREEN_WIDTH); x++) {
 -	//if(ch==0x4d){
 -	if(keyp(77)){
 -	for(q=0; q<16; q++) {
 -	mapScrollRight(&mv, 1);
 -	modexShowPage(mv.page);
 +
 +    /* set up paging */
 +    show = &mv;
 +    draw = &mv2;
-     /* scroll all the way to the right */
-     for(x=0; x<(map.width*16-SCREEN_WIDTH); x++) {
- 	mapScrollRight(draw, 1);
- 	modexShowPage(draw->page);
- 	mapScrollRight(show, 1);
- 	//SWAP(draw, show);
-     }
- 
-     /* scroll all the way to the left */
-     for(; x>0; x--) {
- 	mapScrollLeft(&mv, 1);
- 	modexShowPage(mv.page);
-     }
- 
-     /* scroll all the way down */
-     for(y=0; y<(map.height*16-SCREEN_HEIGHT); y++) {
-         mapScrollDown(&mv, 1);
-         modexShowPage(mv.page);
-     }
 +
-     /* scroll all the way up */
-     for(; y>0; y--) {
- 	mapScrollUp(&mv, 1);
- 	modexShowPage(mv.page);
-     }
++    while(!keyp(1)) {
++	if(keyp(77)){
++	    for(q=0; q<16; q++) {
++		mapScrollRight(draw, 1);
++		modexShowPage(draw->page);
++		SWAP(draw, show);
++	    }
+ 	}
 -    }
+ 
 -    // scroll all the way to the left
 -    //for(; x>0; x--) {
 -	//if(ch==0x4b){
 -	if(keyp(75)){
 -	for(q=0; q<16; q++) {
 -	mapScrollLeft(&mv, 1);
 -	modexShowPage(mv.page);
++	if(keyp(75)){
++	    for(q=0; q<16; q++) {
++ 		mapScrollLeft(draw, 1);
++		modexShowPage(draw->page);
++		SWAP(draw, show);
++	    }
+ 	}
 -    }
+ 
 -    // scroll all the way down
 -    //for(y=0; y<(map.height*16-SCREEN_HEIGHT); y++) {
 -	//if(ch==0x50){
 -	if(keyp(80)){
 -		for(q=0; q<16; q++) {
 -        mapScrollDown(&mv, 1);
 -        modexShowPage(mv.page);
 -    }
 -    }
++	if(keyp(80)){
++	    for(q=0; q<16; q++) {
++		mapScrollDown(draw, 1);
++		modexShowPage(draw->page);
++		SWAP(draw, show);
++	    }
++	}
++
++
++	if(keyp(72)){
++	    for(q=0; q<16; q++) {
++		mapScrollUp(draw, 1);
++		modexShowPage(draw->page);
++		SWAP(draw, show);
+ 
 -    // scroll all the way up
 -    //for(; y>0; y--) {
 -	//if(ch==0x48){
 -	if(keyp(72)){
 -		for(q=0; q<16; q++) {
 -	mapScrollUp(&mv, 1);
 -	modexShowPage(mv.page);
++	    }
+ 	}
++
++	keyp(ch);
 +
-     /* spin for a time */
-     for(x=0; x<500; x++) {
-         modexWaitBorder();
      }
  
 -    // spin for a time 
 -    /*for(x=0; x<500; x++) {
 -        modexWaitBorder();
 -    }*/
 -    //while(1){
 -//			ch=getch();
 -			//printf("0x%02x\n", ch);
 -			keyp(ch);
 -//			if(ch==0x71)break; // 'q'
 -//			if(ch==0x1b)break; // 'ESC'
 -}
 -    modexLeave();
 -	setkb(0);
 +    modexLeave();
++    setkb(0);
  }
  
  
diff --cc 16/modex16/scroll.exe
index ee38ecba,321a7a72..3d700ec2
Binary files differ