Subversion Repositories Kolibri OS

Rev

Rev 7927 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7927 Rev 7942
Line -... Line 1...
-
 
1
/*
-
 
2
 * Backy_lib.h
-
 
3
 * Author: JohnXenox aka Aleksandr Igorevich.
-
 
4
 */
-
 
5
 
1
#ifndef __jxl_Date_get_h__
6
#ifndef __jxl_Date_get_h__
2
#define __jxl_Date_get_h__
7
#define __jxl_Date_get_h__
Line 3... Line 8...
3
 
8
 
4
#include 
-
 
5
 
-
 
6
static inline uint32_t getDate(void)
-
 
7
{
-
 
8
    uint32_t date;
-
 
9
    __asm__ __volatile__("int $0x40":"=a"(date):"a"(29));
-
 
10
    return date;
-
 
11
}
-
 
Line -... Line 9...
-
 
9
#ifdef ___TINY_C___
-
 
10
 
-
 
11
typedef  unsigned int        uint32_t;
-
 
12
typedef  unsigned char       uint8_t;
-
 
13
typedef  unsigned short int  uint16_t;
-
 
14
typedef  unsigned long long  uint64_t;
-
 
15
typedef  char                int8_t;
-
 
16
typedef  short int           int16_t;
Line 12... Line 17...
12
 
17
typedef  int                 int32_t;
13
 
18
typedef  long long           int64_t;
14
 
19
 
15
static inline uint32_t getTime(void)
-
 
16
{
-
 
17
    uint32_t time;
-
 
Line -... Line 20...
-
 
20
static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uint8_t  *path)
Line -... Line 21...
-
 
21
{
-
 
22
    int32_t val;
-
 
23
 
-
 
24
    uint8_t dt[28];  // basic information structure.
-
 
25
 
-
 
26
    (uint32_t)  dt[0]  = 2;       // subfunction number.
-
 
27
    (uint32_t)  dt[4]  = 0;       // reserved.
Line 18... Line 28...
18
    __asm__ __volatile__("int $0x40":"=a"(time):"a"(3));
28
    (uint32_t)  dt[8]  = 0;       // reserved.
19
    return time;
-
 
20
}
-
 
Line 21... Line -...
21
 
-
 
22
 
-
 
23
 
29
    (uint32_t)  dt[12] = nbytes;  // number of bytes to write.
24
static inline void *openFile(uint32_t *length, const uint8_t *path)
30
    (uint8_t *) dt[16] = data;    // pointer to data.
Line -... Line 31...
-
 
31
    (uint32_t)  dt[20] = enc;     // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8).
Line -... Line 32...
-
 
32
    (uint8_t *) dt[24] = path;    // pointer to path.
Line 25... Line 33...
25
{
33
 
26
    uint8_t *fd;
34
    __asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt));
27
 
35
 
Line 62... Line 70...
62
    asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op));
70
    asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op));
63
    return val;
71
    return val;
64
}
72
}
Line -... Line 73...
-
 
73
 
-
 
74
#endif
-
 
75
 
-
 
76
static inline uint32_t getDate(void)
-
 
77
{
-
 
78
    uint32_t date;
-
 
79
    __asm__ __volatile__("int $0x40":"=a"(date):"a"(29));
-
 
80
    return date;
-
 
81
}
-
 
82
 
-
 
83
 
-
 
84
 
-
 
85
static inline uint32_t getTime(void)
-
 
86
{
-
 
87
    uint32_t time;
-
 
88
    __asm__ __volatile__("int $0x40":"=a"(time):"a"(3));
-
 
89
    return time;
-
 
90
}
-
 
91
 
-
 
92
 
-
 
93
 
-
 
94
static inline void *openFile(uint32_t *length, const uint8_t *path)
-
 
95
{
-
 
96
    uint8_t *fd;
-
 
97
 
-
 
98
    __asm__ __volatile__ ("int $0x40":"=a"(fd), "=d"(*length):"a" (68), "b"(27),"c"(path));
-
 
99
 
-
 
100
    return fd;
Line 65... Line 101...
65
 
101
}