]> 4ch.mooo.com Git - 16.git/commitdiff
modified: 16/16.txt
authorsparky4 <sparky4@4ch.maidlab.jp>
Mon, 5 May 2014 04:23:36 +0000 (23:23 -0500)
committersparky4 <sparky4@4ch.maidlab.jp>
Mon, 5 May 2014 04:23:36 +0000 (23:23 -0500)
modified:   16/DOS_GFX.EXE
modified:   16/Project 16.bfproject
deleted:    16/W
modified:   16/dos_gfx.cpp
modified:   16/dos_gfx.h

16/16.txt
16/DOS_GFX.EXE
16/Project 16.bfproject
16/W [deleted file]
16/dos_gfx.cpp
16/dos_gfx.h

index 17cae05342eb24fca37af98338a286a6a01494d0..0b7a3e91ec2e3b9cc0295ddac1bf3662ff98644d 100644 (file)
--- a/16/16.txt
+++ b/16/16.txt
@@ -20,190 +20,190 @@ Something like
 #define TILES_X = NTILES_X - 1
 #define TILES_Y = NTILES_Y - 1
 struct vp_node {
-    uint8_t tile;
-    struct vp_node *up;
-    struct vp_node *right;
-    struct vp_node *down;
-    struct vp_node *left;
+       uint8_t tile;
+       struct vp_node *up;
+       struct vp_node *right;
+       struct vp_node *down;
+       struct vp_node *left;
 };
 struct viewport {
-    uint8_t offset_x; //X offset in pixels
-    uint8_t offset_y; //Y offset in pixels
-    uint16_t world_offset_x;
-    uint16_t world_offset_y;
-    struct vp_node *upper_left; //pointer to the upper left tile
+       uint8_t offset_x; //X offset in pixels
+       uint8_t offset_y; //Y offset in pixels
+       uint16_t world_offset_x;
+       uint16_t world_offset_y;
+       struct vp_node *upper_left; //pointer to the upper left tile
 };
 void initvp(struct viewport *vp, uint8_t **world_matrix, uint16_t offset_x, uint16_t offset_y) {
-    int i, j;
-    struct vp_node *vp_tmp[NTILES_Y][NTILES_X]; //i'd like to copy it
-    for(i=0; i<NTILES_Y; i++) {
-        for(j=0; j<NTILES_X; j++) {
-            vp_tmp[i][j] = malloc(sizeof(struct vp_node));
-            vp_tmp[i][j]->tile = world_matrix[offset_x + i][offset_y + j];
-        }
-    }
-    // i for line, j for column
-    // linking neighbouring tiles
-    // wait, do we need links to left and up?
-    for(i=0; i<NTILES_Y; i++) {
-        for(j=0; j<NTILES_X; j++) {
-            if(i) vp_tmp[i][j]->up = vp_tmp[i-1][j];
-            else vp_tmp[i][j]->up = NULL;
-            if(j) vp_tmp[i][j]->left = vp_tmp[i][j-1];
-            else vp_tmp[i][j]->left = NULL;
-            if(i<20) vp_tmp[i][j]->down = vp_tmp[i+1][j];
-            else vp_tmp[i][j]->down = NULL;
-            if(j<15) vp_tmp[i][j]->right = vp_tmp[i][j+1];
-            else vp_tmp[i][j]->right = NULL;
-        }
-    }
-    vp = malloc(sizeof(struct viewport));
-    vp->offset_x = 0;
-    vp->offset_y = 0;
-    vp->world_offset_x = offset_x;
-    vp->world_offset_y = offset_y;
-    vp->upper_left = vp_tmp[0][0];
+       int i, j;
+       struct vp_node *vp_tmp[NTILES_Y][NTILES_X]; //i'd like to copy it
+       for(i=0; i<NTILES_Y; i++) {
+               for(j=0; j<NTILES_X; j++) {
+                       vp_tmp[i][j] = malloc(sizeof(struct vp_node));
+                       vp_tmp[i][j]->tile = world_matrix[offset_x + i][offset_y + j];
+               }
+       }
+       // i for line, j for column
+       // linking neighbouring tiles
+       // wait, do we need links to left and up?
+       for(i=0; i<NTILES_Y; i++) {
+               for(j=0; j<NTILES_X; j++) {
+                       if(i) vp_tmp[i][j]->up = vp_tmp[i-1][j];
+                       else vp_tmp[i][j]->up = NULL;
+                       if(j) vp_tmp[i][j]->left = vp_tmp[i][j-1];
+                       else vp_tmp[i][j]->left = NULL;
+                       if(i<20) vp_tmp[i][j]->down = vp_tmp[i+1][j];
+                       else vp_tmp[i][j]->down = NULL;
+                       if(j<15) vp_tmp[i][j]->right = vp_tmp[i][j+1];
+                       else vp_tmp[i][j]->right = NULL;
+               }
+       }
+       vp = malloc(sizeof(struct viewport));
+       vp->offset_x = 0;
+       vp->offset_y = 0;
+       vp->world_offset_x = offset_x;
+       vp->world_offset_y = offset_y;
+       vp->upper_left = vp_tmp[0][0];
 }
 void scroll(struct viewport *vp, uint8_t **world_matrix, int8_t offset_x, int8_t offset_y) {
-    int8_t offset_x_total = offset_x + vp->offset_x;
-    int8_t offset_y_total = offset_y + vp->offset_y;
-    if(offset_x_total > 15) shift_right(vp, world_matrix);
-    if(offset_x_total < 0) shift_left(vp, world_matrix);
-    if(offset_y_total > 15) shift_down(vp, world_matrix);
-    if(offset_y_total < 0) shift_up(vp, world_matrix);
-    vp->offset_x = offset_x_total % 16;
-    vp->offset_y = offset_y_total % 16;
+       int8_t offset_x_total = offset_x + vp->offset_x;
+       int8_t offset_y_total = offset_y + vp->offset_y;
+       if(offset_x_total > 15) shift_right(vp, world_matrix);
+       if(offset_x_total < 0) shift_left(vp, world_matrix);
+       if(offset_y_total > 15) shift_down(vp, world_matrix);
+       if(offset_y_total < 0) shift_up(vp, world_matrix);
+       vp->offset_x = offset_x_total % 16;
+       vp->offset_y = offset_y_total % 16;
 }
 void shift_right(struct viewport *vp, uint8_t **world_matrix) {
-    vp->world_offset_x += 1;
-    struct vp_node *tmp = vp->upper_left;
-    vp->upper_left = vp->upper_left->right;
-    while(tmp->down) {
-        tmp->right->left = NULL;
-        tmp = tmp->down;
-        free(tmp->up);
-    }
-    tmp->right->left = NULL;
-    free(tmp);
-    // Starting from the upper left corner
-    tmp = vp->upper_left;
-    // Looking up the rightmost tile
-    while(tmp->right) tmp = tmp->right;
-    // Here and below: allocating and linking new neighbouring tiles
-    int i=0;
-    tmp->right = malloc(sizeof(struct vp_node));
-    tmp->right->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x +20];
-    tmp->right->left = tmp;
-    tmp->right->up = NULL;
-    tmp->right->right = NULL;
-    while(tmp->down) {
-        tmp = tmp->down;
-        tmp->right = malloc(sizeof(struct vp_node));
-        tmp->right->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x + 20];
-        tmp->right->left = tmp;
-        tmp->right->up = tmp->up->right;
-        tmp->up->right->down = tmp->right;
-        tmp->right->right = NULL;
-    }
-    tmp->right->down = NULL;
-    // looks like we've just added a column
+       vp->world_offset_x += 1;
+       struct vp_node *tmp = vp->upper_left;
+       vp->upper_left = vp->upper_left->right;
+       while(tmp->down) {
+               tmp->right->left = NULL;
+               tmp = tmp->down;
+               free(tmp->up);
+       }
+       tmp->right->left = NULL;
+       free(tmp);
+       // Starting from the upper left corner
+       tmp = vp->upper_left;
+       // Looking up the rightmost tile
+       while(tmp->right) tmp = tmp->right;
+       // Here and below: allocating and linking new neighbouring tiles
+       int i=0;
+       tmp->right = malloc(sizeof(struct vp_node));
+       tmp->right->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x +20];
+       tmp->right->left = tmp;
+       tmp->right->up = NULL;
+       tmp->right->right = NULL;
+       while(tmp->down) {
+               tmp = tmp->down;
+               tmp->right = malloc(sizeof(struct vp_node));
+               tmp->right->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x + 20];
+               tmp->right->left = tmp;
+               tmp->right->up = tmp->up->right;
+               tmp->up->right->down = tmp->right;
+               tmp->right->right = NULL;
+       }
+       tmp->right->down = NULL;
+       // looks like we've just added a column
 }
 void shift_left(struct viewport *vp, uint8_t **world_matrix) {
-    vp->world_offset_x -= 1;
-    // Removing the rightmost column first
-    struct vp_node *tmp = vp->upper_left;
-    while(tmp->right) tmp = tmp->right;
-    while(tmp->down) {
-        tmp->left->right = NULL;
-        tmp = tmp->down;
-        free(tmp->up);
-    }
-    tmp->left->right = NULL;
-    free(tmp);
-    // Now we need to add a new column to the left
-    tmp = vp->upper_left;
-    // Here and below: allocating and linking new neighbouring tiles
-    int i=0;
-    tmp->left = malloc(sizeof(struct vp_node));
-    tmp->left->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-    tmp->left->right = tmp;
-    tmp->left->up = NULL;
-    tmp->left->left = NULL;
-    while(tmp->down) {
-        tmp = tmp->down;
-        tmp->left = malloc(sizeof(struct vp_node));
-        tmp->left->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-        tmp->left->right = tmp;
-        tmp->left->up = tmp->up->left;
-        tmp->up->left->down = tmp->left;
-        tmp->left->left = NULL;
-    }
-    tmp->left->down = NULL;
-    // looks like we've just added a column to the left
+       vp->world_offset_x -= 1;
+       // Removing the rightmost column first
+       struct vp_node *tmp = vp->upper_left;
+       while(tmp->right) tmp = tmp->right;
+       while(tmp->down) {
+               tmp->left->right = NULL;
+               tmp = tmp->down;
+               free(tmp->up);
+       }
+       tmp->left->right = NULL;
+       free(tmp);
+       // Now we need to add a new column to the left
+       tmp = vp->upper_left;
+       // Here and below: allocating and linking new neighbouring tiles
+       int i=0;
+       tmp->left = malloc(sizeof(struct vp_node));
+       tmp->left->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+       tmp->left->right = tmp;
+       tmp->left->up = NULL;
+       tmp->left->left = NULL;
+       while(tmp->down) {
+               tmp = tmp->down;
+               tmp->left = malloc(sizeof(struct vp_node));
+               tmp->left->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+               tmp->left->right = tmp;
+               tmp->left->up = tmp->up->left;
+               tmp->up->left->down = tmp->left;
+               tmp->left->left = NULL;
+       }
+       tmp->left->down = NULL;
+       // looks like we've just added a column to the left
 }
 void shift_down(struct viewport *vp, uint8_t **world_matrix) {
-    vp->world_offset_y += 1;
-    // Removing the upper row first
-    struct vp_node *tmp = vp->upper_left->down;
-    vp->upper_left = tmp;
-    do {
-        free(tmp->up);
-        tmp->up = NULL;
-    } while(tmp->right);
-    // Now we need to add a new column to the bottom
-    tmp = vp->upper_left;
-    while(tmp->down) tmp = tmp->down;
-    // Here and below: allocating and linking new neighbouring tiles
-    int i=0;
-    tmp->down = malloc(sizeof(struct vp_node));
-    tmp->dpwn->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-    tmp->down->left = NULL;
-    tmp->down->up = tmp;
-    tmp->down->down = NULL;
-    while(tmp->right) {
-        tmp = tmp->right;
-        tmp->down = malloc(sizeof(struct vp_node));
-        tmp->down->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-        tmp->down->up = tmp;
-        tmp->down->left = tmp->left->down;
-        tmp->left->down->right = tmp->down;
-        tmp->down->down = NULL;
-    }
-    tmp->down->right = NULL;
-    // looks like we've just added a row to the bottom
+       vp->world_offset_y += 1;
+       // Removing the upper row first
+       struct vp_node *tmp = vp->upper_left->down;
+       vp->upper_left = tmp;
+       do {
+               free(tmp->up);
+               tmp->up = NULL;
+       } while(tmp->right);
+       // Now we need to add a new column to the bottom
+       tmp = vp->upper_left;
+       while(tmp->down) tmp = tmp->down;
+       // Here and below: allocating and linking new neighbouring tiles
+       int i=0;
+       tmp->down = malloc(sizeof(struct vp_node));
+       tmp->dpwn->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+       tmp->down->left = NULL;
+       tmp->down->up = tmp;
+       tmp->down->down = NULL;
+       while(tmp->right) {
+               tmp = tmp->right;
+               tmp->down = malloc(sizeof(struct vp_node));
+               tmp->down->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+               tmp->down->up = tmp;
+               tmp->down->left = tmp->left->down;
+               tmp->left->down->right = tmp->down;
+               tmp->down->down = NULL;
+       }
+       tmp->down->right = NULL;
+       // looks like we've just added a row to the bottom
 }
 void shift_up(struct viewport *vp, uint8_t **world_matrix) {
-    vp->world_offset_y += 1;
-    // Removing the bottom row first
-    struct vp_node *tmp = vp->upper_left;
-    while(tmp->down) tmp = tmp->down;
-    while(tmp->right) {
-        tmp->up->down = NULL;
-        tmp = tmp->right;
-        free(tmp->left);
-    }
-    tmp->up->down = NULL;
-    free(tmp);
-    // Now we need to add a new row to the top
-    tmp = vp->upper_left;
-    // Here and below: allocating and linking new neighbouring tiles
-    int i=0;
-    tmp->up = malloc(sizeof(struct vp_node));
-    tmp->up->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-    tmp->up->left = NULL;
-    tmp->up->down = tmp;
-    tmp->up->up = NULL;
-    while(tmp->right) {
-        tmp = tmp->right;
-        tmp->up = malloc(sizeof(struct vp_node));
-        tmp->up->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
-        tmp->up->down = tmp;
-        tmp->up->left = tmp->left->up;
-        tmp->left->up->right = tmp->up;
-        tmp->up->up = NULL;
-    }
-    tmp->up->right = NULL;
-    // looks like we've just added a row to the top
+       vp->world_offset_y += 1;
+       // Removing the bottom row first
+       struct vp_node *tmp = vp->upper_left;
+       while(tmp->down) tmp = tmp->down;
+       while(tmp->right) {
+               tmp->up->down = NULL;
+               tmp = tmp->right;
+               free(tmp->left);
+       }
+       tmp->up->down = NULL;
+       free(tmp);
+       // Now we need to add a new row to the top
+       tmp = vp->upper_left;
+       // Here and below: allocating and linking new neighbouring tiles
+       int i=0;
+       tmp->up = malloc(sizeof(struct vp_node));
+       tmp->up->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+       tmp->up->left = NULL;
+       tmp->up->down = tmp;
+       tmp->up->up = NULL;
+       while(tmp->right) {
+               tmp = tmp->right;
+               tmp->up = malloc(sizeof(struct vp_node));
+               tmp->up->tile = world_matrix[vp->world_offset_y + i++][vp->world_offset_x];
+               tmp->up->down = tmp;
+               tmp->up->left = tmp->left->up;
+               tmp->left->up->right = tmp->up;
+               tmp->up->up = NULL;
+       }
+       tmp->up->right = NULL;
+       // looks like we've just added a row to the top
 }
 void render_vp(struct viewport *vp);
 
