Subversion Repositories Kolibri OS

Rev

Rev 7927 | 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. typedef  unsigned int        uint32_t;
  6. typedef  unsigned char       uint8_t;
  7. typedef  unsigned short int  uint16_t;
  8. typedef  unsigned long long  uint64_t;
  9. typedef  char                int8_t;
  10. typedef  short int           int16_t;
  11. typedef  int                 int32_t;
  12. typedef  long long           int64_t;
  13.  
  14. static inline uint32_t getDate(void)
  15. {
  16.     uint32_t date;
  17.     __asm__ __volatile__("int $0x40":"=a"(date):"a"(29));
  18.     return date;
  19. }
  20.  
  21.  
  22.  
  23. static inline uint32_t getTime(void)
  24. {
  25.     uint32_t time;
  26.     __asm__ __volatile__("int $0x40":"=a"(time):"a"(3));
  27.     return time;
  28. }
  29.  
  30.  
  31.  
  32. static inline void *openFile(uint32_t *length, const uint8_t *path)
  33. {
  34.     uint8_t *fd;
  35.  
  36.     __asm__ __volatile__ ("int $0x40":"=a"(fd), "=d"(*length):"a" (68), "b"(27),"c"(path));
  37.  
  38.     return fd;
  39. }
  40.  
  41.  
  42.  
  43. static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t  *path)
  44. {
  45.     int32_t val;
  46.  
  47.     uint8_t dt[28];  // basic information structure.
  48.  
  49.     (uint32_t)  dt[0]  = 2;       // subfunction number.
  50.     (uint32_t)  dt[4]  = 0;       // reserved.
  51.     (uint32_t)  dt[8]  = 0;       // reserved.
  52.     (uint32_t)  dt[12] = nbytes;  // number of bytes to write.
  53.     (uint8_t *) dt[16] = data;    // pointer to data.
  54.     (uint32_t)  dt[20] = enc;     // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8).
  55.     (uint8_t *) dt[24] = path;    // pointer to path.
  56.  
  57.     __asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt));
  58.  
  59.     return val;
  60. }
  61.  
  62.  
  63. #endif
  64.