From: sparky4 Date: Mon, 18 Apr 2016 04:31:23 +0000 (-0500) Subject: joncampbell123 i tried ww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=e9292f41f721bb096d78a2abe35020c045ebc749;p=16.git joncampbell123 i tried ww --- diff --git a/pcx2vrl b/pcx2vrl index 06179c75..3d9ac6e6 100755 Binary files a/pcx2vrl and b/pcx2vrl differ diff --git a/pcxsscut b/pcxsscut index 2ce56d28..d743ac3b 100755 Binary files a/pcxsscut and b/pcxsscut differ diff --git a/src/fontgfx.c b/src/fontgfx.c index 89e2e2f5..d0c2e1bc 100755 --- a/src/fontgfx.c +++ b/src/fontgfx.c @@ -67,8 +67,7 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ ,'___...---~~~\n\ "; // static byte *rosa; - static word chx, chy, colpee; - static word z; + static word chx, chy, colpee, addr; textInit(); // DOSLIB: check our environment @@ -92,50 +91,38 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ return; } VGAmodeX(1, 1, &gvar); -// __asm{ -// mov AH,12H -// mov BL,30h -// mov AL,04h -// int 10 -// mov ax,1123h -// int 10h -// ;mov ax,1112h ; load 8x8 character set into RAM -// ;int 10h -// } /* setup camera and screen~ */ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); gvar.video.page[0].width += (16*2); gvar.video.page[0].height += (16*2); modexShowPage(&gvar.video.page[0]); + addr = (gvar.video.page[0].width/4) * chy + (chx / 4) + ((word)gvar.video.page[0].data); /* at start of function */ vga_read_crtc_mode(&cm); // NTS: We're in Mode-X now. printf() is useless. Do not use printf(). Or INT 10h text printing. Or DOS console output. //modexprint(16, 16, 1, 15, "wwww"); //getch(); chx=0; chy=0; -// colpee=32; + colpee=32; // bios_cls(); /* position the cursor to home */ // vga_moveto(0,0); // vga_sync_bios_cursor(); - for(e=0x00, z=0; e<=0xFE; e++, z++) + for(e=0x00; e<=0xFE; e++) { - //if(chx+8>(gvar.video.page[0].width/2)) - if((z)+1>16) + if(chx+8>(gvar.video.page[0].width/2)) { chx=0; chy+=8; sprintf(pee,"%u", colpee); - modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 1); - z=0; -// printf("\n"); + modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, addr, 1); //getch(); } sprintf(pee, "%zc", e); - modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 1); + modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, addr, 1); chx+=9; colpee++; -// if(colpee>=32+24) colpee=32; + if(colpee>=32+24) colpee=32; } getch(); //modexprint(100, 100, 1, 47, 0, "wwww"); diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c index 8b40f964..f0b798ce 100755 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -239,7 +239,7 @@ void ding(page_t *page, bakapee_t *pee, word q) break; case 8: colorz(page, pee); - modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", 1); + modexprint(page, page->sw/2, page->sh/2, 1, 47, 0, "bakapi", (page[0].width/4) * pee->yy + (pee->xx / 4) + ((word)page[0].data), 1); break; case 9: if(pee->coor <= HGQ) diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 8ab175ed..247a24d3 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -873,20 +873,7 @@ byte modexgetPixel(page_t *page, int x, int y) } -void modexhlin(page_t *page, word xl, word xh, word y, word color) -{ - word x; - word yy=0; - - for(x=0;x=page[0].sw-1){ x=0; yy+=4; } - modexClearRegion(page, x+xl, y+yy, 4, 4, color); - } - //modexputPixel(page, x+xl, y, color); -} - -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q) +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, word addrq, boolean q) { word s, o, w; word addr = (word) romFontsData.l; @@ -926,7 +913,7 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons JNZ L1 } //TODO: OPTIMIZE THIS!!!! - modexDrawCharPBuf(page, x, y, t, col, bgcol, q); + modexDrawCharPBuf(page, x, y, t, col, bgcol, addrq, q); //if(!q) getch(); } diff --git a/src/lib/modex16.h b/src/lib/modex16.h index fe96a78f..b334e7fe 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -82,6 +82,32 @@ typedef union byte blue; } rgb_t; +/* -======================= Constants & Vars ==========================- */ +extern byte far* VGA; /* The VGA Memory */ +#define SCREEN_SEG 0xa000 +#define VIDEO_INT 0x10 +#define SET_MODE 0x00 +#define VGA_256_COLOR_MODE 0x13 +#define TEXT_MODE 0x03 + +#define AC_INDEX 0x03c0 +#define SC_INDEX 0x03c4 +#define SC_DATA 0x03c5 +#define CRTC_INDEX 0x03d4 +#define CRTC_DATA 0x03d5 +#define GC_INDEX 0x03ce +#define MISC_OUTPUT 0x03c2 +#define HIGH_ADDRESS 0x0C +#define LOW_ADDRESS 0x0D +#define VRETRACE 0x08 +//#define INPUT_STATUS_1 0x03da defined in 16_head +#define DISPLAY_ENABLE 0x01 +#define MAP_MASK 0x02 +#define PAL_READ_REG 0x03C7 /* Color register, read address */ +#define PAL_WRITE_REG 0x03C8 /* Color register, write address */ +#define PAL_DATA_REG 0x03C9 /* Color register, data port */ +#define PAL_SIZE (256 * 3) + /* -============================ Functions =============================- */ /* mode switching, page, and plane functions */ void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv); @@ -123,37 +149,34 @@ void modexPalOverscan(byte *p, word col); void modexchkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/); void modexputPixel(page_t *page, int x, int y, byte color); byte modexgetPixel(page_t *page, int x, int y); -void modexhlin(page_t *page, word xl, word xh, word y, word color); -void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q); +static inline void modexwritepixel(page_t *page, int x, int y, word addr, byte color) +{ + /* Each address accesses four neighboring pixels, so set + Write Plane Enable according to which pixel we want + to modify. The plane is determined by the two least + significant bits of the x-coordinate: */ + modexSelectPlane(PLANE(x)); + //outp(SC_INDEX, 0x02); + //outp(SC_DATA, 0x01 << (x & 3)); + + /* The offset of the pixel into the video segment is + offset = (width * y + x) / 4, and write the given + color to the plane we selected above. Heed the active + page start selection. */ + vga_state.vga_graphics_ram[addr] = color; +} +static inline byte modexreadPixel(page_t *page, int x, int y, word addr) +{ + /* Select the plane from which we must read the pixel color: */ + outpw(GC_INDEX, 0x04); + outpw(GC_INDEX+1, x & 3); + return vga_state.vga_graphics_ram[addr]; +} +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, word addrq, boolean q); void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str); void modexpdump(page_t *pee); void modexcls(page_t *page, byte color, byte *Where); //void modexWaitBorder(); void bios_cls(); -/* -======================= Constants & Vars ==========================- */ -extern byte far* VGA; /* The VGA Memory */ -#define SCREEN_SEG 0xa000 -#define VIDEO_INT 0x10 -#define SET_MODE 0x00 -#define VGA_256_COLOR_MODE 0x13 -#define TEXT_MODE 0x03 - -#define AC_INDEX 0x03c0 -#define SC_INDEX 0x03c4 -#define SC_DATA 0x03c5 -#define CRTC_INDEX 0x03d4 -#define CRTC_DATA 0x03d5 -#define GC_INDEX 0x03ce -#define MISC_OUTPUT 0x03c2 -#define HIGH_ADDRESS 0x0C -#define LOW_ADDRESS 0x0D -#define VRETRACE 0x08 -//#define INPUT_STATUS_1 0x03da defined in 16_head -#define DISPLAY_ENABLE 0x01 -#define MAP_MASK 0x02 -#define PAL_READ_REG 0x03C7 /* Color register, read address */ -#define PAL_WRITE_REG 0x03C8 /* Color register, write address */ -#define PAL_DATA_REG 0x03C9 /* Color register, data port */ -#define PAL_SIZE (256 * 3) #endif diff --git a/src/lib/modex16/16render.c b/src/lib/modex16/16render.c index 0399a777..ad88168f 100755 --- a/src/lib/modex16/16render.c +++ b/src/lib/modex16/16render.c @@ -435,7 +435,7 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, } } -void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q) +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, word addr, boolean q) { word i, j, k; for(i=0; idata + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)), romFontsData.l[i] & j ? col:bgcol, 2); - modexputPixel(page, x+k+romFontsData.chw, y+i, romFontsData.l[i] & j ? col:bgcol); + modexwritepixel(page, x+k+romFontsData.chw, y+i, addr, romFontsData.l[i] & j ? col:bgcol); else //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' '); //printf("%c", l[i] & j ? '*':' '); diff --git a/src/lib/modex16/16render.h b/src/lib/modex16/16render.h index 308944c3..7edb4422 100755 --- a/src/lib/modex16/16render.h +++ b/src/lib/modex16/16render.h @@ -36,6 +36,6 @@ void modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp); /*pbuf ver void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp); void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); -void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q); +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, word addr, boolean q); #endif diff --git a/src/planrpcx.c b/src/planrpcx.c index 06b1f29c..d3ac3bef 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -41,8 +41,6 @@ void main(int argc, char *argv[]) { byte l[1024]; - static byte e; - static word chx, chy, colpee; byte pee[2]; //w=0; @@ -124,25 +122,6 @@ getch(); } } - chx=0; - chy=0; - colpee=32; - for(e=0x00; e<=0xFE; e++) - { - if(chx+8>(gvar.video.page[0].width/2)) - { - chx=0; - chy+=8; - sprintf(pee,"%u", colpee); - modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0); - //getch(); - } - modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0); - chx+=9; - colpee++; - if(colpee>=32+24) colpee=32; - } - fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n"); fprintf(stderr,"version %s\n", VERSION); fprintf(stderr,"%d\n", sizeof(p.plane)); diff --git a/vrl2vrs b/vrl2vrs index cee2d1d5..acdd4bda 100755 Binary files a/vrl2vrs and b/vrl2vrs differ diff --git a/vrsdump b/vrsdump index a75a903a..8ba0497d 100755 Binary files a/vrsdump and b/vrsdump differ