index 1cdab2127cd3011d68964db88afab1ceecbaf207..d3df3f89e3dbf4dfcca1123e0ce6f53b21ad9b54 100644 (file)
Binary files a/16/DOS_GFX.EXE and b/16/DOS_GFX.EXE differ
index 7521911864dc3446681c09461290d9591f023dfb..25b9d51e2ba80f90f0594dcd4e3c6a6fadc36a3a 100644 (file)
@@ -1,21 +1,13 @@
 c2e.convert_special: 0
 e2c.convert_num: 0
-openfiles: /dos/z/16/16/dos_gfx.cpp:6903:6589:1:
-openfiles: /dos/z/16/16/dos_gfx.h:1122:268:0:
-openfiles: /dos/z/16/16/dos_kb.c:1870:1395:0:
-openfiles: /dos/z/16/16/dos_kb.h:0:0:0:
-openfiles: /dos/z/16/16/lib_com.cpp:0:0:0:
+openfiles: /dos/z/16/16/dos_gfx.cpp:8340:8091:1:
+openfiles: /dos/z/16/16/dos_gfx.h:941:268:0:
+openfiles: /dos/z/16/16/dos_kb.c:759:642:0:
+openfiles: /dos/z/16/16/dos_kb.h:179:0:0:
+openfiles: /dos/z/16/16/lib_com.cpp:164:0:0:
 openfiles: /dos/z/16/16/lib_com.h:0:0:0:
 openfiles: /dos/z/16/16/16.txt:0:0:0:
