Merge branch 'master' of https://github.com/psco/simh
This commit is contained in:
commit
febea943d1
3 changed files with 64 additions and 6 deletions
Binary file not shown.
|
@ -45,6 +45,7 @@
|
|||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#include "altairz80_defs.h"
|
||||
#include <assert.h>
|
||||
|
||||
/** Typedefs & Defines **************************************/
|
||||
#define HDSK_SECTOR_SIZE 256 /* size of sector */
|
||||
|
@ -60,6 +61,12 @@
|
|||
#define UNIT_V_DSK_WLK (UNIT_V_UF + 0) /* write locked */
|
||||
#define UNIT_DSK_WLK (1 << UNIT_V_DSK_WLK)
|
||||
|
||||
/* boot related */
|
||||
#define BOOTROM_SIZE_MHDSK 256
|
||||
#define MHDSK_BOOT_ADDRESS 0xfc00
|
||||
static t_stat mhdsk_boot(int32 unitno, DEVICE *dptr);
|
||||
extern t_stat install_bootrom(int32 bootrom[], int32 size, int32 addr, int32 makeROM);
|
||||
|
||||
// Disk controller commands are in upper nibble of command high byte.
|
||||
|
||||
#define CMD_SHIFT 4 // shift right 4 places
|
||||
|
@ -155,11 +162,53 @@ DEVICE mhdsk_dev = {
|
|||
"MHDSK", dsk_unit, NULL, dsk_mod,
|
||||
HDSK_NUMBER, 10, 31, 1, 8, 8,
|
||||
NULL, NULL, &dsk_reset,
|
||||
NULL, NULL, NULL,
|
||||
&mhdsk_boot, NULL, NULL,
|
||||
NULL, (DEV_DISABLE | DEV_DEBUG), 0,
|
||||
NULL, NULL, "MITS Hard Disk MHDSK"
|
||||
};
|
||||
|
||||
static int32 bootrom_mhdsk[BOOTROM_SIZE_MHDSK] = {
|
||||
0xf3, 0x31, 0x00, 0xf8, 0x21, 0x1b, 0x41, 0x2b, /* fc00-fc07 */
|
||||
0x7c, 0xb5, 0xc2, 0x07, 0xfc, 0xe5, 0xd3, 0xa0, /* fc08-fc0f */
|
||||
0xd3, 0xa2, 0xd3, 0xa4, 0xd3, 0xa6, 0xd3, 0xa1, /* fc10-fc17 */
|
||||
0xd3, 0xa5, 0x2f, 0xd3, 0xa3, 0xd3, 0xa7, 0x3e, /* fc18-fc1f */
|
||||
0x2c, 0xd3, 0xa0, 0xd3, 0xa4, 0xd3, 0xa6, 0x3e, /* fc20-fc27 */
|
||||
0x24, 0xd3, 0xa2, 0xdb, 0xa1, 0x3e, 0x03, 0xd3, /* fc28-fc2f */
|
||||
0x10, 0x3e, 0x11, 0xd3, 0x10, 0xcd, 0xe5, 0xfc, /* fc30-fc37 */
|
||||
0x0d, 0x0a, 0x48, 0x44, 0x42, 0x4c, 0x20, 0x31, /* fc38-fc3f */
|
||||
0x2e, 0x30, 0xb1, 0xcd, 0x77, 0xfc, 0x11, 0x2c, /* fc40-fc47 */
|
||||
0x00, 0x7a, 0xbb, 0xdb, 0xa5, 0xd2, 0x54, 0xfc, /* fc48-fc4f */
|
||||
0x6c, 0x61, 0x48, 0x47, 0x14, 0xc2, 0x49, 0xfc, /* fc50-fc57 */
|
||||
0xcd, 0xe5, 0xfc, 0x0d, 0x0a, 0x4c, 0x4f, 0x41, /* fc58-fc5f */
|
||||
0x44, 0x49, 0x4e, 0xc7, 0xd1, 0xd5, 0xcd, 0x77, /* fc60-fc67 */
|
||||
0xfc, 0xdb, 0xa5, 0x12, 0x13, 0x05, 0xc2, 0x69, /* fc68-fc6f */
|
||||
0xfc, 0x23, 0x0d, 0xc2, 0x66, 0xfc, 0xc9, 0xe5, /* fc70-fc77 */
|
||||
0xd5, 0xc5, 0x01, 0xd0, 0xff, 0x11, 0xff, 0xff, /* fc78-fc7f */
|
||||
0x13, 0x09, 0xda, 0x80, 0xfc, 0x7d, 0xc6, 0x30, /* fc80-fc87 */
|
||||
0xeb, 0xfe, 0x18, 0xda, 0x90, 0xfc, 0xc6, 0x08, /* fc88-fc8f */
|
||||
0x47, 0xcd, 0xaf, 0xfc, 0x26, 0x30, 0xdb, 0xff, /* fc90-fc97 */
|
||||
0xe6, 0x03, 0x0f, 0x0f, 0xb0, 0xcd, 0xb0, 0xfc, /* fc98-fc9f */
|
||||
0xdb, 0xa5, 0xdb, 0xa3, 0xaf, 0xd3, 0xa7, 0x3e, /* fca0-fca7 */
|
||||
0x50, 0xd3, 0xa3, 0xc1, 0xd1, 0xe1, 0xc9, 0x7d, /* fca8-fcaf */
|
||||
0xd3, 0xa7, 0xdb, 0xa1, 0xdb, 0xa3, 0xdb, 0xff, /* fcb0-fcb7 */
|
||||
0xe6, 0x00, 0xb4, 0xd3, 0xa3, 0xdb, 0xa0, 0x07, /* fcb8-fcbf */
|
||||
0xd2, 0xbd, 0xfc, 0xdb, 0xa1, 0xe6, 0x7f, 0xc8, /* fcc0-fcc7 */
|
||||
0xfb, 0xf5, 0xcd, 0xe5, 0xfc, 0x0d, 0x0a, 0x4c, /* fcc8-fccf */
|
||||
0x4f, 0x41, 0x44, 0x20, 0x45, 0x52, 0x52, 0x4f, /* fcd0-fcd7 */
|
||||
0x52, 0xba, 0x21, 0x00, 0xfd, 0x34, 0xca, 0xde, /* fcd8-fcdf */
|
||||
0xfc, 0xe3, 0xc3, 0xcf, 0xfd, 0xe3, 0xdb, 0x10, /* fce0-fce7 */
|
||||
0xe6, 0x02, 0xca, 0xe6, 0xfc, 0x7e, 0xe6, 0x7f, /* fce8-fcef */
|
||||
0xd3, 0x11, 0xbe, 0x23, 0xca, 0xe6, 0xfc, 0xe3, /* fcf0-fcf7 */
|
||||
0xc9, 0x70, 0x4a, 0x01, 0x00, 0xd4, 0xb4, 0x13, /* fcf8-fcff */
|
||||
};
|
||||
|
||||
static t_stat mhdsk_boot(int32 unitno, DEVICE *dptr) {
|
||||
const t_bool installSuccessful = (install_bootrom(bootrom_mhdsk, BOOTROM_SIZE_MHDSK,
|
||||
MHDSK_BOOT_ADDRESS, FALSE) == SCPE_OK);
|
||||
assert(installSuccessful);
|
||||
*((int32 *) sim_PC -> loc) = MHDSK_BOOT_ADDRESS;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -363,6 +363,15 @@ void prepareInstructionMessage(const t_addr loc, const uint32 op) {
|
|||
(chiptype == CHIP_TYPE_Z80 ? MnemonicsZ80[op & 0xff] : "???"), loc);
|
||||
}
|
||||
|
||||
/* Ensure that hex number starts with a digit when printed */
|
||||
static void printHex2(char* string, const uint32 value) {
|
||||
sprintf(string, (value <= 0x9f ? "%02X" : "%03X"), value);
|
||||
}
|
||||
|
||||
static void printHex4(char* string, const uint32 value) {
|
||||
sprintf(string, (value <= 0x9fff ? "%04X" : "%05X"), value);
|
||||
}
|
||||
|
||||
/* Symbolic disassembler
|
||||
|
||||
Inputs:
|
||||
|
@ -419,7 +428,7 @@ static int32 DAsm(char *S, const uint32 *val, const int32 useZ80Mnemonics, const
|
|||
if ( (P = strchr(T, '^')) ) {
|
||||
strncpy(R, T, P - T);
|
||||
R[P - T] = '\0';
|
||||
sprintf(H, "%02X", val[B++]);
|
||||
printHex2(H, val[B++]);
|
||||
strcat(R, H);
|
||||
strcat(R, P + 1);
|
||||
}
|
||||
|
@ -434,7 +443,7 @@ static int32 DAsm(char *S, const uint32 *val, const int32 useZ80Mnemonics, const
|
|||
if ( (P = strchr(R, '*')) ) {
|
||||
strncpy(S, R, P - R);
|
||||
S[P - R] = '\0';
|
||||
sprintf(H, "%02X", val[B++]);
|
||||
printHex2(H, val[B++]);
|
||||
strcat(S, H);
|
||||
strcat(S, P + 1);
|
||||
}
|
||||
|
@ -445,7 +454,7 @@ static int32 DAsm(char *S, const uint32 *val, const int32 useZ80Mnemonics, const
|
|||
Offset = val[B++];
|
||||
strcat(S, Offset & 0x80 ? "-" : "+");
|
||||
J = Offset & 0x80 ? 256 - Offset : Offset;
|
||||
sprintf(H, "%02X", J);
|
||||
printHex2(H, J);
|
||||
strcat(S, H);
|
||||
strcat(S, P + 1);
|
||||
}
|
||||
|
@ -453,14 +462,14 @@ static int32 DAsm(char *S, const uint32 *val, const int32 useZ80Mnemonics, const
|
|||
strncpy(S, R, P - R);
|
||||
S[P - R] = '\0';
|
||||
Offset = val[B++];
|
||||
sprintf(H, "%04X", (addr + 2 + (Offset & 0x80 ? (Offset - 256) : Offset)) & 0xFFFF);
|
||||
printHex4(H, (addr + 2 + (Offset & 0x80 ? (Offset - 256) : Offset)) & 0xFFFF);
|
||||
strcat(S, H);
|
||||
strcat(S, P + 1);
|
||||
}
|
||||
else if ( (P = strchr(R, '#')) ) {
|
||||
strncpy(S, R, P - R);
|
||||
S[P - R] = '\0';
|
||||
sprintf(H, "%04X", val[B] + 256 * val[B + 1]);
|
||||
printHex4(H, val[B] + 256 * val[B + 1]);
|
||||
strcat(S, H);
|
||||
strcat(S, P + 1);
|
||||
B += 2;
|
||||
|
|
Loading…
Add table
Reference in a new issue