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.

147 lines
2.7KB

  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. /* Dynamic allocation */
  12. .global _malloc
  13. .global _free
  14. .global _calloc
  15. .global _realloc
  16. /* Bfile driver */
  17. .global _BFile_Remove
  18. .global _BFile_Create
  19. .global _BFile_Open
  20. .global _BFile_Close
  21. .global _BFile_Size
  22. .global _BFile_Write
  23. .global _BFile_Read
  24. .global _BFile_FindFirst
  25. .global _BFile_FindNext
  26. .global _BFile_FindClose
  27. /* Return to menu */
  28. .global ___Timer_Install
  29. .global ___Timer_Start
  30. .global ___Timer_Stop
  31. .global ___Timer_Deinstall
  32. .global ___PutKeyCode
  33. .global ___GetKeyWait
  34. .global ___ClearKeyBuffer
  35. .global ___GetVRAMAddress
  36. .section ".pretext"
  37. #define syscall(id) \
  38. mov.l syscall_table, r2 ;\
  39. mov.l 1f, r0 ;\
  40. jmp @r2 ;\
  41. nop ;\
  42. 1: .long id
  43. #ifdef FX9860G
  44. /* Dynamic allocation */
  45. _malloc:
  46. syscall(0x0acd)
  47. _free:
  48. syscall(0x0acc)
  49. _calloc:
  50. syscall(0x0e6b)
  51. _realloc:
  52. syscall(0x0e6d)
  53. /* BFile driver */
  54. # int BFile_Remove(const uint16_t *file)
  55. _BFile_Remove:
  56. syscall(0x0439)
  57. # int BFile_Create(uint16_t *file, enum { file = 1, folder = 5 }, int *size)
  58. _BFile_Create:
  59. syscall(0x0434)
  60. # int BFile_Open(const uint16_t *file, int mode)
  61. _BFile_Open:
  62. syscall(0x042c)
  63. # int BFile_Close(int handle)
  64. _BFile_Close:
  65. syscall(0x042d)
  66. # int BFile_Size(int handle)
  67. _BFile_Size:
  68. syscall(0x042f)
  69. # int BFile_Write(int handle, const void *ram_buffer, int even_size)
  70. _BFile_Write:
  71. syscall(0x0435)
  72. # int BFile_Read(int handle, void *ram_buffer, int size, int whence)
  73. _BFile_Read:
  74. syscall(0x0432)
  75. # int BFile_FindFirst(uint16_t const *search, int *shandle,
  76. # uint16_t *foundfile, struct BFile_FileInfo *fileinfo)
  77. _BFile_FindFirst:
  78. syscall(0x043b)
  79. # int BFile_FindNext(int shandle, uint16_t *foundfile,
  80. # struct BFile_FileInfo *fileinfo)
  81. _BFile_FindNext:
  82. syscall(0x043c)
  83. # int BFile_FindClose(int shandle)
  84. _BFile_FindClose:
  85. syscall(0x043d)
  86. /* Return to menu */
  87. ___Timer_Install:
  88. syscall(0x118)
  89. ___Timer_Start:
  90. syscall(0x11a)
  91. ___Timer_Stop:
  92. syscall(0x11b)
  93. ___Timer_Deinstall:
  94. syscall(0x119)
  95. ___PutKeyCode:
  96. syscall(0x24f)
  97. ___GetKeyWait:
  98. syscall(0x247)
  99. ___ClearKeyBuffer:
  100. syscall(0x241)
  101. ___GetVRAMAddress:
  102. syscall(0x135)
  103. syscall_table:
  104. .long 0x80010070
  105. #endif /* FX9860G */
  106. #ifdef FXCG50
  107. /* Dynamic allocation */
  108. _malloc:
  109. syscall(0x1f44)
  110. _free:
  111. syscall(0x1f42)
  112. _calloc:
  113. syscall(0x1f40)
  114. _realloc:
  115. syscall(0x1f46)
  116. syscall_table:
  117. .long 0x80020070
  118. #endif /* FXCG50 */