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 . At least DE in this case contains the second argument (mode), so restoring this before _prep_fcbs makes no sense here.
@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?
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.
Hello
Question to all coders using FUSION-C
Which version of SDCC are you currently using ?
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'
4.0 as well, and before was using 3.9, 3.6 sometimes causes weird bugs when using nested if's and switch cases...
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.
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.
Will try that, indeed already forgot about that step . But other than the warning i did not see any side effect of this.
Edit: Yes that worked
Hello
Question to all coders using FUSION-C
Which version of SDCC are you currently using ?
3.6 as advised in the manual
I see a lot of coders are using 4.0, perhaps I will switch as well then
Did you notice benefits in in executable perfomances or in executable file size ?