Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEOSLib - CalcBlksFree issue #1318

Closed
xlar54 opened this issue Oct 30, 2020 · 4 comments
Closed

GEOSLib - CalcBlksFree issue #1318

xlar54 opened this issue Oct 30, 2020 · 4 comments
Labels

Comments

@xlar54
Copy link
Contributor

xlar54 commented Oct 30, 2020

Either the documentation isnt completely clear, or there is a bug in this function. According to the docs, calling GetDirHead() before calling this is all that is needed. But under my project, it continually returned an odd value.

Checking some other documentation, you must first set r5 to the address of curDirHead (which for CBM, is 0x8200). Upon doing this manually, the CalcBlksFree function returns the proper number of blocks free.

So instead of:

GetDirHead();
x = GetBlksFree();

it is:

GetDirHead();
r5 = 0x8200; // or constant curDirHead
x = GetBlksFree();

I didnt know if this was a documentation issue, or if a code issue. (or neither? Perhaps it is assumed that a geos developer would know this?) If a code issue, then adding:

LoadW r5, curDirHead (or ca65 equivalent)

...before the jsr to _CalcBlksFree should take care of it (in calcblksfree.s)

@xlar54
Copy link
Contributor Author

xlar54 commented Oct 30, 2020

this is such a hard one to categorize as any kind of defect.. geos uses all these zero page pseudo registers that you still kind of have to know a little about whats going on in these functions. I dunno.. if you guys decided to nix this one, it wouldnt bother me.

@oliverschmidt
Copy link
Contributor

At least from my POV it's the very purpose of the cc65 GEOS API wrappers to keep the C programmer from having to deal with (or in fact even know about) the GEOS pseudo registers. So if a wrapper only works with additional pseudo register access from C then at least I personally consider this a bug.

@xlar54
Copy link
Contributor Author

xlar54 commented Oct 30, 2020

yeah, i saw it that way too...back and forth. But if the team agrees, than so shall it be. Ill put together a PR and submit soon

@oliverschmidt
Copy link
Contributor

Fixed with 79bdc2d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants