Jump to content

Recommended Posts

Small update: took the Makefile from the Turmoil project and adapted for my use to convert CC, CH an MP lines directly from the .mag file I made.

I like his idea of using the sourcefile directly to generate a C header file more than doing a feature request for a C header file as export as I now do not need to export again on changes made in my screen, just a save of the main .mag file is sufficient

 

Please improve/comment where needed, else maybe usefull for others.

Next step is actually using that in a first C program to show that screen (but out of time now).

SCREENNAME=ludo_mainscreen.mag
GRAPHICS=graphics.h

$(GRAPHICS): $(SCREENNAME) Makefile
	( echo "static const u8 colorset[] = {" ;\
	gawk -F: -e '$$1=="CC" { if (i>=0 && i<25) { split($$2, a, "|"); printf("0x%x%x,\n", a[1], a[2]) } i++ }' $(SCREENNAME) ;\
	echo "};" ;\
	echo "static const u8 charset[] = {" ;\
	gawk -F: -e '$$1=="CH" { if (i>=0 && i<200) { print gensub(/(..)/,"0x\\1,","g",$$2) } i++ }' $(SCREENNAME) ;\
	echo "};" ;\
	echo "static const u8 mainscreen[] = {" ;\
	gawk -F: -e '$$1=="MP" { split($$2, a, "|"); for( b in a ) { printf("0x%02x,", a[b]); } print "" }' $(SCREENNAME) ;\
	echo "};" ) > [email protected]

 

Edited by xahmol
  • Like 2

Share this post


Link to post
Share on other sites
On 3/17/2021 at 4:02 PM, xahmol said:

Small update: took the Makefile from the Turmoil project and adapted for my use to convert CC, CH an MP lines directly from the .mag file I made.

I like his idea of using the sourcefile directly to generate a C header file more than doing a feature request for a C header file as export as I now do not need to export again on changes made in my screen, just a save of the main .mag file is sufficient

 

Please improve/comment where needed, else maybe usefull for others.

Next step is actually using that in a first C program to show that screen (but out of time now).

SCREENNAME=ludo_mainscreen.mag
GRAPHICS=graphics.h

$(GRAPHICS): $(SCREENNAME) Makefile
	( echo "static const u8 colorset[] = {" ;\
	gawk -F: -e '$$1=="CC" { if (i>=0 && i<25) { split($$2, a, "|"); printf("0x%x%x,\n", a[1], a[2]) } i++ }' $(SCREENNAME) ;\
	echo "};" ;\
	echo "static const u8 charset[] = {" ;\
	gawk -F: -e '$$1=="CH" { if (i>=0 && i<200) { print gensub(/(..)/,"0x\\1,","g",$$2) } i++ }' $(SCREENNAME) ;\
	echo "};" ;\
	echo "static const u8 mainscreen[] = {" ;\
	gawk -F: -e '$$1=="MP" { split($$2, a, "|"); for( b in a ) { printf("0x%02x,", a[b]); } print "" }' $(SCREENNAME) ;\
	echo "};" ) > [email protected]

 

I could relatively easy add a C export option if you're interested - especially if a had an example of the desired output. It would follow the assembly output closely but with C syntax.

  • Like 1

Share this post


Link to post
Share on other sites
7 minutes ago, Asmusr said:

I could relatively easy add a C export option if you're interested - especially if a had an example of the desired output. It would follow the assembly output closely but with C syntax.

Thanks. Will come back on that if I get a first program working, as then I also would know what format I need 😉

But advantage of such a Make script is that there is not even a need to use an export, and to be more flexible in how it is converted in different projects.

Share this post


Link to post
Share on other sites

I have Magellan 3.1, and when I click on Export Assembler Data, nothing happens. Exporting to XB works fine.

Am I missing something here?

Share this post


Link to post
Share on other sites
30 minutes ago, Vorticon said:

I have Magellan 3.1, and when I click on Export Assembler Data, nothing happens. Exporting to XB works fine.

Am I missing something here?

 

Why not download Magellan 4.1.1?

 

...lee

  • Like 1

Share this post


Link to post
Share on other sites

Perhaps a feature request for a future update: Could there be an assembly export option with the XB screen offset by any chance?

Share this post


Link to post
Share on other sites
Posted (edited)
5 hours ago, Vorticon said:

Perhaps a feature request for a future update: Could there be an assembly export option with the XB screen offset by any chance?

As I understand your request, you would like an option to add 96 to all values in the map, wrapping around to 0 when greater than 255. It sounds to me like a feature few people would use, but yell if anybody want it. Isn't it possible to account for the offset when you create the Magellan file (use character 128 for space)? Or account for the offset in the assembly code instead?

Edited by Asmusr

Share this post


Link to post
Share on other sites
2 hours ago, Asmusr said:

As I understand your request, you would like an option to add 96 to all values in the map, wrapping around to 0 when greater than 255. It sounds to me like a feature few people would use, but yell if anybody want it. Isn't it possible to account for the offset when you create the Magellan file (use character 128 for space)? Or account for the offset in the assembly code instead?

Yes I could easily add the offset in my code, but it would a slower process if I plan on dumping a character map straight into VDP RAM in one shot using VMBW. 

No harm in asking :)

Share this post


Link to post
Share on other sites
38 minutes ago, Vorticon said:

Yes I could easily add the offset in my code, but it would a slower process if I plan on dumping a character map straight into VDP RAM in one shot using VMBW.

So how about the other option, placing the characters in Magellan at the positions where they should end up?

 

Magellan is open source. If anyone would like to contribute to Magellan, just send me a note and I will add you as a collaborator in github. To be honest the code is a bit messy, but I have spent a lot of time recently making the import/export code more accessible to developers.

 

https://github.com/Rasmus-M/magellan 

  • Like 2

Share this post


Link to post
Share on other sites
25 minutes ago, Asmusr said:

So how about the other option, placing the characters in Magellan at the positions where they should end up?

 

Magellan is open source. If anyone would like to contribute to Magellan, just send me a note and I will add you as a collaborator in github. To be honest the code is a bit messy, but I have spent a lot of time recently making the import/export code more accessible to developers.

 

https://github.com/Rasmus-M/magellan 

Yes, I suppose I could start my character sets at 128 instead of 32, but it would create difficulties with plain XB if I want to do anything with them from within XB proper due to the set limitation unless I use XB256.

I would have loved to contribute to Magellan, but this is likely above my pay grade...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...