diff --git a/sim_BuildROMs.c b/sim_BuildROMs.c index e92c67c7..5c571cb0 100644 --- a/sim_BuildROMs.c +++ b/sim_BuildROMs.c @@ -69,7 +69,7 @@ struct ROM_File_Descriptor { {"PDP11/lunar11/lunar.lda", "PDP11/pdp11_vt_lunar_rom.h", 13824, 0xFFF15D00, "lunar_lda"}, {"PDP11/dazzledart/dazzle.lda", "PDP11/pdp11_dazzle_dart_rom.h", 6096, 0xFFF83848, "dazzle_lda"}, {"PDP11/11logo/11logo.lda", "PDP11/pdp11_11logo_rom.h", 26009, 0xFFDD77F7, "logo_lda"}, - {"swtp6800/swtp6800/swtbug.bin", "swtp6800/swtp6800/swtp_swtbug_bin.h", 1024, 0xFFFE4FBC, "swtp_swtbug_bin"}, + {"swtp6800/swtp6800/swtbugv10.bin", "swtp6800/swtp6800/swtp_swtbugv10_bin.h", 1024, 0xFFFE4FBC, "swtp_swtbugv10_bin"}, {"3B2/rom_rev2.bin", "3B2/rom_rev2_bin.h", 32768, 0xFFD55762, "rom_rev2_bin"}, {"3B2/rom_rev2_demon.bin", "3B2/rom_rev2_demon_bin.h", 65536, 0xFFB345BB, "rom_rev2_demon_bin"}, {"3B2/rom_rev3.bin", "3B2/rom_rev3_bin.h", 131072, 0xFFDC0EB8, "rom_rev3_bin"}, diff --git a/swtp6800/common/bootrom.c b/swtp6800/common/bootrom.c index 77f97d91..65fe4c50 100644 --- a/swtp6800/common/bootrom.c +++ b/swtp6800/common/bootrom.c @@ -25,8 +25,6 @@ MODIFICATIONS: - 23 Apr 15 -- Modified to use simh_debug - NOTES: These functions support a single simulated 2704 to 2764 EPROM device on @@ -51,7 +49,7 @@ #if !defined(DONT_USE_INTERNAL_ROM) -#include "swtp_swtbug_bin.h" +#include "swtp_swtbugv10_bin.h" #endif /* DONT_USE_INTERNAL_ROM */ #define UNIT_V_MSIZE (UNIT_V_UF) /* ROM Size */ @@ -65,11 +63,11 @@ /* function prototypes */ -t_stat BOOTROM_svc (UNIT *uptr); -t_stat BOOTROM_config (UNIT *uptr, int32 val, CONST char *cptr, void *desc); -t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr); -t_stat BOOTROM_reset (DEVICE *dptr); -int32 BOOTROM_get_mbyte(int32 offset); +t_stat BOOTROM_svc (UNIT *uptr); +t_stat BOOTROM_config (UNIT *uptr, int32 val, CONST char *cptr, void *desc); +t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr); +t_stat BOOTROM_reset (DEVICE *dptr); +int32 BOOTROM_get_mbyte(int32 offset); /* SIMH Standard I/O Data Structures */ @@ -124,8 +122,6 @@ DEVICE BOOTROM_dev = { NULL /* lname */ }; -/* global variables */ - /* BOOTROM_attach - attach file to EPROM unit */ t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr) @@ -135,9 +131,7 @@ t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr) t_addr capac; int i; - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_attach: cptr=%s\n", cptr); if ((r = attach_unit (uptr, cptr)) != SCPE_OK) { - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_attach: Error\n"); return sim_messagef (r, "BOOTROM_attach: Failure\n"); } image_size = (t_addr)sim_fsize_ex (BOOTROM_unit.fileref); @@ -152,7 +146,6 @@ t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr) } uptr->flags &= ~UNIT_MSIZE; uptr->flags |= (i << UNIT_V_MSIZE); - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_attach: Done\n"); return (BOOTROM_reset (NULL)); } @@ -160,9 +153,7 @@ t_stat BOOTROM_attach (UNIT *uptr, CONST char *cptr) t_stat BOOTROM_config (UNIT *uptr, int32 val, CONST char *cptr, void *desc) { - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_config: val=%d\n", val); if ((val < UNIT_NONE) || (val > UNIT_2764)) { /* valid param? */ - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_config: Parameter error\n"); return SCPE_ARG; } if (val == UNIT_NONE) @@ -173,9 +164,6 @@ t_stat BOOTROM_config (UNIT *uptr, int32 val, CONST char *cptr, void *desc) free (BOOTROM_unit.filebuf); BOOTROM_unit.filebuf = NULL; } - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_config: BOOTROM_unit.capac=%d\n", - BOOTROM_unit.capac); - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_config: Done\n"); return SCPE_OK; } @@ -187,21 +175,13 @@ t_stat BOOTROM_reset (DEVICE *dptr) int c; FILE *fp; - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_reset: \n"); if ((BOOTROM_unit.flags & UNIT_MSIZE) == 0) { /* if none selected */ -// printf(" EPROM: Defaulted to None\n"); -// printf(" \"set eprom NONE | 2704 | 2708 | 2716 | 2732 | 2764\"\n"); -// printf(" \"att eprom \"\n"); BOOTROM_unit.capac = 0; /* set EPROM size to 0 */ - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_reset: Done1\n"); return SCPE_OK; } /* if attached */ -// printf(" EPROM: Initializing [%04X-%04XH]\n", -// 0xE000, 0xE000 + BOOTROM_unit.capac - 1); if (BOOTROM_unit.filebuf == NULL) { /* no buffer allocated */ BOOTROM_unit.filebuf = calloc(1, BOOTROM_unit.capac); /* allocate EPROM buffer */ if (BOOTROM_unit.filebuf == NULL) { - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_reset: Malloc error\n"); return SCPE_MEM; } } @@ -215,23 +195,22 @@ t_stat BOOTROM_reset (DEVICE *dptr) #endif fp = fopen(BOOTROM_unit.filename, "rb"); /* open EPROM file */ if (fp == NULL) { - printf("\tUnable to open ROM file %s\n",BOOTROM_unit.filename); - printf("\tNo ROM image loaded!!!\n"); + printf("Bootrom: Unable to open ROM file %s\n",BOOTROM_unit.filename); + printf("Bootrom: No ROM image loaded!!!\n"); return SCPE_OK; } j = 0; /* load EPROM file */ c = fgetc(fp); while (c != EOF) { - *((uint8 *)(BOOTROM_unit.filebuf) + j++) = c & 0xFF; + *((uint8 *)(BOOTROM_unit.filebuf) + j++) = c & BYTEMASK; c = fgetc(fp); if (j > BOOTROM_unit.capac) { - printf("\tImage is too large - Load truncated!!!\n"); + printf("Bootrom: Image is too large - Load truncated!!!\n"); break; } } fclose(fp); -// printf("\t%d bytes of ROM image %s loaded\n", j, BOOTROM_unit.filename); - sim_debug (DEBUG_flow, &BOOTROM_dev, "BOOTROM_reset: Done2\n"); + printf("%d bytes of ROM image %s loaded\n", j, BOOTROM_unit.filename); return SCPE_OK; } @@ -242,16 +221,12 @@ int32 BOOTROM_get_mbyte(int32 offset) int32 val; if (BOOTROM_unit.filebuf == NULL) { - sim_debug (DEBUG_read, &BOOTROM_dev, "BOOTROM_get_mbyte: EPROM not configured\n"); return 0xFF; } - sim_debug (DEBUG_read, &BOOTROM_dev, "BOOTROM_get_mbyte: offset=%04X\n", offset); if ((t_addr)offset > BOOTROM_unit.capac) { - sim_debug (DEBUG_read, &BOOTROM_dev, "BOOTROM_get_mbyte: EPROM reference beyond ROM size\n"); return 0xFF; } - val = *((uint8 *)(BOOTROM_unit.filebuf) + offset) & 0xFF; - sim_debug (DEBUG_read, &BOOTROM_dev, "BOOTROM_get_mbyte: Normal val=%02X\n", val); + val = *((uint8 *)(BOOTROM_unit.filebuf) + offset) & BYTEMASK; return val; } diff --git a/swtp6800/swtp6800/swtbug.bin b/swtp6800/swtp6800/swtbugv10.bin similarity index 100% rename from swtp6800/swtp6800/swtbug.bin rename to swtp6800/swtp6800/swtbugv10.bin diff --git a/swtp6800/swtp6800/swtp_defs.h b/swtp6800/swtp6800/swtp_defs.h index 4c5c70c5..ae8f503f 100644 --- a/swtp6800/swtp6800/swtp_defs.h +++ b/swtp6800/swtp6800/swtp_defs.h @@ -31,11 +31,14 @@ Copyright (c) 2005-2012, William Beech #define PC PC_Global +//#define DONT_USE_INTERNAL_ROM 1 + /* Memory */ #define MAXMEMSIZE 65536 // max memory size #define MEMSIZE (m6800_unit.capac) // actual memory size #define ADDRMASK (MAXMEMSIZE - 1) // address mask +#define BYTEMASK 0xff #define MEM_ADDR_OK(x) (((uint32) (x)) < MEMSIZE) /* debug definitions */ @@ -43,6 +46,8 @@ Copyright (c) 2005-2012, William Beech #define DEBUG_flow 0x0001 #define DEBUG_read 0x0002 #define DEBUG_write 0x0004 +#define DEBUG_reg 0x0008 +#define DEBUG_asm 0x0010 #define DEBUG_all 0xFFFF /* Simulator stop codes */ diff --git a/swtp6800/swtp6800/swtp_swtbug_bin.h b/swtp6800/swtp6800/swtp_swtbugv10_bin.h similarity index 86% rename from swtp6800/swtp6800/swtp_swtbug_bin.h rename to swtp6800/swtp6800/swtp_swtbugv10_bin.h index 07cad98b..920ec832 100644 --- a/swtp6800/swtp6800/swtp_swtbug_bin.h +++ b/swtp6800/swtp6800/swtp_swtbugv10_bin.h @@ -1,35 +1,35 @@ -#ifndef ROM_swtp_swtbug_bin_H -#define ROM_swtp_swtbug_bin_H 0 +#ifndef ROM_swtp_swtbugv10_bin_H +#define ROM_swtp_swtbugv10_bin_H 0 /* - swtp6800/swtp6800/swtp_swtbug_bin.h produced at Mon Aug 23 13:30:22 2021 - from swtp6800/swtp6800/swtbug.bin which was last modified at Mon Jul 26 08:03:32 2021 + swtp6800/swtp6800/swtp_swtbugv10_bin.h produced at Tue May 31 12:39:31 2022 + from swtp6800/swtp6800/swtbugv10.bin which was last modified at Sat Mar 12 06:28:24 2022 file size: 1024 (0x400) - checksum: 0xFFFE4FBC This file is a generated file and should NOT be edited or changed by hand. */ #undef BOOT_CODE_SIZE #define BOOT_CODE_SIZE 0x400 #undef BOOT_CODE_FILENAME -#define BOOT_CODE_FILENAME "swtbug.bin" +#define BOOT_CODE_FILENAME "swtbugv10.bin" #undef BOOT_CODE_ARRAY -#define BOOT_CODE_ARRAY swtp_swtbug_bin +#define BOOT_CODE_ARRAY swtp_swtbugv10_bin #if !defined(BOOT_CODE_SIZE_1) #define BOOT_CODE_SIZE_1 0x400 -#define BOOT_CODE_FILENAME_1 "swtbug.bin" -#define BOOT_CODE_ARRAY_1 swtp_swtbug_bin +#define BOOT_CODE_FILENAME_1 "swtbugv10.bin" +#define BOOT_CODE_ARRAY_1 swtp_swtbugv10_bin #elif !defined(BOOT_CODE_SIZE_2) #define BOOT_CODE_SIZE_2 0x400 -#define BOOT_CODE_FILENAME_2 "swtbug.bin" -#define BOOT_CODE_ARRAY_2 swtp_swtbug_bin +#define BOOT_CODE_FILENAME_2 "swtbugv10.bin" +#define BOOT_CODE_ARRAY_2 swtp_swtbugv10_bin #elif !defined(BOOT_CODE_SIZE_3) #define BOOT_CODE_SIZE_3 0x400 -#define BOOT_CODE_FILENAME_3 "swtbug.bin" -#define BOOT_CODE_ARRAY_3 swtp_swtbug_bin +#define BOOT_CODE_FILENAME_3 "swtbugv10.bin" +#define BOOT_CODE_ARRAY_3 swtp_swtbugv10_bin #elif !defined(BOOT_CODE_SIZE_4) #define BOOT_CODE_SIZE_4 0x400 -#define BOOT_CODE_FILENAME_4 "swtbug.bin" -#define BOOT_CODE_ARRAY_4 swtp_swtbug_bin +#define BOOT_CODE_FILENAME_4 "swtbugv10.bin" +#define BOOT_CODE_ARRAY_4 swtp_swtbugv10_bin #endif -unsigned char swtp_swtbug_bin[] = { +unsigned char swtp_swtbugv10_bin[] = { 0xFE,0xA0,0x00,0x6E,0x00,0x8D,0x40,0x6E,0x00,0x10,0x16,0x04,0xBD,0xE3,0x34,0x8D, 0x67,0x81,0x53,0x26,0xFA,0x8D,0x61,0x81,0x39,0x27,0x29,0x81,0x31,0x26,0xF0,0x7F, 0xA0,0x0F,0x8D,0x31,0x80,0x02,0xB7,0xA0,0x47,0x8D,0x1C,0x8D,0x28,0x7A,0xA0,0x47, @@ -94,4 +94,4 @@ unsigned char swtp_swtbug_bin[] = { 0xBF,0x47,0xE1,0xD0,0x5A,0xC0,0x00,0x4D,0xE0,0x88,0x46,0xE1,0xAE,0x52,0xE1,0x30, 0x4A,0xE0,0x05,0x43,0xE2,0xCC,0x44,0xE2,0x8F,0x42,0xE2,0xD9,0x4F,0xE2,0x69,0x50, 0xE3,0x1A,0x4C,0xE0,0x0C,0x45,0xE3,0x1E,0xE0,0x00,0xE1,0x8B,0xE1,0xA7,0xE0,0xD0,}; -#endif /* ROM_swtp_swtbug_bin_H */ +#endif /* ROM_swtp_swtbugv10_bin_H */