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

sp1 sdcc + classic fixes (new) #2006

Merged
merged 49 commits into from May 9, 2022
Merged

Conversation

jorgegv
Copy link
Contributor

@jorgegv jorgegv commented Apr 25, 2022

This PR has the goal of using same SP1 sources from newlib, for compilation with Classic + SDCC. It fixes the mess from PR #1986, which has been withdrawn.

Changes to be done:

  • Create new library targets and Makefile
  • Ensure all SP1 C stubs save/restore IX when needed
  • Ported all examples as a testbed for migration
  • Remove old sources from build
    • Replace sp1.h with newlib one
    • Replace references to spectrum sources with zx ones, then remove spectrum directory (old SP1 classic sources)
      • Migrate zx81hr sources
      • Migrate ts2068hr sources
  • Debug issue with ex5e.c

@@ -217,6 +217,7 @@ extern void __LIB__ sp1_MoveSprAbs(struct sp1_ss *s, struct sp1_
extern void __LIB__ sp1_MoveSprRel(struct sp1_ss *s, struct sp1_Rect *clip, void *frame, char rel_row, char rel_col, char rel_vrot, char rel_hrot);
extern void __LIB__ sp1_MoveSprPix(struct sp1_ss *s, struct sp1_Rect *clip, void *frame, uint16_t x, uint16_t y);

// hook1 and hook2 must have prototype: void userfunc( uint8_t count, struct sp1_cs *c ) __smallc;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this the case then prototype properly - if there's parsing issues then a typedef void (*sp1_hook_func)( uint8_t count, struct sp1_cs *c ) __smallc should get around them.

Copy link
Contributor Author

@jorgegv jorgegv Apr 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function can have __z88dk_fastcall or not, and the prototype would be different for each (1 parameter vs. 2). The functions calling the hooks can use both types, so in order to be compatible, a void * pointer needs to be passed.

@suborb
Copy link
Member

suborb commented Apr 28, 2022

Thanks for re-doing.

Please feel free to delete the classic version as part of this PR and update the arch/zx/sprites/sp1.h header.

…lace with newlib ones

Old sources in "spectrum" dir have been kept around for the moment, since
the zx81 and the ts versions of SP1 reference some files there
@jorgegv
Copy link
Contributor Author

jorgegv commented Apr 29, 2022

I have disabled Classic SP1 sources in the build, but the zx81hr and ts2068hr sources reference some files under spectrum dir, so I'm not removing it until I also fix those sources.

@suborb
Copy link
Member

suborb commented May 2, 2022

@jorgegv is there more to come or should I merge this through?

@jorgegv
Copy link
Contributor Author

jorgegv commented May 2, 2022

@jorgegv is there more to come or should I merge this through?

It depends on what we need/want. I just ported the Spectrum sources, but when I started porting the other ones, it turned out they are a bit different than the Spectrum ones. There is even one struct that has 1 byte less for TS and ZX81 (for the lack of attributes), so they need a good review.

For now, the Spectrum port is working, but the others are still pending, and we can't remove the old sources until TS and ZX81 have been migrated also to the new sources.

Also, there is one issue with example ex5e.c. It does not work exactly as when compiled with SCCZ80, and I've still to know why, but I think I have the issue pretty cornered in function sp1_IterateUpdateRect, which is called by swap_dfile. Still working on it though.

So, your choice. Do you have any deadline in mind, @suborb ?

P.S. I'm updating the task list to reflect this issues.

P.S2: In fact, there are no sources in Newlib-SP1 for platforms other than Spectrum! Does this mean that we should ditch the sources for TS and ZX81?

@jorgegv
Copy link
Contributor Author

jorgegv commented May 5, 2022

Maybe we can just move the TS and ZX81 code to a deprecated subdir and keep SP1 building for them with the old code... I think I'll do this.

@jorgegv
Copy link
Contributor Author

jorgegv commented May 7, 2022

Maybe we can just move the TS and ZX81 code to a deprecated subdir and keep SP1 building for them with the old code... I think I'll do this.

@suborb Done, you can merge this PR if you wish.

If you do, I'll open an issue for tracking the problem with ex5e.c, and you can assign it to me (I'll assign it myself if I am allowed)

@suborb suborb merged commit 9fe69e3 into z88dk:share_sp1 May 9, 2022
@suborb
Copy link
Member

suborb commented May 9, 2022

This is still in a branch in z88dk and not merged to master yet.

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

Successfully merging this pull request may close these issues.

None yet

2 participants