#include "compiler.h"
#include "dosio.h"
#include "fddfile.h"
#include "newdisk.h"
static const BYTE hdddiskboot[] = {
0xb8,0x00,0x10,0xbb,0x00,0x80,0x8e,0xd0,0x8b,0xe3,0x8c,0xc8,
0x8e,0xd8,0xb8,0x00,0xa0,0x8e,0xc0,0xb9,0x00,0x10,0xb8,0x20,
0x00,0x33,0xff,0xfc,0xf3,0xab,0xb0,0xe1,0xb9,0xe0,0x1f,0xaa,
0x47,0xe2,0xfc,0xbe,0x44,0x00,0x33,0xff,0xe8,0x08,0x00,0xbf,
0xa0,0x00,0xe8,0x02,0x00,0xeb,0xfe,0x2e,0xad,0x85,0xc0,0x74,
0x06,0xab,0x83,0xc7,0x02,0xeb,0xf4,0xc3,0x04,0x33,0x04,0x4e,
0x05,0x4f,0x01,0x3c,0x05,0x49,0x05,0x47,0x05,0x23,0x05,0x39,
0x05,0x2f,0x05,0x24,0x05,0x61,0x01,0x3c,0x05,0x38,0x04,0x4f,
0x05,0x55,0x05,0x29,0x01,0x3c,0x05,0x5e,0x05,0x43,0x05,0x48,
0x04,0x35,0x04,0x6c,0x04,0x46,0x04,0x24,0x04,0x5e,0x04,0x3b,
0x04,0x73,0x01,0x25,0x00,0x00,0x05,0x47,0x05,0x23,0x05,0x39,
0x05,0x2f,0x05,0x24,0x05,0x61,0x01,0x3c,0x05,0x38,0x04,0x72,
0x21,0x5e,0x26,0x7e,0x18,0x65,0x01,0x24,0x05,0x6a,0x05,0x3b,
0x05,0x43,0x05,0x48,0x04,0x37,0x04,0x46,0x12,0x3c,0x04,0x35,
0x04,0x24,0x01,0x25,0x00,0x00};
void newdisk_hdd(const char *fname, UINT hddsize) {
FILEH fh;
BYTE work[256];
UINT size;
UINT wsize;
if ((fname == NULL) || (hddsize < 5) || (hddsize > 256)) {
return;
}
fh = file_create(fname);
if (fh != FILEH_INVALID) {
ZeroMemory(work, 256);
size = hddsize * 15;
STOREINTELWORD(work, size);
file_write(fh, work, 256);
file_write(fh, hdddiskboot, sizeof(hdddiskboot));
ZeroMemory(work, sizeof(work));
size = 0x400 - sizeof(hdddiskboot);
while(size) {
wsize = min(size, sizeof(work));
size -= wsize;
file_write(fh, work, wsize);
}
file_close(fh);
}
}
void newdisk_fdd(const char *fname, BYTE type, const char *label) {
_D88HEAD d88head;
FILEH fh;
ZeroMemory(&d88head, sizeof(d88head));
STOREINTELDWORD(d88head.fd_size, sizeof(d88head));
milstr_ncpy((char *)d88head.fd_name, label, sizeof(d88head.fd_name));
d88head.fd_type = type;
fh = file_create(fname);
if (fh != FILEH_INVALID) {
file_write(fh, &d88head, sizeof(d88head));
file_close(fh);
}
}
RetroPC.NET-CVS <cvs@retropc.net>