MEGA65 / mega65-libc

Simple C library for the MEGA65
Other
25 stars 20 forks source link

Refactoring of fileio.s #40

Open mlund opened 1 year ago

mlund commented 1 year ago

Subroutines in fileio.s overlaps with C functions:

  1. mega65_io_enable()
  2. lcopy()
  3. Copying filename to 0x0100 could be done directly from C. Is it safe to override 0x0100 for temporary storage for setname?

Using C for the above, fileio.s becomes smaller; could be inline; and reduce compiler specific code.

Ping @ki-bo.

Notes

ki-bo commented 10 months ago

Copying the filename to 0x100 will often work, but be aware that this is by default the stack page, so you may overwrite the stack depending on where the stack pointer is and how long the filename will be.

mlund commented 10 months ago

Thanks! Mega65libc has always been hardcoded to $0100 and I wonder if there are better alternatives, e.g. by dynamic allocation. If I recall correctly the hypervisor has restrictions as to where it can be placed(?).