forked from KolibriOS/kolibrios
Rewrite Backy to compile with GCC.
git-svn-id: svn://kolibrios.org@7927 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fa93417e04
commit
733e326d0a
Binary file not shown.
@ -2,14 +2,7 @@
|
||||
#ifndef __jxl_Date_get_h__
|
||||
#define __jxl_Date_get_h__
|
||||
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef char int8_t;
|
||||
typedef short int int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int64_t;
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint32_t getDate(void)
|
||||
{
|
||||
@ -44,18 +37,30 @@ static inline int32_t saveFile(uint32_t nbytes, uint8_t *data, uint32_t enc, uin
|
||||
{
|
||||
int32_t val;
|
||||
|
||||
uint8_t dt[28]; // basic information structure.
|
||||
struct file_op_t
|
||||
{
|
||||
uint32_t fn;
|
||||
uint32_t reserved0;
|
||||
uint32_t reserved1;
|
||||
uint32_t number_of_bytes_to_write;
|
||||
void * pointer_to_data;
|
||||
char path[1];
|
||||
} *file_op = calloc(sizeof(*file_op) + strlen(path) + 2, 1); // FIXME: Not works on UTF16LE enc
|
||||
|
||||
(uint32_t) dt[0] = 2; // subfunction number.
|
||||
(uint32_t) dt[4] = 0; // reserved.
|
||||
(uint32_t) dt[8] = 0; // reserved.
|
||||
(uint32_t) dt[12] = nbytes; // number of bytes to write.
|
||||
(uint8_t *) dt[16] = data; // pointer to data.
|
||||
(uint32_t) dt[20] = enc; // string encoding (0 = default, 1 = cp866, 2 = UTF-16LE, 3 = UTF-8).
|
||||
(uint8_t *) dt[24] = path; // pointer to path.
|
||||
|
||||
__asm__ __volatile__("int $0x40":"=a"(val):"a"(80), "b"(&dt));
|
||||
file_op->fn = 2;
|
||||
file_op->number_of_bytes_to_write = nbytes;
|
||||
file_op->pointer_to_data = data;
|
||||
if (enc != 0)
|
||||
{
|
||||
file_op->path[0] = enc;
|
||||
strcpy(file_op->path + 1, path);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(file_op->path, path);
|
||||
}
|
||||
|
||||
asm volatile ("int $0x40":"=a"(val):"a"(80), "b"(file_op));
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
|
||||
itoab(*dta, num, 16);
|
||||
itoa(*dta, num, 16);
|
||||
|
||||
if (num[1] == 0)
|
||||
{
|
||||
@ -254,7 +254,7 @@ int main(int argc, char** argv)
|
||||
if (i == 2)
|
||||
dta = &seconds;
|
||||
|
||||
itoab(*dta, num, 16);
|
||||
itoa(*dta, num, 16);
|
||||
|
||||
if (num[1] == 0)
|
||||
{
|
||||
|
4
programs/develop/backy/make_gcc.bat
Normal file
4
programs/develop/backy/make_gcc.bat
Normal file
@ -0,0 +1,4 @@
|
||||
gcc -m32 -c -fomit-frame-pointer -IC:\Users\Boppan\Documents\KolibriOS\contrib/sdk/sources/newlib/libc/include Backy.c -o Backy.o -Wall -Wextra
|
||||
kos32-ld Backy.o -o Backy.gcc -static -S -nostdlib -T C:\Users\Boppan\Documents\KolibriOS\contrib/sdk/sources/newlib/app.lds --image-base 0 -L "C:\Program Files (x86)\kos32-msys-5.4.0\win32\lib" -lgcc -lapp -lc.dll
|
||||
kos32-objcopy Backy.gcc -O binary
|
||||
@pause
|
Loading…
Reference in New Issue
Block a user