OSDN Git Service

svn rev.329より移動。
[chnosproject/CHNOSProject.git] / CHNOSProject / chnos / tolset_chn_000 / chnos_009 / chnos / api.c
diff --git a/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/api.c b/CHNOSProject/chnos/tolset_chn_000/chnos_009/chnos/api.c
new file mode 100644 (file)
index 0000000..952e936
--- /dev/null
@@ -0,0 +1,28 @@
+\r
+#include "core.h"\r
+\r
+uint *API_Execute(uint edi, uint esi, uint ebp, uint esp, uint ebx, uint edx, uint ecx, uint eax)\r
+{\r
+       UI_Task *nowtask;\r
+       uchar s[128];\r
+       uint i;\r
+\r
+       nowtask = MultiTask_Get_NowTask();\r
+\r
+       if(edx == 0x00000001){\r
+               InputBox_Put_Character(nowtask->cons->input, eax & 0xff);\r
+       } else if(edx == 0x00000002){\r
+               InputBox_Put_String(nowtask->cons->input, (uchar *)(ebx + System_SegmentDescriptor_Get_Base(nowtask->cons->app_ds)));\r
+       } else if(edx == 0x00000003){\r
+               for(i = 0; i < ecx; i++){\r
+                       InputBox_Put_Character(nowtask->cons->input, ((uchar *)ebx + System_SegmentDescriptor_Get_Base(nowtask->cons->app_ds))[i]);\r
+               }\r
+       } else if(edx == 0x00000004){\r
+               return &nowtask->tss.esp0;\r
+       } else{\r
+               sprintf(s, "API:0x%08X:Unknown API Function.\n", edx);\r
+               InputBox_Put_String(nowtask->cons->input, s);\r
+       }\r
+\r
+       return 0;\r
+}\r