Has Solid-C compiler any known bugs?

Page 2/3
1 | | 3

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

25-01-2017, 10:25

But ontopic, Solid C, there is on another thread telling a few things about this

By DarkSchneider

Paladin (965)

DarkSchneider's picture

25-01-2017, 10:39

After some tests, it seems Solid-C uses the same argument passing than MSX-C, the same registers for 3 arguments, and then stack.

So even more interested on Solid-C now.

Right I read that thread, but no reference to newer versions of the compiler (it seems there is a 1.01 version looking at the japanese page). And don't know if the 1.0 we have could have some compiling bugs.

Also, the BDS C uses the stack too for argument passing (page 32, 2.3):

Quote:

All argument passing on function invocation, as well as all local (automatic) storage allocation, take place on a single stack at run time.

http://www.bdsoft.com/dist/bdsc-guide.pdf

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

25-01-2017, 11:10

Ok, so Solid-C is the alternative for ASCII MSX-C, what are the reasons for switching to Solid-C and not using ASCII MSX-C?
I was actually thinking of switching, only if it would better the results. But I need to know for sure and the why is part of that answer. Tongue

By DarkSchneider

Paladin (965)

DarkSchneider's picture

25-01-2017, 11:28

Seems to be more Z80 specific oriented, i.e. it uses the IX register while MSX-C not. So maybe there are other things. Is not much really a difference, buy if can use the same code and improve something, why not.

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

25-01-2017, 11:37

true true Wink I cannot find version 1.01 of Solid-C though, only 1.00 with basic libraries

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

25-01-2017, 12:21

On this page there is a bug fix library for solid c. I will keep looking when i got some time.

By DarkSchneider

Paladin (965)

DarkSchneider's picture

25-01-2017, 12:55

I'll take it a look, but my japanese...

About libraries, I think ASCII MSX-C ones can be used. I have tested only with the ASCII stdio (that is a large one defining its own types and etc.) and works fine (only compilation tested not assembling nor linking). Solid-C compiler outputs M80 compliant code, so we could even only use the compiler and for assembly and linking use the M80/L80. The compilation BAT could be something like (compare with the MSX-C one for changes):

CC1 -r2:2:1 %1
CC2 %1
ren %1.asm %1.mac
m80 =%1
l80 ... //the same than for MSX-C

Simply note the 'ren' command, as Solid-C outputs a .ASM file instead .MAC file, but it is really a M80 assembly file.
So we only change the use of compiler by CC1 and CC2, the both passes of Solid-C compiler proccess.

For reference, here an example of asm generated code:
C code:

UINT16 test(arg1, arg2, arg3, arg4)
BYTE arg2, arg4;
UINT16 arg1, arg3;
{
	return ((UINT16)arg1 + (UINT16)arg2 + (UINT16)arg3 + (UINT16)arg4);
}

MSX-C code:

test@:
	push	hl
	push	bc
	push	de
	call	?saut4
	pop	de
	ld	hl,6
	add	hl,sp
	push	hl
	ld	hl,2
	add	hl,sp
	ld	(hl),c
	inc	hl
	ld	(hl),b
	pop	hl
	ld	c,(hl)
	ld	b,0
	push	bc
	ld	l,e
	ld	h,0
	push	hl
	ld	hl,6
	add	hl,sp
	ld	e,(hl)
	inc	hl
	ld	d,(hl)
	pop	hl
	add	hl,de
	push	hl
	ld	hl,4
	add	hl,sp
	ld	c,(hl)
	inc	hl
	ld	b,(hl)
	pop	hl
	add	hl,bc
	pop	bc
	add	hl,bc
	pop	bc
	pop	bc
	ret

Solid-C code:

test_:
	push	ix
	ld	ix,0
	add	ix,sp
	push	hl
	push	bc
	ld	(ix-2),l
	ld	(ix-1),h
	ld	hl,8
	add	hl,sp
	ld	(ix-4),c
	ld	(ix-3),b
	ld	c,(hl)
	ld	b,0
	push	bc
	ld	l,e
	ld	h,0
	ld	e,(ix-2)
	ld	d,(ix-1)
	add	hl,de
	ld	c,(ix-4)
	ld	b,(ix-3)
	add	hl,bc
	pop	bc
	add	hl,bc
	ld	sp,ix
	pop	ix
	ret

It uses IX register. A difference I notice is that for public symbols it suffix them with '_' instead '@', so I'll have to take it a look better. Maybe have to use the AS.COM utility (Solid-C assembler), no problem as it seems to support MAC and REL files.

Edit: OK confirmed, AS.COM read MAC files and generates REL files, but there is a symbol problem because the '_' instad '@'.

By Wolverine_nl

Paragon (1160)

Wolverine_nl's picture

25-01-2017, 13:17

except from the symbol issue, the comparison between the two codes is clear as day.

By AxelStone

Prophet (3189)

AxelStone's picture

25-01-2017, 16:16

Possible workaround for _ vs @ trouble: make a small program in C that replaces all _ for @ and compile using a custom bat, this is:

CC1 -r2:2:1 %1
CC2 %1
ren %1.asm %1.mac
--- rename _ in mac file ---
m80 =%1
l80 ... //the same than for MSX-C

By DarkSchneider

Paladin (965)

DarkSchneider's picture

25-01-2017, 16:28

Hi, I created a conversion tool, here can get:

https://1drv.ms/u/s!AhQqCoPY5hXqjZogmZAgnfKNFQmMZg

Is the AS2M80. It converts a Solid-C ASM generated file to M80 MAC compliant file. Run it without params to get usage. Currently only changes the public symbols, if any other difference is found then the tool should be updated.

Then, the compilation BAT would be like this:

CC1 -r2:2:1 %1
CC2 %1
AS2M80 %1
M80 =%1/Z
L80 A:\LIB\CK,%1,A:\LIB\MLIB/S,A:\LIB\CLIB/S,A:\LIB\CRUN/S,A:\LIB\CEND,%1/N/Y/E:xmain

Notice the line AS2M80, it outputs the MAC file required by M80 from the ASM file with the same name.
Tested and working.

Page 2/3
1 | | 3