MSX Application Templates for MS Visual Studio

Page 2/3
1 | | 3

By thegeps

Champion (356)

thegeps's picture

13-01-2020, 02:05

DamnedAngel wrote:

Does Glass have a C cross-compiler too?

Nope, asm only

By konamiman

Paragon (1051)

konamiman's picture

13-01-2020, 08:27

Quote:

A Github was created. Please do explore it... and criticize it!

YOU CAN BET I'LL DO!! :-D

Thanks for creating the repo. Now I'd say the next steps would be:

1. Distribute the binary as a GitHub release instead of as a file hosted elsewhere. That not only makes the repository self-contained, it also allows you to include a nice changelog so that you don't have to create a new post here every time you make changes. Example: https://github.com/Konamiman/Nextor/releases/tag/v2.1.0-beta2

2. I guess you already plan to do that eventually but anyway I'll mention it: move the documentation from GDocs to a Markdown file inside the repository itself.

By DamnedAngel

Master (166)

DamnedAngel's picture

14-01-2020, 12:46

konamiman wrote:

1. Distribute the binary as a GitHub (...)
2. (...) move the documentation from GDocs to a Markdown file inside the repository itself.

Both will be done!

Now, if I may ask you some (newbie) questions regarding your crt0s for MSX-DOS (I am working on the MSX-DOS template now):
1. Why must gsinit be in a _GSINIT area, which must be after the _DATA area? Why cant it be directly inside init? Is it just semantics?
2. Why did you pick 0xc000 to move the cmdline parsing routine (parloop and friends) to? What if the program is large enough to fill that area?
3. Why do you end the advanced crt0 with

	call    _main

        ;--- Step 4: Program termination.
        ;    Termination code for DOS 2 was returned on L.
                
        ld      c,#0x62   ;DOS 2 function for program termination (_TERM)
        ld      b,l
        call    5      ;On DOS 2 this terminates; on DOS 1 this returns...
        ld      c,#0x0
        jp      5      ;...and then this one terminates
                       ;(DOS 1 function for program termination).

and the simple crt0 with just

	jp _main

?
Somehow the complete termination routine (and the exit code in b and l) does not apply to parameterless programs, or was it just your option to keep the simple version as simple as it gets?
Forgive me if these are to be a somewhat common knowledge. If they are answered somewhere else, I'd appreciate the reference.

best,

By DRomero

Expert (121)

DRomero's picture

14-01-2020, 22:38

Thanks DamnedAngel, i have installed and followed the instructions and the example compiled perfect.

Just a question please, i am using Fusion-C and i have installed it in C:\MSX\Development\Libraries\Fusion-C

What file shoud i edit for the build process to found the libs, headers, includes, etc in this directory?

For the dirasdisk in openMSX i use a directory in: C:\MSX\Virtual-FDDs\openMSX_FDD-A

Is there a way to chante the output of the compiled bin file to that directory for example?

Thanks a lot for your work Smile

By DamnedAngel

Master (166)

DamnedAngel's picture

15-01-2020, 11:03

DRomero wrote:

Thanks DamnedAngel, i have installed and followed the instructions and the example compiled perfect.

\o/

DRomero wrote:

Just a question please, i am using Fusion-C and i have installed it in C:\MSX\Development\Libraries\Fusion-C
What file shoud i edit for the build process to found the libs, headers, includes, etc in this directory?

Try this:
Inside your project in VS's solution exeplorer, open Make|Make.bat.
In lines 8 and 9 set (yes, this is still cumbersome, I have to make this customizable in the config files):

set MSX_DEV_PATH=C:\MSX\Development
set MSX_LIB_PATH=%MSX_DEV_PATH%\Libraries

Now, inside Project Config|IncludeDirectories.txt, uncomment the line

[MSX_LIB_PATH]\Fusion-C\header

If needed, fix the path for matching your Fusion-C headers directory.
Include aldo whatever other entries you want to config you libs.

In Project Config|LibrarySources.txt, include whatever Fusion-C source files you want recompiled/reassembled every Rebuild action (if you are editing the source, include it in ApplicationSources.txt instead, and they will be recompiled/reassembled every Build action). Example:

[MSX_LIB_PATH]\Fusion-C\source\lib\keyboard.s
[MSX_LIB_PATH]\Fusion-C\source\lib\setspritepattern.c

Lastly, if you are using Fusion-C REL files, include them in Project Config|RELs.txt:

[MSX_LIB_PATH]\Fusion-C\include\printf.rel
DRomero wrote:

For the dirasdisk in openMSX i use a directory in: C:\MSX\Virtual-FDDs\openMSX_FDD-A

Is there a way to chante the output of the compiled bin file to that directory for example?

Again, there is , but in an ugly way.
Open again Make|Make.bat. Change the line 233 to match your desired output dir:

copy %1\objs\*.bin C:\MSX\Virtual-FDDs\openMSX_FDD-A
DRomero wrote:

Thanks a lot for your work Smile

Code first, thank later! Smile

Let me know of the outcome. Hope to have helped.

By ericb59

Paladin (900)

ericb59's picture

16-01-2020, 10:00

About the CRT0 for DOS you can refer to the one included in FUSION-C
It's the Konamiman's one, corrected by Eugeny Brychkov.
https://github.com/ericb59/Fusion-C-v1.2/tree/master/Working...

Check : crt0_msxdos.s

By DamnedAngel

Master (166)

DamnedAngel's picture

16-01-2020, 11:44

Hi ericb59,

Thanks for the tip!

I took a look at FUSION-C's version of crt0_msxdos.s and found out that Eugeny changed from

__pre_main:
	push de
	ld de,#_HEAP_start
	ld (_heap_top),de
	pop de

to

__pre_main:
	push hl
	ld hl,#_HEAP_start
	ld (_heap_top),hl
	pop hl

Indeed, that saves a byte (and 4 cycles). I have already updated the VS template code.

My question is: Is there any reason not to do that in crt0_msxdos_advanced.s as well? This one still uses de instead of hl.

best,

By DamnedAngel

Master (166)

DamnedAngel's picture

19-01-2020, 10:45

Hi ericb59,

I just realized that FUSION-C's advanced version of the MSX-DOS CRT0 code lacks the global variables initialization routine.

That potentially breaks programs that rely on initialied global variables. Is there a reason to have such code removed (Konimiman's original code does have the routine)?

        .area   _GSINIT
gsinit::
        ld	bc,#l__INITIALIZER
        ld	a,b
        or	a,c
        jp	z,gsinext
        ld	de,#s__INITIALIZED
        ld	hl,#s__INITIALIZER
        ldir
gsinext:
        .area   _GSFINAL
        ret

thanks!

By ericb59

Paladin (900)

ericb59's picture

19-01-2020, 12:34

You are right the expanded crt0 was not updated.

Have to do ! Smile

Eugeny made the modification because global variables were not initialized with original crt0

By DamnedAngel

Master (166)

DamnedAngel's picture

25-01-2020, 15:10

ToriHino wrote:

Well done, that looks already very workable. Looking forward to the support for DOS and ROM files as well.

Hi ToriHino, please check next post! Big smile

Page 2/3
1 | | 3