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

Reduce calls to mega65_io_enable() #43

Open
3 tasks
mlund opened this issue Jul 30, 2023 · 4 comments
Open
3 tasks

Reduce calls to mega65_io_enable() #43

mlund opened this issue Jul 30, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@mlund
Copy link
Collaborator

mlund commented Jul 30, 2023

To ensure that MEGA65 expanded features are availbel, mega65_io_enable() is called from many functions, for example memory.c::do_dma() and multiple places in fcio.c, see e.g. the call graph produces by Doxygen:
image

  • Remove calls
  • Update function documentation that it's the callers responsibility to call it
  • Does this break backwards compatibility?
@mlund mlund added the enhancement New feature or request label Jul 30, 2023
@lydon42
Copy link
Member

lydon42 commented Jul 30, 2023

To the last point, the following parts of core and utilities do enable mega65_io:

  • megflash
  • onboarding
  • mega65_config (does not use libc)
  • fdisk (does not use libc)
  • tools ftphelper (does not use libc)
  • tools tests (either call the function or do the POKE)

So I gather we are save on that side.

As you have added versions, this is a good change as it reduces repetition, which makes the program slower, so if someone forgot to enable MEGA65 IO at the start of the program, they can fix it after reading the release notes.

Additrional idea: If we add a real startup for MEGA65 C programs to the various compilers, then the startup should do that and the user does not need to remember, right?

@mlund
Copy link
Collaborator Author

mlund commented Aug 3, 2023

Is this habit still the case?

mega65_io_enable(); // kernal has the disgusting habit of resetting vic

@lydon42
Copy link
Member

lydon42 commented Aug 3, 2023

good question, lets ask @dansanderson

@dansanderson
Copy link

The Compendium warns that DOS operations reset the KEY register. I don't see where this happens in code. (Get_DOS doesn't seem to have anything relevant.) I'm still pretty new to the DOS code.

There are only a few direct references to vic+47 (and none to d024) and they're in respectable places (ioinit, c64beg, reset). I gather that any write to d024 that isn't an enable knock will disable, so maybe there are indirect references. The only place I know that resets all VIC registers is the one in ioinit.

I have tried and failed to set a watchpoint on a VIC register, so I don't know if there's an easy way to interrogate this. Ideas welcome. Let me know how else i can help.

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

No branches or pull requests

3 participants