bfile: add BFile syscalls on fx-CG 50 (still unstable)

For some reason these syscalls tend to crash in a basic delete, create,
open, write, close workflow (after the write is finished). I'll look
into using the new gint/fxlib switch to use them safely.
This commit is contained in:
Lephe 2020-05-16 17:11:55 +02:00
parent 15dd4990dd
commit 4036a583df
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495
3 changed files with 29 additions and 26 deletions

3
TODO
View file

@ -7,8 +7,7 @@ For the 2.0.0 release:
Crucial, missing things. Crucial, missing things.
! core: the four basic memory functions (with automated tests) ! core: the four basic memory functions (with automated tests)
! core: use gint_switch() to handle TLB misses ! core: use gint_switch() to handle TLB misses
! core: return to menu on fxcg50 ! bfile: solve stability issues
! syscalls: fxcg50 BFile calls
Issues. Issues.
* #3 make drawing functions parameterized * #3 make drawing functions parameterized

View file

@ -24,7 +24,7 @@ int BFile_Remove(uint16_t const *file);
@file FONTCHARACTER file path @file FONTCHARACTER file path
@type Entry type @type Entry type
@size Pointer to file size if [type = BFile_File], ignored otherwise @size Pointer to file size if [type = BFile_File], use NULL otherwise
Returns a BFile error code. */ Returns a BFile error code. */
enum BFile_EntryType enum BFile_EntryType
{ {
@ -102,8 +102,8 @@ struct BFile_FileInfo
uint32_t data_size; uint32_t data_size;
/* Is 0 if the file is complete */ /* Is 0 if the file is complete */
uint32_t property; uint32_t property;
/* Address of first fragmented (do not use directly) */ /* Address of first fragment (do not use directly) */
uint32_t address; void *address;
}; };
int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile, int BFile_FindFirst(uint16_t const *search, int *shandle, uint16_t *foundfile,
struct BFile_FileInfo *fileinfo); struct BFile_FileInfo *fileinfo);

View file

@ -62,45 +62,24 @@ _realloc:
/* BFile driver */ /* BFile driver */
# int BFile_Remove(const uint16_t *file)
_BFile_Remove: _BFile_Remove:
syscall(0x0439) syscall(0x0439)
# int BFile_Create(uint16_t *file, enum { file = 1, folder = 5 }, int *size)
_BFile_Create: _BFile_Create:
syscall(0x0434) syscall(0x0434)
# int BFile_Open(const uint16_t *file, int mode)
_BFile_Open: _BFile_Open:
syscall(0x042c) syscall(0x042c)
# int BFile_Close(int handle)
_BFile_Close: _BFile_Close:
syscall(0x042d) syscall(0x042d)
# int BFile_Size(int handle)
_BFile_Size: _BFile_Size:
syscall(0x042f) syscall(0x042f)
# int BFile_Write(int handle, const void *ram_buffer, int even_size)
_BFile_Write: _BFile_Write:
syscall(0x0435) syscall(0x0435)
# int BFile_Read(int handle, void *ram_buffer, int size, int whence)
_BFile_Read: _BFile_Read:
syscall(0x0432) syscall(0x0432)
# int BFile_FindFirst(uint16_t const *search, int *shandle,
# uint16_t *foundfile, struct BFile_FileInfo *fileinfo)
_BFile_FindFirst: _BFile_FindFirst:
syscall(0x043b) syscall(0x043b)
# int BFile_FindNext(int shandle, uint16_t *foundfile,
# struct BFile_FileInfo *fileinfo)
_BFile_FindNext: _BFile_FindNext:
syscall(0x043c) syscall(0x043c)
# int BFile_FindClose(int shandle)
_BFile_FindClose: _BFile_FindClose:
syscall(0x043d) syscall(0x043d)
@ -141,6 +120,31 @@ _calloc:
_realloc: _realloc:
syscall(0x1f46) syscall(0x1f46)
/* BFile driver */
_BFile_Remove:
syscall(0x1db4)
_BFile_Create:
syscall(0x1dae)
_BFile_Open:
syscall(0x1da3)
_BFile_Close:
syscall(0x1da4)
_BFile_Size:
syscall(0x1da6)
_BFile_Write:
syscall(0x1daf)
_BFile_Read:
syscall(0x1dac)
_BFile_FindFirst:
syscall(0x1db7)
_BFile_FindNext:
syscall(0x1db9)
_BFile_FindClose:
syscall(0x1dba)
/* Return to menu */
___Timer_Install: ___Timer_Install:
syscall(0x8d9) syscall(0x8d9)
___Timer_Start: ___Timer_Start: