How can my changes be re-integrated upstream?
Posted: Sat Feb 06, 2021 2:35 pm
Hi there,
In the process of working on a project on mine I've cloned z88dk so that I could make a
few changes to fix what seem to me to be bugs and also to add a couple of features.
I'm now wondering, what could be done to merge my amendments back into the upstream version of
z88dk?
Thanks
Here's a list of what I have:
Potential bugs(?):
------------------
1. If you're compiling code for the esxdos zx spectrum disk system and use fopen to
read a file that doesn't exist, the fopen call didn't fail but instead created a new file.
I've made a change that should make the fopen call return null instead:
https://github.com/pjshumphreys/z88dk/c ... a1d9e54f5c
2. Again when compiling using esxdos file io, I found that fread would behave seemingly
incorrectly according to standard C when reading past the end of a file:
I'm not 100% sure but feof should return a non 0 value in such a situation right?
I believe this commit would sort of fix this by checking whether fread actually read
any bytes before flagging an error:
https://github.com/pjshumphreys/z88dk/c ... d9baf312f6
3. I was experiencing some problems with the call stack becoming unbalanced when I used
fseek with esxdos.
This commit seemed to fix that:
https://github.com/pjshumphreys/z88dk/c ... 3fdf0973ca
4. I believe a file's path was changed historically for residos support on a zx
spectrum, but a reference to that file wasn't updated:
Here's my commit to update it:
https://github.com/pjshumphreys/z88dk/c ... c3b31487ba
5. Code related to l_qsort and l_bsearch wasn't being placed into the code_clib section
along with the rest of clib. I appreciate these two functions are z88dk specific, but
they are part of z88dk's c library and not user written code right?
https://github.com/pjshumphreys/z88dk/c ... 42d01f62ec
6. The MSXDOS2 file io library for msx targets doesn't seem to be being compiled by default.
I've been able to get it built and manually put in the right place, but I don't know
how to get it done automatically when the full toolchain is being built.
https://github.com/pjshumphreys/z88dk/c ... c21f226337
7. In the MSXDOS2 file io library, there seems to be a typo where the getcwd.asm file
instead defines a getwd function. The getcwd and getwd functions in general have
different semantics plus there is also a getwd.asm file present in the same folder,
so this seems to be a typo in getcwd.asm
https://github.com/pjshumphreys/z88dk/c ... eab83dff6a
8. When I did a fresh checkout of z88dk to build it from source, I experienced
problems with a couple of tests failing. I got these tests to pass by amending
testsuite/results/Far_Pointer_Call_ieee.opt and testsuite/results/mathops_ieee.opt,
but I'm not sure what the correct output code here should be.
https://github.com/pjshumphreys/z88dk/c ... 677700adc3
New features
------------
9. In order to support the page banking facilities I need for my project, I've added a
new command-line option to manually set the offset that local variables are accessed
from for *all* functions compiled by an invocation of z88dk.
The syntax is
--base=[integer for local variables custom offset]
This will break code if compiled directly to an object file, but my intention with this
is to only compile C code into assembly language so that I can then integrate this asm
code together with my own custom banking trampoline asm in the build process of my project.
The commits to add this are at:
https://github.com/pjshumphreys/z88dk/c ... d16d94e269
and
https://github.com/pjshumphreys/z88dk/c ... 63be8894ff
10. I've added an INCBIN directive to z88dk-z80asm as an alias to the BINARY directive.
I understand the INCBIN directive may have also been added to upstream z88dk recently,
but I thought it might be worth showing my commit to implement it as it's only a 2
line change:
https://github.com/pjshumphreys/z88dk/c ... 868d633250
In the process of working on a project on mine I've cloned z88dk so that I could make a
few changes to fix what seem to me to be bugs and also to add a couple of features.
I'm now wondering, what could be done to merge my amendments back into the upstream version of
z88dk?
Thanks
Here's a list of what I have:
Potential bugs(?):
------------------
1. If you're compiling code for the esxdos zx spectrum disk system and use fopen to
read a file that doesn't exist, the fopen call didn't fail but instead created a new file.
I've made a change that should make the fopen call return null instead:
https://github.com/pjshumphreys/z88dk/c ... a1d9e54f5c
2. Again when compiling using esxdos file io, I found that fread would behave seemingly
incorrectly according to standard C when reading past the end of a file:
I'm not 100% sure but feof should return a non 0 value in such a situation right?
I believe this commit would sort of fix this by checking whether fread actually read
any bytes before flagging an error:
https://github.com/pjshumphreys/z88dk/c ... d9baf312f6
3. I was experiencing some problems with the call stack becoming unbalanced when I used
fseek with esxdos.
This commit seemed to fix that:
https://github.com/pjshumphreys/z88dk/c ... 3fdf0973ca
4. I believe a file's path was changed historically for residos support on a zx
spectrum, but a reference to that file wasn't updated:
Here's my commit to update it:
https://github.com/pjshumphreys/z88dk/c ... c3b31487ba
5. Code related to l_qsort and l_bsearch wasn't being placed into the code_clib section
along with the rest of clib. I appreciate these two functions are z88dk specific, but
they are part of z88dk's c library and not user written code right?
https://github.com/pjshumphreys/z88dk/c ... 42d01f62ec
6. The MSXDOS2 file io library for msx targets doesn't seem to be being compiled by default.
I've been able to get it built and manually put in the right place, but I don't know
how to get it done automatically when the full toolchain is being built.
https://github.com/pjshumphreys/z88dk/c ... c21f226337
7. In the MSXDOS2 file io library, there seems to be a typo where the getcwd.asm file
instead defines a getwd function. The getcwd and getwd functions in general have
different semantics plus there is also a getwd.asm file present in the same folder,
so this seems to be a typo in getcwd.asm
https://github.com/pjshumphreys/z88dk/c ... eab83dff6a
8. When I did a fresh checkout of z88dk to build it from source, I experienced
problems with a couple of tests failing. I got these tests to pass by amending
testsuite/results/Far_Pointer_Call_ieee.opt and testsuite/results/mathops_ieee.opt,
but I'm not sure what the correct output code here should be.
https://github.com/pjshumphreys/z88dk/c ... 677700adc3
New features
------------
9. In order to support the page banking facilities I need for my project, I've added a
new command-line option to manually set the offset that local variables are accessed
from for *all* functions compiled by an invocation of z88dk.
The syntax is
--base=[integer for local variables custom offset]
This will break code if compiled directly to an object file, but my intention with this
is to only compile C code into assembly language so that I can then integrate this asm
code together with my own custom banking trampoline asm in the build process of my project.
The commits to add this are at:
https://github.com/pjshumphreys/z88dk/c ... d16d94e269
and
https://github.com/pjshumphreys/z88dk/c ... 63be8894ff
10. I've added an INCBIN directive to z88dk-z80asm as an alias to the BINARY directive.
I understand the INCBIN directive may have also been added to upstream z88dk recently,
but I thought it might be worth showing my commit to implement it as it's only a 2
line change:
https://github.com/pjshumphreys/z88dk/c ... 868d633250