Updates as Floppy Drive control and GUI are developed

This commit is contained in:
Philip Smart
2022-01-23 14:12:32 +00:00
parent a352cc4b92
commit a98b4d35ce
12 changed files with 1629 additions and 194 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1005,19 +1005,18 @@ uint8_t OSDInit(enum WINDOWS window)
{
debugf("Freeing OSD display framebuffer:%08lx\n", osdWindow.display);
free(osdWindow.display);
}
// Allocate largest required block on the heap which will act as the OSD window framebuffer - this is necessary as updating the physical display is time consuming due to control overhead.
//
osdWindow.display = malloc(VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE);
if(osdWindow.display == NULL)
{
printf("Failed to allocate heap for the OSD display framebuffer, %d bytes\n", VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE);
result = 1;
} else
{
// Allocate largest required block on the heap which will act as the OSD window framebuffer - this is necessary as updating the physical display is time consuming due to control overhead.
//
osdWindow.display = malloc(VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE);
if(osdWindow.display == NULL)
{
printf("Failed to allocate heap for the OSD display framebuffer, %d bytes\n", VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE);
result = 1;
} else
{
debugf("OSD window framebuffer allocated: %dBytes@%08lx\n", VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE, osdWindow.display);
}
debugf("OSD window framebuffer allocated: %dBytes@%08lx\n", VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE > VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE ? VC_MENU_RGB_BITS * VC_MENU_BUFFER_SIZE : VC_STATUS_RGB_BITS * VC_STATUS_BUFFER_SIZE, osdWindow.display);
}
// Clear screen ready for use.

View File

