runable Graphics wanted...
Moderator: Moderators
runable Graphics wanted...
Hy,
i am playing around with the screenshot feature in VICE a bit, i need runable VIC20 graphics. Preferably something that loads quickly and doesnt require me to press any buttons/keys. Any pointers?
i am playing around with the screenshot feature in VICE a bit, i need runable VIC20 graphics. Preferably something that loads quickly and doesnt require me to press any buttons/keys. Any pointers?
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
- Mike
- Herr VC
- Posts: 4887
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: runable Graphics wanted...
All MINIGRAFIK/MINIPAINT picture files contain a built-in display routine. Just load them with ",8" (*not* ",8,1"!) with a +8K RAM expansion and then run them.groepaz wrote:i need runable VIC20 graphics. [...] Any pointers?
The *.d64 of the MG batch suite features several picture files, which are normally displayed within a slide show, but you can also view them stand-alone with the method just stated.
Re: runable Graphics wanted...
thank you, that helped
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Re: runable Graphics wanted...
Oh btw, while i am at it... the point of this request was that i am fixing "native" Screenshots - ie C64 "koala" and "hires" formats.
Now the question is - is there a similar common format for vic20 aswell? and can you point to a description of the format, and preferably a pc based tool to display it (for quick testing)?
Now the question is - is there a similar common format for vic20 aswell? and can you point to a description of the format, and preferably a pc based tool to display it (for quick testing)?
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
- Mike
- Herr VC
- Posts: 4887
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: runable Graphics wanted...
I am the inventor of the aforementioned MG file format, so my view might be somewhat biased, but I think yes, it is the equivalent of *.koa for the VIC-20. There is enough 3rd party use of it to justify the point.groepaz wrote:Oh btw, while i am at it... the point of this request was that i am fixing "native" Screenshots - ie C64 "koala" and "hires" formats.
Now the question is - is there a similar common format for vic20 aswell? and can you point to a description of the format, and preferably a pc based tool to display it (for quick testing)?
The format has been thoroughly documented in the MINIPAINT manual, in Appendix D, save for the static/boilerplate binary blobs at the begin and end. You get a copy of those with each saved file.
Thus far I didn't consider a PC based viewer, but I can hack together a MG2PPM converter, which also would check the conformity of the static parts. Shall we discuss the details in PM?
I should note that MG displays a 160x192 pixel bitmap, whereas the standard text mode has an equivalent resolution of 176x184 pixels, so you won't be able to screenshot a text screen as MG bitmap.
Re: runable Graphics wanted...
We already have code to deal with the size differences (either scaling or cropping or adding borders), so that's no problem.
It raises another question though - is there also a "hires" format? Or does this work similar to the C64 Textmode, ie mixed hires and mulicolor, toggled by some bit in the color ram?
It raises another question though - is there also a "hires" format? Or does this work similar to the C64 Textmode, ie mixed hires and mulicolor, toggled by some bit in the color ram?
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
- Mike
- Herr VC
- Posts: 4887
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: runable Graphics wanted...
Exactly this. The VIC-I always renders a multi-colour text mode.groepaz wrote:Or does this work similar to the C64 Textmode, ie mixed hires and mulicolor, toggled by some bit in the color ram?
Re: runable Graphics wanted...
OK, fine, should be very doable then
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
- Mike
- Herr VC
- Posts: 4887
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: runable Graphics wanted...
groepaz wrote:[...] can you point to a description of the format, and preferably a pc based tool to display it (for quick testing)?
Here we go: (download)Mike wrote:Thus far I didn't consider a PC based viewer, but I can hack together a MG2PPM converter, which also would check the conformity of the static parts. [...]
You can use the resize function of your favourite image processing tool to apply the correct pixel aspect ratio.
Code: Select all
/*
* mg_render.c - written 2020-09-17 by Michael Kircher
*
* - validate and render a MG picture file to *.ppm with predefined palette.
*/
#include <stdio.h>
#include <stdlib.h>
#include "image.h"
#define X_SIZE 160
#define Y_SIZE 192
#define FILE_SIZE 4097
typedef enum {false,true} boolean;
RGB vic_palette[16]=
{
{ 0, 0, 0}, /* Black */
{255, 255, 255}, /* White */
{148, 23, 1}, /* Red */
{ 82, 198, 212}, /* Cyan */
{144, 28, 204}, /* Purple */
{ 81, 190, 8}, /* Green */
{ 49, 26, 213}, /* Blue */
{196, 215, 28}, /* Yellow */
{163, 81, 0}, /* Orange */
{208, 176, 22}, /* Light Orange */
{233, 121, 105}, /* Light Red */
{132, 243, 255}, /* Light Cyan */
{221, 115, 255}, /* Light Purple */
{142, 246, 79}, /* Light Green */
{133, 112, 255}, /* Light Blue */
{242, 255, 84} /* Light Yellow */
};
unsigned char MG_FILE_HEADER[]=
{
0xF1, 0x10, 0x0C, 0x12, 0xD8, 0x07, 0x9E, 0x20, 0x38, 0x35,
0x38, 0x34, 0x00, 0x00, 0x00
};
unsigned char MG_FILE_FOOTER[]=
{
0x18, 0xA9, 0x10, 0xA8, 0x99, 0xF0, 0x0F, 0x69, 0x0C, 0x90,
0x02, 0xE9, 0xEF, 0xC8, 0xD0, 0xF4, 0xA0, 0x05, 0x18, 0xB9,
0xE4, 0xED, 0x79, 0xFA, 0x21, 0x99, 0x00, 0x90, 0x88, 0x10,
0xF3, 0xAD, 0x0E, 0x90, 0x29, 0x0F, 0x0D, 0x0E, 0x12, 0x8D,
0x0E, 0x90, 0xAD, 0x0F, 0x12, 0x8D, 0x0F, 0x90, 0xA9, 0x10,
0x85, 0xFB, 0xA9, 0x12, 0x85, 0xFC, 0xA9, 0x00, 0x85, 0xFD,
0xA9, 0x11, 0x85, 0xFE, 0xA2, 0x0F, 0xA0, 0x00, 0xB1, 0xFB,
0x91, 0xFD, 0xC8, 0xD0, 0xF9, 0xE6, 0xFC, 0xE6, 0xFE, 0xCA,
0xD0, 0xF2, 0xA2, 0x00, 0xA0, 0x00, 0xBD, 0x10, 0x21, 0xE8,
0x99, 0x00, 0x94, 0xC8, 0x4A, 0x4A, 0x4A, 0x4A, 0x99, 0x00,
0x94, 0xC8, 0xC0, 0xF0, 0xD0, 0xEC, 0x20, 0xE4, 0xFF, 0xF0,
0xFB, 0x4C, 0x32, 0xFD, 0x02, 0xFE, 0xFE, 0xEB, 0x00, 0x0C
};
IMAGE *mg_render(unsigned char *raw)
{
IMAGE *dst;
if(NULL != (dst=image_alloc(X_SIZE,Y_SIZE,RGB_IMG)))
{
RGB temp,palette[4];
int x1,x2,y1,y2;
unsigned char bitmap,colour;
boolean is_multi,is_inverse=(0 == (raw[-1]&0x08));
palette[3]=vic_palette[(raw[-2]>>4)&0x0F];
for(y1=0; y1<Y_SIZE/16; y1++)
for(x1=0; x1<X_SIZE/8; x1++)
{
colour=(raw+X_SIZE*Y_SIZE/8)[((X_SIZE/8)*y1+x1)/2];
palette[0]=vic_palette[(raw[-1]>>4)&0x0F];
if(0 == (x1&1))
{
palette[1]=vic_palette[colour&0x07];
is_multi=(0 != (colour&0x08));
}
else
{
palette[1]=vic_palette[(colour>>4)&0x07];
is_multi=(0 != ((colour>>4)&0x08));
}
palette[2]=vic_palette[raw[-1]&0x07];
if(is_multi)
{
temp=palette[1]; palette[1]=palette[2]; palette[2]=temp;
}
else if(is_inverse)
{
temp=palette[0]; palette[0]=palette[1]; palette[1]=temp;
}
for(y2=0; y2<16; y2++)
{
bitmap=raw[Y_SIZE*x1+16*y1+y2];
if(!is_multi)
for(x2=0; x2<8; x2+=1)
rgb_pixel(dst,8*x1+x2,16*y1+y2)=palette[(bitmap>>(7-x2))&0x01];
else
for(x2=0; x2<8; x2+=2)
{
int x=8*x1+x2,y=16*y1+y2;
rgb_pixel(dst,x+1,y)=rgb_pixel(dst,x,y)=palette[(bitmap>>(6-x2))&0x03];
}
}
}
}
return(dst);
}
int main(int argc, char *argv[])
{
FILE *src;
IMAGE *dst;
unsigned char file[FILE_SIZE];
int i, data;
if(3 != argc)
{
fprintf(stderr,"%s: Syntax: %s <in_file> <out_file>\n",argv[0],argv[0]);
exit(EXIT_FAILURE);
}
if(NULL == (src=fopen(argv[1],"rb")))
{
fprintf(stderr,"%s: Error: could not open file \'%s\' for read access.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
for(i=0; i<FILE_SIZE; i++)
{
if(EOF == (data=getc(src)))
{
fprintf(stderr,"%s: Error: file \'%s\' truncated.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
file[i]=data;
}
if(EOF != (data=getc(src)))
{
fprintf(stderr,"%s: Error: file \'%s\' over-length.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
fclose(src);
for(i=0; i<sizeof(MG_FILE_HEADER); i++)
{
if(file[i] != MG_FILE_HEADER[i])
{
fprintf(stderr,"%s: Error: file \'%s\', header mismatch.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
}
for(i=0; i<sizeof(MG_FILE_FOOTER); i++)
{
if(file[i+FILE_SIZE-sizeof(MG_FILE_FOOTER)] != MG_FILE_FOOTER[i])
{
fprintf(stderr,"%s: Error: file \'%s\', footer mismatch.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
}
if(0 != (file[15] & 0x0F))
{
fprintf(stderr,"%s: Error: file \'%s\' saved with non-0 audio volume.\n",argv[0],argv[1]);
exit(EXIT_FAILURE);
}
dst=mg_render(file+17);
image_save(dst,argv[2]);
image_free(dst);
exit(EXIT_SUCCESS);
}
Michael
- pixel
- Vic 20 Scientist
- Posts: 1399
- Joined: Fri Feb 28, 2014 3:56 am
- Website: http://hugbox.org/
- Location: Berlin, Germany
- Occupation: Pan–galactic shaman
Re: runable Graphics wanted...
Hey, thant's great! If you don't mind I slap on an open-source license of your choice, refurbish it a bit, add a make script for Unices and put it on Github.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
- Mike
- Herr VC
- Posts: 4887
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: runable Graphics wanted...
@pixel: PM sent.pixel wrote:Hey, thant's great! If you don't mind I slap on an open-source license of your choice, refurbish it a bit, add a make script for Unices and put it on Github.
For the interested parties: "image.c", "image.h" and "matrix.h" are licenced with CC0, and "mg_render.c" is licenced with CC-BY-SA.
- pixel
- Vic 20 Scientist
- Posts: 1399
- Joined: Fri Feb 28, 2014 3:56 am
- Website: http://hugbox.org/
- Location: Berlin, Germany
- Occupation: Pan–galactic shaman
Re: runable Graphics wanted...
It's been finished a couple of days ago – if someone could tell me how (what text) to include these licenses in the sources that'd be much of a help.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
- pixel
- Vic 20 Scientist
- Posts: 1399
- Joined: Fri Feb 28, 2014 3:56 am
- Website: http://hugbox.org/
- Location: Berlin, Germany
- Occupation: Pan–galactic shaman
Re: runable Graphics wanted...
Here is the unixoid version: https://github.com/SvenMichaelKlose/mg_render with Windoze executable included.
Took some extra time because of a lot of regular work and then something that could've been COVID knocked me out for the better part of the week.
Took some extra time because of a lot of regular work and then something that could've been COVID knocked me out for the better part of the week.
A man without talent or ambition is most easily pleased. Others set his path and he is content.
https://github.com/SvenMichaelKlose
https://github.com/SvenMichaelKlose
Re: runable Graphics wanted...
Oookay, i finally found the time to actually add this
https://sourceforge.net/p/vice-emu/code/39977/
Not perfect yet, Hires blocks not handled at all right now. The algorithm that chooses the common/shared colors can probably be improved. The tables used for color substitution are kindof bad. Patches welcome
Find an ad hoc build for windows here: https://github.com/VICE-Team/svn-mirror ... tag/r39977
Cheers
https://sourceforge.net/p/vice-emu/code/39977/
Not perfect yet, Hires blocks not handled at all right now. The algorithm that chooses the common/shared colors can probably be improved. The tables used for color substitution are kindof bad. Patches welcome
Find an ad hoc build for windows here: https://github.com/VICE-Team/svn-mirror ... tag/r39977
Cheers
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
Re: runable Graphics wanted...
Thanks, interesting feature. I just tested on Linux.
Multicolor seems pretty OK but hires needs to be supported to get decent screenshots from games.
Multicolor seems pretty OK but hires needs to be supported to get decent screenshots from games.