diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e80383..28dff18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,8 @@ project(fxos LANGUAGES C CXX) find_package(FLEX 2.6) add_compile_options( - -Wall -Wextra -D_GNU_SOURCE -std=c++17 + -Wall -Wextra -D_GNU_SOURCE + $<$:-std=c++17> -fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}/= $<$:-O0> $<$:-g> $<$:-O2>) @@ -34,6 +35,19 @@ endif() flex_target(LoadAsm lib/load-asm.l "${CMAKE_CURRENT_BINARY_DIR}/load-asm.yy.cpp" COMPILE_FLAGS -s) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_FX.c" + COMMAND xxd -i -n FxOS_SyscallDefs_FX + "${CMAKE_CURRENT_SOURCE_DIR}/lib/syscalls_fx.def" > + "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_FX.c" + DEPENDS lib/syscalls_fx.def) +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_CG.c" + COMMAND xxd -i -n FxOS_SyscallDefs_CG + "${CMAKE_CURRENT_SOURCE_DIR}/lib/syscalls_cg.def" > + "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_CG.c" + DEPENDS lib/syscalls_cg.def) + set(fxos_core_SOURCES lib/binary.cpp lib/disassembly.cpp @@ -48,6 +62,8 @@ set(fxos_core_SOURCES lib/semantics.cpp lib/view/assembly.cpp lib/vspace.cpp + "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_FX.c" + "${CMAKE_CURRENT_BINARY_DIR}/FxOS_SyscallDefs_CG.c" lib/ai/RelConst.cpp lib/util/bson.cpp diff --git a/base-library/config b/base-library/config deleted file mode 100644 index 96c65ac..0000000 --- a/base-library/config +++ /dev/null @@ -1,4 +0,0 @@ -library: /path/to/base-library -load: /path/to/base-library/asmtables -load: /path/to/base-library/targets -load: /path/to/base-library/symbols diff --git a/base-library/symbols/syscalls-fx.txt b/base-library/symbols/syscalls-fx.txt deleted file mode 100644 index a5fe999..0000000 --- a/base-library/symbols/syscalls-fx.txt +++ /dev/null @@ -1,454 +0,0 @@ -type: symbols -name: syscalls-simlo ---- - -%001 vbr_tlb_error -%002 vbr_cpu_address -%003 vbr_tlb_exception -%005 App_RegisterAddins -%009 App_FindFreeAddinSlot -%00a App_GetAddinHeaderAddr -%00e App_GetAddindEstrip -%013 GlibAddinAplExecutionCheck -%014 GlibGetAddinLibInfo -%015 GlibGetOSVersionInfo -%018 MMU_FlushCache -%01b DD_Clear -%01c Bdisp_WriteGraph_VRAM -%01d Bdisp_WriteGraph_DD -%01e Bdisp_WriteGraph_DDVRAM -%022 Bdisp_ReadArea_VRAM -%023 Bdisp_ReadArea_DD -%024 Bdisp_GetDisp_DD -%025 DD_Read -%026 DD_ReadFromPage -%027 DD_WriteToPage -%028 Bdisp_PutDisp_DD -%02a Bdisp_DrawShapeToVRAM -%02f Bdisp_DrawShapeToVRAM -%030 Bdisp_DrawLineVRAM -%031 Bdisp_ClearLineVRAM -%032 Bdisp_DrawShapeToDD -%033 Bdisp_DrawShapeToVRAM_DD -%034 Bdisp_DrawShapeToDD -%035 Bdisp_DrawShapeToVRAM_DD -%039 RTC_Reset -%03a RTC_GetTime -%03b RTC_GetTicks -%03c RTC_Elapsed_ms -%05c Num_UIntToBCD -%05d Num_BCDToUInt - -%118 Timer_Install -%119 Timer_Deinstall -%11a Timer_Start -%11b Timer_Stop -%11f Bdisp_PutDispArea_DD -%12d DD_Poweroff -%130 Wait_ms -%132 DD_SetContrast -%133 DD_SetFRS -%134 DD_SetBias -%135 GetVRAMAddress -%136 GetCharacterGlyph -%137 GetCharacterMiniGlyph -%138 Cursor_SetPosition -%139 Cursor_SetFlashStyle -%13a Cursor_SetFlashMode -%13b Cursor_GetSettings -%13c Print_OS -%142 Bdisp_AllClr_DD -%143 Bdisp_AllClr_VRAM -%144 Bdisp_AllClr_DDVRAM -%145 Bdisp_GetDisp_VRAM -%146 Bdisp_SetPoint_VRAM -%147 Bdisp_SetPoint_DD -%148 Bdisp_SetPoint_DDVRAM -%149 Bdisp_GetPoint_VRAM -%14a Bdisp_AreaClr_DD -%14b Bdisp_AreaClr_VRAM -%14c Bdisp_AreaClr_DDVRAM -%14d Bdisp_AreaReverseVRAM -%150 PrintXY -%153 Disp_Save -%154 Disp_Restore -%155 Disp_GetPtr -%156 PopUpWin -%158 Disp_Manage -%159 System_UpdateOS -%15d PrintCR -%15f atoi -%160 LongToAsc -%161 LongToAscHex -%162 pc_toupper -%163 pc_tolower -%172 strcmp -%173 strcmp -%175 some_datatable -%176 DiagnosticMode -%18a InvertMem -%19f SMEM_Optimization -%1a9 GUI_ProgressBar -%1b7 Get8x8BitmapPointer_1 -%1b8 Get8x8BitmapPointer_2 -%1b9 Get8x8BitmapPointer_3 -%1ba Get8x8BitmapPointer_4 -%1bb Get8x8BitmapPointer_5 -%1bc Get8x8BitmapPointer_6 -%1bd Get8x8BitmapPointer_7 - -%20e StorageMemory_GetFilePos -%236 RebootOS -%23d RTC_TriggerAlarm -%23e RTC_SetDateTime -%241 Keyboard_ClrBuffer -%242 Bkey_Set_RepeatTime -%243 Bkey_Get_RepeatTime -%244 Bkey_Set_RepeatTime_Default -%245 Keyboard_EnableAutoRepeat -%246 Keyboard_DisableAutoRepeat -%247 Keyboard_GetKeyWait -%248 Keyboard_PutKeycode -%249 Keyboard_GetKeyDownTime -%24a Keyboard_IsAnyKeyDown -%24b Keyboard_IsSpecialKeyDown -%24c Keyboard_IsSpecialKeyDown -%24d Keyboard_KeyDown -%24e Keyboard_SecondaryInterruptHandler -%24f Keyboard_PutKeymatrixCode -%251 Keyboard_TimerHandler -%25e Keyboard_PrimaryInterruptHandler -%268 GetFKeyIconPointer -%284 BCD_GetNaN -%285 Serial_Open_57600 -%286 BCD_AnsToSerial -%28d Comm_Open -%28e Comm_Close -%28f Comm_WaitForAnyBuffer -%290 Comm_ReadOneByte -%291 Comm_TransmitOneByte -%292 Comm_WaitForAndReadNBytes -%293 Comm_TransmitNBytes -%294 Comm_ClearReceiveBuffer -%295 Comm_ClearTransmitBuffer -%296 Comm_IsValidPacketAvailable -%298 Comm_IsOpen -%299 Comm_GetCurrentSelector -%2a1 HexToByte -%2a2 HexToWord -%2a3 ByteToHex -%2a4 WordToHex -%2a5 Comm_Padding_5C -%2a6 Comm_ReversePadding_5C -%2a7 AscHexToNibble -%2a8 NibbleToAscHex -%2a9 strlen -%2aa slow_memcpy -%2ab Serial_Open2 -%2af Comm_Spy0thByte -%2db Comm_ProcessInPacket -%2e1 Comm_PrepareAckPacket -%2e2 Comm_PrepareErrorPacket -%2e3 Comm_PrepareTerminatePacket -%2e4 Comm_PrepareRoleswapPacket -%2e5 Comm_PrepareCheckPacket -%2e6 Comm_PrepareCommandPacket -%2e7 Comm_PrepareDataPacket -%2ee System_GetOSVersion - -%35e memset_range -%35f memset -%363 MCS_CreateDirectory -%364 MCS_WriteItem -%366 MCS_DeleteDirectory -%367 MCS_DeleteItem -%368 MCS_GetState -%369 MCS_GetSystemDirectoryInfo -%370 MCS_RenameItem -%371 MCS_OverwriteData -%372 MCS_GetItemData -%373 MCS_RenameDirectory -%374 BMCSRenameVariable -%375 MCS_SearchDirectory -%376 MCS_SearchDirectoryItem -%37c MCS_GetFirstDataPointerByDirno -%37d MCS_GetDirectoryEntryByNumber -%37e MCS_SearchItem -%37f MCS_str8cpy -%380 MCS_GetDirectoryEntryAddress -%381 MCS_GetCurrentBottomAddress -%383 MCS_GetCapa -%392 MCS_GetMainMemoryStart -%3dc Setup_GetInfo -%3ea SYSCALL_3ea_DATATABLE -%3ed Interrupt_SetOrClrStatusFlags -%3ee Interrupt_QueryStatusFlags -%3f4 PowerOff -%3f5 ClearMainMemory -%3f6 SH7337_TMU_Stop -%3f7 SH7337_TMU_int_handler -%3fa Hmem_SetMMU -%3fb MMU_ConfigureAndFlush -%3fc TLB_SetAddressValue -%3fe GetStackPtr -%3ff MMU_FlushCache - -%400 MMU_ConfigureAndEnable -%404 GetPhysicalROMstart -%405 GetPhysicalRAMstart -%409 Serial_ResetAndDisable -%40a Serial_GetInterruptHandler -%40b Serial_SetInterruptHandler -%40c Serial_ReadOneByte -%40d Serial_ReadNBytes -%40e Serial_BufferedTransmitOneByte -%40f Serial_BufferedTransmitNBytes -%410 Serial_DirectTransmitOneByte -%411 Serial_GetReceivedBytesAvailable -%412 Serial_GetFreeTransmitSpace -%413 Serial_ClearReceiveBuffer -%414 Serial_ClearTransmitBuffer -%418 Serial_Open -%419 Serial_Close -%41b Serial_CallReceiveIntErrorResetHandler -%41c Serial_CallReceiveIntHandler -%41d Serial_CallTransmitIntErrorResetHandler -%41e Serial_CallTransmitIntHandler -%420 OS_inner_Sleep -%422 Serial_SpyNthByte -%423 Serial_GetStatus -%425 Serial_IsOpen -%429 Bfile_identify_device_OS -%42c Bfile_OpenFile_OS -%42d Bfile_CloseFile_OS -%42e Bfile_GetMediaFree_OS -%42f Bfile_GetFileSize_OS -%431 Bfile_SeekFile_OS -%432 Bfile_ReadFile_OS -%434 Bfile_CreateEntry_OS -%435 Bfile_WriteFile_OS -%438 Bfile_RenameEntry -%439 Bfile_DeleteEntry -%43b Bfile_FindFirst -%43c Bfile_FindNext -%43d Bfile_FindClose -%44e memcpy -%44f memcmp -%450 Bfile_GetFilenameLength -%451 Bfile_Name_cmp -%452 Bfile_Name_cpy -%453 Bfile_Name_ncpy -%456 Bfile_NameToStr_ncpy -%457 Bfile_StrToName_ncpy -%462 GetAppName -%463 SetAppName -%464 CmpAppName -%465 GetIntPtrContent -%467 LongToAscHex -%468 hasSDOption -%469 Battery_DisplayLowStatus -%46b App_BuiltInCount -%476 Battery_IsLow -%477 EnableGetkeyToMainFunctionReturn -%478 DisableGetkeyToMainFunctionReturn -%47f SetAutoPowerOffTime -%480 GetAutoPowerOffTime -%486 GetdatatablePtr -%48d SetAutoPowerOffFlag -%48e GetAutoPowerOffFlag -%492 Battery_IsLow -%494 CallbackAtQuitMainFunction -%495 Battery_DisplayLowStatus -%499 Heap_SetTopChunk -%49a App_Start -%49c Battery_GetStatus -%49e RebootOS -%4a0 AUX_DisplayErrorMessage -%4ad USB_InterruptHandler -%4ae USB_TimerHandler -%4b0 AUX_DisplayFKeyIcons -%4cb Keyboard_RemapFKeyCode -%4d1 AUX_DisplayFKeyIcon -%4dc Setup_GetEntry -%4dd Setup_SetEntry -%4de Setup_GetEntryPtr -%4df Alpha_GetData -%4e0 Alpha_SetData -%4e1 Alpha_ClearAll -%4e6 HourGlass -%4e9 LocalizeStringID -%4f5 BCD_ToStrAsNumber1 -%4f6 BCD_ToStrAsNumber2 - -%500 BCDToInternal -%518 Setup_GetEntry_3E -%519 Setup_GetEntry_40 -%51a Setup_SetEntry_3E -%51b Setup_SetEntry_40 -%531 MB_IsLead -%533 MB_ElementCount -%534 MB_ByteCount -%536 MB_strcat -%537 MB_strncat -%538 MB_strcpy -%53c MB_GetSecondElemPtr -%53d MB_GetElement -%53e MB_CopyToHeap -%53f memcmp -%541 itoa -%542 to_uppercase -%543 to_lowercase -%544 BCD_0 -%545 BCD_1 -%546 BCD_2 -%547 BCD_10 -%548 BCD_1_over_3 -%549 BCD_0.5 -%54a BCD_32767 -%54b BCD_m32768 -%54c BCD_65536 -%54d BCD_0x7fffffff -%54e BCD_m2Gi -%54f BCD_4Gi -%550 BCD_pi -%551 BCD_2pi -%552 BCD_pi_over_2 -%553 BCD_e -%554 BCD_5 -%5a6 BCD_SetAsInt -%5af BCD_pi_over_4 -%5b0 BCD_ln10 -%5b1 BCD_ln2 -%5b2 BCD_9.99e99 -%5b3 BCD_m9.99e99 -%5b4 BCD_9.99999999999999e99 -%5b5 BCD_227.85 -%5b6 BCD_sqrt2 -%5b7 BCD_sqrt2_over_2 -%5b8 BCD_506.6282746310 - -%645 CalculateExpression -%64a CalculateExpression0 -%652 PRGM_NextOpcode -%6a6 PRGM_IsEndOfLine -%6c4 Keyboard_PRGM_GetKey -%6d4 Alpha_GetData2 - -%713 Print_ClearLine -%763 Bdisp_DrawRectangle -%7fc OpcodeToStr - -%804 CLIP_Store -%807 locate -%808 Print -%809 PrintRev -%80a PrintC -%80b PrintRevC -%80c PrintLine -%80d PrintRLine -%80e Cursor_GetFlashStyle -%80f Cursor_GetSettings -%811 Cursor_SetFlashOn -%812 Cursor_SetFlashOff -%813 SaveDisp -%814 RestoreDisp -%829 MCS_CreateDirectory -%82a MCS_PutInternalItem -%82b MCSPutVar2 -%830 MCSOvwDat2 -%832 MCS_OverwriteOpenItem -%833 MCS_ClearInternalDirectory -%834 MCS_ClearDirectory -%835 MCS_DeleteInternalItem -%836 MCSDelVar2 -%83a MCS_GotoInternalItem -%83b MCS_OpenMainMemoryItem -%83c MCS_GotoHandleNeighbour -%83d MCS_CheckOpenedItem -%83e MCS_GetOpenItem -%83f MCS_OpenInternalDirectoryItem -%840 MCSGetDlen2 -%841 MCSGetData1 -%843 MCS_MapMCS_Result -%844 MCSGetCapa -%84d MCS_OpenAlphaMemItem -%852 MCS_DirtypeToItemtype -%853 MCS_ItemtypeToDirtype -%863 MCS_DirtypeToName -%866 MCS_MapError -%869 Alpha_ClearAllAndAns -%86f MCS_DeleteDirectoryItems -%8db EditExpression -%8dc EditValue -%8e6 EditMBStringCtrl -%8ea DisplayMBString -%8ec EditMBStringChar -%8f7 DisplayMBString2 -%8fe PopupWin - -%901 DisplayMessageBox -%905 DisplayErrorMessage -%90b SetShiftAlphaState -%90c GetInsOverwriteState -%90d SetInsOverwriteState -%90e ClrShiftAlphaState -%90f GetKey -%910 PutKey -%91b GetShiftAlphaState -%924 TestMode -%954 DisplayErrorMessage -%985 App_CONICS -%998 App_DYNA -%9ad PrintXY -%9df App_EACT -%9e1 App_Equation -%9e2 App_EQUA -%9f5 App_Program - -%a00 App_FINANCE -%a1f Keyboard_RemapFKeyCode -%a35 AUX_DisplayMessage -%a48 App_GRAPH_TABLE -%a4a App_LINK -%a6a App_Optimization -%a6b App_Memory -%a75 App_RECUR -%a97 App_RUN_MAT_EXE -%aae App_RUN_MAT -%ac6 App_STAT -%ac8 App_SYSTEM -%acc free -%acd malloc -%ace memcmp -%acf smart_memcpy -%ad0 memset -%ad4 strcat -%ad5 smart_strcmp -%ad6 strlen -%ad7 strncat -%ad8 strncmp -%ad9 strncpy -%ada strrchr -%ae8 CatalogDialog - -%c4f PrintMiniSd -%ca7 OpcodeType -%cb0 Basic_Send_Send38k -%cb1 Basic_Receive_Receive38k -%cb2 Basic_OpenComPort38k_CloseComPort38k -%cc4 InputNumber -%cc5 InputString -%ccb GetRAMSize -%cd0 another_diagnostic_dialog - -%d64 InputDateDialog -%d65 InputMonthDialog -%d66 InputDayDialog -%d67 InputYearDialog -%dab StoreExpressionToGraphFuncMemory - -%e6b calloc -%e6c memmove -%e6d realloc -%e6e strchr -%e6f strstr diff --git a/include/fxos/os.h b/include/fxos/os.h index 893f701..d8cb603 100644 --- a/include/fxos/os.h +++ b/include/fxos/os.h @@ -30,6 +30,11 @@ namespace FxOS { class VirtualSpace; +/* Predefined list of syscalls for each OS. These are used to auto-defined + functions at corresponding syscalls' locations during analysis. The string + is either an identifier or a C function prototype. */ +using SyscallDefs = std::map; + class OS { public: @@ -65,6 +70,8 @@ public: int find_syscall(uint32_t entry) const noexcept; /* Get address of syscall table */ uint32_t syscall_table_address() const noexcept; + /* Get syscall definitions object for current OS, if any. */ + SyscallDefs const *syscall_defs() const noexcept; /* Tests against the OS version */ bool version_lt(int major, int minor, int patch) const noexcept; diff --git a/lib/os.cpp b/lib/os.cpp index 47f6a89..280bc0f 100644 --- a/lib/os.cpp +++ b/lib/os.cpp @@ -5,9 +5,24 @@ #include #include +#include +#include + +extern "C" { + +extern char const FxOS_SyscallDefs_FX[]; +extern int FxOS_SyscallDefs_FX_len; + +extern char const FxOS_SyscallDefs_CG[]; +extern int FxOS_SyscallDefs_CG_len; + +} /* extern "C" */ namespace FxOS { +static std::map> syscallDefsCache; +static std::unique_ptr buildSyscallDefs(char const *str, int len); + OS::OS(VirtualSpace &space): type {UNKNOWN}, m_space {space} { if(!space.covers(0x80000000, (256 << 10))) { @@ -158,6 +173,29 @@ void OS::parse_syscall_table() } } +SyscallDefs const *OS::syscall_defs() const noexcept +{ + if(syscallDefsCache.count(this->type)) + return syscallDefsCache[this->type].get(); + + /* Use the preloaded definitions */ + if(this->type == OS::FX) { + auto defs + = buildSyscallDefs(FxOS_SyscallDefs_FX, FxOS_SyscallDefs_FX_len); + syscallDefsCache.insert({OS::FX, std::move(defs)}); + } + else if(this->type == OS::CG) { + auto defs + = buildSyscallDefs(FxOS_SyscallDefs_CG, FxOS_SyscallDefs_CG_len); + syscallDefsCache.insert({OS::CG, std::move(defs)}); + } + + if(syscallDefsCache.count(this->type)) + return syscallDefsCache[this->type].get(); + + return nullptr; +} + //--- // Footer search //--- @@ -242,4 +280,49 @@ uint32_t OS::compute_checksum() const return -1; } +//--- +// Parsing predefined syscall definitions +//--- + +struct SyscallDef +{ + int syscall; + std::string name; + // TODO: Prototype +}; + +static bool parseSyscallDef(std::string &str, SyscallDef *def) +{ + /* Trim comments and spaces */ + auto comm = str.find("//"); + if(comm != std::string::npos) + str.erase(comm, std::string::npos); + str = str.substr(0, str.find_last_not_of(" \t") + 1); + + int off; + // TODO: Does not really check for the colon + if(sscanf(str.c_str(), " %%%x : %n", &def->syscall, &off) == 1) { + def->name = str.substr(off, std::string::npos); + return true; + } + + return false; +} + +static std::unique_ptr buildSyscallDefs(char const *str, int len) +{ + std::istringstream iss({str, (size_t)len}); + std::string line; + + auto defs = std::make_unique(); + SyscallDef def; + + while(std::getline(iss, line)) { + if(parseSyscallDef(line, &def)) + defs->insert({def.syscall, def.name}); + } + + return defs; +} + } /* namespace FxOS */ diff --git a/lib/syscalls_cg.def b/lib/syscalls_cg.def new file mode 100644 index 0000000..c09128b --- /dev/null +++ b/lib/syscalls_cg.def @@ -0,0 +1,561 @@ +// TODO: Prototypes + +%0002: HourGlassTimer +%0003: DrawHourGlass +%000c: Exception_Handler_000c +%000d: Exception_Handler_000d +%000e: Exception_Handler_000e +%0010: SystemError +%0011: MMU_FlushCache +%0026: App_CheckG3AFileSizeAndChecksum +%002b: GlibGetOSVersionInfo +%0031: Setup_GetEntry +%0032: Setup_SetEntry +%0033: Setup_GetEntryPtr +%0034: Alpha_GetData +%0035: Alpha_SetData +%0036: Alpha_ClearAll + +%0111: Bkey_ClrAllFlags2 +%0112: Bkey_SetFlag2 +%0113: Bkey_ClrFlag2 +%0114: Bkey_AllFlagsAreZero2 +%0115: Bkey_GetAllFlags2 +%0129: FKey_mapping2 +%012b: FKey_mapping1 +%0131: FKey_Display +%0160: BCDToInternal +%0194: Bdisp_SetDDRegisterB +%0195: Bdisp_IsZeroDDRegisterB +%0199: Bdisp_SetBacklightLevel +%019a: Bdisp_WriteDDRegister5A1 +%01a2: Bdisp_DDRegisterSelect +%01a3: Bdisp_DefineDMARange +%01a6: Bdisp_WriteDDRegister3_bit7 +%01a7: Bdisp_ReadDDRegister3_bit7 +%01a8: Bdisp_PutPixel_x3 +%01b6: Bdisp_AreaClr_DD_x3 +%01b9: Bdisp_AreaClr_DD +%01ba: Bdisp_AreaClr_VRAM_WB +%01bb: Bdisp_AreaClr_VRAM +%01c0: Bdisp_ShapeToDD +%01c1: Bdisp_ShapeToVRAM +%01c2: Bdisp_ShapeToVRAMDD +%01c3: Bdisp_ShapeToDD16C +%01c4: Bdisp_ShapeToVRAM16C +%01c5: Bdisp_ShapeToVRAMDD16C +%01c7: Bdisp_ShapeBase +%01c8: Bdisp_ShapeDot +%01c9: Bdisp_ShapeLine +%01ca: Bdisp_ShapeBox +%01cb: Bdisp_ShapeCircle +%01d0: Bdisp_Line3X_Draw +%01d1: Bdisp_Line3X_Clear +%01d2: Bdisp_LineC16 +%01d8: Bdisp_Line +%01e5: GetVRAMBackgroundAddress +%01e6: GetVRAMAddress +%01e8: GetGlyphPtr_MB +%01e9: GetMiniGlyphPtr_MB +%01ea: GetMiniMiniGlyphPtr_MB +%01eb: GetBoldMiniMiniGlyphPtr_MB +%01f1: Cursor_SetPosition +%01f3: Cursor_SetFlashMode_incompatible +%01f5: Cursor_GetSettings +%01f8: PrintXY +%01f9: Print_OS +%0208: PrintChar +%021b: PrintMiniMini +%0238: PrintGlyph +%0239: PrintCXY +%023b: PrintMiniGlyph +%023c: PrintMini +%023f: PrintMiniMini2 +%025f: Bdisp_PutDisp_DD +%0260: Bdisp_PutDisp_DD_stripe +%0262: Bdisp_SetPoint_VRAM_WB +%0263: Bdisp_SetPoint_VRAM +%0264: Bdisp_SetPoint_VRAM_WB_C3 +%0265: Bdisp_SetPoint_VRAM_C3 +%0266: Bdisp_GetPoint_VRAM_WB +%0267: Bdisp_GetPoint_VRAM +%026a: Bdisp_SetPoint_DD_WB +%026b: Bdisp_SetPoint_DD +%026e: Bdisp_GetPoint_DD_WB +%026f: Bdisp_GetPoint_DD +%0272: Bdisp_AllClr_VRAM +%0275: Bdisp_Fill_VRAM +%0276: Bdisp_Fill_DD +%0278: Bdisp_Fill_DD_1 +%027a: Bdisp_Fill_VRAM_2 +%0281: SaveWBVRAM +%0283: C16WorkbenchToC3Workbench +%028f: Bdisp_WriteGraphVRAM_WB +%0290: Bdisp_WriteGraphVRAM +%0291: Bdisp_WriteGraphDD_WB +%0296: Bdisp_AreaFillVRAM +%0297: Bdisp_AreaFillDD +%0298: Bdisp_AreaFillVRAMDD +%0299: Bdisp_AreaFillVRAM16C +%029a: Bdisp_AreaFillDD16C +%029b: Bdisp_AreaFillVRAMDD16C +%02a3: FrameColor +%02a4: FrameColorIndex +%02a8: DrawFrame +%02a9: DrawFrameC3 +%02aa: DirectDrawRectangle +%02ac: DisplayCursor +%02b2: Bdisp_AreaClr +%02b7: EnableStatusArea +%02b8: DefineStatusAreaFlags +%02b9: DefineStatusMessage +%02bb: DrawHeaderLine +%02bc: ClearHeader +%02bf: RTC_Reset +%02c0: RTC_GetTime +%02c1: RTC_GetTicks +%02c2: RTC_Elapsed_ms +%02c7: HourGlass +%0308: BCD_mean +%0311: BCD_StdToHigh +%0313: BCD_HighToStd +%038b: BCD_GetError +%038c: BCD_GetError +%0489: some_BCD_function_0489 +%048b: some_BCD_function_048b +%0496: ShortToBCD +%0497: BCDtoShort +%0498: IntToBCD +%0499: BCDtoInt +%04aa: BCD_0 +%04ab: BCD_1 +%04ac: BCD_2 +%04ad: BCD_5 +%04ae: BCD_10 +%05f6: BCDhigh_SetAsShort +%05f7: BCDhigh_GetAsShort +%05f8: BCDhigh_SetAsInt +%05f9: BCDhigh_GetAsInt +%05fa: BCDhigh_SetError +%05ff: BCDhigh_BCD_0_5 +%0600: BCDhigh_BCD_32767 +%0601: BCDhigh_BCD_minus_32768 +%0602: BCDhigh_BCD_2G +%0603: BCDhigh_BCD_minus_2G +%0604: BCDhigh_PI +%060d: strlen +%060e: strcpy +%060f: strcat +%07a2: CharacterSelectDialog +%07bb: PRGM_IsEndOfLine +%07bd: Is_Comma +%07e5: CLIP_Store +%0834: APP_CONICS +%08c3: Cursor_GetSettings +%08c7: Cursor_SetFlashOn +%08c8: Cursor_SetFlashOff +%08ca: Keyboard_CursorFlash +%08cb: Keyboard_CursorFlash +%08cc: Keyboard_CursorFlash +%08cd: Keyboard_CursorFlash +%08cf: DisplayVisibleCursor +%08d0: TextCursorToPoint +%08d1: GetCursorFlashToggle +%08d2: SetCursorFlashToggle +%08d9: Timer_Install +%08da: Timer_Deinstall +%08db: Timer_Start +%08dc: Timer_Stop +%0901: OpenDeflate +%0909: PerformDeflate +%090a: CloseDeflate +%0921: EnableColor +%0924: Bdisp_Rectangle +%0925: Bdisp_FilledRectangle +%0926: Bdisp_FilledRectangle +%0927: Bdisp_FilledRectangle +%0928: Bdisp_FilledRectangle +%0937: MsgBoxMoveWB_C3 +%0938: MsgBoxMoveWB +%0a10: APP_DYNA +%0a83: APP_EACT +%0a8c: Alpha_ClearAllAndAns +%0a8e: MCS_CreateEACTPackDumy +%0a8f: MCS_DeleteEACTPackDumy +%0b02: APP_E_CON +%0bd0: Ly555_Table +%0beb: APP_EQUA +%0c01: AUX_DisplayErrorMessage +%0c0f: FileHeader_Prepare +%0c12: FileHeader_CheckControlBytes +%0c13: FileHeader_CheckUSBPower +%0c15: FileHeader_CheckFilesize +%0c1b: InvertMem +%0c1d: ReadProtectBin_file_from_SD +%0c20: CreateProtectBin_file_to_SD +%0c2c: SMEM_MapIconToExt +%0c2f: Bfile_Name_ExtractDir +%0c5a: StandardScrollbar +%0c66: SaveFileDialog +%0c6b: APP_FINANCE +%0cef: GetGlyphPtr_F9 +%0cf0: GetGlyphPtr_E7 +%0cf1: GetGlyphPtr_E6 +%0cf2: GetGlyphPtr_E5 +%0cf3: GetGlyphPtr_7F +%0cf4: GetGlyphPtr_F7 +%0cf5: GetMiniGlyphPtr +%0cf6: GetMiniGlyphPtr_7F +%0cf8: GetMiniGlyphPtr_F7 +%0cf9: GetMiniGlyphPtr_E5 +%0cfa: GetMiniGlyphPtr_E6 +%0cfb: GetMiniGlyphPtr_E7 +%0cfc: GetMiniGlyphPtr_F9 +%0d39: KeyBoard_PRGM_GetKey +%0d79: App_InitDlgDescriptor +%0d90: AUX_Display4linesAndWaitFor_1or2 +%0d91: OverwriteConfirmation +%0da1: SMEM_OpenFile +%0da3: SMEM_ReadFile +%0da4: SMEM_WriteFile +%0db5: SMEM_RenameEntry +%0e57: Check_G3P_FileHeader +%0e5b: Check_G3P_MetaData +%0e5c: Check_G3P_MetaData2 +%0e92: G3P_crypt +%0e96: KeyMapper +%0e97: KeyMapper +%0ea0: Bkey_GetAllFlags +%0ea1: Bkey_SetAllFlags +%0ea2: Bkey_SetFlag +%0ea3: Bkey_ClrAllFlags +%0ea4: Bkey_ClrFlag +%0ea9: Keyboard_PutKeycode +%0eaa: GetKey_4 +%0eab: GetKey +%0eae: Bkey_GetkeyTablePtr +%0eaf: Cursor_AutoSetAndSwitchOn +%0fda: APP_GRAPH_TABLE +%1009: SaveG3P +%100f: LoadG3P +%1154: MB_ByteCount +%115e: memcmp3 +%1161: MB_IsLead +%1163: MB_ElementCount +%1164: MB_ByteCount +%1166: MB_strcat +%1167: MB_strncat +%1168: MB_strcpy +%116c: MB_GetSecondElemPtr +%116d: MB_GetElement +%116e: memcmp3 +%116f: Disp_strcpy +%1170: itoa +%1171: pc_toupper +%1172: pc_tolower +%117a: OpenInflate +%117b: PerformInflate +%117c: CloseInflate +%1186: GetMainBatteryVoltage +%1196: IsCG10 +%11ad: RTC_SetCarryFlag +%11b0: PrimaryKeyboardHandler +%11bb: IRQ1_Handler +%11bc: IRQ2_Handler +%11d6: CMT_Delay_micros +%11d7: CMT_Delay_100micros +%11dd: RTC_TriggerAlarm +%11de: RTC_SetDateTime +%11e2: RTC_GetDateTime +%120e: EditMBString +%1218: DisplayMBString2 +%121d: DisplayMBString +%1224: EditMBStringChar +%128f: OpCodeToStr +%1291: ExpressionToStr +%1293: SecondaryKeyboardHandler +%12a0: KeyMatrixSnapshot +%12a4: Bkey_Set_RepeatTime +%12a5: Bkey_Get_RepeatTime +%12bf: GetKeyWait_OS +%12c0: GetKeyWait +%12c1: Keyboard_ResetFlags +%12c6: Keyboard_PutKeyCode +%12c7: Keyboard_ClrBuffer +%12c9: Keyboard_SpyMatrixCode +%12ca: Bkey_Set_RepeatTime_Default +%12cb: Keyboard_EnableAutoRepeat +%12cc: Keyboard_DisableAutoRepeat +%12d4: SetBatteryType +%12d5: GetBatteryType +%12d8: SetBacklightDuration +%12d9: GetBacklightDuration +%12f3: GetFKeyPtr +%12fc: LocalizeMessage1 +%12fd: LocalizeMessage2 +%1343: HexToNibble +%1344: HexToByte +%1345: HexToWord +%1346: NibbleToHex +%1347: ByteToHex +%1348: WordToHex +%1349: strlen +%134a: memcpy +%134b: Comm_Padding_5C +%134c: Comm_ReversePadding_5C +%134d: Serial_Open +%1353: Comm_Open +%1354: Comm_Close +%1356: Comm_WaitForAnyBuffer +%1370: IsCG10 +%1381: APP_LINK +%1384: APP_LINK_transmit_select_dialog +%1388: AnyMemTransmitSelectDialog +%138a: APP_LINK_TransmitOKDlg +%138c: AnyMem_OpenDialog +%1396: Comm_TryCheckPacket +%1397: App_LINK_SetRemoteBaud +%1398: App_LINK_Send_ST9_Packet +%1399: App_LINK_GetDeviceInfo +%13a6: App_LINK_TransmitInit +%13a7: App_LINK_Transmit +%13aa: App_LINK_PrepareTransmitBuffer +%13ae: App_LINK_already_exists_dialog +%13ed: Comm_13ED +%13f0: Comm_SendPacket +%13f3: fx_TimeoutTermination +%13f4: Comm_PrepareAckPacket +%13f5: Comm_PrepareErrorPacket +%13f9: Comm_PrepareCommandPacket +%1402: Device_Info_1 +%1403: Device_Info_RenesasID +%1406: OS_Version_String +%1407: Device_Info_Block +%1409: App_LINK_SetReceiveTimeout_ms +%140a: App_LINK_GetReceiveTimeout_ms +%150f: MCS_memmove +%1511: memset +%1512: MCS_memmove +%1514: MCS_SearchDirectory +%1515: MCS_CreateDirectory +%1516: MCS_DeleteDirectory +%1518: MCS_GetSystemDirectoryInfo +%1519: MCS_SearchDirectoryItem +%151a: MCS_WriteItem +%151c: MCS_DeleteItem +%151e: MCS_GetItemFlag1 +%1524: MCS_ChangeItemSize +%1529: MCS_GetState +%1530: MCS_GetDirectoryEntryAddress +%1531: MCS_GetCurrentBottomAddress +%1532: MCS_GetCapa +%1533: MCS_GetDirectoryEntryByNumber +%1534: MCS_GetFirstDataPointerByDirno +%1535: str8cpy_with_upper_lower_mode +%1536: MCS_SearchItem +%1537: MCS_SetControlBlockTo_FF +%1538: MCS_SetControlBlockTo_00 +%153a: MCS_SaveControlBlockToP1 +%153b: MCS_RestoreControlBlockFromP1 +%1543: MCS_GetMainMemoryStart +%1544: Alpha_char_to_number +%1545: MCS_DirtypeToName +%1548: MCS_MapError +%1549: MCS_DirtypeToItemtype +%154a: MCS_ItemtypeToDirtype +%154b: MCS_CreateDirectory +%154d: MCSPutVar2 +%1552: MCSOvwDat2 +%1553: MCS_OpenAlphaMemItem2 +%1558: MCSDelVar2 +%155c: MCS_GotoInternalItem +%155d: MCS_OpenMainMemoryItem +%155e: MCS_GotoHandleNeighbour +%155f: MCS_CheckOpenedItem +%1560: MCS_GetOpenItem +%1561: MCS_OpenInternalDirectoryItem +%1562: MCSGetDlen2 +%1563: MCSGetData1 +%1564: MCS_GetAlphaMem +%1565: MCS_MapMCS_Result +%1566: MCSGetCapa +%1567: MCS_Reset +%156f: MCS_OpenInternalDirectoryItem2 +%1570: MCS_OpenDirectoryItem +%1571: MCS_OpenAlphaMemItem +%161c: Setup_GetInfo +%1630: App_Optimize +%1632: APP_MEMORY +%1633: ItoA_10digit +%1634: ItoA_10digit +%1635: strcmp_ignore_case +%1636: strcmp_ignore_case +%1637: rts +%1638: FKey_Icon_Table +%1743: CalculateExpression0 +%175d: CalculateExpression +%1749: PRGM_NextOPcode +%1761: BCD_SetError_01 +%17e9: OpenFileDialog +%17ea: CheckG3P +%17ee: CheckForG3PLock +%17ef: CheckForG3PLockAndMachine +%17f7: MsgBoxPush +%17f9: MsgBoxPop +%17fb: BoxYLimits +%1802: ConfirmFileOverwriteDialog +%180b: ProgressBar2 +%180b: ProgressBar0 +%180e: ProgressBar1 +%1814: ColorIndexDialog0 +%1815: ColorIndexDialog1 +%1816: ColorIndexDialog2 +%1834: RTC_StartHalfSecondPeriodicInterrupt +%1839: PowerOff +%183a: PowerOff +%183d: SetOrClrInterruptStatusFlag +%183e: QueryAndCondClrInterruptStatusFlag +%1841: LongToAscHex +%1845: CheckMCSBackups +%184d: OpCodeStrPtr +%1863: locate_OS +%187a: PrintChar +%1882: PrintCharReverse +%1883: PrintLine +%18ec: PrintXY_msg_by_no +%18f6: PrintPixXY_a +%18f7: PrintPixXY_normal +%18f8: PrintXY_normal +%18f9: PrintXY +%18ff: PrintPixXY +%1901: Bdisp_WriteSystemMessageChar +%1902: Bdisp_WriteSystemMessage_WB +%1906: Bdisp_WriteSystemMessage +%193e: free_recursive_struct +%193f: MCS_GoBASICItemAndCompareWithHandle +%1940: MCS_AllocateBASICProgramListItem +%1941: MCS_AllocateBASICProgramList +%1945: APP_PROG +%198a: Send_Send38k +%198b: Receive_Receive38k +%198c: OpenCloseComPort38k +%199d: APP_RECUR +%1a03: APP_RUNMAT +%1a0a: Scrollbar +%1a2c: GetStackPtr +%1a2e: SetSystemSetting +%1a2f: GetSystemSetting +%1a37: Keyboard_GetShiftStatus +%1a38: Keyboard_ClrShiftStatus +%1b0b: GetVRAMWorkBuffer +%1b0f: APP_SHEET +%1bb4: OS_InnerWait_ms +%1bb7: Serial_Open +%1bb8: Serial_Close +%1bb9: Serial_ReadOneByte +%1bba: Serial_ReadNBytes +%1bbb: Serial_SpyNthByte +%1bbc: Serial_BufferedTransmitOneByte +%1bbd: Serial_DirectTransmitOneByte +%1bbe: Serial_BufferedTransmitNBytes +%1bbf: Serial_GetReceivedBytesAvailable +%1bc0: Serial_GetFreeTransmitSpace +%1bc1: Serial_ClearReceiveBuffer +%1bc2: Serial_ClearTransmitBuffer +%1bc3: Serial_TranslateParameters +%1bc4: Serial_GetStatus +%1bc5: Serial_ClearStatusRegister +%1bc6: Serial_IsOpen +%1bc7: Serial_Check_physical_connect +%1bc9: Serial_Enable_Int +%1bca: Serial_Disable_Int +%1bcb: Serial_DisableHardware +%1bcc: Serial_SetHandler +%1bcd: Serial_GetHandler +%1ced: APP_STAT +%1d77: DefineStatusMessage +%1d7b: DefineStatusGlyph +%1d81: DisplayStatusArea +%1d82: Bdisp_HeaderText +%1d85: Bdisp_HeaderGlyph +%1d86: Bdisp_HeaderFill +%1d87: Bdisp_HeaderFill2 +%1d89: BatteryIcon +%1d8a: KeyboardIcon +%1d8b: RadIcon +%1d8c: RealIcon +%1d8d: NormIcon +%1d8e: d_c_Icon +%1d8f: LineIcon +%1d9f: Bfile_IdentifyDevice_OS +%1da3: Bfile_OpenFile_OS +%1da4: Bfile_CloseFile_OS +%1da6: Bfile_GetFileSize_OS +%1da7: Bfile_GetFileInfo +%1da9: Bfile_SeekFile_OS +%1dab: Bfile_Filepos +%1dac: Bfile_ReadFile_OS +%1dae: Bfile_CreateEntry_OS +%1daf: Bfile_WriteFile_OS +%1db3: Bfile_RenameEntry +%1db4: Bfile_DeleteEntry +%1db6: Bfile_FindFirst_FAT +%1db7: Bfile_FindFirst +%1db8: Bfile_FindNext_FAT +%1db9: Bfile_FindNext +%1dba: Bfile_FindClose +%1dd0: memcpy +%1dd1: invers_memcmp +%1dd2: Bfile_GetFilenameLength +%1dd3: Bfile_Name_cmp +%1dd4: Bfile_Name_strcpy +%1dd6: Bfile_Name_strcmp +%1dd8: Bfile_Name_tolower +%1dd9: Bfile_Name_toupper +%1dda: Bfile_Name_MatchMask +%1ddb: Bfile_NameToStr_ncpy +%1ddc: Bfile_StrToName_ncpy +%1ddd: Bfile_Name_npad +%1dde: Bfile_Name_toupper_tolower +%1ddf: Bfile_Name_strchr +%1de0: Bfile_Name_strrchr +%1e05: APP_SYSTEM_POWER +%1e07: APP_SYSTEM_BATTERY +%1e0a: APP_SYSTEM_DISPLAY +%1e0d: APP_SYSTEM_LANGUAGE +%1e13: APP_SYSTEM +%1e17: APP_SYSTEM_RESET +%1e23: ResetAllDialog +%1e34: APP_SYSTEM_VERSION +%1e4b: DisplayMessage +%1e50: GetVRAMWorkBuffer +%1e55: Heap_Allocate +%1e56: Heap_Init +%1e60: SpecialMatrixcodeProcessing +%1e62: SaveVRAM_1 +%1e63: LoadVRAM_1 +%1e6e: SetQuitHandler +%1e72: Battery_IsLow +%1e73: BatteryCheck +%1e76: BatteryLowMessage +%1e7d: GetIntPtrContent +%1e80: CountInstalledForeignLanguages +%1e82: Ly555ptr +%1e83: Ly555ptr +%1e90: SetAutoPowerOffTime +%1e91: GetAutoPowerOffTime +%1e99: GetGetkeyToMainFunctionReturnFlag +%1e9e: Maybe_SetAppName +%1e9f: GetAppName +%1ea0: CmpAppName +%1ea4: SetAutoPowerOffFlag +%1ea5: GetAutoPowerOffFlag +%1ef7: WriteBackground +%1ef8: SetBackGround +%1f40: calloc +%1f41: free +%1f42: free +%1f43: malloc +%1f44: malloc +%1f45: realloc +%1f46: realloc diff --git a/lib/syscalls_fx.def b/lib/syscalls_fx.def new file mode 100644 index 0000000..52144ff --- /dev/null +++ b/lib/syscalls_fx.def @@ -0,0 +1,457 @@ +// TODO: Prototypes + +%000: sys_init +%001: vbr_tlb_error +%002: vbr_cpu_address +%003: vbr_tlb_exception +%004: TLB_init +%005: App_RegisterAddins +%009: App_FindFreeAddinSlot +%00a: App_GetAddinHeaderAddr +%00e: App_GetAddindEstrip +%013: GlibAddinAplExecutionCheck +%014: GlibGetAddinLibInfo +%015: GlibGetOSVersionInfo +%016: System_ERROR_popup +%018: MMU_FlushCache +%01b: T6K11_Clear +%01c: Bdisp_WriteGraph_VRAM +%01d: Bdisp_WriteGraph_DD +%01e: Bdisp_WriteGraph_DDVRAM +%022: Bdisp_ReadArea_VRAM +%023: Bdisp_ReadArea_DD +%024: Bdisp_GetDisp_DD +%025: T6K11_ReadCurrentPage +%026: T6K11_ReadPage +%027: T6K11_WritePage +%028: Bdisp_PutDisp_DD +%02a: Bdisp_DrawShapeToVRAM +%02f: Bdisp_DrawShapeToVRAM +%030: Bdisp_DrawLineVRAM +%031: Bdisp_ClearLineVRAM +%032: Bdisp_DrawShapeToDD +%033: Bdisp_DrawShapeToVRAM_DD +%034: Bdisp_DrawShapeToDD +%035: Bdisp_DrawShapeToVRAM_DD +%039: RTC_Reset +%03a: RTC_GetTime +%03b: RTC_GetTicks +%03c: RTC_Elapsed_ms +%05c: Num_UIntToBCD +%05d: Num_BCDToUInt + +%118: Timer_Install +%119: Timer_Deinstall +%11a: Timer_Start +%11b: Timer_Stop +%11f: Bdisp_PutDispArea_DD +%12d: DD_Poweroff +%130: Wait_ms +%132: DD_SetContrast +%133: DD_SetFRS +%134: DD_SetBias +%135: GetVRAMAddress +%136: GetCharacterGlyph +%137: GetCharacterMiniGlyph +%138: Cursor_SetPosition +%139: Cursor_SetFlashStyle +%13a: Cursor_SetFlashMode +%13b: Cursor_GetSettings +%13c: Print_OS +%142: Bdisp_AllClr_DD +%143: Bdisp_AllClr_VRAM +%144: Bdisp_AllClr_DDVRAM +%145: Bdisp_GetDisp_VRAM +%146: Bdisp_SetPoint_VRAM +%147: Bdisp_SetPoint_DD +%148: Bdisp_SetPoint_DDVRAM +%149: Bdisp_GetPoint_VRAM +%14a: Bdisp_AreaClr_DD +%14b: Bdisp_AreaClr_VRAM +%14c: Bdisp_AreaClr_DDVRAM +%14d: Bdisp_AreaReverseVRAM +%150: PrintXY +%153: Disp_Save +%154: Disp_Restore +%155: Disp_GetPtr +%156: PopUpWin +%158: Disp_Manage +%159: System_UpdateOS +%15d: PrintCR +%15f: atoi +%160: LongToAsc +%161: LongToAscHex +%162: pc_toupper +%163: pc_tolower +%172: strcmp +%173: strcmp +%175: some_datatable +%176: DiagnosticMode +%18a: InvertMem +%19f: SMEM_Optimization +%1a9: GUI_ProgressBar +%1b7: Get8x8BitmapPointer_1 +%1b8: Get8x8BitmapPointer_2 +%1b9: Get8x8BitmapPointer_3 +%1ba: Get8x8BitmapPointer_4 +%1bb: Get8x8BitmapPointer_5 +%1bc: Get8x8BitmapPointer_6 +%1bd: Get8x8BitmapPointer_7 + +%20e: StorageMemory_GetFilePos +%236: RebootOS +%23d: RTC_TriggerAlarm +%23e: RTC_SetDateTime +%241: Keyboard_ClrBuffer +%242: Bkey_Set_RepeatTime +%243: Bkey_Get_RepeatTime +%244: Bkey_Set_RepeatTime_Default +%245: Keyboard_EnableAutoRepeat +%246: Keyboard_DisableAutoRepeat +%247: Keyboard_GetKeyWait +%248: Keyboard_PutKeycode +%249: Keyboard_GetKeyDownTime +%24a: Keyboard_IsAnyKeyDown +%24b: Keyboard_IsSpecialKeyDown +%24c: Keyboard_IsSpecialKeyDown +%24d: Keyboard_KeyDown +%24e: Keyboard_SecondaryInterruptHandler +%24f: Keyboard_PutKeymatrixCode +%251: Keyboard_TimerHandler +%25e: Keyboard_PrimaryInterruptHandler +%268: GetFKeyIconPointer +%284: BCD_GetNaN +%285: Serial_Open_57600 +%286: BCD_AnsToSerial +%28d: Comm_Open +%28e: Comm_Close +%28f: Comm_WaitForAnyBuffer +%290: Comm_ReadOneByte +%291: Comm_TransmitOneByte +%292: Comm_WaitForAndReadNBytes +%293: Comm_TransmitNBytes +%294: Comm_ClearReceiveBuffer +%295: Comm_ClearTransmitBuffer +%296: Comm_IsValidPacketAvailable +%298: Comm_IsOpen +%299: Comm_GetCurrentSelector +%2a1: HexToByte +%2a2: HexToWord +%2a3: ByteToHex +%2a4: WordToHex +%2a5: Comm_Padding_5C +%2a6: Comm_ReversePadding_5C +%2a7: AscHexToNibble +%2a8: NibbleToAscHex +%2a9: strlen +%2aa: slow_memcpy +%2ab: Serial_Open2 +%2af: Comm_Spy0thByte +%2db: Comm_ProcessInPacket +%2e1: Comm_PrepareAckPacket +%2e2: Comm_PrepareErrorPacket +%2e3: Comm_PrepareTerminatePacket +%2e4: Comm_PrepareRoleswapPacket +%2e5: Comm_PrepareCheckPacket +%2e6: Comm_PrepareCommandPacket +%2e7: Comm_PrepareDataPacket +%2ee: System_GetOSVersion + +%35e: memset_range +%35f: memset +%363: MCS_CreateDirectory +%364: MCS_WriteItem +%366: MCS_DeleteDirectory +%367: MCS_DeleteItem +%368: MCS_GetState +%369: MCS_GetSystemDirectoryInfo +%370: MCS_RenameItem +%371: MCS_OverwriteData +%372: MCS_GetItemData +%373: MCS_RenameDirectory +%374: BMCSRenameVariable +%375: MCS_SearchDirectory +%376: MCS_SearchDirectoryItem +%37c: MCS_GetFirstDataPointerByDirno +%37d: MCS_GetDirectoryEntryByNumber +%37e: MCS_SearchItem +%37f: MCS_str8cpy +%380: MCS_GetDirectoryEntryAddress +%381: MCS_GetCurrentBottomAddress +%383: MCS_GetCapa +%392: MCS_GetMainMemoryStart +%3dc: Setup_GetInfo +%3ea: SYSCALL_3ea_DATATABLE +%3ed: Interrupt_SetOrClrStatusFlags +%3ee: Interrupt_QueryStatusFlags +%3f4: PowerOff +%3f5: ClearMainMemory +%3f6: SH7337_TMU_Stop +%3f7: SH7337_TMU_int_handler +%3fa: Hmem_SetMMU +%3fb: MMU_ConfigureAndFlush +%3fc: TLB_SetAddressValue +%3fe: GetStackPtr +%3ff: MMU_FlushCache + +%400: MMU_ConfigureAndEnable +%404: GetPhysicalROMstart +%405: GetPhysicalRAMstart +%409: Serial_ResetAndDisable +%40a: Serial_GetInterruptHandler +%40b: Serial_SetInterruptHandler +%40c: Serial_ReadOneByte +%40d: Serial_ReadNBytes +%40e: Serial_BufferedTransmitOneByte +%40f: Serial_BufferedTransmitNBytes +%410: Serial_DirectTransmitOneByte +%411: Serial_GetReceivedBytesAvailable +%412: Serial_GetFreeTransmitSpace +%413: Serial_ClearReceiveBuffer +%414: Serial_ClearTransmitBuffer +%418: Serial_Open +%419: Serial_Close +%41b: Serial_CallReceiveIntErrorResetHandler +%41c: Serial_CallReceiveIntHandler +%41d: Serial_CallTransmitIntErrorResetHandler +%41e: Serial_CallTransmitIntHandler +%420: OS_inner_Sleep +%422: Serial_SpyNthByte +%423: Serial_GetStatus +%425: Serial_IsOpen +%429: Bfile_identify_device_OS +%42c: Bfile_OpenFile_OS +%42d: Bfile_CloseFile_OS +%42e: Bfile_GetMediaFree_OS +%42f: Bfile_GetFileSize_OS +%431: Bfile_SeekFile_OS +%432: Bfile_ReadFile_OS +%434: Bfile_CreateEntry_OS +%435: Bfile_WriteFile_OS +%438: Bfile_RenameEntry +%439: Bfile_DeleteEntry +%43b: Bfile_FindFirst +%43c: Bfile_FindNext +%43d: Bfile_FindClose +%44e: memcpy +%44f: memcmp +%450: Bfile_GetFilenameLength +%451: Bfile_Name_cmp +%452: Bfile_Name_cpy +%453: Bfile_Name_ncpy +%456: Bfile_NameToStr_ncpy +%457: Bfile_StrToName_ncpy +%462: GetAppName +%463: SetAppName +%464: CmpAppName +%465: GetIntPtrContent +%467: LongToAscHex +%468: hasSDOption +%469: Battery_DisplayLowStatus +%46b: App_BuiltInCount +%476: Battery_IsLow +%477: EnableGetkeyToMainFunctionReturn +%478: DisableGetkeyToMainFunctionReturn +%47f: SetAutoPowerOffTime +%480: GetAutoPowerOffTime +%486: GetdatatablePtr +%48d: SetAutoPowerOffFlag +%48e: GetAutoPowerOffFlag +%492: Battery_IsLow +%494: CallbackAtQuitMainFunction +%495: Battery_DisplayLowStatus +%499: Heap_SetTopChunk +%49a: App_Start +%49c: Battery_GetStatus +%49e: RebootOS +%4a0: AUX_DisplayErrorMessage +%4ad: USB_InterruptHandler +%4ae: USB_TimerHandler +%4b0: AUX_DisplayFKeyIcons +%4cb: Keyboard_RemapFKeyCode +%4d1: AUX_DisplayFKeyIcon +%4dc: Setup_GetEntry +%4dd: Setup_SetEntry +%4de: Setup_GetEntryPtr +%4df: Alpha_GetData +%4e0: Alpha_SetData +%4e1: Alpha_ClearAll +%4e6: HourGlass +%4e9: LocalizeStringID +%4f5: BCD_ToStrAsNumber1 +%4f6: BCD_ToStrAsNumber2 + +%500: BCDToInternal +%518: Setup_GetEntry_3E +%519: Setup_GetEntry_40 +%51a: Setup_SetEntry_3E +%51b: Setup_SetEntry_40 +%531: MB_IsLead +%533: MB_ElementCount +%534: MB_ByteCount +%536: MB_strcat +%537: MB_strncat +%538: MB_strcpy +%53c: MB_GetSecondElemPtr +%53d: MB_GetElement +%53e: MB_CopyToHeap +%53f: memcmp +%541: itoa +%542: to_uppercase +%543: to_lowercase +%544: BCD_0 +%545: BCD_1 +%546: BCD_2 +%547: BCD_10 +%548: BCD_1_over_3 +%549: BCD_0.5 +%54a: BCD_32767 +%54b: BCD_m32768 +%54c: BCD_65536 +%54d: BCD_0x7fffffff +%54e: BCD_m2Gi +%54f: BCD_4Gi +%550: BCD_pi +%551: BCD_2pi +%552: BCD_pi_over_2 +%553: BCD_e +%554: BCD_5 +%5a6: BCD_SetAsInt +%5af: BCD_pi_over_4 +%5b0: BCD_ln10 +%5b1: BCD_ln2 +%5b2: BCD_9.99e99 +%5b3: BCD_m9.99e99 +%5b4: BCD_9.99999999999999e99 +%5b5: BCD_227.85 +%5b6: BCD_sqrt2 +%5b7: BCD_sqrt2_over_2 +%5b8: BCD_506.6282746310 + +%645: CalculateExpression +%64a: CalculateExpression0 +%652: PRGM_NextOpcode +%6a6: PRGM_IsEndOfLine +%6c4: Keyboard_PRGM_GetKey +%6d4: Alpha_GetData2 + +%713: Print_ClearLine +%763: Bdisp_DrawRectangle +%7fc: OpcodeToStr + +%804: CLIP_Store +%807: locate +%808: Print +%809: PrintRev +%80a: PrintC +%80b: PrintRevC +%80c: PrintLine +%80d: PrintRLine +%80e: Cursor_GetFlashStyle +%80f: Cursor_GetSettings +%811: Cursor_SetFlashOn +%812: Cursor_SetFlashOff +%813: SaveDisp +%814: RestoreDisp +%829: MCS_CreateDirectory +%82a: MCS_PutInternalItem +%82b: MCSPutVar2 +%830: MCSOvwDat2 +%832: MCS_OverwriteOpenItem +%833: MCS_ClearInternalDirectory +%834: MCS_ClearDirectory +%835: MCS_DeleteInternalItem +%836: MCSDelVar2 +%83a: MCS_GotoInternalItem +%83b: MCS_OpenMainMemoryItem +%83c: MCS_GotoHandleNeighbour +%83d: MCS_CheckOpenedItem +%83e: MCS_GetOpenItem +%83f: MCS_OpenInternalDirectoryItem +%840: MCSGetDlen2 +%841: MCSGetData1 +%843: MCS_MapMCS_Result +%844: MCSGetCapa +%84d: MCS_OpenAlphaMemItem +%852: MCS_DirtypeToItemtype +%853: MCS_ItemtypeToDirtype +%863: MCS_DirtypeToName +%866: MCS_MapError +%869: Alpha_ClearAllAndAns +%86f: MCS_DeleteDirectoryItems +%8db: EditExpression +%8dc: EditValue +%8e6: EditMBStringCtrl +%8ea: DisplayMBString +%8ec: EditMBStringChar +%8f7: DisplayMBString2 +%8fe: PopupWin + +%901: DisplayMessageBox +%905: DisplayErrorMessage +%90b: SetShiftAlphaState +%90c: GetInsOverwriteState +%90d: SetInsOverwriteState +%90e: ClrShiftAlphaState +%90f: GetKey +%910: PutKey +%91b: GetShiftAlphaState +%924: TestMode +%954: DisplayErrorMessage +%985: App_CONICS +%998: App_DYNA +%9ad: PrintXY +%9df: App_EACT +%9e1: App_Equation +%9e2: App_EQUA +%9f5: App_Program + +%a00: App_FINANCE +%a1f: Keyboard_RemapFKeyCode +%a35: AUX_DisplayMessage +%a48: App_GRAPH_TABLE +%a4a: App_LINK +%a6a: App_Optimization +%a6b: App_Memory +%a75: App_RECUR +%a97: App_RUN_MAT_EXE +%aae: App_RUN_MAT +%ac6: App_STAT +%ac8: App_SYSTEM +%ac9: longjmp +%aca: setjmp +%acc: free +%acd: malloc +%ace: memcmp +%acf: smart_memcpy +%ad0: memset +%ad4: strcat +%ad5: smart_strcmp +%ad6: strlen +%ad7: strncat +%ad8: strncmp +%ad9: strncpy +%ada: strrchr +%ae8: CatalogDialog + +%c4f: PrintMiniSd +%ca7: OpcodeType +%cb0: Basic_Send_Send38k +%cb1: Basic_Receive_Receive38k +%cb2: Basic_OpenComPort38k_CloseComPort38k +%cc4: InputNumber +%cc5: InputString +%ccb: GetRAMSize +%cd0: another_diagnostic_dialog + +%d64: InputDateDialog +%d65: InputMonthDialog +%d66: InputDayDialog +%d67: InputYearDialog +%dab: StoreExpressionToGraphFuncMemory + +%e6b: calloc +%e6c: memmove +%e6d: realloc +%e6e: strchr +%e6f: strstr diff --git a/shell/i.cpp b/shell/i.cpp index 1390e88..be1700e 100644 --- a/shell/i.cpp +++ b/shell/i.cpp @@ -457,6 +457,8 @@ void _isc(Session &session, std::string binary_name, bool sort, return; } + SyscallDefs const *scdefs = os->syscall_defs(); + if(!addresses.empty()) { if(sort) std::sort(&addresses[0], &addresses[addresses.size()]); @@ -468,6 +470,9 @@ void _isc(Session &session, std::string binary_name, bool sort, fmt::print(theme(3), " 0x{:08x}", address); fmt::print(theme(10), " %{:04x}", syscall); + + if(scdefs && scdefs->count(syscall)) + fmt::print(" {}", scdefs->at(syscall)); fmt::print("\n"); } @@ -486,6 +491,9 @@ void _isc(Session &session, std::string binary_name, bool sort, for(int i = 0; i < total; i++) { fmt::print(theme(3), " 0x{:08x}", info[i].address); fmt::print(theme(10), " %{:04x}", info[i].id); + + if(scdefs && scdefs->count(info[i].id)) + fmt::print(" {}", scdefs->at(info[i].id)); fmt::print("\n"); } }