orbspace
@@ -1,6 +1,24 @@ | ||
1 | +#include "..\orbspace\orbfs.h" | |
2 | +/* io_img.c */ | |
3 | +int io_img_init(unsigned char *name, unsigned int size, unsigned char *iplname); | |
4 | +int io_img_final(void); | |
5 | + | |
1 | 6 | #include <stdio.h> |
7 | +#include <stdlib.h> | |
2 | 8 | |
3 | 9 | int main(int argc, char **argv) |
4 | 10 | { |
11 | + if (argc < 4) { | |
12 | + puts("Syntax error"); | |
13 | + return 1; | |
14 | + } | |
15 | + if (io_img_init(argv[1], atoi(argv[2]), argv[3]) != 0) { | |
16 | + puts("File error"); | |
17 | + return 1; | |
18 | + } | |
19 | + if (io_img_final() != 0) { | |
20 | + puts("File error"); | |
21 | + return 1; | |
22 | + } | |
5 | 23 | return 0; |
6 | 24 | } |
@@ -0,0 +1,41 @@ | ||
1 | +#include "..\orbspace\io.h" | |
2 | +#include <stdio.h> | |
3 | +#include <stdlib.h> | |
4 | +#include <string.h> | |
5 | + | |
6 | +FILE *imgfp; | |
7 | +unsigned char *imgbuf; | |
8 | +unsigned int imgsize; | |
9 | + | |
10 | +unsigned char ptable[16] = { | |
11 | + 0x80, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, | |
12 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
13 | +}; | |
14 | + | |
15 | +int io_img_init(unsigned char *name, unsigned int size, unsigned char *iplname) | |
16 | +{ | |
17 | + FILE *fp; | |
18 | + | |
19 | + if ((imgfp = fopen(name, "wb")) == 0) { | |
20 | + return 1; | |
21 | + } | |
22 | + imgsize = size * 1024; | |
23 | + imgbuf = (unsigned char *) malloc(imgsize); | |
24 | + memset(imgbuf, 0, imgsize); | |
25 | + if ((fp = fopen(iplname, "rb")) == 0) { | |
26 | + return 1; | |
27 | + } | |
28 | + fread(imgbuf, 1, 446, fp); | |
29 | + memcpy(imgbuf + 446, ptable, 16); | |
30 | + *((int *) (imgbuf + 446 + 0xc)) = imgsize / 512; | |
31 | + imgbuf[510] = 0x55; imgbuf[511] = 0xaa; | |
32 | + return 0; | |
33 | +} | |
34 | + | |
35 | +int io_img_final(void) | |
36 | +{ | |
37 | + if (fwrite(imgbuf, 1, imgsize, imgfp) != imgsize) { | |
38 | + return 1; | |
39 | + } | |
40 | + return 0; | |
41 | +} |
@@ -1,6 +1,6 @@ | ||
1 | 1 | TARGET = mkorbfs |
2 | 2 | MODE = exe |
3 | -OBJS = $(TARGET).obj | |
3 | +OBJS = $(TARGET).obj io_img.obj ..\orbspace\orbfs.obj | |
4 | 4 | STACKSIZE = 0x1000000 # 16MB (default) |
5 | 5 | |
6 | 6 | INCPATH = ../../z_tools/win32/ |
@@ -1,5 +1,7 @@ | ||
1 | -config: | |
1 | +default: | |
2 | 2 | make -C mkorbfs |
3 | + make -C orbspace | |
3 | 4 | |
4 | 5 | clean: |
5 | - make -C mkorbfs clean | |
\ No newline at end of file | ||
6 | + make -C mkorbfs clean | |
7 | + make -C orbspace clean |
@@ -0,0 +1 @@ | ||
1 | +#include "io.h" |
@@ -0,0 +1 @@ | ||
1 | +..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 | |
\ No newline at end of file |
@@ -0,0 +1,12 @@ | ||
1 | +TOOLPATH = ../../z_tools/ | |
2 | +NASK = $(TOOLPATH)nask.exe | |
3 | + | |
4 | +default: | |
5 | + make ipl.bin | |
6 | + | |
7 | +ipl.bin: ipl.nas Makefile | |
8 | + $(NASK) ipl.nas ipl.bin ipl.lst | |
9 | + | |
10 | +clean: | |
11 | + del *.obj | |
12 | + del *.map |