commanderx16 / x16-emulator

Emulator for the Commander X16 8-bit computer
384 stars 61 forks source link

HostFS: Fix behavior of realpath() on Windows. Clear carry flag on return from hostfs ACPTR #479

Closed mooinglemur closed 1 year ago

mooinglemur commented 1 year ago

This PR addresses two distinct problems.

_fullpath() on windows returns a valid path even if the final part does not exist. This differs from the behavior of realpath(), so I changed the macro into a function call that implements realpath() behavior on Windows.

Emulated ACPTR was leaving the state of the carry flag alone, which confuses BASIC if it's not cleared.. This is the counterpart of the behavior for write that was described in https://github.com/commanderx16/x16-emulator/issues/416 which I had fixed in the main hostfs PR, but for reading instead of writing. The real ROM code clears carry unconditionally on return from ACPTR, so the hostfs code must as well.

mooinglemur commented 1 year ago

fleshed out the behavior of Windows realpath() emulation to follow proper behavior if the second arg is not NULL, even though all of the current uses of the function in the project pass NULL in the second arg.

indigodarkwolf commented 1 year ago

Looks fine to me. Thanks for the fixes!