Alternative library and kernel for add-in development on fx-9860G and fx-CG50 under Linux.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

syscalls.S 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. ** gint:core:syscalls - calls to CASIOWIN
  3. **
  4. ** This file can be seen as a list of everywhere gint relies on the
  5. ** underlying OS. Although I wish to make gint free-standing, there are
  6. ** still a few hard questions, namely:
  7. ** * MMU management, because doing it wrong might break the calculator.
  8. ** * Dynamic allocation, because we can't trash the system heap.
  9. ** * File system, because it's a mess and we might ruin the ROM.
  10. */
  11. /* OS version */
  12. .global ___os_version
  13. /* Dynamic allocation */
  14. .global _malloc
  15. .global _free
  16. .global _calloc
  17. .global _realloc
  18. /* Bfile driver */
  19. .global _BFile_Remove
  20. .global _BFile_Create
  21. .global _BFile_Open
  22. .global _BFile_Close
  23. .global _BFile_Write
  24. .global _BFile_Read
  25. .section ".pretext"
  26. #define syscall(id) \
  27. mov.l syscall_table, r2 ;\
  28. mov.l 1f, r0 ;\
  29. jmp @r2 ;\
  30. nop ;\
  31. 1: .long id
  32. #ifdef FX9860G
  33. /* OS version */
  34. ___os_version:
  35. syscall(0x02ee)
  36. /* Dynamic allocation */
  37. _malloc:
  38. syscall(0x0acd)
  39. _free:
  40. syscall(0x0acc)
  41. _calloc:
  42. syscall(0x0e6b)
  43. _realloc:
  44. syscall(0x0e6d)
  45. /* BFile driver */
  46. # int BFile_Remove(const uint16_t *file)
  47. _BFile_Remove:
  48. syscall(0x0439)
  49. # int BFile_Create(uint16_t *file, enum { file = 1, folder = 5 }, int *size)
  50. _BFile_Create:
  51. syscall(0x0434)
  52. # int BFile_Open(const uint16_t *file, int mode)
  53. _BFile_Open:
  54. syscall(0x042c)
  55. # int BFile_Close(int handle)
  56. _BFile_Close:
  57. syscall(0x042d)
  58. # int BFile_Write(int handle, const void *ram_buffer, int even_size)
  59. _BFile_Write:
  60. syscall(0x0435)
  61. # int BFile_Read(int handle, void *ram_buffer, int size, int whence)
  62. _BFile_Read:
  63. syscall(0x0432)
  64. syscall_table:
  65. .long 0x80010070
  66. #endif /* FX9860G */
  67. #ifdef FXCG50
  68. /* OS version */
  69. ___os_version:
  70. syscall(0x1406)
  71. /* Dynamic allocation */
  72. _malloc:
  73. syscall(0x1f44)
  74. _free:
  75. syscall(0x1f42)
  76. _calloc:
  77. syscall(0x1f40)
  78. _realloc:
  79. syscall(0x1f46)
  80. syscall_table:
  81. .long 0x80020070
  82. #endif /* FXCG50 */