Fix Little-Big endian BAG
This commit is contained in:
parent
603d3a87a4
commit
b5f8ed9456
29
ntsys.h
29
ntsys.h
@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
#define NTSYS_VERSION "1.0"
|
#define NTSYS_VERSION "1.0"
|
||||||
|
|
||||||
|
#define NAME_OF_32_BITS_TYPE unsigned int
|
||||||
|
#define NAME_OF_64_BITS_TYPE unsigned long int
|
||||||
|
#define NAME_OF_16_BITS_TYPE unsigned short int
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -61,6 +65,10 @@ static void __help(void) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __exe_run(__e_byte_t* memory, unsigned int memorysize, unsigned long filesize, FILE* fp) {
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
int ntsys_api_call(char* filename) {
|
int ntsys_api_call(char* filename) {
|
||||||
|
|
||||||
/* File data */
|
/* File data */
|
||||||
@ -105,14 +113,19 @@ int ntsys_api_call(char* filename) {
|
|||||||
ntsys_error("Header read error or digital signature is invalid!");
|
ntsys_error("Header read error or digital signature is invalid!");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
unsigned long int filesize = 0;
|
||||||
/*
|
switch (4) {
|
||||||
* printf("Filesize: %d bytes\n", *((unsigned short int*)head.e_filesize));
|
case sizeof(NAME_OF_64_BITS_TYPE): filesize = *((NAME_OF_64_BITS_TYPE*)head.e_filesize); break;
|
||||||
* printf("Memorysize: %d bytes\n", *((unsigned short int*)head.e_memorysize));
|
case sizeof(NAME_OF_32_BITS_TYPE): filesize = *((NAME_OF_32_BITS_TYPE*)head.e_filesize); break;
|
||||||
*/
|
default:
|
||||||
|
ntsys_error("Unknown data type! You must recompile the program and specify a different type.");
|
||||||
|
return EXIT_FAILURE;
|
||||||
return EXIT_SUCCESS;
|
}
|
||||||
|
__e_byte_t* memory = malloc(*((NAME_OF_16_BITS_TYPE*)head.e_memorysize));
|
||||||
|
int stat = __exe_run(memory, (unsigned int)*((NAME_OF_16_BITS_TYPE*)head.e_memorysize), filesize, fp);
|
||||||
|
fclose(fp);
|
||||||
|
free(memory);
|
||||||
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ntsys_compile_asm(char* in_file, char* out_file) {
|
int ntsys_compile_asm(char* in_file, char* out_file) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user