[MSX-C] Q&A official thread

Page 61/68
54 | 55 | 56 | 57 | 58 | 59 | 60 | | 62 | 63 | 64 | 65 | 66

By aoineko

Paladin (1002)

aoineko's picture

18-01-2023, 21:11

Check the VDP register values in your favorite emulator and compare with value you are expecting.

By rolandve

Champion (358)

rolandve's picture

18-01-2023, 21:49

aoineko wrote:

Check the VDP register values in your favorite emulator and compare with value you are expecting.

It shows register 25 having the right values. So it shows all the expected values. Puzzling. I don't know which other values are normal...

By rolandve

Champion (358)

rolandve's picture

18-01-2023, 21:50

try this Smile

#include 
#include 

BOOL skip, scale;
#define TRUE	1		/* constants for BOOL */
#define FALSE	0

TINY smode;

VOID disscr();
VOID enascr();

VOID wait()
{
	char toets='\0';
	while (toets == '\0' )
		{
			if ( kbhit()) {
				toets=chget();
			}

		}
}


VOID display( file )
char *file;

{
    FILE *ptr;
    char buf;
    char *stBuf[256];
    char *cpBuf[128];
    TINY it=1;
    TINY CT=0;
    NAT il=0;
    NAT teller,size, acttel;
    skip = scale = FALSE;

    teller = size = acttel = 0;
    screen((TINY)8);
    di();
    outp(0x99,(TINY)8);
    outp(0x99,(TINY)128+25); /* screen 12 ???*/
    ei();
    if ( (ptr = fopen(file,"rb")) == NULL ) {
        screen((TINY)0);
        puts("Couldn't open file");
        exit(0);
    }
    memset(cpBuf,(char)0,128);
    /* skip header*/
    fread(&buf,1,1,ptr);
    /* skip location in memory*/
    fread(&buf,2,1,ptr);
    disscr();
    setwrt(0);    
    /* read size*/
    fread(&size,2,1,ptr);
    /* go */
    for (teller = 0; teller < size; teller+=256) {
            fread(stBuf,256,1,ptr);
            if ( scale ) {
                for (il=0; il < 256;il++) {
                    if (it == 1) {
                        if (CT < 127) cpBuf[CT] = stBuf[il];
                        it++;
                        CT++;
                    } else {
                        it=1;
                    }
                }
                if (!skip) { 
                    ldirvm(acttel,cpBuf,128);
                }
                if (skip) {
                    skip = FALSE;
                } else {
                    skip = TRUE;
                    acttel+=256;
                }
                it=1;
                CT=0;
        } else {
            ldirvm(teller, stBuf, 256);
        }
    }
    fclose(ptr);
    enascr();
    wait();
    screen((TINY)0);
}


VOID main(argc, argv) 
int argc;
char *argv[];
{
    unsigned teller=0;
    unsigned size=0;
    int c=0;
    smode = 8;

    wrtvdp((TINY)9,(TINY)130);
    wait();
    if ( argc > 0 ) {
        while ( --argc > 0 && (*++argv)[0] == '-' )
		while (c = *++argv[0])
			switch (c) {
				case 's':
					scale = TRUE;
					break;
				case '8':
					smode = 8;
					break;
                case 'c':
                    smode=12;
                    break;
			}
        ginit();
        color ((TINY)15,(TINY)0,(TINY)0);
        printf("loading :%s\n",(*argv));
        display(*argv);    
        exit(0); 
} else
    {
        printf("usage: picview -2 file\n");
        printf(" -2 half size\n");
        exit(0);
    }
}

By aoineko

Paladin (1002)

aoineko's picture

18-01-2023, 23:17

Check section 2. REGISTER FUNCTIONS of http://rs.gr8bit.ru/Documentation/V9938-programmers-guide.pdf for VDP registers bits meaning. For example, if BL bit of R#1 is 0, it may generate the problem you discribe.

By rolandve

Champion (358)

rolandve's picture

19-01-2023, 07:59

BL bit is set through function enascr() and disscr(). It is one. The only big problem I have now: the picture loads fine, I can see it, all colours are replaces by shades of green. R#0 0x0E and R#1 0x60. OpenMSX shows that the color palet is not only green. BL stays 1 all the time.

By rolandve

Champion (358)

rolandve's picture

19-01-2023, 15:18

My simple question is:

    screen((TINY)8);
    wrtvdp((TINY)25,(TINY)8);

Why does my screen 12 vram dump turn in to all shades of green? Registers are ok and show its screen 12. I am clearing the VRAM before I load the VRAM file. I Start writing from 0.

By aoineko

Paladin (1002)

aoineko's picture

19-01-2023, 17:58

I don't know the details of the MSX-C functions you mention, but if I were in your shoes, I would use the VDP register viewer widget of the openMSX debugger. It shows all the VDP options according to registers bit value and you can change those bits live to see how it affects your rendering. You should start by using the VRAM viewer to see if your graphics data is correct.

If you share your executable, we could help you more easily.

By rolandve

Champion (358)

rolandve's picture

19-01-2023, 18:51

I did that Smile I used the VDP register viewer and that's how I know that my registers are ok. I compared it with output from MSXgl. Can't post binary here.....

By rolandve

Champion (358)

rolandve's picture

19-01-2023, 20:02

Sadly openmsx debugger doesn't work on newest Mac OS. Crash.

By Manuel

Ascended (19462)

Manuel's picture

19-01-2023, 22:00

Where did you get it?

Page 61/68
54 | 55 | 56 | 57 | 58 | 59 | 60 | | 62 | 63 | 64 | 65 | 66