Subversion Repositories Kolibri OS

Rev

Rev 7562 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. :dword std_print(dword count, args)
  2. {
  3.         consoleInit();
  4.         WHILE(count)
  5.         {
  6.                 con_printf stdcall (DSDWORD[args]);
  7.                 args+=4;
  8.                 count--;
  9.         }
  10. }
  11.  
  12. :dword std_str(dword count, args)
  13. {
  14.         dword tmp = 0;
  15.         tmp = malloc(15);
  16.         itoa_(tmp,DSDWORD[args]);
  17.         RETURN tmp;
  18. }
  19.  
  20. :dword std_add(dword count, args)
  21. {
  22.         dword ret = 0;
  23.         WHILE(count)
  24.         {
  25.                 ret += DSDWORD[args];
  26.                 args+=4;
  27.                 count--;
  28.         }
  29.         RETURN ret;
  30. }
  31.  
  32. :dword std_sub(dword count, args)
  33. {
  34.         dword ret = 0;
  35.         IF(count)
  36.         {
  37.                 ret = DSDWORD[args];
  38.                 count--;
  39.                 args+=4;
  40.         }
  41.         WHILE(count)
  42.         {
  43.                 ret -= DSDWORD[args];
  44.                 args+=4;
  45.                 count--;
  46.         }
  47.         RETURN ret;
  48. }
  49.  
  50. void Init()
  51. {
  52.         functions.init(100);
  53.        
  54.         /* Console functions */
  55.         functions.set("print", #std_print);
  56.        
  57.         /* String functions */
  58.         functions.set("str", #std_str);
  59.        
  60.         /* System functions */
  61.         functions.set("exit", #ExitProcess);
  62.        
  63.         /* Math functions */
  64.         functions.set("+", #std_add);
  65.         functions.set("-", #std_sub);
  66.        
  67.         variables.init(100);
  68. }
  69.  
  70. dword StdCall(dword count, name, args)
  71. {
  72.         dword tmp = 0;
  73.         functions.get(name);
  74.         IF(EAX)RETURN EAX(count, args);
  75.         RETURN 0;
  76. }