diff --git a/modflash/AddItem.c b/modflash/AddItem.c deleted file mode 100644 index ebdb41d..0000000 --- a/modflash/AddItem.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include - -FILE *fi, *fo; -int i; -unsigned char mem[0x4004], core; -unsigned short j, k; - -int main(int argc, char *argv[]) { - if( argc==1 ) - printf("\n" - "AddItem v0.02, simulates Machine and ROM addition to the ZX-Uno flash image\n\n" - " AddItem \n\n" - " ROM or COREX, when 2<=X<=45, i.e. CORE5\n" - " Input .TAP file generate with GenRom\n" - " Number of slot from 0 to 63, only when type is ROM\n\n" - "All modifications occur in the file FLASH.ZX1\n\n"), - exit(0); - fo= fopen("FLASH.ZX1", "rb+"); - if( strstr(argv[1], "CORE")==argv[1] && strlen(argv[1])<=6 && strlen(argv[1])>=5 && argc==3 ){ - core= (strlen(argv[1])==5 ? argv[1][4] : (argv[1][4]-'0')*10+argv[1][5])-'2'; - if( core>43 ) - printf("\nCore number out of range: %d\n", core+2), - exit(-1); - fi= fopen(argv[2], "rb"); - if( !fi ) - printf("\nInput file not found: %s\n", argv[2]), - exit(-1); - fread(mem, 1, 0x58, fi); - fseek(fo, 0x7100+(core<<5), SEEK_SET); - fwrite(mem+0x34, 1, 0x20, fo); - j= mem[3]; - fseek(fo, (core>7?0x160000:0xac000)+core*0x54000, SEEK_SET); - for ( i=0; i. + * + * SPDX-FileCopyrightText: Copyright (C) 2019, 2021 Antonio Villena + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include +#include +#include + +#define PROGRAM "AddItem" +#define DESCRIPTION "simulates Machine and ROM addition to the ZX-Uno flash image." +#define VERSION "0.02" +#define COPYRIGHT "Copyright (C) 2019, 2021 Antonio Villena" +#define LICENSE \ +"This program is free software: you can redistribute it and/or modify\n" \ +"it under the terms of the GNU General Public License as published by\n" \ +"the Free Software Foundation, version 3." +#define HOMEPAGE "https://github.com/zxdos/zxuno/" + +#define OUTPUT_FILE "FLASH.ZX1" + +FILE *fi, *fo; +int i; +unsigned char mem[0x4004], core; +unsigned short j, k; + +void show_help() { + printf( + PROGRAM " version " VERSION " - " DESCRIPTION "\n" + COPYRIGHT "\n" + LICENSE "\n" + "Home page: " HOMEPAGE "\n" + "\n" + "Usage:\n" + " " PROGRAM " \n" + "\n" + " ROM or COREX, where 2<=X<=45, i.e. CORE5\n" + " Input .TAP file generated with GenRom\n" + " Slot's number from 0 to 63, only when type is ROM\n" + "\n" + "All modifications occur in the file `" OUTPUT_FILE "'.\n" + ); +} + +int main(int argc, char *argv[]) { + if( argc==1 ) + show_help(), + exit(0); + fo= fopen(OUTPUT_FILE, "rb+"); + if( strstr(argv[1], "CORE")==argv[1] && strlen(argv[1])<=6 && strlen(argv[1])>=5 && argc==3 ){ + core= (strlen(argv[1])==5 ? argv[1][4] : (argv[1][4]-'0')*10+argv[1][5])-'2'; + if( core>43 ) + printf("\nCore number out of range: %d\n", core+2), + exit(-1); + fi= fopen(argv[2], "rb"); + if( !fi ) + printf("\nInput file not found: %s\n", argv[2]), + exit(-1); + fread(mem, 1, 0x58, fi); + fseek(fo, 0x7100+(core<<5), SEEK_SET); + fwrite(mem+0x34, 1, 0x20, fo); + j= mem[3]; + fseek(fo, (core>7?0x160000:0xac000)+core*0x54000, SEEK_SET); + for ( i=0; i