@@ -1214,8 +1214,12 @@ uint8_t writeZ80Array(uint32_t addr, uint8_t *data, uint32_t size, enum TARGETS
// Loop through the array and write out the data to the next Z80 memory location.
for(uint32_t idx=0; idx < size; idx++, nxtAddr++, ptr++)
{
//printf("%08lx:%02x ", nxtAddr, *ptr);
//if(addr >= 0x300000 && addr < 0x300010)
// delay(1);
writeZ80Memory(nxtAddr, *ptr, target);
}
//printf("\n");
}
// Release the bus if it is not being held for further transations.
@@ -3416,9 +3420,9 @@ printf("CPUCONFIG=%02x\n", cpuConfig);
case CPUMODE_IS_EMU_MZ:
printf("Sharp MZ Series Emulation Active\n");
// Start the emulation.
EMZRun((uint8_t)(svcControl.cmd - TZSVC_CMD_EMU_SETMZ80K));
EMZRun();
break;
}
@@ -3471,6 +3475,7 @@ printf("CPUCONFIG=%02x\n", cpuConfig);
// For the Sharp MZ Series Emulations we just issue a soft reset so that the T80 starts processing the ROM contents.
else if(cpuConfig == CPUMODE_IS_EMU_MZ)
{
printf("Writing CPUCFG:%02x\n", cpuConfig | CPUMODE_CLK_EN | CPUMODE_RESET_CPU);
writeZ80IO(IO_TZ_CPUCFG, cpuConfig | CPUMODE_CLK_EN | CPUMODE_RESET_CPU, TRANZPUTER);
} else
{
@@ -5356,7 +5361,7 @@ void processServiceRequest(void)
case TZSVC_CMD_EMU_SETMZ2200:
case TZSVC_CMD_EMU_SETMZ2500:
// Initialise the emulation and OSD.
if(!EMZInit(z80Control.hostType))
if(!EMZInit(z80Control.hostType, (uint8_t)(svcControl.cmd - TZSVC_CMD_EMU_SETMZ80K)))
{
// Switch to the emulation CPU (T80).
writeZ80IO(IO_TZ_CPUCFG, CPUMODE_SET_EMU_MZ, TRANZPUTER);

View File

@@ -59,6 +59,10 @@
#define MAX_KEY_INS_BUFFER 64 // Maximum number of key sequences in a FIFO which can be inserted into the emulation keyboard.
#define MAX_INJEDIT_ROWS 4 // Maximum number of rows in the key injection editor.
#define MAX_INJEDIT_COLS 8 // Maximum number of columns in the key injection editor.
#define MAX_FB_LEN 0x4000 // Maximum size of a bank of pixels in the graphic framebuffer
#define MAX_TEXT_VRAM_LEN 0x800 // Maximum size of the text based character VRAM.
#define MAX_ATTR_VRAM_LEN 0x800 // Maximum size of the text based character attribute VRAM.
#define MAX_FLOPPY_DRIVES 4 // Maximum number of floppy drives supported.
// Keyboard key-injection constants.
#define KEY_INJEDIT_NIBBLES 8 // Number of nibbles in an injected key word.
@@ -85,6 +89,11 @@
#define MZ_EMU_CGROM_ADDR 0x220000 // VideoController CGROM address.
#define MZ_EMU_USER_ROM_ADDR 0x12E800 // Sharp MZ Series Emulation USER ROM address.
#define MZ_EMU_FDC_ROM_ADDR 0x12F000 // Sharp MZ Series Emulation FDC ROM address.
#define MZ_EMU_TEXT_VRAM_ADDR 0x21D000 // Base address for the text based VRAM.
#define MZ_EMU_ATTR_VRAM_ADDR 0x21D800 // Base address for the text based attributes VRAM.
#define MZ_EMU_RED_FB_ADDR 0x240000 // Base address for the pixel based frame buffer - Red.
#define MZ_EMU_BLUE_FB_ADDR 0x250000 // Base address for the pixel based frame buffer - Blue.
#define MZ_EMU_GREEN_FB_ADDR 0x260000 // Base address for the pixel based frame buffer - Green.
#define MZ_EMU_REG_BASE_ADDR 0x300000 // Base address, in the FPGA address domain, of the emulator registers.
#define MZ_EMU_REG_INTR_ADDR 0x300020 // Base address of the interrupt generator.
#define MZ_EMU_REG_SND_ADDR 0x300200 // Base address of the sound generator.
@@ -93,6 +102,93 @@
#define MZ_EMU_CMT_DATA_ADDR 0x350000 // Data RAM - 64KBytes. 0x350000:0x35FFFF
#define MZ_EMU_CMT_MAP_ADDR 0x360000 // ASCII MAP RAM - 512 bytes 0x360000:0x36FFFF
#define MZ_EMU_CMT_REG_ADDR 0x360200 // CMT Registers.
#define MZ_EMU_FDD_CACHE_ADDR 0x330000 // FDD Sector Cache.
#define MZ_EMU_FDC_CTRL_ADDR 0x330800 // WD1793 Controller Control/Status register.
#define MZ_EMU_FDC_TRACK_ADDR 0x330801 // WD1793 Controller Track number.
#define MZ_EMU_FDC_SECTOR_ADDR 0x330802 // WD1793 Controller Sector number.
#define MZ_EMU_FDC_DATA_ADDR 0x330803 // WD1793 Controller Data register.
#define MZ_EMU_FDC_LCMD_ADDR 0x330804 // WD1793 Last Command executed.
#define MZ_EMU_FDD_CTRL_ADDR 0x331000 // FDD IOP Control/Status register.
#define MZ_EMU_FDD_TRACK_ADDR 0x331001 // FDD Active track number.
#define MZ_EMU_FDD_SECTOR_ADDR 0x331002 // FDD Active sector number.
#define MZ_EMU_FDD_CST_ADDR 0x331003 // FDD Control/Status signals.
#define MZ_EMU_FDD_DISK_ADDR 0x331004 // FDD Disk Parameter Registers, 1 per disk 0..3
// Floppy controller and drive registers.
//
#define MZ_EMU_FDD_MAX_REGISTERS 8 // Number of registers in the floppy disk drive unit.
#define MZ_EMU_FDC_MAX_REGISTERS 5 // Number of registers in the WD1793 controller.
#define MZ_EMU_FDD_MAX_DISKS 4 // Number of disks supported by the FDD unit.
#define MZ_EMU_FDD_CTRL_REG 0x00 // IOP control/status register in the FDD.
#define MZ_EMU_FDD_TRACK_REG 0x01 // Active track in the WD1793 controller, IOP actions based on this track.
#define MZ_EMU_FDD_SECTOR_REG 0x02 // Active sector in the WD1793 controller, IOP actions based on this sector.
#define MZ_EMU_FDD_CST_REG 0x03 // Floppy Disk Control register, current status and signal settings within the controller.
#define MZ_EMU_FDD_DISK_REG 0x04 // Disk parameter registers to control layout, polarity, speed and write protection.
#define MZ_EMU_FDD_DISK_0_REG 0x04 // Disk parameter registers Disk 0
#define MZ_EMU_FDD_DISK_1_REG 0x05 // Disk parameter registers Disk 1
#define MZ_EMU_FDD_DISK_2_REG 0x06 // Disk parameter registers Disk 2
#define MZ_EMU_FDD_DISK_3_REG 0x07 // Disk parameter registers Disk 3
#define MZ_EMU_FDC_CTRL_REG 0x00 // WD1793 Controller Control/Status register.
#define MZ_EMU_FDC_TRACK_REG 0x01 // WD1793 Controller Track number.
#define MZ_EMU_FDC_SECTOR_REG 0x02 // WD1793 Controller Sector number.
#define MZ_EMU_FDC_DATA_REG 0x03 // WD1793 Controller Data register.
#define MZ_EMU_FDC_LCMD_REG 0x04 // WD1793 Last Command executed.
// Floppy Disk Control bits.
//
#define FDD_IOP_DISK_SELECT_NO 0xE0 // Floppy disk selected drive number.
#define FDD_IOP_SIDE 0x04 // IOP Control parameters: Disk side selected.
#define FDD_IOP_SECTOR_REQ 0x02 // IOP Control parameters: Sector request service flag/
#define FDD_IOP_SECTOR_DIR 0x01 // IOP Control parameters: Sector request direction, 0 = write, host has written into the cache, 1 = read, IOP needs to write the requested sector into cache.
#define FDD_DISK_BUSY 0x40 // Floppy disk BUSY signal state.
#define FDD_DISK_DRQ 0x20 // Floppy disk DRQ signal state.
#define FDD_DISK_MOTORON 0x10 // Floppy disk MOTOR signal state, 0 = on.
#define FDD_DISK_DDEN 0x10 // Floppy disk Double Density DDEN signal state, 0 = double density.
#define FDD_DISK_SELECT_NO 0x07 // Floppy disk selected drive number.
#define FDD_CTRL_READY 0x01 // Flag to indicate the I/O processor is ready. 1 = ready, 0 = busy.
#define FDD_CTRL_TYPE 0xF0 // Configuration of the controller for a given disk type.
#define FDD_DISK_0_WRITEN 0x02 // Write enable Disk 0
#define FDD_DISK_1_WRITEN 0x08 // Write enable Disk 1
#define FDD_DISK_2_WRITEN 0x20 // Write enable Disk 2
#define FDD_DISK_3_WRITEN 0x80 // Write enable Disk 3
#define FDD_DISK_0_POLARITY 0x01 // Disk data polarity. 1 = data inverted (standard), 0 = data normal.
#define FDD_DISK_1_POLARITY 0x04 // Disk data polarity.
#define FDD_DISK_2_POLARITY 0x10 // Disk data polarity.
#define FDD_DISK_3_POLARITY 0x40 // Disk data polarity.
#define FDC_STI_NOTRDY 0x80 // WD1793 Status I command - Not Ready
#define FDC_STI_PROTECTED 0x40 // WD1793 Status I command - Protected Disk
#define FDC_STI_HEADLOADED 0x20 // WD1793 Status I command - Head Loaded
#define FDC_STI_SEEKERROR 0x10 // WD1793 Status I command - Seek Error
#define FDC_STI_CRCERROR 0x08 // WD1793 Status I command - CRC Error
#define FDC_STI_TRACK0 0x04 // WD1793 Status I command - Track 0
#define FDC_STI_INDEX 0x02 // WD1793 Status I command - Index
#define FDC_STI_BUSY 0x01 // WD1793 Status I command - Busy
#define FDC_STII_NOTRDY 0x80 // WD1793 Status I command - Not Ready
#define FDC_STII_PROTECTED 0x40 // WD1793 Status I command - Protected Disk
#define FDC_STII_WRITEFAULT 0x20 // WD1793 Status I command - Write Fault
#define FDC_STII_RECORDFAULT 0x20 // WD1793 Status I command - Record Type
#define FDC_STII_RECORDNOTFOUND 0x10 // WD1793 Status I command - Record Not Found
#define FDC_STII_CRCERROR 0x08 // WD1793 Status I command - CRC Error
#define FDC_STII_LOSTDATA 0x04 // WD1793 Status I command - Lost Data
#define FDC_STII_DATAREQUEST 0x02 // WD1793 Status I command - Data Request
#define FDC_STII_BUSY 0x01 // WD1793 Status I command - Busy
#define FDC_CMD_RESTORE 0x00 // WD1793 Controller command - Restore to track 0 and initialise.
#define FDC_CMD_SEEK 0x10 // WD1793 Controller command - Seek track
#define FDC_CMD_STEP 0x20 // WD1793 Controller command - Step
#define FDC_CMD_STEP_TU 0x30 // WD1793 Controller command - Step with track update.
#define FDC_CMD_STEP_IN 0x40 // WD1793 Controller command - Step In
#define FDC_CMD_STEPIN_TU 0x50 // WD1793 Controller command - Step In with track update.
#define FDC_CMD_STEPOUT 0x60 // WD1793 Controller command - Step Out
#define FDC_CMD_STEPOUT_TU 0x70 // WD1793 Controller command - Step Out with track update.
#define FDC_CMD_READSEC 0x80 // WD1793 Controller command - Read Sector
#define FDC_CMD_READSEC_MULT 0x90 // WD1793 Controller command - Read Sector multiple.
#define FDC_CMD_WRITESEC 0xA0 // WD1793 Controller command - Write Sector
#define FDC_CMD_WRITESEC_MULT 0xB0 // WD1793 Controller command - Write Sector multiple
#define FDC_CMD_READADDR 0xC0 // WD1793 Controller command - Read address
#define FDC_CMD_READTRACK 0xE0 // WD1793 Controller command - Read Track
#define FDC_CMD_WRITETRACK 0xF0 // WD1793 Controller command - Write Track
#define FDC_CMD_FORCEINT 0xD0 // WD1793 Controller command - Force Interrupt
// Registers within the Machine Control module. Some of the data provided within these registers
// is also available directly from the hardware modules.
@@ -106,10 +202,12 @@
#define MZ_EMU_REG_CMT 6 // CMT (tape drive) configuration register.
#define MZ_EMU_REG_CMT2 7 // CMT (tape drive) apss status register.
#define MZ_EMU_REG_CMT3 8 // CMT (tape drive) status register.
#define MZ_EMU_REG_USERROM 9 // USER ROM selection register (not currently used.)
#define MZ_EMU_REG_FDCROM 10 // Floppy Disk ROM selection register.
#define MZ_EMU_REG_SWITCHES 11 // Hardware switches, MZ800 = 3:0
#define MZ_EMU_REG_SETUP 13 // Emulator current setup (configuration) register.
#define MZ_EMU_REG_FDD 9 // Floppy Disk Drive configuration register 1.
#define MZ_EMU_REG_FDD2 10 // Floppy Disk Drive configuration register 2.
#define MZ_EMU_REG_FDD3 11 // Floppy Disk Drive configuration register 3.
#define MZ_EMU_REG_FDD4 12 // Floppy Disk Drive configuration register 4.
#define MZ_EMU_REG_ROMS 13 // Options ROMS configuration
#define MZ_EMU_REG_SWITCHES 14 // Hardware switches, MZ800 = 3:0
#define MZ_EMU_REG_CTRL 15 // Emulator control register.
// Physical address of the registers within the Machine Control module.
@@ -122,9 +220,12 @@
#define MZ_EMU_ADDR_REG_CMT MZ_EMU_REG_BASE_ADDR + 6 // Address of the CMT (tape drive) configuration register.
#define MZ_EMU_ADDR_REG_CMT2 MZ_EMU_REG_BASE_ADDR + 7 // Address of the CMT (tape drive) apss register.
#define MZ_EMU_ADDR_REG_CMT3 MZ_EMU_REG_BASE_ADDR + 8 // Address of the CMT (tape drive) status register.
#define MZ_EMU_ADDR_REG_USERROM MZ_EMU_REG_BASE_ADDR + 9 // Address of the USER ROM selection register (not currently used.).
#define MZ_EMU_ADDR_REG_FDCROM MZ_EMU_REG_BASE_ADDR + 10 // Address of the Floppy Disk ROM selection register.
#define MZ_EMU_ADDR_REG_SETUP MZ_EMU_REG_BASE_ADDR + 13 // Address of the emulator current setup (configuration) register.
#define MZ_EMU_ADDR_REG_FDD MZ_EMU_REG_BASE_ADDR + 9 // Address of the Floppy Disk Drive configuration register 1.
#define MZ_EMU_ADDR_REG_FDD2 MZ_EMU_REG_BASE_ADDR + 10 // Address of the Floppy Disk Drive configuration register 2.
#define MZ_EMU_ADDR_REG_FDD3 MZ_EMU_REG_BASE_ADDR + 11 // Address of the Floppy Disk Drive configuration register 3.
#define MZ_EMU_ADDR_REG_FDD4 MZ_EMU_REG_BASE_ADDR + 12 // Address of the Floppy Disk Drive configuration register 4.
#define MZ_EMU_ADDR_REG_ROMS MZ_EMU_REG_BASE_ADDR + 13 // Address of the optional ROMS configuration register.
#define MZ_EMU_ADDR_REG_SWITCHES MZ_EMU_REG_BASE_ADDR + 14 // Address of the Hardware configuration switches.
#define MZ_EMU_ADDR_REG_CTRL MZ_EMU_REG_BASE_ADDR + 15 // Address of the Control reigster.
// Interrupt generator control and status registers.
@@ -132,6 +233,7 @@
#define MZ_EMU_INTR_REG_ISR 0x00 // Interupt service reason register, define what caused the interupt.
#define MZ_EMU_INTR_SRC_KEYB 0x01 // Interrupt source = Keyboard.
#define MZ_EMU_INTR_SRC_CMT 0x02 // Interrupt source = CMT.
#define MZ_EMU_INTR_SRC_FDD 0x04 // Interrupt source = FDD.
// Cassette module control and status registers.
#define MZ_EMU_CMT_MAX_REGISTERS 0x04 // Maximum number of registers in the cmt interface.
@@ -219,6 +321,8 @@
#define MZ_EMU_CMT2_EJECT 0x04 // APSS CMT EJECT tape.
#define MZ_EMU_CMT2_PLAY 0x08 // APSS CMT PLAY tape.
#define MZ_EMU_CMT2_STOP 0x10 // APSS CMT STOP tape.
#define MZ_EMU_CMT2_AUTOREW 0x20 // APSS Auto rewind at tape end.
#define MZ_EMU_CMT2_AUTOPLAY 0x40 // APSS Auto play after APSS or rewind.
// Menu selection types.
@@ -236,7 +340,8 @@ enum MENUSTATE {
MENUSTATE_HIDDEN = 0x01, // Menu item is active but not visible on the menu.
MENUSTATE_GREYED = 0x02, // Menu item is inactive, visible but greyed out.
MENUSTATE_BLANK = 0x03, // Menu item is visible but has no content.
MENUSTATE_TEXT = 0x04 // Menu item is visible text for display only
MENUSTATE_TEXT = 0x04, // Menu item is visible text for display only
MENUSTATE_INACTIVE = 0x05 // Menu item is not active or visible, a placeholder state.
};
// Modes of menu display interaction.
@@ -276,6 +381,44 @@ enum ACTIONMODE {
ACTION_TOGGLECHOICE = 0x02, // Action callback implements toggle feature.
};
// Types of disks recognised by the Sharp MZ hardware.
// These definitions are coded into the WD1773 controller so any changes in this source file must be reflected in the controller VHDL.
enum DISKTYPES {
DISKTYPE_320K = 0x00, // 40T DS 16S 256B 320K
DISKTYPE_320KT2 = 0x01, // 40T DS 8S 512B 320K
DISKTYPE_720K = 0x02, // 80T DS 9S 512B 720K
DISKTYPE_800K = 0x03, // 80T DS 10S 512B 800K
DISKTYPE_640K = 0x04, // 80T DS 16S 256B 640K
DISKTYPE_350K = 0x05, // 35T DS 10S 512B 350K
DISKTYPE_280K = 0x06, // 35T DS 16S 256B 280K
DISKTYPE_400K = 0x07, // 40T 2H 10S 512B 400K
DISKTYPE_TBD4 = 0x08, //
DISKTYPE_TBD5 = 0x09, //
DISKTYPE_TBD6 = 0x0A, //
DISKTYPE_TBD7 = 0x0B, //
DISKTYPE_TBD8 = 0x0C, //
DISKTYPE_TBD9 = 0x0D, //
DISKTYPE_TBDA = 0x0E, //
DISKTYPE_TBDB = 0x0F
};
// Types of disk image we recognise and process.
enum IMAGETYPES {
IMAGETYPE_EDSK = 0x00, // Extended CPC DSK Image Format.
IMAGETYPE_IMG = 0x01 // Raw binary format.
};
// Polarity of the floppy disk image, caters for direct MB8866 inverted images or normal images.
enum POLARITYTYPES {
POLARITY_NORMAL = 0x00, // Normal image (created and visible in a hex editor).
POLARITY_INVERTED = 0x01 // Inverted image, extracted from the MB8866 controller with inverted data bus.
};
// Write mode of the floppy drive. Read/Write or Read Only (Write Protected).
enum UPDATEMODETYPES {
UPDATEMODE_READWRITE = 0x00, // Disk data can be updated.
UPDATEMODE_READONLY = 0x01 // Disk data is read only.
};
// Declare the menu callback as a type. This callback is used when a menu item such as submenu is activated.
typedef void (*t_menuCallback)(uint8_t);
@@ -291,7 +434,6 @@ typedef void (*t_renderCallback)(uint16_t);
// Declare the return from dialog callback which is required to process data from a non-menu dialog such as a file list.
typedef void (*t_dialogCallback)(char *param);
// Structure to map an ascii key into a row and column scan code.
typedef struct {
uint8_t scanRow; // Emulation scan row.
@@ -347,6 +489,8 @@ typedef struct {
t_menuItem *data[MAX_MENU_ROWS]; // Details of a row's data to be displayed such as text.
} t_menu;
// Structure to maintain a directory entry, wether it is a file or directory entry.
//
typedef struct {
char *name;
uint8_t isDir;
@@ -381,7 +525,7 @@ typedef struct
uint8_t romEnabled;
uint32_t loadAddr;
uint32_t loadSize;
} romData_t;
} t_romData;
// Structure to store the cold boot application details which gets loaded on machine instantiation.
//
@@ -397,16 +541,16 @@ typedef struct
//
typedef struct
{
unsigned char dataType; // 01 = machine code program.
// 02 MZ-80 Basic program.
// 03 MZ-80 data file.
// 04 MZ-700 data file.
// 05 MZ-700 Basic program.
char fileName[17]; // File name.
unsigned short fileSize; // Size of data partition.
unsigned short loadAddress; // Load address of the program/data.
unsigned short execAddress; // Execution address of program.
unsigned char comment[104]; // Free text or code area.
unsigned char dataType; // 01 = machine code program.
// 02 MZ-80 Basic program.
// 03 MZ-80 data file.
// 04 MZ-700 data file.
// 05 MZ-700 Basic program.
char fileName[17]; // File name.
unsigned short fileSize; // Size of data partition.
unsigned short loadAddress; // Load address of the program/data.
unsigned short execAddress; // Execution address of program.
unsigned char comment[104]; // Free text or code area.
} t_tapeHeader;
// Structures to store the tape file queue.
@@ -419,6 +563,37 @@ typedef struct
uint16_t elements;
} t_tapeQueue;
// Structure for a lookup table on floppy disk definition parameters.
//
typedef struct
{
uint8_t tracks; // Number of tracks in floppy disk image.
uint8_t heads; // Number of heads in floppy disk image.
uint8_t sectors; // Number of sectors in floppy disk image.
uint16_t sectorSize; // Size of a sector.
uint16_t rpm; // Rotational Speed of image.
} t_floppyDef;
// Structure to maintain a Floppy Disk Drive configuration.
//
typedef struct
{
char fileName[MAX_FILENAME_LEN]; // Name of floppy disk image, extension indicates type of image.
enum IMAGETYPES imgType; // Type of image for fileName.
uint8_t mounted; // Disk image is mounted and available to the disk drive.
enum DISKTYPES diskType; // Type of disk.
enum POLARITYTYPES polarity; // Polarity of the image data (normal, inverted).
enum UPDATEMODETYPES updateMode; // Write Protect/Read Only or read/write mode.
} t_floppyDrive;
// Structure to store floppy disk control variables.
//
typedef struct
{
uint8_t ctrlReg; // Control register mirror to allow single bit updates.
} t_floppyCtrl;
// Structure to store the parameters for key insertion editting.
//
typedef struct
@@ -478,6 +653,8 @@ typedef struct {
uint8_t loadDirectFilter;
uint8_t queueTapeFilter;
uint8_t cmtMode; // CMT Mode, physical CMT = 0, FPGA CMT = 1
uint8_t fddEnabled; // FDD Enabled, 1 = enabled, 0 = disabled.
uint8_t fddImageFilter; // Filter to be applied when selecting floppy image files.
uint8_t tapeAutoSave;
uint8_t tapeButtons;
uint8_t fastTapeLoad;
@@ -487,12 +664,13 @@ typedef struct {
uint8_t mz800TapeIn; // MZ-800 Tape Input setting switch.
uint8_t autoStart; // Application autostart on machine instantiation.
char tapeSavePath[MAX_FILENAME_LEN]; // Path where saved files should be stored.
romData_t romMonitor40; // Details of 40x25 rom monitor image to upload.
romData_t romMonitor80; // Details of 80x25 rom monitor image to upload.
romData_t romCG; // Details of rom character generator images to upload.
romData_t romKeyMap; // Details of rom Key mapping images to upload.
romData_t romUser; // Details of User ROM images to upload.
romData_t romFDC; // Details of FDC ROM images to upload.
t_floppyDrive fdd[MAX_FLOPPY_DRIVES]; // Entries per floppy drive to maintain image and control data.
t_romData romMonitor40; // Details of 40x25 rom monitor image to upload.
t_romData romMonitor80; // Details of 80x25 rom monitor image to upload.
t_romData romCG; // Details of rom character generator images to upload.
t_romData romKeyMap; // Details of rom Key mapping images to upload.
t_romData romUser; // Details of User ROM images to upload.
t_romData romFDC; // Details of FDC ROM images to upload.
appData_t loadApp; // Details of an application to load on machine instantiation.
} t_emuMachineConfig;
@@ -533,12 +711,32 @@ typedef struct {
t_fileList fileList; // List of files for perusal and selection during OSD interaction.
t_tapeHeader tapeHeader; // Last processed tape details.
t_tapeQueue tapeQueue; // Linked list of files which together form a virtual tape.
t_floppyCtrl fdd; // Floppy disk drive control.
t_keyInjectionEdit keyInjEdit; // Control structure for event callback editting of the key injection array.
} t_emuControl;
// Application execution constants.
//
// Lookup table for floppy disk parameter definitions.
const t_floppyDef FLOPPY_DEFINITIONS[16]= { { .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 0 40T DS 16S 256B 320K
{ .tracks = 40, .heads = 2, .sectors = 8, .sectorSize = 512, .rpm = 300 }, // 1 40T DS 8S 512B 320K
{ .tracks = 80, .heads = 2, .sectors = 9, .sectorSize = 512, .rpm = 300 }, // 2 80T DS 9S 512B 720K
{ .tracks = 80, .heads = 2, .sectors = 10, .sectorSize = 512, .rpm = 300 }, // 3 80T DS 10S 512B 800K
{ .tracks = 80, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 4 80T DS 16S 256B 640K
{ .tracks = 35, .heads = 2, .sectors = 10, .sectorSize = 512, .rpm = 300 }, // 5 35T DS 10S 512B 350K
{ .tracks = 35, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 6 35T DS 16S 256B 280K
{ .tracks = 40, .heads = 2, .sectors = 10, .sectorSize = 512, .rpm = 300 }, // 7 40T 2H 10S 512B 400K
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 8
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 9
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 10
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 11
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 12
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 13
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 }, // 14
{ .tracks = 40, .heads = 2, .sectors = 16, .sectorSize = 256, .rpm = 300 } }; // 15
// Lookup tables for menu entries.
//
const uint8_t MZ_ACTIVE[MAX_MZMACHINES] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
@@ -571,9 +769,9 @@ const char *SHARPMZ_AUDIO_HARDWARE[] = { "Host", "FPGA" };
const char *SHARPMZ_AUDIO_VOLUME[] = { "Off", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "Max" };
const char *SHARPMZ_AUDIO_MUTE[] = { "Off", "Mute" };
const char *SHARPMZ_AUDIO_MIX [] = { "Off", "25%", "50%", "Mono" };
const char *SHARPMZ_USERROM_ENABLED[] = { "Disabled", "Enabled" };
const char *SHARPMZ_FDCROM_ENABLED[] = { "Disabled", "Enabled" };
const char *SHARPMZ_ROM_ENABLED[] = { "Disabled", "Enabled" };
//const char *SHARPMZ_USERROM_ENABLED[] = { "Disabled", "Enabled" };
//const char *SHARPMZ_FDCROM_ENABLED[] = { "Disabled", "Enabled" };
//const char *SHARPMZ_ROM_ENABLED[] = { "Disabled", "Enabled" };
const char *SHARPMZ_DISPLAY_TYPE[][4] = {
{ "Mono 40x25", "Mono 80x25 ", NULL, NULL }, // 80K
{ "Mono 40x25", "Mono 80x25 ", NULL, NULL }, // 80C
@@ -609,7 +807,6 @@ const char *SHARPMZ_GRAMDISABLE_MODE[] = { "Enabled", "Disabled" };
//const char *SHARPMZ_GRAM_BASEADDR[] = { "0x00", "0x08", "0x10", "0x18", "0x20", "0x28", "0x30", "0x38", "0x40", "0x48", "0x50", "0x58", "0x70", "0x78",
// "0x80", "0x88", "0x90", "0x98" };
const char *SHARPMZ_PCG_MODE[] = { "ROM", "RAM" };
const char *SHARPMZ_TAPE_AUTO_SAVE[] = { "Disabled", "Enabled" };
const char *SHARPMZ_AUTOSTART[] = { "Disabled", "Enabled" };
const char *SHARPMZ_MEMORY_BANK[] = { "SysROM", "SysRAM", "KeyMap", "VRAM", "CMTHDR", "CMTDATA", "CGROM", "CGRAM", "All" };
//const char *SHARPMZ_MEMORY_BANK_FILE[] = { "sysrom.dump", "sysram.dump", "keymap.dump", "vram.dump", "cmt_hdr.dump", "cmt_data.dump", "cgrom.dump", "cgram.dump", "all_memory.dump" };
@@ -618,7 +815,20 @@ const char *SHARPMZ_FILE_FILTERS[] = { "*.MZF", "*.MTI", "*.MZT", "*.*" };
const char *SHARPMZ_MZ800_MODE[] = { "MZ-800", "MZ-700" };
const char *SHARPMZ_MZ800_PRINTER[] = { "MZ", "Centronics" };
const char *SHARPMZ_MZ800_TAPEIN[] = { "External", "Internal" };
const char *SHARPMZ_FDD_MODE[] = { "Disabled", "Enabled" };
const char *SHARPMZ_FDD_DISK_TYPE[] = { "40T DS 16S 256B 320K",
"40T DS 8S 512B 320K",
"80T DS 9S 512B 720K",
"80T DS 10S 512B 800K",
"80T DS 16S 256B 640K",
"35T DS 10S 512B 350K",
"35T DS 16S 256B 280K",
"40T DS 10S 512B 400K",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
const char *SHARPMZ_FDD_IMAGE_POLARITY[] = { "Normal", "Inverted" };
const char *SHARPMZ_FDD_UPDATE_MODE[] = { "Read/Write", "Read Only" };
const char *SHARPMZ_FDD_FILE_FILTERS[] = { "*.DSK", "*.D88", "*.IMG", "*.*" };
const char *SHARPMZ_FDD_MOUNT[] = { "Ejected", "Mounted" };
// Prototypes.
//
@@ -669,6 +879,9 @@ void EMZLoadDirectToRAM(enum ACTIONMODE);
void EMZLoadDirectToRAMSet(char *);
void EMZQueueTape(enum ACTIONMODE);
void EMZQueueTapeSet(char *);
void EMZQueueClear(enum ACTIONMODE);
void EMZQueueNext(enum ACTIONMODE);
void EMZQueuePrev(enum ACTIONMODE);
void EMZTapeSave(enum ACTIONMODE);
void EMZTapeSaveSet(char *);
void EMZMonitorROM40(enum ACTIONMODE);
@@ -687,15 +900,17 @@ void EMZLoadApplication(enum ACTIONMODE);
void EMZLoadApplicationSet(char *);
void EMZChangeLoadApplication(enum ACTIONMODE);
void EMZTapeQueuePushFile(char *);
char *EMZTapeQueuePopFile(void);
char *EMZTapeQueueAPSSSearch(char);
char *EMZTapeQueuePopFile(uint8_t);
char *EMZTapeQueueAPSSSearch(char, uint8_t);
char *EMZNextTapeQueueFilename(char);
uint16_t EMZClearTapeQueue(void);
void EMZChangeCMTMode(enum ACTIONMODE);
short EMZReadTapeDetails(const char *);
short EMZLoadTapeToRAM(const char *, unsigned char);
short EMZSaveTapeFromCMT(const char *);
void EMZProcessTapeQueue(uint8_t);
// Menu choice helper functions, increment to next choice.
void EMZNextMachineModel(enum ACTIONMODE);
@@ -725,6 +940,13 @@ const char *EMZGetAudioVolumeChoice(void);
const char *EMZGetAudioMuteChoice(void);
const char *EMZGetAudioMixChoice(void);
const char *EMZGetCMTModeChoice(void);
const char *EMZGetFDDMountChoice(uint8_t);
const char *EMZGetFDDMount0Choice(void);
const char *EMZGetFDDMount1Choice(void);
const char *EMZGetFDDMount2Choice(void);
const char *EMZGetFDDMount3Choice(void);
const char *EMZGetDisplayTypeChoice(void);
const char *EMZGetDisplayOptionChoice(void);
const char *EMZGetDisplayOutputChoice(void);
@@ -736,7 +958,6 @@ const char *EMZGetAspectRatioChoice(void);
const char *EMZGetScanDoublerFXChoice(void);
const char *EMZGetLoadDirectFileFilterChoice(void);
const char *EMZGetQueueTapeFileFilterChoice(void);
const char *EMZGetTapeAutoSaveChoice(void);
const char *EMZGetTapeSaveFilePathChoice(void);
const char *EMZGetMonitorROM40Choice(void);
const char *EMZGetMonitorROM80Choice(void);
@@ -765,7 +986,6 @@ void EMZNextAspectRatio(enum ACTIONMODE);
void EMZNextScanDoublerFX(enum ACTIONMODE);
void EMZNextLoadDirectFileFilter(enum ACTIONMODE);
void EMZNextQueueTapeFileFilter(enum ACTIONMODE);
void EMZNextTapeAutoSave(enum ACTIONMODE);
void EMZNextMonitorROM40(enum ACTIONMODE);
void EMZNextMonitorROM80(enum ACTIONMODE);
void EMZNextCGROM(enum ACTIONMODE);
@@ -777,6 +997,62 @@ void EMZNextMZ800Mode(enum ACTIONMODE mode);
void EMZNextMZ800Printer(enum ACTIONMODE mode);
void EMZNextMZ800TapeIn(enum ACTIONMODE mode);
const char *EMZGetFDDModeChoice(void);
void EMZChangeFDDMode(enum ACTIONMODE);
void EMZNextFDDMode(enum ACTIONMODE);
const char *EMZGetFDDDriveFileFilterChoice(void);
void EMZFDDSetDriveImage(enum ACTIONMODE, uint8_t);
void EMZFDDSetDriveImage0(enum ACTIONMODE);
void EMZFDDSetDriveImage1(enum ACTIONMODE);
void EMZFDDSetDriveImage2(enum ACTIONMODE);
void EMZFDDSetDriveImage3(enum ACTIONMODE);
void EMZFDDDriveImageSet(char *, uint8_t);
void EMZFDDDriveImage0Set(char *);
void EMZFDDDriveImage1Set(char *);
void EMZFDDDriveImage2Set(char *);
void EMZFDDDriveImage3Set(char *);
void EMZNextDriveImageFilter(enum ACTIONMODE);
void EMZMountDrive(enum ACTIONMODE, uint8_t, uint8_t);
void EMZNextMountDrive0(enum ACTIONMODE);
void EMZNextMountDrive1(enum ACTIONMODE);
void EMZNextMountDrive2(enum ACTIONMODE);
void EMZNextMountDrive3(enum ACTIONMODE);
short EMZProcessFDDRequest(uint8_t, uint8_t, uint8_t, uint8_t);
short EMZCheckFDDImage(char *);
short EMZSetFDDImageParams(char *, uint8_t, enum IMAGETYPES);
void EMZNextFDDDriveType(enum ACTIONMODE, uint8_t);
void EMZNextFDDDriveType0(enum ACTIONMODE);
void EMZNextFDDDriveType1(enum ACTIONMODE);
void EMZNextFDDDriveType2(enum ACTIONMODE);
void EMZNextFDDDriveType3(enum ACTIONMODE);
void EMZNextFDDImagePolarity(enum ACTIONMODE, uint8_t);
void EMZNextFDDImagePolarity0(enum ACTIONMODE);
void EMZNextFDDImagePolarity1(enum ACTIONMODE);
void EMZNextFDDImagePolarity2(enum ACTIONMODE);
void EMZNextFDDImagePolarity3(enum ACTIONMODE);
void EMZNextFDDUpdateMode(enum ACTIONMODE, uint8_t);
void EMZNextFDDUpdateMode0(enum ACTIONMODE);
void EMZNextFDDUpdateMode1(enum ACTIONMODE);
void EMZNextFDDUpdateMode2(enum ACTIONMODE);
void EMZNextFDDUpdateMode3(enum ACTIONMODE);
const char *EMZGetFDDDriveTypeChoice(uint8_t);
const char *EMZGetFDDDriveType0Choice(void);
const char *EMZGetFDDDriveType1Choice(void);
const char *EMZGetFDDDriveType2Choice(void);
const char *EMZGetFDDDriveType3Choice(void);
const char *EMZGetFDDDriveFileChoice(uint8_t);
const char *EMZGetFDDDrive0FileChoice(void);
const char *EMZGetFDDImagePolarityChoice(uint8_t);
const char *EMZGetFDDImagePolarity0Choice(void);
const char *EMZGetFDDImagePolarity1Choice(void);
const char *EMZGetFDDImagePolarity2Choice(void);
const char *EMZGetFDDImagePolarity3Choice(void);
const char *EMZGetFDDUpdateModeChoice(uint8_t);
const char *EMZGetFDDUpdateMode0Choice(void);
const char *EMZGetFDDUpdateMode1Choice(void);
const char *EMZGetFDDUpdateMode2Choice(void);
const char *EMZGetFDDUpdateMode3Choice(void);
#ifdef __cplusplus
}
@@ -788,8 +1064,8 @@ void EMZNextMZ800TapeIn(enum ACTIONMODE mode);
extern "C" {
#endif
uint8_t EMZInit(enum MACHINE_HW_TYPES hostMachine);
void EMZRun(uint8_t);
uint8_t EMZInit(enum MACHINE_HW_TYPES, uint8_t);
void EMZRun(void);
const char *EMZGetVersion(void);
const char *EMZGetVersionDate(void);

View File

@@ -131,9 +131,14 @@
#define MZ_EMU_ADDR_REG_AUDIO MZ_EMU_BASE_ADDR + 5 // Address of the AUDIO configuration register.
#define MZ_EMU_ADDR_REG_CMT MZ_EMU_BASE_ADDR + 6 // Address of the CMT (tape drive) configuration register 1.
#define MZ_EMU_ADDR_REG_CMT2 MZ_EMU_BASE_ADDR + 7 // Address of the CMT (tape drive) configuration register 2.
#define MZ_EMU_ADDR_REG_USERROM MZ_EMU_BASE_ADDR + 8 // Address of the USER ROM selection register (not currently used.).
#define MZ_EMU_ADDR_REG_FDCROM MZ_EMU_BASE_ADDR + 9 // Address of the Floppy Disk ROM selection register.
#define MZ_EMU_ADDR_REG_SETUP MZ_EMU_BASE_ADDR + 13 // Address of the emulator current setup (configuration) register.
#define MZ_EMU_ADDR_REG_CMT3 MZ_EMU_BASE_ADDR + 8 // Address of the CMT (tape drive) configuration register 3.
#define MZ_EMU_ADDR_REG_FDD MZ_EMU_BASE_ADDR + 9 // Address of the Floppy Disk Drive configuration register 1.
#define MZ_EMU_ADDR_REG_FDD2 MZ_EMU_BASE_ADDR + 10 // Address of the Floppy Disk Drive configuration register 2.
#define MZ_EMU_ADDR_REG_FDD3 MZ_EMU_BASE_ADDR + 11 // Address of the Floppy Disk Drive configuration register 3.
#define MZ_EMU_ADDR_REG_FDD4 MZ_EMU_BASE_ADDR + 12 // Address of the Floppy Disk Drive configuration register 4.
#define MZ_EMU_ADDR_REG_ROMS MZ_EMU_BASE_ADDR + 13 // Address of the optional ROMS configuration register.
#define MZ_EMU_ADDR_REG_SWITCHES MZ_EMU_BASE_ADDR + 14 // Address of the Hardware configuration switches.
#define MZ_EMU_ADDR_REG_CTRL MZ_EMU_BASE_ADDR + 15 // Address of the Control reigster.
#define MZ_EMU_INTR_ISR 0x00 // Interupt service reason register, define what caused the interupt.
#define MZ_EMU_KEYB_KEY_MATRIX 0x00 // Key matrix array current scan.
#define MZ_EMU_KEYB_KEY_MATRIX_LAST 0x10 // Key matrix array previous scan.
@@ -154,9 +159,14 @@
#define MZ_EMU_REG_AUDIO 5 // AUDIO configuration register.
#define MZ_EMU_REG_CMT 6 // CMT (tape drive) configuration register 1.
#define MZ_EMU_REG_CMT2 7 // CMT (tape drive) configuration register 2.
#define MZ_EMU_REG_USERROM 8 // USER ROM selection register (not currently used.)
#define MZ_EMU_REG_FDCROM 9 // Floppy Disk ROM selection register.
#define MZ_EMU_REG_SETUP 13 // Emulator current setup (configuration) register.
#define MZ_EMU_REG_CMT3 8 // CMT (tape drive) configuration register 2.
#define MZ_EMU_REG_FDD 9 // Floppy Disk Drive configuration register 1.
#define MZ_EMU_REG_FDD2 10 // Floppy Disk Drive configuration register 2.
#define MZ_EMU_REG_FDD3 11 // Floppy Disk Drive configuration register 3.
#define MZ_EMU_REG_FDD4 12 // Floppy Disk Drive configuration register 4.
#define MZ_EMU_REG_ROMS 13 // Options ROMS configuration
#define MZ_EMU_REG_SWITCHES 14 // Hardware switches, MZ800 = 3:0
#define MZ_EMU_REG_CTRL 15 // Emulation control register.
#define MZ_EMU_MAX_REGISTERS 16 // Maximum number of registers on the emulator.
#define MZ_EMU_KEYB_DISABLE_EMU 0x01 // Disable keyboard scan codes being sent to the emulation.
#define MZ_EMU_KEYB_ENABLE_INTR 0x02 // Enable interrupt on every key press.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -130,7 +130,7 @@
#endif
// Version info.
#define VERSION "v1.40b"
#define VERSION "v1.41"
#define VERSION_DATE "28/10/2021"
#define PROGRAM_NAME "zOS"