1 /* Project 16 Source Code~
2 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
4 * This file is part of Project 16.
6 * Project 16 is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * Project 16 is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
19 * Fifth Floor, Boston, MA 02110-1301 USA.
29 #include "src/lib/modex16.h"
31 byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */
33 static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette);
34 static byte tmppal[PAL_SIZE];
43 int86(VIDEO_INT, ®s, ®s);
47 /* -========================= Entry Points ==========================- */
51 dword far*ptr=(dword far*)VGA; /* used for faster screen clearing */
53 0x0d06, /* vertical total */
54 0x3e07, /* overflow (bit 8 of vertical counts) */
55 0x4109, /* cell height (2 to double-scan */
56 0xea10, /* v sync start */
57 0xac11, /* v sync end and protect cr0-cr7 */
58 0xdf12, /* vertical displayed */
59 0x0014, /* turn off dword mode */
60 0xe715, /* v blank start */
61 0x0616, /* v blank end */
62 0xe317 /* turn on byte mode */
64 int CRTParmCount = sizeof(CRTParms) / sizeof(CRTParms[0]);
66 /* TODO save current video mode and palette */
67 vgaSetMode(VGA_256_COLOR_MODE);
69 /* disable chain4 mode */
70 outpw(SC_INDEX, 0x0604);
72 /* synchronous reset while setting Misc Output */
73 outpw(SC_INDEX, 0x0100);
75 /* select 25 MHz dot clock & 60 Hz scanning rate */
76 outp(MISC_OUTPUT, 0xe3);
78 /* undo reset (restart sequencer) */
79 outpw(SC_INDEX, 0x0300);
81 /* reprogram the CRT controller */
82 outp(CRTC_INDEX, 0x11); /* VSync End reg contains register write prot */
83 outp(CRTC_DATA, 0x7f); /* get current write protect on varios regs */
85 /* send the CRTParms */
86 for(i=0; i<CRTParmCount; i++) {
87 outpw(CRTC_INDEX, CRTParms[i]);
90 /* clear video memory */
91 outpw(SC_INDEX, 0x0f02);
92 for(i=0; i<0x8000; i++) {
100 /* TODO restore original mode and palette */
101 vgaSetMode(TEXT_MODE);
109 /* default page values */
113 page.width = SCREEN_WIDTH;
114 page.height = SCREEN_HEIGHT;
120 /* returns the next page in contiguous memory
121 * the next page will be the same size as p, by default
124 modexNextPage(page_t *p) {
127 result.data = p->data + (p->width/4)*p->height; /* compute the offset */
130 result.width = p->width;
131 result.height = p->height;
137 //next page with defined dimentions~
139 modexNextPage0(page_t *p, word x, word y)
143 result.data = p->data + (p->width/4)*p->height; /* compute the offset */
155 modexShowPage(page_t *page) {
161 /* calculate offset */
162 offset = (word) page->data;
163 offset += page->dy * (page->width >> 2 );
164 offset += page->dx >> 2;
166 /* calculate crtcOffset according to virtual width */
167 crtcOffset = page->width >> 3;
169 high_address = HIGH_ADDRESS | (offset & 0xff00);
170 low_address = LOW_ADDRESS | (offset << 8);
172 /* wait for appropriate timing and then program CRTC */
173 while ((inp(INPUT_STATUS_1) & DISPLAY_ENABLE));
174 outpw(CRTC_INDEX, high_address);
175 outpw(CRTC_INDEX, low_address);
176 outp(CRTC_INDEX, 0x13);
177 outp(CRTC_DATA, crtcOffset);
179 /* wait for one retrace */
180 while (!(inp(INPUT_STATUS_1) & VRETRACE));
182 /* do PEL panning here */
183 outp(AC_INDEX, 0x33);
184 outp(AC_INDEX, (page->dx & 0x03) << 1);
189 modexPanPage(page_t *page, int dx, int dy) {
196 modexSelectPlane(byte plane) {
197 outp(SC_INDEX, MAP_MASK); /* select plane */
198 outp(SC_DATA, plane);
203 modexClearRegion(page_t *page, int x, int y, int w, int h, byte color) {
204 word pageOff = (word) page->data;
205 word xoff=x/4; /* xoffset that begins each row */
206 word scanCount=w/4; /* number of iterations per row (excluding right clip)*/
207 word poffset = pageOff + y*(page->width/4) + xoff; /* starting offset */
208 word nextRow = page->width/4-scanCount-1; /* loc of next row */
209 byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */
210 byte rclip[] = {0x00, 0x01, 0x03, 0x07};
211 byte left = lclip[x&0x03];
212 byte right = rclip[(x+w)&0x03];
214 /* handle the case which requires an extra group */
215 if((x & 0x03) && !((x+w) & 0x03)) {
220 MOV AX, SCREEN_SEG ; go to the VGA memory
222 MOV DI, poffset ; go to the first pixel
223 MOV DX, SC_INDEX ; point to the map mask
227 MOV AL, color ; get ready to write colors
229 MOV CX, scanCount ; count the line
230 MOV BL, AL ; remember color
231 MOV AL, left ; do the left clip
232 OUT DX, AL ; set the left clip
233 MOV AL, BL ; restore color
234 STOSB ; write the color
236 JZ SCAN_DONE ; handle 1 group stuff
238 ;-- write the main body of the scanline
239 MOV BL, AL ; remember color
240 MOV AL, 0x0f ; write to all pixels
242 MOV AL, BL ; restore color
243 REP STOSB ; write the color
245 MOV BL, AL ; remeber color
247 OUT DX, AL ; do the right clip
248 MOV AL, BL ; restore color
250 ADD DI, nextRow ; go to the next row
258 oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite)
264 /* TODO Make this fast. It's SLOOOOOOW */
265 for(plane=0; plane < 4; plane++) {
266 modexSelectPlane(PLANE(plane+x));
267 for(px = plane; px < bmp->width; px+=4) {
269 for(py=0; py<bmp->height; py++) {
270 if(!sprite || bmp->data[offset])
271 page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset];
280 modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp) {
281 /* draw the region (the entire freakin bitmap) */
282 modexDrawBmpRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);
287 modexDrawBmpRegion(page_t *page, int x, int y,
288 int rx, int ry, int rw, int rh, bitmap_t *bmp) {
289 word poffset = (word) page->data + y*(page->width/4) + x/4;
290 byte *data = bmp->data;//+bmp->offset;
291 word bmpOffset = (word) data + ry * bmp->width + rx;
294 byte plane = 1 << ((byte) x & 0x03);
295 word scanCount = width/4 + (width%4 ? 1 :0);
296 word nextPageRow = page->width/4 - scanCount;
297 word nextBmpRow = (word) bmp->width - width;
299 byte planeCounter = 4;
301 //code is a bit slow here
303 MOV AX, SCREEN_SEG ; go to the VGA memory
306 MOV DX, SC_INDEX ; point at the map mask register
311 MOV DX, SC_DATA ; select the current plane
315 ;-- begin plane painting
316 MOV AX, height ; start the row counter
318 MOV DI, poffset ; go to the first pixel
319 MOV SI, bmpOffset ; go to the bmp pixel
321 MOV CX, width ; count the columns
323 MOVSB ; copy the pixel
324 SUB CX, 3 ; we skip the next 3
325 ADD SI, 3 ; skip the bmp pixels
326 LOOP SCAN_LOOP ; finish the scan
329 ADD DI, AX ; go to the next row on screen
331 ADD SI, AX ; go to the next row on bmp
334 JNZ ROW_LOOP ; do all the rows
335 ;-- end plane painting
337 MOV AL, plane ; advance to the next plane
339 AND AL, 0x0f ; mask the plane properly
340 MOV plane, AL ; store the plane
342 INC bmpOffset ; start bmp at the right spot
345 JNZ PLANE_LOOP ; do all 4 planes
351 modexDrawPlanarBuf(page_t *page, int x, int y, planar_buf_t *bmp) {
352 /* TODO - adapt from test code */
354 for(plane=0; plane < 4; plane++)
362 modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) {
363 /* draw the whole sprite */
364 modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);
368 modexDrawSpriteRegion(page_t *page, int x, int y,
369 int rx, int ry, int rw, int rh, bitmap_t *bmp) {
370 word poffset = (word)page->data + y*(page->width/4) + x/4;
371 byte *data = bmp->data;//+bmp->offset;
372 word bmpOffset = (word) data + ry * bmp->width + rx;
375 byte plane = 1 << ((byte) x & 0x03);
376 word scanCount = width/4 + (width%4 ? 1 :0);
377 word nextPageRow = page->width/4 - scanCount;
378 word nextBmpRow = (word) bmp->width - width;
380 byte planeCounter = 4;
383 MOV AX, SCREEN_SEG ; go to the VGA memory
386 MOV DX, SC_INDEX ; point at the map mask register
391 MOV DX, SC_DATA ; select the current plane
395 ;-- begin plane painting
396 MOV AX, height ; start the row counter
398 MOV DI, poffset ; go to the first pixel
399 MOV SI, bmpOffset ; go to the bmp pixel
401 MOV CX, width ; count the columns
406 JNE DRAW_PIXEL ; draw non-zero pixels
408 INC DI ; skip the transparent pixel
412 MOVSB ; copy the pixel
414 SUB CX, 3 ; we skip the next 3
415 ADD SI, 3 ; skip the bmp pixels
416 LOOP SCAN_LOOP ; finish the scan
419 ADD DI, AX ; go to the next row on screen
421 ADD SI, AX ; go to the next row on bmp
424 JNZ ROW_LOOP ; do all the rows
425 ;-- end plane painting
427 MOV AL, plane ; advance to the next plane
429 AND AL, 0x0f ; mask the plane properly
430 MOV plane, AL ; store the plane
432 INC bmpOffset ; start bmp at the right spot
435 JNZ PLANE_LOOP ; do all 4 planes
440 /* copy a region of video memory from one page to another.
441 * It assumes that the left edge of the tile is the same on both
442 * regions and the memory areas do not overlap.
445 modexCopyPageRegion(page_t *dest, page_t *src,
448 word width, word height)
450 word doffset = (word)dest->data + dy*(dest->width/4) + dx/4;
451 word soffset = (word)src->data + sy*(src->width/4) + sx/4;
452 word scans = width/4;
453 word nextSrcRow = src->width/4 - scans - 1;
454 word nextDestRow = dest->width/4 - scans - 1;
455 byte lclip[] = {0x0f, 0x0e, 0x0c, 0x08}; /* clips for rectangles not on 4s */
456 byte rclip[] = {0x0f, 0x01, 0x03, 0x07};
457 byte left = lclip[sx&0x03];
458 byte right = rclip[(sx+width)&0x03];
461 MOV AX, SCREEN_SEG ; work in the vga space
466 MOV DX, GC_INDEX ; turn off cpu bits
470 MOV AX, SC_INDEX ; point to the mask register
480 MOV CX, scans ; the number of latches
482 MOV AL, left ; do the left column
487 MOV AL, 0fh ; do the inner columns
489 REP MOVSB ; copy the pixels
491 MOV AL, right ; do the right column
496 MOV AX, SI ; go the start of the next row
500 ADD AX, nextDestRow ;
503 DEC height ; do the rest of the actions
506 MOV DX, GC_INDEX+1 ; go back to CPU data
507 MOV AL, 0ffh ; none from latches
515 modexFadeOn(word fade, byte *palette) {
516 fadePalette(-fade, 64, 64/fade+1, palette);
521 modexFadeOff(word fade, byte *palette) {
522 fadePalette(fade, 0, 64/fade+1, palette);
527 modexFlashOn(word fade, byte *palette) {
528 fadePalette(fade, -64, 64/fade+1, palette);
533 modexFlashOff(word fade, byte *palette) {
534 fadePalette(-fade, 0, 64/fade+1, palette);
539 fadePalette(sbyte fade, sbyte start, word iter, byte *palette) {
543 /* handle the case where we just update */
545 modexPalUpdate1(palette);
549 while(iter > 0) { /* FadeLoop */
550 for(i=0; i<PAL_SIZE; i++) { /* loadpal_loop */
551 tmppal[i] = palette[i] - dim;
552 if(tmppal[i] > 127) {
554 } else if(tmppal[i] > 63) {
558 modexPalUpdate1(tmppal);
567 modexPalSave(byte *palette) {
570 outp(PAL_READ_REG, 0); /* start at palette entry 0 */
571 for(i=0; i<PAL_SIZE; i++) {
572 palette[i] = inp(PAL_DATA_REG); /* read the palette data */
580 ptr = malloc(PAL_SIZE);
584 printf("Could not allocate palette.\n");
593 modexLoadPalFile(byte *filename, byte **palette) {
597 /* free the palette if it exists */
602 /* allocate the new palette */
603 *palette = modexNewPal();
606 file = fopen(filename, "rb");
608 printf("Could not open palette file: %s\n", filename);
615 *ptr++ = fgetc(file);
623 modexSavePalFile(char *filename, byte *pal) {
627 /* open the file for writing */
628 file = fopen(filename, "wb");
630 printf("Could not open %s for writing\n", filename);
634 /* write the data to the file */
635 fwrite(pal, 1, PAL_SIZE, file);
643 fadePalette(-1, 64, 1, tmppal);
649 fadePalette(-1, -64, 1, tmppal);
655 modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset)
657 byte *p = bmp->palette;
661 static word a[PAL_SIZE]; //palette array of change values!
662 word z=0, aq=0, aa=0, pp=0;
667 memset(a, -1, sizeof(a));
668 outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
678 // printf("q: %02d\n", (q));
679 // printf("qq: %02d\n", (qq));
680 //printf(" (*i)-q=%02d\n", (*i)-q);
681 outp(PAL_WRITE_REG, qq); /* start at the beginning of palette */
683 if((*i)<PAL_SIZE/2 && w==0)
685 for(; (*i)<PAL_SIZE/2; (*i)++)
687 //if(i%3==0 && (p[i+5]==p[i+4] && p[i+4]==p[i+3] && p[i+3]==p[i+2] && p[i+2]==p[i+1] && p[i+1]==p[i] && p[i+5]==p[i]))
688 //____ if((qp>0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else
689 if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5]))
694 else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3))
696 //printf("qp=%d\n", qp);
697 //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);
698 printf(" %d's color=%d\n", (*i), (a[qp])-(bmp->offset*3)+qp);
699 //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit!
700 if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; }
704 if(bmp->offset==0 && (*i)<3 && q==0) outp(PAL_DATA_REG, 0);
706 if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]);
707 else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]);
708 printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); }
711 //if(qp>0) printf("qp=%d\n", qp);
712 //if(qp>0) printf(" (*i)=%d\n", (*i)/3);
714 modexWaitBorder(); /* waits one retrace -- less flicker */
715 if((*i)>=PAL_SIZE/2 && w==0)
717 for(; (*i)<PAL_SIZE; (*i)++)
719 //____ if((qp>0)&&((*i)-q)%3==0 && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5])) outp(PAL_DATA_REG, p[(*i)-q]); else
720 if(((((*i)-q)%3==0)) && (p[((*i)-q)]==p[((*i)-q)+3] && p[((*i)-q)+1]==p[((*i)-q)+4] && p[((*i)-q)+2]==p[((*i)-q)+5]))
725 else if(qp>0 && (*i)>=(qp) && (*i)<((qp)+3))
727 //printf("qp=%d\n", qp);
728 //printf(" (*i)=%d a[%d]=%d\n", (*i), qp, a[qp]);
729 printf(" %d's color=%d\n", (*i), (a[qp]-(bmp->offset*3)+qp));
730 //outp(PAL_DATA_REG, p[((a[qp])-(bmp->offset*3)+qp)]);// fix this shit!
731 if((*i)+1==(qp)+3){ w++; /*(*i)++;*/ break; }
735 if(qp==0) outp(PAL_DATA_REG, p[(*i)-q]);
736 else{ //outp(PAL_DATA_REG, p[((*i)-(bmp->offset*3)+qp)]);
737 printf("p[]=%d qp=%d p[]-qp=%d\n", ((*i)-(bmp->offset*3)), qp, ((*i)-(bmp->offset*3))+qp); }
740 //printf(" (*i)=%d\n", (*i)/3);
743 printf("\nqqqqqqqq\n\n");
749 long bufSize = (bmp->width * bmp->height);
751 //printf("1(*i)=%02d\n", (*i)/3);
752 //printf("1z=%02d\n", z/3);
753 chkcolor(bmp, &q, &a, &aa, &z, i);
754 //printf("2(*i)=%02d\n", (*i)/3);
755 //printf("2z=%02d\n", z/3);
760 // printf("a[%02d]=(%d)\n", aq, a[aq]);
762 else { aqoffset++; break; }
764 //update the image data here!
765 for(lq=0; lq<bufSize; lq++)
769 use a[qp] instead of bmp->offset for this spot!
774 Facking bloody point the values of the changed palette to correct values.... major confusion! wwww
777 //(offset/bmp->offset)*bmp->offset
780 //printf("%02d ",bmp->data[lq]+bmp->offset);
781 //if(lq > 0 && lq%bmp->width==0) printf("\n");
782 //printf("%02d_", bmp->data[lq]+bmp->offset);
783 /*if(bmp->data[lq]+bmp->offset==aq)
785 //printf("%02d", bmp->data[lq]);
786 //printf("\n%02d\n", bmp->offset);
787 printf("aq=%02d ", aq);
788 printf("a[aq]=%02d ", a[aq]);
789 printf("a[aq]+aqpp=%02d ", a[aq]+aqpp);
790 printf("a[aq]-aqpp=%02d\n", a[aq]-aqpp);
791 //bmp->data[lq]=((bmp->data[lq]+bmp->offset)-a[aq]);
792 //++++ bmp->data[lq]=a[aq]-aqpp;
793 // printf("_%d ", bmp->data[lq]);
794 //if(lq > 0 && lq%bmp->width==0) printf("\n");
796 else if(bmp->data[lq]+bmp->offset < ((*i)/3)-aqpp)
798 if(bmp->data[lq]+bmp->offset >= aq)
800 bmp->data[lq]=(bmp->data[lq]+bmp->offset)-aqpp;//-((z-(*i))/3);
801 //printf("_%d ", bmp->data[lq]+bmp->offset)-aqpp-((z-(*i))/3);
803 else bmp->data[lq]+=(bmp->offset-aqpp);
806 //printf("%02d`", bmp->data[lq]);
807 //if(lq > 0 && lq%bmp->width==0) printf("\n");
810 //printf(" aq=%02d\n", aq);
811 //printf(" aa=%02d\n", aa);
813 //update the palette~
814 modexPalUpdate(bmp, &pp, aq, aqoffset);
817 if(aq<aa){ pp=q; aq++; goto aqpee; }
822 modexPalUpdate1(byte *p)
826 outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
827 for(i=0; i<PAL_SIZE/2; i++)
829 outp(PAL_DATA_REG, p[i]);
831 modexWaitBorder(); /* waits one retrace -- less flicker */
832 for(; i<PAL_SIZE; i++)
834 outp(PAL_DATA_REG, p[(i)]);
839 modexPalUpdate0(byte *p)
843 outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
844 for(i=0; i<PAL_SIZE/2; i++)
846 outp(PAL_DATA_REG, rand());
848 modexWaitBorder(); /* waits one retrace -- less flicker */
849 for(; i<PAL_SIZE; i++)
851 outp(PAL_DATA_REG, rand());
856 //i want to make another vesion that checks the palette when the palette is being appened~
857 void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)
863 //printf("q: %02d\n", (*q));
864 printf("chkcolor start~\n");
865 printf("1 (*z): %d\n", (*z)/3);
866 printf("1 (*i): %d\n", (*i)/3);
867 // printf("1 offset of color in palette (*q): %d\n", (*q)/3);
868 printf("wwwwwwwwwwwwwwww\n");
869 //check palette for dups
870 for(; (*z)<PAL_SIZE; (*z)+=3)
872 //printf("\n z: %d\n", (*z));
873 //printf(" q: %d\n", (*q));
874 //printf(" z+q: %d\n\n", ((*z)+(*q)));
877 //---- if(pal[(*z)]==pal[(*z)+3] && pal[(*z)+1]==pal[(*z)+4] && pal[(*z)+2]==pal[(*z)+5])
880 // printf("\n%d [%02d][%02d][%02d]\n", (*z), pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
881 // printf("%d [%02d][%02d][%02d]\n\n", (*z)+3, pal[(*z)+3], pal[(*z)+4], pal[(*z)+5]);
885 else for(zz=0; zz<(*q); zz+=3)
887 //printf("zz: %02d\n", zz/3);
890 if(pal[((*z)+(*q))]==pal[((*z)+(*q))+3] && pal[((*z)+(*q))+1]==pal[((*z)+(*q))+4] && pal[((*z)+(*q))+2]==pal[((*z)+(*q))+5]) //break if duplicate colors found in palette because it have reached the end of the current data of the palette
894 // printf("\nzq1:%d[%02d][%02d][%02d]\n", (zz+q), pal[(zz+q)], pal[(zz+q)+1], pal[(zz+q)+2]);
895 // printf("zq2:%d[%02d][%02d][%02d]\n\n", (zz+q)+3, pal[(zz+q)+3], pal[(zz+q)+4], pal[(zz+q)+5]);
898 else if(pal[zz]==pal[((*z)+(*q))] && pal[zz+1]==pal[((*z)+(*q))+1] && pal[zz+2]==pal[((*z)+(*q))+2])
900 // printf("\n\nwwwwwwwwwwwwwwww\n");
901 // printf(" zq: %d [%02d][%02d][%02d] value that is needing to be changed~\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);
902 // printf(" zz: %d [%02d][%02d][%02d] value that the previous value is going to change to~\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);
903 // //printf(" zv: %d [%02d][%02d][%02d] wwww\n", (zz-z+q)/3, pal[(zz-z+q)], pal[(zz-z+q)+1], pal[(zz-z+q)+2]);
904 // printf(" z : %d [%02d][%02d][%02d] offset value~\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
909 planned features that i plan to implement~
910 image that has values on the pallete list!
912 no... wait.... no wwww
914 //for(zzii=0; zzii<3; zzii++)
916 //printf("z+q: %d\n\n", ((*z)+(*q)));
920 printf("!! a[%02d]: %d\n", (((*z)+(*q))/3), zz/3);
921 // printf("\n aa: %d\n\n", (*aa));
922 // printf(" a[%02d]=(%02d) offset array i think the palette should be updated again~\n", ((*z)+(*q))/3, a[((*z)+(*q))/3]);
923 // printf("wwwwwwwwwwwwwwww\n\n");
927 printf("================\n");
928 printf("zq: %d [%02d][%02d][%02d]\n", ((*z)+(*q))/3, pal[((*z)+(*q))], pal[((*z)+(*q))+1], pal[((*z)+(*q))+2]);
929 printf("zz: %d [%02d][%02d][%02d]\n", (zz)/3, pal[zz], pal[zz+1], pal[zz+2]);
930 printf("z : %d [%02d][%02d][%02d]\n", (*z)/3, pal[(*z)], pal[(*z)+1], pal[(*z)+2]);
931 printf("================\n");
933 //printf("[%d]", (zz+q));
937 printf("wwwwwwwwwwwwwwww\n");
938 printf("2 (*z): %d\n", (*z)/3);
939 printf("2 (*i): %d\n", (*i)/3);
940 // printf("2 offset of color in palette (*q): %d\n", (*q)/3);
941 printf("chkcolor end~\n");
945 void bputs(/*bmp_t *bmp, */unsigned x, unsigned y, const char *s)
\r
950 //font = bios_8x8_font();
\r
953 //src.ops = &g_ops1;
\r
954 for(; *s != '\0'; s++)
\r
956 //src.raster = font + 8 * (*s);
\r
957 //blit1(&src, bmp, x, y);
\r
964 while(inp(INPUT_STATUS_1) & 8) {
968 while(!(inp(INPUT_STATUS_1) & 8)) {