-openfiles: /dos/z/16/16/project16.txt:1737:476:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/FONT1.H:0:0:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/FONT2.H:0:0:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/TAURON.H:0:0:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/MODES_C.INC:0:7495:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/PALETTE.INC:1213:2412:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/CLEAR.CPP:1394:2142:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/MODES.CPP:0:0:0:
-openfiles: /dos/z/4x4_16/tauron/C_SRC/TESTS.CPP:3437:3167:0:
+openfiles: /dos/z/16/16/project16.txt:1755:1676:0:
 snr_recursion_level: 0
 convertcolumn_horizontally: 0
 adv_open_matchname: 0
@@ -30,11 +22,12 @@ c2e.convert_iso: 0
 opendir: file:///dos/z/4x4_16/tauron/C_SRC
 wrap_text_default: 0
 bookmarks_filename_mode: 1
-ssearch_text: fill_plane(
+ssearch_text: fmem
 snr_casesens: 0
 view_blocks: 1
 name: project 16
 replacelist: てすと
+replacelist: \t
 fb_show_hidden_f: 0
 editor_tab_width: 4
 show_visible_spacing: 1
@@ -48,25 +41,25 @@ ssearch_regex: 0
 e2c.convert_iso: 0
 ssearch_casesens: 0
 charmap_block: 1
+recent_files: file:///dos/z/grdemo.c
+recent_files: file:///dos/z/4x4_16/tauron/C_SRC/DUAL.CPP
+recent_files: file:///dos/z/4x4_16/tauron/C_SRC/MAINC.CPP
+recent_files: file:///dos/z/16/16/dos_gfx.cpp
 recent_files: file:///dos/z/16/16/dos_gfx.h
-recent_files: file:///dos/z/16/16/lib_com.cpp
-recent_files: file:///dos/z/16/16/lib_com.h
 recent_files: file:///dos/z/16/16/dos_kb.h
 recent_files: file:///dos/z/16/16/dos_kb.c
-recent_files: file:///dos/z/16/16/dos_gfx.cpp
+recent_files: file:///dos/z/16/16/lib_com.h
+recent_files: file:///dos/z/16/16/lib_com.cpp
 recent_files: file:///dos/z/16/16/project16.txt
 recent_files: file:///dos/z/16/16/16.txt
-recent_files: file:///dos/z/grdemo.c
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/PALETTE.INC
-recent_files: file:///dos/z/4x4_16/tauron/C_SRC/DUAL.CPP
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/TAURON.H
-recent_files: file:///dos/z/4x4_16/tauron/C_SRC/MAINC.CPP
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/CLEAR.CPP
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/MODES_C.INC
-recent_files: file:///dos/z/4x4_16/tauron/C_SRC/FONT2.H
-recent_files: file:///dos/z/4x4_16/tauron/C_SRC/FONT1.H
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/TESTS.CPP
 recent_files: file:///dos/z/4x4_16/tauron/C_SRC/MODES.CPP
+recent_files: file:///dos/z/4x4_16/tauron/C_SRC/FONT1.H
+recent_files: file:///dos/z/4x4_16/tauron/C_SRC/FONT2.H
 snr_replacetype: 0
 savedir: file:///dos/z/16/16
 spell_check_default: 1
@@ -78,11 +71,6 @@ snr_escape_chars: 0
 htmlbar_view: 1
 spell_lang: en
 ssearch_dotmatchall: 0
-searchlist: \82Ä\82·\82Æ
-searchlist: LGQ
-searchlist: plot
-searchlist: out
-searchlist: put
 searchlist: put
 searchlist: print
 searchlist: d put
@@ -93,6 +81,11 @@ searchlist: red
 searchlist: rext
 searchlist: rect`-
 searchlist: fill_plane(
+searchlist: fmemset
+searchlist: se
+searchlist:     
+searchlist: rect
+searchlist: fmem
 autocomplete: 1
 outputb_show_all_output: 0
 bookmarks_show_mode: 0
diff --git a/16/W b/16/W
deleted file mode 100644 (file)
index f5334d4..0000000
--- a/16/W
+++ /dev/null
@@ -1,5 +0,0 @@
-3\r
-Where to next?  It's your move! wwww\r
-bakapi ver. 1.04.09a\r
-is made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\r
-Licence: GPL v2\r
index 5f31ad4ef6faf3d55eda112fbe71e8a5695e19c3..c1d9f135759496947c31c43793e6b6ef5ae7deff 100644 (file)
@@ -6,20 +6,20 @@
  *\r
  * Simple graphics library to accompany the article\r
  * \r
- *                     INTRODUCTION TO MODE X.\r
+ *                                       INTRODUCTION TO MODE X.\r
  * \r
  * This library provides the basic functions for initializing and using\r
  * unchained (planar) 256-color VGA modes.  Currently supported are:\r
  *\r
- *     - 320x200\r
- *     - 320x240\r
+ *       - 320x200\r
+ *       - 320x240\r
  *\r
  * Functions are provided for:\r
  *\r
- *     - initializing one of the available modes\r
- *     - setting the start address of the VGA refresh data\r
- *     - setting active and visible display pages\r
- *     - writing and reading a single pixel to/from video memory\r
+ *       - initializing one of the available modes\r
+ *       - setting the start address of the VGA refresh data\r
+ *       - setting active and visible display pages\r
+ *       - writing and reading a single pixel to/from video memory\r
  *\r
  * The library is provided as a demonstration only, and is not claimed\r
  * to be particularly efficient or suited for any purpose.  It has only\r
@@ -76,10 +76,10 @@ byte coor;
 /*\r
  * Define the port addresses of some VGA registers.\r
  */\r
-#define CRTC_ADDR      0x3d4   /* Base port of the CRT Controller (color) */\r
+#define CRTC_ADDR         0x3d4   /* Base port of the CRT Controller (color) */\r
 \r
-#define SEQU_ADDR      0x3c4   /* Base port of the Sequencer */\r
-#define GRAC_ADDR      0x3ce   /* Base port of the Graphics Controller */\r
+#define SEQU_ADDR         0x3c4   /* Base port of the Sequencer */\r
+#define GRAC_ADDR         0x3ce   /* Base port of the Graphics Controller */\r
 \r
 \r
 /*\r
@@ -105,56 +105,56 @@ unsigned actStart, visStart;
 \r
 /*\r
  * set320x200x256_X()\r
- *     sets mode 13h, then turns it into an unchained (planar), 4-page\r
- *     320x200x256 mode.\r
+ *       sets mode 13h, then turns it into an unchained (planar), 4-page\r
+ *       320x200x256 mode.\r
  */\r
 void set320x200x256_X(void)\r
-       {\r
-       union REGS r;\r
+               {\r
+               union REGS r;\r
 \r
-       /* Set VGA BIOS mode 13h: */\r
-       r.x.ax = 0x0013;\r
-       int86(0x10, &r, &r);\r
+               /* Set VGA BIOS mode 13h: */\r
+               r.x.ax = 0x0013;\r
+               int86(0x10, &r, &r);\r
 \r
-       /* Turn off the Chain-4 bit (bit 3 at index 4, port 0x3c4): */\r
-       outpw(SEQU_ADDR, 0x0604);\r
+               /* Turn off the Chain-4 bit (bit 3 at index 4, port 0x3c4): */\r
+               outpw(SEQU_ADDR, 0x0604);\r
 \r
-       /* Turn off word mode, by setting the Mode Control register\r
-       of the CRT Controller (index 0x17, port 0x3d4): */\r
-       outpw(CRTC_ADDR, 0xE317);\r
+               /* Turn off word mode, by setting the Mode Control register\r
+               of the CRT Controller (index 0x17, port 0x3d4): */\r
+               outpw(CRTC_ADDR, 0xE317);\r
 \r
-       /* Turn off doubleword mode, by setting the Underline Location\r
-          register (index 0x14, port 0x3d4): */\r
-       outpw(CRTC_ADDR, 0x0014);\r
+               /* Turn off doubleword mode, by setting the Underline Location\r
+                  register (index 0x14, port 0x3d4): */\r
+               outpw(CRTC_ADDR, 0x0014);\r
 \r
-       /* Clear entire video memory, by selecting all four planes, then\r
-          writing 0 to entire segment. */\r
-       outpw(SEQU_ADDR, 0x0F02);\r
-       memset(vga+1, 0, 0xffff); /* stupid size_t exactly 1 too small */\r
-       vga[0] = 0;\r
+               /* Clear entire video memory, by selecting all four planes, then\r
+                  writing 0 to entire segment. */\r
+               outpw(SEQU_ADDR, 0x0F02);\r
+               memset(vga+1, 0, 0xffff); /* stupid size_t exactly 1 too small */\r
+               vga[0] = 0;\r
 \r
-       /* Update the global variables to reflect dimensions of this\r
-          mode.  This is needed by most future drawing operations. */\r
-       width           = 320;\r
-       height  = 200;\r
+               /* Update the global variables to reflect dimensions of this\r
+                  mode.  This is needed by most future drawing operations. */\r
+               width              = 320;\r
+               height  = 200;\r
 \r
-       /* Each byte addresses four pixels, so the width of a scan line\r
-          in *bytes* is one fourth of the number of pixels on a line. */\r
-       widthBytes = width / 4;\r
+               /* Each byte addresses four pixels, so the width of a scan line\r
+                  in *bytes* is one fourth of the number of pixels on a line. */\r
+               widthBytes = width / 4;\r
 \r
-       /* By default we want screen refreshing and drawing operations\r
-          to be based at offset 0 in the video segment. */\r
-       actStart = visStart = 0;\r
-       }\r
+               /* By default we want screen refreshing and drawing operations\r
+                  to be based at offset 0 in the video segment. */\r
+               actStart = visStart = 0;\r
+               }\r
 \r
 /*\r
  * setActiveStart() tells our graphics operations which address in video\r
  * memory should be considered the top left corner.\r
  */\r
 void setActiveStart(unsigned offset)\r
-       {\r
-       actStart = offset;\r
-       }\r
+               {\r
+               actStart = offset;\r
+               }\r
 \r
 /*\r
  * setVisibleStart() tells the VGA from which byte to fetch the first\r
@@ -165,13 +165,13 @@ void setActiveStart(unsigned offset)
  * set, but before the low byte is set, which produces a bad flicker.\r
  */\r
 void setVisibleStart(unsigned offset)\r
-       {\r
-       visStart = offset;\r
-       outpw(CRTC_ADDR, 0x0C);         /* set high byte */\r
-       outpw(CRTC_ADDR+1, visStart >> 8);\r
-       outpw(CRTC_ADDR, 0x0D);         /* set low byte */\r
-       outpw(CRTC_ADDR+1, visStart & 0xff);\r
-       }\r
+               {\r
+               visStart = offset;\r
+               outpw(CRTC_ADDR, 0x0C);          /* set high byte */\r
+               outpw(CRTC_ADDR+1, visStart >> 8);\r
+               outpw(CRTC_ADDR, 0x0D);          /* set low byte */\r
+               outpw(CRTC_ADDR+1, visStart & 0xff);\r
+               }\r
 \r
 /*\r
  * setXXXPage() sets the specified page by multiplying the page number\r
@@ -180,125 +180,134 @@ void setVisibleStart(unsigned offset)
  * function.  The first page is number 0.\r
  */\r
 void setActivePage(int page)\r
-       {\r
-       setActiveStart(page * widthBytes * height);\r
-       }\r
+               {\r
+               setActiveStart(page * widthBytes * height);\r
+               }\r
 \r
 void setVisiblePage(int page)\r
-       {\r
-       setVisibleStart(page * widthBytes * height);\r
-       }\r
+               {\r
+               setVisibleStart(page * widthBytes * height);\r
+               }\r
 \r
 void putPixel_X(int x, int y, byte color)\r
-       {\r
-       /* Each address accesses four neighboring pixels, so set\r
-          Write Plane Enable according to which pixel we want\r
-          to modify.  The plane is determined by the two least\r
-          significant bits of the x-coordinate: */\r
-       outp(0x3c4, 0x02);\r
-       outp(0x3c5, 0x01 << (x & 3));\r
-\r
-       /* The offset of the pixel into the video segment is\r
-          offset = (width * y + x) / 4, and write the given\r
-          color to the plane we selected above.  Heed the active\r
-          page start selection. */\r
-       vga[(unsigned)(widthBytes * y) + (x / 4) + actStart] = color;\r
-\r
-       }\r
+               {\r
+               /* Each address accesses four neighboring pixels, so set\r
+                  Write Plane Enable according to which pixel we want\r
+                  to modify.  The plane is determined by the two least\r
+                  significant bits of the x-coordinate: */\r
+               outp(0x3c4, 0x02);\r
+               outp(0x3c5, 0x01 << (x & 3));\r
+\r
+               /* The offset of the pixel into the video segment is\r
+                  offset = (width * y + x) / 4, and write the given\r
+                  color to the plane we selected above.  Heed the active\r
+                  page start selection. */\r
+               vga[(unsigned)(widthBytes * y) + (x / 4) + actStart] = color;\r
+\r
+               }\r
 \r
 byte getPixel_X(int x, int y)\r
-       {\r
-       /* Select the plane from which we must read the pixel color: */\r
-       outpw(GRAC_ADDR, 0x04);\r
-       outpw(GRAC_ADDR+1, x & 3);\r
+               {\r
+               /* Select the plane from which we must read the pixel color: */\r
+               outpw(GRAC_ADDR, 0x04);\r
+               outpw(GRAC_ADDR+1, x & 3);\r
 \r
-       return vga[(unsigned)(widthBytes * y) + (x / 4) + actStart];\r
+               return vga[(unsigned)(widthBytes * y) + (x / 4) + actStart];\r
 \r
-       }\r
+               }\r
 \r
 void set320x240x256_X(void)\r
-       {\r
-       /* Set the unchained version of mode 13h: */\r
-       set320x200x256_X();\r
-\r
-       /* Modify the vertical sync polarity bits in the Misc. Output\r
-          Register to achieve square aspect ratio: */\r
-       outp(0x3C2, 0xE3);\r
-\r
-       /* Modify the vertical timing registers to reflect the increased\r
-          vertical resolution, and to center the image as good as\r
-          possible: */\r
-       outpw(0x3D4, 0x2C11);           /* turn off write protect */\r
-       outpw(0x3D4, 0x0D06);           /* vertical total */\r
-       outpw(0x3D4, 0x3E07);           /* overflow register */\r
-       outpw(0x3D4, 0xEA10);           /* vertical retrace start */\r
-       outpw(0x3D4, 0xAC11);           /* vertical retrace end AND wr.prot */\r
-       outpw(0x3D4, 0xDF12);           /* vertical display enable end */\r
-       outpw(0x3D4, 0xE715);           /* start vertical blanking */\r
-       outpw(0x3D4, 0x0616);           /* end vertical blanking */\r
-\r
-       /* Update mode info, so future operations are aware of the\r
-          resolution */\r
-       height = 240;\r
-\r
-       }\r
-
-
-/*tile*/
+               {\r
+               /* Set the unchained version of mode 13h: */\r
+               set320x200x256_X();\r
+\r
+               /* Modify the vertical sync polarity bits in the Misc. Output\r
+                  Register to achieve square aspect ratio: */\r
+               outp(0x3C2, 0xE3);\r
+\r
+               /* Modify the vertical timing registers to reflect the increased\r
+                  vertical resolution, and to center the image as good as\r
+                  possible: */\r
+               outpw(0x3D4, 0x2C11);              /* turn off write protect */\r
+               outpw(0x3D4, 0x0D06);              /* vertical total */\r
+               outpw(0x3D4, 0x3E07);              /* overflow register */\r
+               outpw(0x3D4, 0xEA10);              /* vertical retrace start */\r
+               outpw(0x3D4, 0xAC11);              /* vertical retrace end AND wr.prot */\r
+               outpw(0x3D4, 0xDF12);              /* vertical display enable end */\r
+               outpw(0x3D4, 0xE715);              /* start vertical blanking */\r
+               outpw(0x3D4, 0x0616);              /* end vertical blanking */\r
+\r
+               /* Update mode info, so future operations are aware of the\r
+                  resolution */\r
+               height = 240;\r
+\r
+               }\r
+\r
+\r
+/*tile*/\r
 // This is Bresenham's Line Drawing Algorithm\r
 void drawline(int x1, int y1, int x2, int y2, char col)\r
 {\r
-       int d, x, y, ax, ay, sx, sy, dx, dy;\r
-\r
-       dx = x2-x1;\r
-       ax = ABS(dx) << 1;\r
-       sx = SGN(dx);\r
-       dy = y2-y1;\r
-       ay = ABS(dy) << 1;\r
-       sy = SGN(dy);\r
-\r
-       x = x1;\r
-       y = y1;\r
-       if( ax > ay )\r
-       {\r
-               d = ay - (ax >> 1);\r
-               while( x != x2 )\r
+               int d, x, y, ax, ay, sx, sy, dx, dy;\r
+\r
+               dx = x2-x1;\r
+               ax = ABS(dx) << 1;\r
+               sx = SGN(dx);\r
+               dy = y2-y1;\r
+               ay = ABS(dy) << 1;\r
+               sy = SGN(dy);\r
+\r
+               x = x1;\r
+               y = y1;\r
+               if( ax > ay )\r
                {\r
-                       putPixel_X( x, y, col );\r
-                       if( d >= 0 )\r
-                       {\r
-                               y += sy;\r
-                               d -= ax;\r
-                       }\r
-               x += sx;\r
-               d += ay;\r
+                               d = ay - (ax >> 1);\r
+                               while( x != x2 )\r
+                               {\r
+                                               putPixel_X( x, y, col );\r
+                                               if( d >= 0 )\r
+                                               {\r
+                                                               y += sy;\r
+                                                               d -= ax;\r
+                                               }\r
+                               x += sx;\r
+                               d += ay;\r
+                               }\r
                }\r
-       }\r
-       else\r
-       {\r
-               d = ax - (ay >> 1);\r
-               while( y != y2 )\r
+               else\r
                {\r
-                       putPixel_X( x, y, col );\r
-                       if( d >= 0 )\r
-                       {\r
-                               x += sx;\r
-                               d -= ay;\r
-                       }\r
-                       y += sy;\r
-                       d += ax;\r
+                               d = ax - (ay >> 1);\r
+                               while( y != y2 )\r
+                               {\r
+                                               putPixel_X( x, y, col );\r
+                                               if( d >= 0 )\r
+                                               {\r
+                                                               x += sx;\r
+                                                               d -= ay;\r
+                                               }\r
+                                               y += sy;\r
+                                               d += ax;\r
+                               }\r
                }\r
-       }\r
-       return;\r
+               return;\r
 }\r
 \r
 void drawrect(int x1, int y1, int x2, int y2, char color)\r
-{
-       drawline(x1,y1,x2,y1,color);\r
+{\r
+       /*drawline(x1,y1,x2,y1,color);\r
        drawline(x1,y2,x2,y2,color);\r
        drawline(x1,y1,x1,y2,color);\r
-       drawline(x2,y1,x2,y2+1,color);\r
-}
+       drawline(x2,y1,x2,y2+1,color);*/
+       //_fmemset(vga+x1+y2, color, 16*16);
+       byte far *p;
+       
+       p=vga+y1*width+x1;  // make p point to the start of the line
+       while((y2-y1))                  // repeat for entire line height
+               {
+               _fmemset(p, color, x2-x1);      // set one line
+               p+=width;               // move down one row
+               }\r
+}\r
 \r
 \r
 /*-----------XXXX-------------*/\r
@@ -312,252 +321,252 @@ void drawrect(int x1, int y1, int x2, int y2, char color)
 int far *\r
 getFont()\r
 {\r
-    union REGPACK rg;\r
-    int seg;\r
-    int off;\r
-    memset(&rg, 0, sizeof(rg));\r
-\r
-    rg.w.ax = 0x1130;\r
-    rg.h.bh = 0x03;\r
-    intr(0x10, &rg);\r
-    seg = rg.w.es;\r
-    off = rg.w.bp;\r
-    \r
-\r
-    return (int far *)MK_FP(seg, off);\r
+       union REGPACK rg;\r
+       int seg;\r
+       int off;\r
+       memset(&rg, 0, sizeof(rg));\r
+\r
+       rg.w.ax = 0x1130;\r
+       rg.h.bh = 0x03;\r
+       intr(0x10, &rg);\r
+       seg = rg.w.es;\r
+       off = rg.w.bp;\r
+       \r
+\r
+       return (int far *)MK_FP(seg, off);\r
 }\r
 \r
 void drawChar(int x, int y, int color, byte c)\r
 {\r
-       int i, j;\r
-       int mask;\r
-       int far *font = getFont() + (c * 8);\r
-\r
-       for (i = 0; i < 8; i++)\r
-       {\r
-               mask = *font;\r
-               for (j = 0; j < 8; j++)\r
+               int i, j;\r
+               int mask;\r
+               int far *font = getFont() + (c * 8);\r
+\r
+               for (i = 0; i < 8; i++)\r
                {\r
-                       if (mask & 0x80)\r
-                       {\r
-                               //pixel(x + j, y + i, color);\r
-                               putPixel_X(x + j, y + i, color);\r
-                       }\r
-                       mask <<= 1;\r
+                               mask = *font;\r
+                               for (j = 0; j < 8; j++)\r
+                               {\r
+                                               if (mask & 0x80)\r
+                                               {\r
+                                                               //pixel(x + j, y + i, color);\r
+                                                               putPixel_X(x + j, y + i, color);\r
+                                               }\r
+                                               mask <<= 1;\r
+                               }\r
+                               font++;\r
                }\r
-               font++;\r
-       }\r
 }\r
 \r
 void drawText(int x, int y, int color, byte string)\r
 {\r
-       while (string)\r
-       {\r
-               drawChar(x, y, color, string);\r
-               x += 8;\r
-               string++;\r
-       }\r
+               while (string)\r
+               {\r
+                               drawChar(x, y, color, string);\r
+                               x += 8;\r
+                               string++;\r
+               }\r
 }\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
-//                                                                         //\r
-// setvideo() - This function Manages the video modes                      //\r
-//                                                                         //\r
+//                                                                                                                                              //\r
+// setvideo() - This function Manages the video modes                                    //\r
+//                                                                                                                                              //\r
 /////////////////////////////////////////////////////////////////////////////\r
 void setvideo(/*byte mode, */int vq){\r
-       union REGS in, out;\r
-\r
-       if(!vq){ // deinit the video\r
-               // change to the video mode we were in before we switched to mode 13h\r
-               in.h.ah = 0x00;\r
-               in.h.al = old_mode;\r
-               int86(0x10, &in, &out);\r
-\r
-       }else if(vq == 1){ // init the video\r
-               // get old video mode\r
-               in.h.ah = 0xf;\r
-               int86(0x10, &in, &out);\r
-               old_mode = out.h.al;\r
-\r
-               // enter mode\r
-               set320x240x256_X();\r
-       }\r
+               union REGS in, out;\r
+\r
+               if(!vq){ // deinit the video\r
+                               // change to the video mode we were in before we switched to mode 13h\r
+                               in.h.ah = 0x00;\r
+                               in.h.al = old_mode;\r
+                               int86(0x10, &in, &out);\r
+\r
+               }else if(vq == 1){ // init the video\r
+                               // get old video mode\r
+                               in.h.ah = 0xf;\r
+                               int86(0x10, &in, &out);\r
+                               old_mode = out.h.al;\r
+\r
+                               // enter mode\r
+                               set320x240x256_X();\r
+               }\r
 }\r
 \r
 /////////////////////////////////////////////////////////////////////////////\r
-//                                                                         //\r
+//                                                                                                                                              //\r
 // cls() - This clears the screen to the specified color, on the VGA or on //\r
-//         the Virtual screen.                                             //\r
-//                                                                         //\r
+//              the Virtual screen.                                                                                     //\r
+//                                                                                                                                              //\r
 /////////////////////////////////////////////////////////////////////////////\r
 void cls(byte color, byte *Where){\r
-       _fmemset(Where, color, width*height);\r
+               _fmemset(Where, color, width*(height*17));
 }\r
 \r
 //color \82Ä\82·\82Æ\r
 int colortest(){\r
-       if(gq < NUM_COLORS){\r
-               cls(gq, vga);\r
-               gq++;\r
-       }else gq = 0;\r
-       return gq;\r
+               if(gq < NUM_COLORS){\r
+                               cls(gq, vga);\r
+                               gq++;\r
+               }else gq = 0;\r
+               return gq;\r
 }\r
 \r
 //color \82Ä\82·\82Æ\r
 int colorz(){\r
-       if(gq < HGQ){\r
-//----         cls(gq, vaddr);\r
-               cls(gq, vga);\r
-               gq++;\r
-       }else gq = LGQ;\r
-       return gq;\r
+               if(gq < HGQ){\r
+//----           cls(gq, vaddr);\r
+                               cls(gq, vga);\r
+                               gq++;\r
+               }else gq = LGQ;\r
+               return gq;\r
 }\r
 \r
 //slow spectrum down\r
 void ssd(int svq){\r
-       if(sy < height+1){\r
-               if(sx < width+1){\r
-                       //plotpixel(xx, yy, coor, vga);\r
-                       //ppf(sx, sy, coor, vga);\r
-                       putPixel_X(sx, sy, coor);\r
-                       //printf("%d %d %d %d\n", sx, sy, svq, coor);\r
-                       sx++;\r
-               }else sx = 0;\r
-               if(sx == width){\r
-                       sy++;\r
-                       if(svq == 7) coor++;\r
-                       if(sy == height && svq == 8) coor = rand()%NUM_COLORS;\r
-               }\r
-       }else sy = 0;\r
+               if(sy < height+1){\r
+                               if(sx < width+1){\r
+                                               //plotpixel(xx, yy, coor, vga);\r
+                                               //ppf(sx, sy, coor, vga);\r
+                                               putPixel_X(sx, sy, coor);\r
+                                               //printf("%d %d %d %d\n", sx, sy, svq, coor);\r
+                                               sx++;\r
+                               }else sx = 0;\r
+                               if(sx == width){\r
+                                               sy++;\r
+                                               if(svq == 7) coor++;\r
+                                               if(sy == height && svq == 8) coor = rand()%NUM_COLORS;\r
+                               }\r
+               }else sy = 0;\r
 }\r
 \r
 /*-----------ding-------------*/\r
 int ding(int q){\r
-       setActivePage(0);\r
-       setVisiblePage(0);\r
-       int d3y;\r
-\r
-//++++ if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;\r
-       if((q == 2\r
-       ||q==4\r
-       ||q==16\r
-       ) && gq == BONK-1){\r
-                       if(coor < HGQ && coor < LGQ) coor = LGQ;\r
-                       if(coor < HGQ-1){\r
-                               coor++;\r
-               }else{ coor = LGQ;\r
-                       bakax = rand()%3; bakay = rand()%3;\r
+               setActivePage(0);\r
+               setVisiblePage(0);\r
+               int d3y;\r
+\r
+//++++  if(q <= 4 && q!=2 && gq == BONK-1) coor = rand()%HGQ;\r
+               if((q == 2\r
+               ||q==4\r
+               ||q==16\r
+               ) && gq == BONK-1){\r
+                                               if(coor < HGQ && coor < LGQ) coor = LGQ;\r
+                                               if(coor < HGQ-1){\r
+                                                               coor++;\r
+                               }else{ coor = LGQ;\r
+                                               bakax = rand()%3; bakay = rand()%3;\r
+                               }\r
                }\r
-       }\r
-\r
-       if(q == 5){ colortest(); return gq; }\r
-       if(q == 10){ colorz(); return gq; }\r
-       if(q == 11){ colorz(); delay(100); return gq; }\r
-       if(q == 8){ ssd(q); /*printf("%d\n", coor);*/ }\r
-       if(q == 6){\r
-               coor = rand()%NUM_COLORS;\r
-//----         cls(coor, vaddr);\r
-               cls(coor, vga);\r
-               //updatevbuff();\r
-       }\r
-\r
-       if(q == 7 || q== 9){\r
-               if(gq < HGQ){\r
-                       if(q == 7) ssd(q);\r
-                       if(q == 9){ ssd(q); coor++; }\r
-                       gq++;\r
-               }else gq = LGQ;\r
-       }\r
-       if((q<5 && gq<BONK) || (q==16 && gq<BONK)){ // the number variable make the colors more noticable\r
-               if(q==1){\r
-                       if(xx==width){bakax=0;}\r
-                       if(xx==0){bakax=1;}\r
-                       if(yy==height){bakay=0;}\r
-                       if(yy==0){bakay=1;}\r
-               }else if(q==3){\r
-                       if(xx!=width||yy!=height){\r
-                               if(xx==0){bakax=1;bakay=-1;d3y=1;}\r
-                               if(yy==0){bakax=1;bakay=0;d3y=1;}\r
-                               if(xx==width){bakax=-1;bakay=-1;d3y=1;}\r
-                               if(yy==height){bakax=1;bakay=0;d3y=1;}\r
-                       }else if(xx==width&&yy==height) xx=yy=0;\r
+\r
+               if(q == 5){ colortest(); return gq; }\r
+               if(q == 10){ colorz(); return gq; }\r
+               if(q == 11){ colorz(); delay(100); return gq; }\r
+               if(q == 8){ ssd(q); /*printf("%d\n", coor);*/ }\r
+               if(q == 6){\r
+                               coor = rand()%NUM_COLORS;\r
+//----           cls(coor, vaddr);\r
+                               cls(coor, vga);\r
+                               //updatevbuff();\r
                }\r
-               if(q==3){\r
-                       if(d3y){\r
-                               if(bakay<0){\r
-                                       yy--;\r
-                                       d3y--;\r
-                               }else\r
-                               if(bakay>0){\r
-                                       yy++;\r
-                                       d3y--;\r
-                               }\r
-                       }\r
-                       if(bakax<0){\r
-                               xx--;\r
-                       }else\r
-                       if(bakax>0){\r
-                               xx++;\r
-                       }\r
-               }else{\r
-                       if(q==16)\r
-                       {\r
-                               if(!bakax){\r
-                                       xx--;//=TILEWH;\r
-                               }else if(bakax>0){\r
-                                       xx++;//=TILEWH;\r
-                               }\r
-                               if(!bakay){\r
-                                       yy--;//=TILEWH;\r
-                               }else if(bakay>0){\r
-                                       yy++;//=TILEWH;\r
+\r
+               if(q == 7 || q== 9){\r
+                               if(gq < HGQ){\r
+                                               if(q == 7) ssd(q);\r
+                                               if(q == 9){ ssd(q); coor++; }\r
+                                               gq++;\r
+                               }else gq = LGQ;\r
+               }\r
+               if((q<5 && gq<BONK) || (q==16 && gq<BONK)){ // the number variable make the colors more noticable\r
+                               if(q==1){\r
+                                               if(xx==width){bakax=0;}\r
+                                               if(xx==0){bakax=1;}\r
+                                               if(yy==height){bakay=0;}\r
+                                               if(yy==0){bakay=1;}\r
+                               }else if(q==3){\r
+                                               if(xx!=width||yy!=height){\r
+                                                               if(xx==0){bakax=1;bakay=-1;d3y=1;}\r
+                                                               if(yy==0){bakax=1;bakay=0;d3y=1;}\r
+                                                               if(xx==width){bakax=-1;bakay=-1;d3y=1;}\r
+                                                               if(yy==height){bakax=1;bakay=0;d3y=1;}\r
+                                               }else if(xx==width&&yy==height) xx=yy=0;\r
                                }\r
-                       }else{\r
-                               if(!bakax){\r
-                                       xx-=TILEWH;\r
-                               }else if(bakax>1){\r
-                                       xx+=TILEWH;\r
+                               if(q==3){\r
+                                               if(d3y){\r
+                                                               if(bakay<0){\r
+                                                                               yy--;\r
+                                                                               d3y--;\r
+                                                               }else\r
+                                                               if(bakay>0){\r
+                                                                               yy++;\r
+                                                                               d3y--;\r
+                                                               }\r
+                                               }\r
+                                               if(bakax<0){\r
+                                                               xx--;\r
+                                               }else\r
+                                               if(bakax>0){\r
+                                                               xx++;\r
+                                               }\r
+                               }else{\r
+                                               if(q==16)\r
+                                               {\r
+                                                               if(!bakax){\r
+                                                                               xx--;//=TILEWH;\r
+                                                               }else if(bakax>0){\r
+                                                                               xx++;//=TILEWH;\r
+                                                               }\r
+                                                               if(!bakay){\r
+                                                                               yy--;//=TILEWH;\r
+                                                               }else if(bakay>0){\r
+                                                                               yy++;//=TILEWH;\r
+                                                               }\r
+                                               }else{\r
+                                                               if(!bakax){\r
+                                                                               xx-=TILEWH;\r
+                                                               }else if(bakax>1){\r
+                                                                               xx+=TILEWH;\r
+                                                               }\r
+                                                               if(!bakay){\r
+                                                                               yy-=TILEWH;\r
+                                                               }else if(bakay>1){\r
+                                                                               yy+=TILEWH;\r
+                                                               }\r
+                                               }\r
                                }\r
-                               if(!bakay){\r
-                                       yy-=TILEWH;\r
-                               }else if(bakay>1){\r
-                                       yy+=TILEWH;\r
+                               // fixer\r
+                               if(q!=16){\r
+                                               if(xx<0) xx=width;\r
+                                               if(yy<0) yy=height;\r
+                                               if(xx>width) xx=0;\r
+                                               if(yy>height) yy=0;\r
                                }\r
-                       }\r
-               }\r
-               // fixer\r
-               if(q!=16){\r
-                       if(xx<0) xx=width;\r
-                       if(yy<0) yy=height;\r
-                       if(xx>width) xx=0;\r
-                       if(yy>height) yy=0;\r
-               }\r
 \r
 //interesting effects\r
-               if(q==16)\r
-               {\r
-               int tx=0,ty=0;\r
-               tx+=xx+16;\r
-               ty+=yy+16;\r
-               putPixel_X(tx, ty, coor);
-               //drawrect(tx, ty, tx+TILEWH, ty+TILEWH, coor);\r
-               //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH);\r
-\r
-               // plot the pixel\r
-//----         ppf(xx, yy, coor, vga);\r
-//++++0000             putPixel_X(xx, yy, coor);\r
-               }else drawrect(xx, yy, xx+TILEWH-1, yy+TILEWH-1, coor);\r
-//----         if(q==2) ppf(rand()%, rand()%height, 0, vga);\r
-               if(q==2||q==16) putPixel_X(rand()%width, rand()%height, 0);\r
-               if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; }\r
-               gq++;\r
+                               if(q==16)\r
+                               {\r
+                               int tx=0,ty=0;\r
+                               tx+=xx+16;\r
+                               ty+=yy+16;\r
+                               putPixel_X(tx, ty, coor);\r
+                               //drawrect(tx, ty, tx+TILEWH, ty+TILEWH, coor);\r
+                               //printf("%d %d %d %d %d %d\n", xx, yy, tx, ty, TILEWH);\r
+\r
+                               // plot the pixel\r
+//----           ppf(xx, yy, coor, vga);\r
+//++++0000                       putPixel_X(xx, yy, coor);\r
+                               }else drawrect(xx, yy, xx+TILEWH-1, yy+TILEWH-1, coor);\r
+//----           if(q==2) ppf(rand()%, rand()%height, 0, vga);\r
+                               if(q==2||q==16) putPixel_X(rand()%width, rand()%height, 0);\r
+                               if(q==2||q==4||q==16){ bakax = rand()%3; bakay = rand()%3; }\r
+                               gq++;\r
 //if(xx<0||xx>320||yy<0||yy>240)\r
-//     printf("%d %d %d %d %d %d\n", xx, yy, coor, bakax, bakay, getPixel_X(xx,yy));\r
-//     printf("%d\n", getPixel_X(xx,yy));\r
+//       printf("%d %d %d %d %d %d\n", xx, yy, coor, bakax, bakay, getPixel_X(xx,yy));\r
+//       printf("%d\n", getPixel_X(xx,yy));\r
 //0000\r
-//     drawText(0, 0, 15, getPixel_X(xx,yy));\r
-       }else gq = LGQ;\r
-       return gq;\r
+//       drawText(0, 0, 15, getPixel_X(xx,yy));\r
+               }else gq = LGQ;\r
+               return gq;\r
 }\r
 \r
 \r
@@ -572,103 +581,103 @@ int ding(int q){
 #include <conio.h>\r
 \r
 void doTest(void)\r
-       {\r
-       int p, x, y, pages;\r
-\r
-       /* This is the way to calculate the number of pages available. */\r
-       pages = 65536L/(widthBytes*height); // apparently this takes the A000 address\r
+               {\r
+               int p, x, y, pages;\r
 \r
-       printf("%d\n", pages);\r
+               /* This is the way to calculate the number of pages available. */\r
+               pages = 65536L/(widthBytes*height); // apparently this takes the A000 address\r
 \r
-       for (p = 0; p <= pages; ++p)\r
-               {\r
-               setActivePage(p);\r
+               printf("%d\n", pages);\r
 \r
-               /* On each page draw a single colored border, and dump the palette\r
-                  onto a small square about the middle of the page. */\r
-                  \r
-                  //{\r
-                       for (x = 0; x <= width; ++x)\r
+               for (p = 0; p <= pages; ++p)\r
                                {\r
-                               putPixel_X(x, 0, p+1);\r
-                               if(p!=pages) putPixel_X(x, height-1, p+1);\r
-                                       else putPixel_X(x, 99-1, p+1);\r
-                               }\r
+                               setActivePage(p);\r
 \r
-                       for (y = 0; y <= height; ++y)\r
-                               {\r
-                               putPixel_X(0, y, p+1);\r
-                               if(p!=pages) putPixel_X(width-1, y, p+1);\r
-                                       else putPixel_X(width-1, y, p+1);\r
-                               }\r
+                               /* On each page draw a single colored border, and dump the palette\r
+                                  onto a small square about the middle of the page. */\r
 \r
-                       for (x = 0; x < 16; ++x)\r
-                               for (y = 0; y < 16; ++y)\r
-                                       putPixel_X(x+(p+2)*16, y+(p+2)*16, x + y*16);\r
-                       //}\r
+                                  //{\r
+                                               for (x = 0; x <= width; ++x)\r
+                                                               {\r
+                                                               putPixel_X(x, 0, p+1);\r
+                                                               if(p!=pages) putPixel_X(x, height-1, p+1);\r
+                                                                               else putPixel_X(x, 99-1, p+1);\r
+                                                               }\r
 \r
-               drawText(0, 0, 15, p);\r
+                                               for (y = 0; y <= height; ++y)\r
+                                                               {\r
+                                                               putPixel_X(0, y, p+1);\r
+                                                               if(p!=pages) putPixel_X(width-1, y, p+1);\r
+                                                                               else putPixel_X(width-1, y, p+1);\r
+                                                               }\r
 \r
-               }\r
+                                               for (x = 0; x < 16; ++x)\r
+                                                               for (y = 0; y < 16; ++y)\r
+                                                                               putPixel_X(x+(p+2)*16, y+(p+2)*16, x + y*16);\r
+                                               //}\r
 \r
-       /* Each pages will now contain a different image.  Let the user cycle\r
-          through all the pages by pressing a key. */\r
-       for (p = 0; p <= pages; ++p)\r
-               {\r
-               setVisiblePage(p);\r
-               //drawText(0, 240, 15, "bakapi");\r
-               getch();\r
-               }\r
+                               drawText(0, 0, 15, p);\r
 \r
-       }\r
+                               }\r
+\r
+               /* Each pages will now contain a different image.  Let the user cycle\r
+                  through all the pages by pressing a key. */\r
+               for (p = 0; p <= pages; ++p)\r
+                               {\r
+                               setVisiblePage(p);\r
+                               //drawText(0, 240, 15, "bakapi");\r
+                               getch();\r
+                               }\r
+\r
+               }\r
 \r
 /*\r
  * Library test (program) entry point.\r
  */\r
 \r
 int main(void)\r
-       {\r
-       int key,d;\r
-       // main variables\r
-       d=1; // switch variable\r
-       key=4; // default screensaver number\r
-//     puts("First, have a look at the 320x200 mode.  I will draw some rubbish");\r
-//     puts("on all of the four pages, then let you cycle through them by");\r
-//     puts("hitting a key on each page.");\r
-//     puts("Press a key when ready...");\r
-//     getch();\r
-\r
-//     doTest();\r
-\r
-//     puts("Then, check out Mode X, 320x240 with 3 (and a half) pages.");\r
-//     puts("Press a key when ready...");\r
-//     getch();\r
-\r
-       setvideo(1);\r
+               {\r
+               int key,d;\r
+               // main variables\r
+               d=1; // switch variable\r
+               key=4; // default screensaver number\r
+//       puts("First, have a look at the 320x200 mode.  I will draw some rubbish");\r
+//       puts("on all of the four pages, then let you cycle through them by");\r
+//       puts("hitting a key on each page.");\r
+//       puts("Press a key when ready...");\r
+//       getch();\r
+\r
+//       doTest();\r
+\r
+//       puts("Then, check out Mode X, 320x240 with 3 (and a half) pages.");\r
+//       puts("Press a key when ready...");\r
+//       getch();\r
+\r
+               setvideo(1);\r
 // screen savers\r
 \r
 /*while(d!=0){ // on!\r
-               if(!kbhit()){ // conditions of screen saver\r
-                       ding(key);\r
-               }else{\r
-                       setvideo(0);\r
-                       // user imput switch\r
-                       printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.\n", getch());  // prompt the user\r
-                       scanf("%d", &key);\r
-                       //if(key==3){xx=yy=0;} // crazy screen saver wwww\r
-                       if(key==5) d=0;\r
-                       setvideo(1);\r
+                               if(!kbhit()){ // conditions of screen saver\r
+                                               ding(key);\r
+                               }else{\r
+                                               setvideo(0);\r
+                                               // user imput switch\r
+                                               printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 5 to quit.\n", getch());  // prompt the user\r
+                                               scanf("%d", &key);\r
+                                               //if(key==3){xx=yy=0;} // crazy screen saver wwww\r
+                                               if(key==5) d=0;\r
+                                               setvideo(1);\r
+                               }\r
+               }*/ // else off\r
+               while(!kbhit()){ // conditions of screen saver\r
+                               ding(4);\r
+               }\r
+               //end of screen savers\r
+               doTest();\r
+               setvideo(0);\r
+               puts("Where to next?  It's your move! wwww");\r
+               printf("bakapi ver. 1.04.09a\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");\r
+               return 0;\r
                }\r
-       }*/ // else off\r
-       while(!kbhit()){ // conditions of screen saver\r
-               ding(4);\r
-       }\r
-       //end of screen savers\r
-       doTest();\r
-       setvideo(0);\r
-       puts("Where to next?  It's your move! wwww");\r
-       printf("bakapi ver. 1.04.09a\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v2\n");\r
-       return 0;\r
-       }\r
 \r
 #endif\r
index b95f0159732d133716ec9d8bbb4583793c8210ac..1036e362fdbe2ea5cd7394b4478f09463d878f73 100644 (file)
@@ -9,14 +9,14 @@
 //static hgq=NUM_COLORS/(1/8)\r
 #define BONK            400\r
 #define LGQ             32\r
-#define HGQ             56
-#define TILEWH                         16
+#define HGQ             56\r
+#define TILEWH                          16\r
 #define ABS(a)   ((a < 0) ? -a : a)\r
 #define SGN(a)   ((a < 0) ? -1 : 1)\r
 //#define VMEM            0xA000 // = vga\r
 //int width = 320;\r
 //int height = 240;\r
-
+\r
 void drawChar(int x, int y, int color, byte c);\r
 void drawText(int x, int y, int color, byte string);\r
 void setvideo(/*byte mode, */int vq);\r
@@ -25,9 +25,9 @@ void setvideo(/*byte mode, */int vq);
 void cls(byte color, byte *Where);\r
 //void clearscr();\r
 //void plotpixel(int x, int y, byte color, byte *Where);\r
-//void plotpixelfast(int x, int y, byte color, byte *Where);
-void putPixel_X(int x, int y, byte color);
-void putTile(int x, int y, byte color);\r
+//void plotpixelfast(int x, int y, byte color, byte *Where);\r
+void putPixel_X(int x, int y, byte color);\r
+//void putTile(int x, int y, byte color);\r
 //void BlockMove();\r
 //void eraseplayer(int x, int y);\r
 //void drawplayer(int x, int y, int color);\r