Subversion Repositories Kolibri OS

Rev

Rev 7883 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #ifndef __jxl_Date_get_h__
  3. #define __jxl_Date_get_h__
  4.  
  5. #include <stdint.h>
  6.  
  7. static inline uint32_t getDate(void)
  8. {
  9.     uint32_t date;
  10.     __asm__ __volatile__("int $0x40":"=a"(date):"a"(29));
  11.     return date;
  12. }
  13.  
  14.  
  15.  
  16. static inline uint32_t getTime(void)
  17. {
  18.     uint32_t time;
  19.     __asm__ __volatile__("int $0x40":"=a"(time):"a"(3));
  20.     return time;
  21. }
  22.  
  23.  
  24.  
  25. static inline void *openFile(uint32_t *length, const uint8_t *path)
  26. {
  27.     uint8_t *fd;
  28.  
  29.     __asm__ __volatile__ ("int $0x40":"=a"(fd), "=d"(*length):"a" (68), "b"(27),"c"(path));
  30.  
  31.     return fd;
  32. }
  33.  
  34.  
  35.  
  36. static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t  *path)
  37. {
  38.     int32_t val;
  39.  
  40.     struct file_op_t
  41.     {
  42.         uint32_t    fn;
  43.         uint32_t    reserved0;
  44.         uint32_t    reserved1;
  45.         uint32_t    number_of_bytes_to_write;
  46.         void *      pointer_to_data;
  47.         char        path[1];
  48.     } *file_op = calloc(sizeof(*file_op) + strlen(path) + 2, 1); // FIXME: Not works on UTF16LE enc
  49.    
  50.     file_op->fn = 2;
  51.     file_op->number_of_bytes_to_write = nbytes;
  52.     file_op->pointer_to_data = data;
  53.     if (enc != 0)
  54.     {
  55.         file_op->path[0] = enc;
  56.         strcpy(file_op->path + 1, path);
  57.     }
  58.     else
  59.     {
  60.         strcpy(file_op->path, path);
  61.     }
  62.    
  63.     asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op));
  64.     return val;
  65. }
  66.  
  67.  
  68. #endif
  69.