As a result of the fairly new file caching for CP/M, lib/crt/classic/crt_cpm_fcntl.asm has this block of code:
Code: Select all
IF CLIB_OPEN_MAX > 0
SECTION bss_crt
PUBLIC __fcb
__fcb:
defs CLIB_OPEN_MAX * 166 ; Each FCB is 43 bytes long
ENDIF
However, I found that this only works if the __sgoioblk and __sgoioblk_end symbols are located in the same address for both msx2 and fcb variants.
I have been able to always locate these symbols in the same place by placing #pragma output CRT_ENABLE_STDIO = 0 in my C source code, then manually writing an assembly language file that has contains these symbols.
Now that the CP/M file caching exists, I've found that I now need to also move the __fcb symbol as well (which is fine for me to do) as I also need to be careful the fcb and msx2 routines don't go past address 0x3fff, as I'm banking the memory from 0x4000 to 0x7fff.
But although __sgoioblk and __sgoioblk_end can be disabled from the standard crt0 startup code when using nofileio, the __fcb symbol in crt_cpm_fcntl.asm cannot be.
What I'd like to request is that the __fcb symbol be wrapped by an IF CRT_ENABLE_STDIO = 1 block, like so:
Code: Select all
; CP/M style FCB support (CP/M + MSXDOS1)
SECTION bss_crt
IF CRT_ENABLE_STDIO = 1
IF CLIB_OPEN_MAX > 0
SECTION bss_crt
PUBLIC __fcb
__fcb:
defs CLIB_OPEN_MAX * 166 ; Each FCB is 43 bytes long
ENDIF
ENDIF
PUBLIC defltdsk
defltdsk: defb 0 ;Default disc
Finally, is there perhaps some better means of detecting whether MSXDOS2 file access routines are available and using the FCB based ones if they aren't?