MSX FUSION-C, Talking about bugs, errors, mistakes

페이지 15/21
8 | 9 | 10 | 11 | 12 | 13 | 14 | | 16 | 17 | 18 | 19 | 20

By ToriHino

Hero (601)

ToriHino의 아바타

04-03-2020, 00:28

Found a bug in the Open( char *name, int mode ); function (as part of io.s).

part of the function (just after _iopen:: ) does the following:

	push	hl
	push	de
	push	bc
	call	_OS_version
	call	_prep_fcbs
	pop	bc
	pop	de
	pop	hl

The call to _OS_version modifies (amongst others) the DE register (which after this contains the MSXDOS2.SYS version number, in my case 0x0210 for 2.10). However _prep_fcbs starts with:

_prep_fcbs:
	xor	a
	ld	(de),a

So effectively overwriting adress 0x210 with a zero, meaning it modifies the code at that location. Of course this can lead to all sorts of (undesired) resulting effects. BTW I see the same calls also in the _FCBS:: function.

A first short check shows no real need to put a zero on (DE) so easy solution could be to just remove this, but probably some further check is needed Smile. At least DE in this case contains the second argument (mode), so restoring this before _prep_fcbs makes no sense here.

By ericb59

Paladin (1014)

ericb59의 아바타

04-03-2020, 10:27

@ToriHino
Thank you for notifying this problem.
Most of the functions of "IO.s" come from the conversion to SDCC of the SOLID-C library, but it seems some functions were added by the author of this conversion.

I must admit that I did not pay much attention to these IO functions, preferring to use the "fcb_" functions which are included in "msx_fusion.h" by default.
I was even tempted to delete this library, which duplicates the "Fcb_" functions.

Anyway...
Indeed I do not see the interest of this
xor A
ld (de), a

did you try to remove it to test?

By ToriHino

Hero (601)

ToriHino의 아바타

04-03-2020, 18:57

I did not test it yet but will do. Indeed it makes sense to maybe remove these functions from the library, since there is an overlap with the FCB_ functions anyway as you already state.
Next to that i have my doubts about the functionality of the fseek functions in io as well. They don't seem to work as intended but also did go further into that as well.

By ericb59

Paladin (1014)

ericb59의 아바타

17-03-2020, 17:20

Hello

Question to all coders using FUSION-C
Which version of SDCC are you currently using ?

By ToriHino

Hero (601)

ToriHino의 아바타

17-03-2020, 20:25

I recently switched to SDCC 4.0. Works fine, only get one warning:

?ASlink-Warning-Definition of public symbol '_printf' found more than once:
   Library: '../fusion-c/lib/fusion.lib', Module: 'printf.rel'
   Library: 'C:\Program Files\SDCC\bin\..\lib\z80/z80.lib', Module: 'vprintf.rel'

By ducasp

Champion (386)

ducasp의 아바타

17-03-2020, 21:30

4.0 as well, and before was using 3.9, 3.6 sometimes causes weird bugs when using nested if's and switch cases...

By ducasp

Champion (386)

ducasp의 아바타

17-03-2020, 23:14

ToriHino wrote:

I recently switched to SDCC 4.0. Works fine, only get one warning:

?ASlink-Warning-Definition of public symbol '_printf' found more than once:
   Library: '../fusion-c/lib/fusion.lib', Module: 'printf.rel'
   Library: 'C:\Program Files\SDCC\bin\..\lib\z80/z80.lib', Module: 'vprintf.rel'

Have you re-done the sdar steps?

> cp z80.lib z80.save
> sdar -d z80.lib printf.rel
> sdar -d z80.lib sprintf.rel
> sdar -d z80.lib vprintf.rel
> sdar -d z80.lib putchar.rel
> sdar -d z80.lib getchar.rel

I have no such issue. Wink

By ToriHino

Hero (601)

ToriHino의 아바타

17-03-2020, 23:46

ducasp wrote:
ToriHino wrote:

I recently switched to SDCC 4.0. Works fine, only get one warning:

?ASlink-Warning-Definition of public symbol '_printf' found more than once:
   Library: '../fusion-c/lib/fusion.lib', Module: 'printf.rel'
   Library: 'C:\Program Files\SDCC\bin\..\lib\z80/z80.lib', Module: 'vprintf.rel'

Have you re-done the sdar steps?

> cp z80.lib z80.save
> sdar -d z80.lib printf.rel
> sdar -d z80.lib sprintf.rel
> sdar -d z80.lib vprintf.rel
> sdar -d z80.lib putchar.rel
> sdar -d z80.lib getchar.rel

I have no such issue. Wink

Will try that, indeed already forgot about that step Smile . But other than the warning i did not see any side effect of this.

Edit: Yes that worked Cool

By raymond

Champion (462)

raymond의 아바타

18-03-2020, 06:42

ericb59 wrote:

Hello

Question to all coders using FUSION-C
Which version of SDCC are you currently using ?

3.6 as advised in the manual Smile

I see a lot of coders are using 4.0, perhaps I will switch as well then Big smile

By ericb59

Paladin (1014)

ericb59의 아바타

18-03-2020, 08:48

Did you notice benefits in in executable perfomances or in executable file size ?

페이지 15/21
8 | 9 | 10 | 11 | 12 | 13 | 14 | | 16 | 17 | 18 | 19 | 20