X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fmodex16.c;h=1e086ea74f130cc9444f67f9a68f2c0a3938f7a8;hb=f7cc0a116e67ff8f1666feec75863397249cfada;hp=e61df5a1ce7928c7e979029eb64428c8db9e54ef;hpb=d1ce94441d5e0bffafeb959c505bf3d3975a0a35;p=16.git diff --git a/src/lib/modex16.c b/src/lib/modex16.c index e61df5a1..1e086ea7 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -942,12 +942,14 @@ no... wait.... no wwww free(pal); } -void modexputPixel(int x, int y, byte color) -{ +void modexputPixel(page_t *page, int x, int y, byte color) +{ + word pageOff = (word) page->data; /* 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: */ + significant bits of the x-coordinate: */ + //modexSelectPlane(PLANE(x)); outp(SC_INDEX, 0x02); outp(SC_DATA, 0x01 << (x & 3)); @@ -955,35 +957,182 @@ void modexputPixel(int x, int y, byte color) offset = (width * y + x) / 4, and write the given color to the plane we selected above. Heed the active page start selection. */ - VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + 0] = color; + VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff] = color; } -byte modexgetPixel(int x, int y) -{ +byte modexgetPixel(page_t *page, int x, int y) +{ + word pageOff = (word) page->data; /* Select the plane from which we must read the pixel color: */ outpw(GC_INDEX, 0x04); outpw(GC_INDEX+1, x & 3); - return VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + 0]; - + return VGA[(unsigned)((SCREEN_WIDTH/4) * y) + (x / 4) + pageOff]; + +} + +void modexhlin(page_t *page, word xl, word xh, word y, word color) +{ + word x; + word yy=0; + + for(x=0;x=SCREEN_WIDTH-1){ x=0; yy+=4; } + modexClearRegion(page, x+xl, y+yy, 4, 4, color); + } + //modexputPixel(page, x+xl, y, color); } -void bputs(/*bmp_t *bmp, */unsigned x, unsigned y, const char *s) -{ - byte far *font; - //bmp_t src; - - //font = bios_8x8_font(); - //src.wd = 8; - //src.ht = 8; - //src.ops = &g_ops1; - for(; *s != '\0'; s++) - { - //src.raster = font + 8 * (*s); - //blit1(&src, bmp, x, y); - x += 8; - } +void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) +{ + word i, s, o, w, j, xp; + byte l[1024]; + word addr = (word) l; + word chw=0; + byte c; + + switch(t) + { + case 0: + w=14; + break; + case 1: + w=8; + break; + case 2: + w=8; + break; + case 3: + w=16; + break; + default: + t=3; + w=16; + break; + } + + s=romFonts[t].seg; + o=romFonts[t].off; + + for(; *str != '\0'; str++) + { + c = (*str); + if((c=='\n'/* || c=="\ +"*/) || chw +>=page->width) + { + chw=0; + y+=w; + continue; + } + //load the letter 'A' + __asm { + MOV DI, addr + MOV SI, o + MOV ES, s + SUB AH, AH + MOV AL, c ; the letter + MOV CX, w + MUL CX + ADD SI, AX ;the address of charcter + L1: MOV AX, ES:SI + MOV DS:DI, AX + INC SI + INC DI + DEC CX + JNZ L1 + } + + for(i=0; i>=1; + } + } + chw += xp; + } +} + +void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) +{ + word i, s, o, w, j, xp; + byte l[1024]; + word addr = (word) l; + word chw=0; + byte c; + + switch(t) + { + case 0: + w=14; + break; + case 1: + w=8; + break; + case 2: + w=8; + break; + case 3: + w=16; + break; + default: + t=3; + w=16; + break; + } + + s=romFonts[t].seg; + o=romFonts[t].off; + + for(; *str != '\0'; str++) + { + c = (*str); + if((c=='\n'/* || c=="\ +"*/)/* || chw>=page->width*/) + { + chw=0; + y+=w; + continue; + } + //load the letter 'A' + __asm { + MOV DI, addr + MOV SI, o + MOV ES, s + SUB AH, AH + MOV AL, c ; the letter + MOV CX, w + MUL CX + ADD SI, AX ;the address of charcter + L1: MOV AX, ES:SI + MOV DS:DI, AX + INC SI + INC DI + DEC CX + JNZ L1 + } + + for(i=0; i>=1; + } + } + chw += xp; + } } void