Hello,
I released a new version of MSXgl on GitHub: MSXgl v0.9.3 Alpha.
Main changes:
- [VDP] Made the module compatible with last founding about VRAM access timing.
- [VDP] Added support for unofficial Screen 2 & 4 settings with screen strip mirroring. Showcased in s_gm3
sample.
- [PAC] Added feature to save data to PAC or FM-PAC cartridge SRAM. Showcased in s_pac
sample.
- [Clock] Added feature to save data to MSX2 real-time clock CMOS. Showcased in s_clock
sample.
- [DOS] Added several new MSX-DOS2 functions, and support for mapped memory. Showcased in s_dos2
sample.
- [Arkos] Added SFX support for Arkos Tracker II module (for AKG & AKM replayer).
- [Memory] Added 16-bits fill/copy feature (copy function are just inlined wrapper).
- [Game menu] Added new events callback when new item/page is selected.
- [Tile] Added new module to handle MSX2 bitmap modes as tiled modes. Showcased in s_swtile
sample.
- [Math] Optimized registers usage.
- [V9990] Fixed bug in 16 bits peek function.
- [Reg] Added helper function to set registers from C.
- [Crt0] Added new target to generate bootable disk program (names DOS0
).
- [Crt0] Added new feature for ROM target on page 0 to be able to put data without the need of __at()
directive.
- [Build tool] Added option to change SDCC compile complexity (the higher, the best code is generated, but the longer the compile long).
- [MSXtk] Updated MSXimg image converter tool (support Screen 1, and Pletter compression for tiled base Screen).
- [Doc] Updated source code documentation.
- Many other fixes and optimizations...
Graph mode 3 sample (using mirrored unofficial Screen 4 setting and screen-split to display 64 sprites on screen). Try it on WebMSX!
Software tile sample (using Screen 5). Try it on WebMSX!
I'm available here or on Discord to answer any questions or help you get started with MSXgl.
Great update again, this library is getting better and better .
In the project_config.js of the templates there is a setting for ROMSize mentioned twice, with almost the same description. It looks like this is just a duplication, or was there really a different setting intended?
This is indeed a duplication. Fixed.
Thanks for pointing it out.
Question about MSXimg:
For a V9990 based MSXgl project I now have a tiles bitmap (.PNG) which I convert into the format for V9990. The bitmap has a size of 256 x 744, so want to convert it into segments of 8KB (I'm using an ASCII-8 mapper target).
Current solution runs the MSXImg tool multiple times in chunks of 64 pixels high, which gives exactly blocks of 8KB, these are used directly in _s?_b? files. Problem however is that it also generates the palette data and this makes it go just over the 8KB boundary. For now I manually removed the palette data after generating and it all works. Of course this could also become an automatic step but wondering if there is not an easier way.
So in short my questions:
- Is there a way to let the MSXImg tool generate multiple blocks of data (separate files) out of one image file?
- Is there a way to select to use, but not output in the generated file, the -bpc 4 -pal custom --pal24 option?
- Is there a way to only generate the palette output, for example in a seperate .h file so to have it only once?
Hello,
I didn't anticipate this.
Having said that, I think you can place a file larger than 8 KB in a segment file (myProject_sX_bX) and the extra will be placed in the following segments.
I'll give it a try.
Otherwise, I can easily add an option to don't save the palette and/or save it in a separate file.
Hello,
I have just started experimenting with MSXgl and must say that this is a very interesting project.
I have just tried my first own little program. However, I am struggling with a strange behaviour by the compiler.
If I try this:
#include "msxgl.h" #include "dos.h" #include "string.h" #include "myDOSapp.h" /// Program entry point const u8 dimX = 40; //#define DIMX 40 void main(u8 argc, const c8** argv) { DOS_StringOutput("Hello World 18:00\n\r$"); dimX++; int field[dimX]; field[0] = 1; char dimString[20]; String_FromUInt8(dimX, dimString); dimString[3]='$'; DOS_StringOutput(dimString); DOS_Exit0(); }
I get these strange and contradicting error messages:
./myDOSapp.c(39) : error 2: Initializer element is not a constant expression ./myDOSapp.c(38) : error 33: Attempt to assign value to a constant variable (++)
The line numbers in the error messages refer to these lines:
dimX++; int field[dimX];
How can the compiler say that I can not declare an array because the argument is not constant and at the same time say that I can not change the very same symbol because it is a constant ?
I have tried a comparable example with gcc and had no errors (as expected).
I know that I can do a workaround using preprocessor directives but I still wonder why this approach does not work.
Well, both things are not supported in standard C... you can't change the value of the constant dimX with the ++ post-fix operator. And variable array sizes are not supported. However, as it is declared as const, you'd expect it to just use the const value at compile time. But maybe this wasn't supported in older C standards. Well, see e.g. the highest comment on https://stackoverflow.com/questions/18848537/can-a-const-var...
I suppose SDCC is not C99 compliant :) (Although the website claims it is.)
const u8 dimX = 40; ... dimX++;
The error you get with this is good, because you explicitly asked the compiler to give you an error if you try to modify dimX
. "Constant" means "doesn't change." So if you're not jumping for joy that the compiler refuses to compile dimX++
in this situation, you need to step back and carefully re-think what you're trying to do, because what you say you want is pretty clearly not what you want.
(This is a pretty normal situation in computer programming, BTW; you get a half-formed idea, start coding it, the compiler starts complaining, and that's what gives you the hint that your idea has some serious problems with it. Happens to me all the time.)
MSXgl use the sdcc11 option for compile C code that is described as « Generally follow the ISO C11 standard, but allow some SDCC behaviour that conflicts with the standard ».
I recommend you to use define for your constant values.