big question is: where to download Fusion C. I registered and "bought it". I never got a download link.
If you had asked Google you would already have the answer.
- Fusion-C 1.2 : https://github.com/ericb59/Fusion-C-v1.2
- Fusion-C 1.3 : https://github.com/ericb59/FUSION-C-1.3 (stable?)
- Fusion-C 2.0 : Incoming...
big question is: where to download Fusion C. I registered and "bought it". I never got a download link.
If you had asked Google you would already have the answer.
- Fusion-C 1.2 : https://github.com/ericb59/Fusion-C-v1.2
- Fusion-C 1.3 : https://github.com/ericb59/FUSION-C-1.3 (stable?)
- Fusion-C 2.0 : Incoming...
Ofcourse I have found that, but then: why register at all? I assume that if you have a webshop, and you offer a product, you also offer it for download. This way, the registration is a joke.
Hi All,
New project. I solved my linked list issue and went to a new challenge. I made a little program that reads a screen 8 file and vpokes it straight in to cram, starting at 0, all the way to EOF. I skip the header, start location and size of the file. That way I get the image but the colours are not what I see with MifUI when I create a file.
Second challenge: I can also decrease the image size by taking every second byte and skipping every second line. But whatever way I try, it doesn't work. At some point I even got my input image at two location with one vpoke. Does anyone have a smart way to do something like this? In ascii C, not assembly please.
Another question: is there an example or description of the layout of other screenmodes and there .sc files? I happen to find a site that described the layout of the screen 8 file. I also have some code that can translate RGB to screen 12 (YJK) but I don't understand how I can use that when vpoking it in to VRAM.
code below works but doesn't really display a correct image.
#include #include #define TRUE 1 /* constants for BOOL */ #define FALSE 0 FILE *ptr; char buf; unsigned teller, tel2, size; NAT maxX; NAT maxY; BOOL skip = FALSE; VOID disscr(); VOID enascr(); VOID wait() { char toets='\0'; while (toets == '\0' ) { if ( kbhit()) { toets=chget(); } } } VOID main() { TINY ylin,it,ix, yt; NAT Fc=2; tel2=0; it = 1; yt = 0; ix= ylin =0; ginit(); screen((TINY)8); setbuf(stdout, NULL); maxX = gtxmax(); maxY = gtymax(); teller = 0; if ( (ptr = fopen("flower.sc8","rb")) == NULL ) { screen((TINY)0); puts("Couldn't open file"); exit(0); } /* skip header*/ fread(&buf,1,1,ptr); /* skip location in memory*/ fread(&size,2,1,ptr); /* read size*/ fread(&size,2,1,ptr); /* go */ for (teller=0;teller <= size;++teller) { fread(&buf,1,1,ptr); tel2++; if ( it < Fc) { if (skip == FALSE ) vpoke ((NAT)((ylin*maxX)+ix),(TINY)buf); ++ix; ++it; } else { it=1; } if (tel2 == (int)(maxX/Fc)) { yt++; if ( yt == Fc ) { yt=1; if (skip) { skip = FALSE; } else { skip = TRUE; } ylin++; } ix=0; tel2=0; it=1; } } wait(); screen((TINY)0); exit(0); }
Ascii C shouldn't be used for graphics. See code below and comment out the line where it says so. Then see the difference. Tested on openmsx 17, 18 and a NMS 8255.
#include #include #define TRUE 1 /* constants for BOOL */ #define FALSE 0 FILE *ptr; char buf; unsigned teller, tel2, size; NAT maxX; NAT maxY; BOOL skp = FALSE; TINY csx, csy; VOID disscr(); VOID enascr(); VOID ei(); VOID di(); VOID wait() { char toets='\0'; while (toets == '\0' ) { if ( kbhit()) { toets=chget(); } } } VOID main() { TINY lt,ct,cy,factor; lt = ct = 1; cy=0; skp = FALSE; ginit(); color ((TINY)15,(TINY)0,(TINY)0); screen((TINY)8); setbuf(stdout, NULL); maxX = gtxmax(); maxY = gtymax(); factor=3; if ( (ptr = fopen("flower.sc8","rb")) == NULL ) { screen((TINY)0); puts("Couldn't open file"); exit(0); } /* skip header*/ fread(&buf,1,1,ptr); /* skip location in memory*/ fread(&buf,1,1,ptr); vpoke((NAT)0,(TINY)buf); fread(&buf,1,1,ptr); vpoke((NAT)1,(TINY)buf); /* read size*/ fread(&size,2,1,ptr); /* go */ setwrt(0); for (csy = 1; csy < 212; csy++ ) { /*if ((csy % factor) == 0) { skp = TRUE; } else { skp = FALSE; cy++; }*/ for (csx = 0; csx <= 250; csx++ ) { fread(&buf,1,1,ptr); if ((csx % factor) != 0) /* comment this line out and see*/ outvdp((TINY)buf); } cy++; } wait(); screen((TINY)0); exit(0); }
Another question: is there an example or description of the layout of other screenmodes and there .sc files?
Detailed description of screen modes can be found in the V9938 Programmers Guide (for MSX 1 and 2 modes).
.SCx
format description can be found on the MSX-BASIC file formats wiki page.
It's just a dump of the VRAM so depending of the screen mode a .SCx
file can contain bitmap information, screen layout, pattern shape/color, sprite or palette.
I had seen the file formats on msx.org. Thats what I covered in my code. I had hoped that the V9938 guide had been processed to something like offsets etc. I have however given up on this topic. MSX C and graphics are no good combination. See my posted code to see, why.
If you want to code in C to create MSX application, you should use a newer library like Fusion-C or MSXgl.
Thanks for your support. After two hours I got it working. For people that also consider going too Fusion
- the SDCC version in the Fusion pack is 3.6, newest version is 4.1. Leave that
- the included linux SDCC version is 32 bit which is no longer supported on modern linux
- the included Mac OS universal binaries won't run on X86_64
- the newest 4.1 build will run on Mac OS but you will have to tell gatekeeper "Run Anyway" for every tool it needs
- SDCC on Windows will default to an install in C:\Program Files\SDCC. Windows protects the integrity of all files in this directory so you'll need administrator rights for about everything.
And what about MSXgl?
And what about MSXgl?
I skipped Mac and Linux. Went for Windows and got that working.