Not useful here

This commit is contained in:
shagr4th 2016-12-18 14:19:42 +01:00
parent c6dad6bfcf
commit 993974932f
3 changed files with 0 additions and 500 deletions

View file

@ -1,144 +0,0 @@
/*
* This file is part of x48, an emulator of the HP-48sx Calculator.
* Copyright (C) 1994 Eddie C. Dost (ecd@dressler.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Log: checkrom.c,v $
* Revision 1.4 1995/01/11 18:20:01 ecd
* major update to support HP48 G/GX
*
* Revision 1.3 1994/11/02 14:40:38 ecd
* support for "compressed" rom files added
*
* Revision 1.3 1994/11/02 14:40:38 ecd
* support for "compressed" rom files added
*
* Revision 1.2 1994/10/06 16:30:05 ecd
* changed char to unsigned
*
* Revision 1.1 1994/10/01 10:12:53 ecd
* Initial revision
*
*
* $Id: checkrom.c,v 1.4 1995/01/11 18:20:01 ecd Exp ecd $
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include "global.h"
#include "romio.h"
unsigned char *rom;
unsigned short rom_crc, crc;
int verbose = 0;
char *progname;
#define calc_crc(n) (crc = ((crc >> 4) ^ (((crc ^ n) & 0xf) * 0x1081)))
int
#ifdef __FunctionProto__
main(int argc, char **argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{
unsigned char version[7];
long ver_addr;
int i, a, c, d, d0, d1, D0, D1;
int fail;
if (argc < 2) {
LOGE( "usage: %s rom-file\n", argv[0]);
exit (1);
}
if (!read_rom_file(argv[1], &rom, &rom_size))
{
LOGE( "%s: can\'t read ROM from %s\n", argv[0], argv[1]);
exit (1);
}
if (opt_gx != 0)
ver_addr = 0x7ffbf;
else
ver_addr = 0x7fff0;
for (i = 0; i < 6; i++) {
version[i] = rom[ver_addr + 2 * i + 1] << 4;
version[i] |= rom[ver_addr + 2 * i];
}
version[6] = '\0';
printf("ROM Version is %s\n", version);
for (i = 0x100; i < 0x140; i++) {
rom[i] = 0x0;
}
fail = a = 0;
D0 = 0x00000;
D1 = 0x40000;
for (d = 1; d <= rom_size / 0x80000; d++) {
crc = 0x0000;
rom_crc = 0;
for (i = 0; i < 4; i++) {
rom_crc <<= 4;
rom_crc |= (rom[0x80000 * d - i - 1] & 0x0f);
}
if (opt_gx)
printf("ROM CRC %d reads 0x%.4x\n", d, rom_crc);
else
printf("ROM CRC reads 0x%.4x\n", rom_crc);
d0 = D0;
d1 = D1;
for (c = 0x3fff; c >= 0x0000; c--) {
for (i = 0; i < 16; i++) {
calc_crc(rom[d0 + i]);
}
d0 += 16;
for (i = 0; i < 16; i++) {
calc_crc(rom[d1 + i]);
}
d1 += 16;
}
D0 += 0x80000;
D1 += 0x80000;
a = crc;
a = ((a | 0xf0000) + 1) & 0xfffff;
if (a != 0x00000) {
fail++;
}
}
if (fail != 0)
printf("IROM %.4x: ROM CRC test FAILED !!!\n", a & 0xffff);
else
printf("IROM OK: ROM CRC test passed.\n");
return 0;
}

View file

@ -1,226 +0,0 @@
/*
* This file is part of x48, an emulator of the HP-48sx Calculator.
* Copyright (C) 1994 Eddie C. Dost (ecd@dressler.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Log: dump2rom.c,v $
* Revision 1.7 1995/01/11 18:20:01 ecd
* major update to support HP48 G/GX
*
* Revision 1.6 1994/12/07 20:20:50 ecd
* minor changes
*
* Revision 1.6 1994/12/07 20:20:50 ecd
* minor changes
*
* Revision 1.5 1994/11/28 02:00:51 ecd
* improved trapping of EOF
*
* Revision 1.4 1994/11/02 14:40:38 ecd
* support for "compressed" rom files added
*
* Revision 1.3 1994/09/18 15:29:22 ecd
* turned off unused rcsid message
*
* Revision 1.2 1994/09/13 16:57:00 ecd
* changed to plain X11
*
* Revision 1.1 1994/09/07 12:57:36 ecd
* Initial revision
*
* $Id: dump2rom.c,v 1.7 1995/01/11 18:20:01 ecd Exp ecd $
*/
#include "global.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef SUNOS
#include <memory.h>
#endif
#include <fcntl.h>
unsigned char *core;
#define DEFAULT_ROM_FILE "rom.dump"
int
#ifdef __FunctionProto__
write_mem_file(char *name, unsigned char *mem, int size)
#else
write_mem_file(name, mem, size)
char *name;
unsigned char *mem;
int size;
#endif
{
FILE *fp;
unsigned char *tmp_mem;
unsigned char byte;
int i, j;
if (NULL == (fp = fopen(name, "w")))
{
LOGE( "can\'t open %s\n", name);
return 0;
}
if (NULL == (tmp_mem = (unsigned char *)malloc((size_t)size / 2)))
{
for (i = 0, j = 0; i < size / 2; i++)
{
byte = (mem[j++] & 0x0f);
byte |= (mem[j++] << 4) & 0xf0;
if (1 != fwrite(&byte, 1, 1, fp))
{
LOGE( "can\'t write %s\n", name);
fclose(fp);
return 0;
}
}
}
else
{
for (i = 0, j = 0; i < size / 2; i++)
{
tmp_mem[i] = (mem[j++] & 0x0f);
tmp_mem[i] |= (mem[j++] << 4) & 0xf0;
}
if (fwrite(tmp_mem, 1, (size_t)size / 2, fp) != size / 2)
{
LOGE( "can\'t write %s\n", name);
fclose(fp);
free(tmp_mem);
return 0;
}
free(tmp_mem);
}
fclose(fp);
return 1;
}
int
#ifdef __FunctionProto__
main(int argc, char **argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{
FILE *dump;
long addr, size;
int ch, i, gx, error;
if (argc < 2) {
LOGE( "usage: %s hp48-dump-file\n", argv[0]);
exit (1);
}
if ((dump = fopen(argv[1], "r")) == NULL) {
LOGE( "%s: can\'t open %s\n", argv[0], argv[1]);
exit (1);
}
if ((core = (unsigned char *)malloc(0x100000)) == NULL) {
LOGE( "%s: can\'t malloc %d bytes\n", argv[0], 0x100000);
exit (1);
}
memset(core, 0, 0x100000);
gx = 0;
error = 0;
while (1) {
addr = 0;
for (i = 0; i < 5; i++) {
addr <<= 4;
if ((ch = fgetc(dump)) < 0) {
error = 1;
break;
}
if (ch >= '0' && ch <= '9') {
addr |= ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
addr |= ch - 'A' + 10;
} else {
LOGE( "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
error = 1;
break;
}
}
if (error)
break;
if (addr >= 0x80000)
gx = 1;
if ((ch = fgetc(dump)) < 0) {
LOGE( "%s: Unexpected EOF at %lx\n", argv[0], addr);
break;
}
if (ch != ':') {
LOGE( "%s: Illegal char %c, expected \':\' at %lx\n",
argv[0], ch, addr);
break;
}
for (i = 0; i < 16; i++) {
if ((ch = fgetc(dump)) < 0) {
LOGE( "%s: Unexpected EOF at %lx\n", argv[0], addr);
error = 1;
break;
}
if (ch >= '0' && ch <= '9') {
core[addr++] = ch - '0';
} else if (ch >= 'A' && ch <= 'F') {
core[addr++] = ch - 'A' + 10;
} else {
LOGE( "%s: Illegal char %c at %lx\n", argv[0], ch, addr);
error = 1;
break;
}
}
if (error)
break;
if ((ch = fgetc(dump)) < 0)
break;
if (ch != '\n') {
LOGE( "%s: Illegal char %c, expected \'\\n\' at %lx\n",
argv[0], ch, addr);
break;
}
}
if (!gx)
if (core[0x29] == 0x0)
gx = 1;
if (gx)
size = 0x100000;
else
size = 0x80000;
if (!write_mem_file(DEFAULT_ROM_FILE, core, size))
{
LOGE( "%s: can\'t write to %s\n", argv[0], DEFAULT_ROM_FILE);
exit (1);
}
exit (0);
}

View file

@ -1,130 +0,0 @@
/*
* This file is part of x48, an emulator of the HP-48sx Calculator.
* Copyright (C) 1994 Eddie C. Dost (ecd@dressler.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Log: mkcard.c,v $
* Revision 1.1 1995/01/11 18:11:25 ecd
* Initial revision
*
*
* $Id: mkcard.c,v 1.1 1995/01/11 18:11:25 ecd Exp ecd $
*/
#include "global.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef SUNOS
#include <memory.h>
#endif
#include <fcntl.h>
unsigned char *mem;
int
#ifdef __FunctionProto__
write_mem_file(char *name, unsigned char *mem, int size)
#else
write_mem_file(name, mem, size)
char *name;
unsigned char *mem;
int size;
#endif
{
FILE *fp;
if (NULL == (fp = fopen(name, "w")))
{
printf( "can\'t open %s\n", name);
return 0;
}
if (fwrite(mem, 1, (size_t)size, fp) != size)
{
printf( "can\'t write %s\n", name);
fclose(fp);
return 0;
}
fclose(fp);
return 1;
}
int
#ifdef __FunctionProto__
main(int argc, char **argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{
long size;
char *name;
char *asize;
unsigned char *core;
if (argc < 2)
{
printf( "usage: %s [32K | 128K | 1M | 2M | 4M] file-name\n",
argv[0]);
exit (1);
}
name = argv[2];
asize = argv[1];
if (!strcmp(asize, "32K"))
size = 0x8000;
else if (!strcmp(asize, "128K"))
size = 0x20000;
else if (!strcmp(asize, "256K"))
size = 0x40000;
else if (!strcmp(asize, "512K"))
size = 0x80000;
else if (!strcmp(asize, "1M"))
size = 0x100000;
else if (!strcmp(asize, "2M"))
size = 0x200000;
else if (!strcmp(asize, "4M"))
size = 0x400000;
else
{
printf(
"%s: size must be one of 32K, 128K, 256K, 512K, 1M, 2M, or 4M\n",
argv[0]);
exit (1);
}
if ((core = (unsigned char *)malloc(size)) == NULL) {
printf( "%s: can\'t malloc %ld bytes\n", argv[0], size);
exit (1);
}
memset(core, 0, size);
if (!write_mem_file(name, core, size))
{
printf( "%s: can\'t write to %s\n", argv[0], name);
exit (1);
}
exit (0);
}