Can now boot, had to disable Z180 internal I/O temporarily due to conflicts
authorNick Downing <nick@ndcode.org>
Sun, 3 Mar 2019 08:01:56 +0000 (19:01 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 3 Mar 2019 08:01:56 +0000 (19:01 +1100)
13 files changed:
Makefile
emu.h
sim/iosim.cpp
sim/memory.cpp
sim/sim.h
sim/sim0.cpp
sim/simctl.cpp
sim/simglb.cpp
sim/simglb.h
sim/simint.cpp
z180/z180.cpp
z180/z180.h
z180/z180ops.h

index 2935dc4..09dfe2c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 CPPFLAGS=-DCONFDIR=\".\" -DDISKSDIR=\".\" -I.
-#CXXFLAGS=-Wfatal-errors
+CXXFLAGS=-g
 
 fuzix_sim: \
 iodevices/unix_terminal.o \
diff --git a/emu.h b/emu.h
index 8ebcbbd..c26e4c1 100644 (file)
--- a/emu.h
+++ b/emu.h
@@ -1,6 +1,7 @@
 #ifndef _EMU_H
 #define _EMU_H 1
 
+#include <assert.h>
 #include <stdint.h>
 #include <string.h>
 typedef uint8_t u8;
@@ -22,6 +23,13 @@ class device_t {
 public:
   virtual void device_start() = 0;
   virtual void device_reset() = 0;
+};
+
+class cpu_device : public device_t {
+public:
+  int *m_icountptr;
+
+  cpu_device() : m_icountptr(NULL) {}
   virtual uint32_t execute_min_cycles() const = 0;
   virtual uint32_t execute_max_cycles() const = 0;
   virtual uint32_t execute_input_lines() const = 0;
@@ -30,10 +38,10 @@ public:
   virtual void execute_run() = 0;
   virtual void execute_burn(int32_t cycles) = 0;
   virtual void execute_set_input(int inputnum, int state) = 0;
-  virtual bool memory_translate(int spacenum, int intention, offs_t &address) = 0;
-};
-
-class cpu_device : public device_t {
+  void set_icountptr(int &icount) {
+    assert(!m_icountptr);
+    m_icountptr = &icount;
+  }
 };
 
 class machine_config {
index a57c4e0..e67c39c 100644 (file)
  *     51 - client socket #1 data
  */
 
+#include <assert.h> // temporary
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -1103,10 +1104,14 @@ BYTE io_in(BYTE addrl, BYTE addrh)
 {
        addrh = addrh;  /* to avoid compiler warning */
 
+#if 1
+ return (*port_in[addrl])();
+#else
        io_port = addrl;
        io_data = (*port_in[addrl]) ();
        //printf("input %02x from port %02x\r\n", io_data, io_port);
        return(io_data);
+#endif
 }
 
 /*
@@ -1118,8 +1123,10 @@ void io_out(BYTE addrl, BYTE addrh, BYTE data)
 {
        addrh = addrh;  /* to avoid compiler warning */
 
+#if 0
        io_port = addrl;
        io_data = data;
+#endif
 
        busy_loop_cnt[0] = 0;
 
@@ -1133,8 +1140,12 @@ void io_out(BYTE addrl, BYTE addrh, BYTE data)
 static BYTE io_trap_in(void)
 {
        if (i_flag) {
+#if 1
+ assert(false);
+#else
                cpu_error = IOTRAPIN;
                cpu_state = STOPPED;
+#endif
        }
        return((BYTE) 0xff);
 }
@@ -1147,8 +1158,12 @@ static void io_trap_out(BYTE data)
        data = data;    /* to avoid compiler warning */
 
        if (i_flag) {
+#if 1
+ assert(false);
+#else
                cpu_error = IOTRAPOUT;
                cpu_state = STOPPED;
+#endif
        }
 }
 
@@ -1486,8 +1501,12 @@ static BYTE nets1_in(void)
                host = gethostbyname(&cs_host[0]);
                if ((cs = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
                        perror("create client socket");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
                memset((void *) &sin, 0, sizeof(sin));
@@ -1496,8 +1515,12 @@ static BYTE nets1_in(void)
                sin.sin_port = htons(cs_port);
                if (connect(cs, (struct sockaddr *) &sin, sizeof(sin)) == -1) {
                        perror("connect client socket");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
                if (setsockopt(cs, IPPROTO_TCP, TCP_NODELAY,
@@ -1607,8 +1630,12 @@ static BYTE cond1_in(void)
                        return((BYTE) 0);
                } else {
                        perror("read console 1");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
        }
@@ -1643,8 +1670,12 @@ static BYTE cond2_in(void)
                        return((BYTE) 0);
                } else {
                        perror("read console 2");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
        }
@@ -1679,8 +1710,12 @@ static BYTE cond3_in(void)
                        return((BYTE) 0);
                } else {
                        perror("read console 3");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
        }
@@ -1715,8 +1750,12 @@ static BYTE cond4_in(void)
                        return((BYTE) 0);
                } else {
                        perror("read console 4");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
        }
@@ -1745,8 +1784,12 @@ static BYTE netd1_in(void)
 #ifdef NETWORKING
        if (read(cs, &c, 1) != 1) {
                perror("read client socket");
+#if 1
+ assert(false);
+#else
                cpu_error = IOERROR;
                cpu_state = STOPPED;
+#endif
                return((BYTE) 0);
        }
 #ifdef CNETDEBUG
@@ -1774,8 +1817,12 @@ again:
                        goto again;
                } else {
                        perror("write console 0");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 }
@@ -1800,8 +1847,12 @@ again:
                        goto again;
                } else {
                        perror("write console 1");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 #endif
@@ -1827,8 +1878,12 @@ again:
                        goto again;
                } else {
                        perror("write console 2");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 #endif
@@ -1854,8 +1909,12 @@ again:
                        goto again;
                } else {
                        perror("write console 3");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 #endif
@@ -1881,8 +1940,12 @@ again:
                        goto again;
                } else {
                        perror("write console 4");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 #endif
@@ -1908,8 +1971,12 @@ again:
                        goto again;
                } else {
                        perror("write client socket");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                }
        }
 #endif
@@ -1958,8 +2025,12 @@ again:
                                goto again;
                        } else {
                                perror("write printer");
+#if 1
+ assert(false);
+#else
                                cpu_error = IOERROR;
                                cpu_state = STOPPED;
+#endif
                        }
                }
        }
@@ -2010,8 +2081,12 @@ static BYTE auxd_in(void)
        if (aux_in == 0) {
                if ((aux_in = open("auxiliaryin.txt", O_RDONLY)) == -1){
                        perror("open auxiliaryin.txt");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return((BYTE) 0);
                }
        }
@@ -2055,8 +2130,12 @@ static void auxd_out(BYTE data)
        if (aux_out == 0) {
                if ((aux_out = creat("auxiliaryout.txt", 0644)) == -1) {
                        perror("open auxiliaryout.txt");
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return;
                }
        }
@@ -2298,16 +2377,24 @@ static void mmui_out(BYTE data)
        if (data > MAXSEG) {
                printf("Try to init %d banks, available %d banks\r\n",
                       data, MAXSEG);
+#if 1
+ assert(false);
+#else
                cpu_error = IOERROR;
                cpu_state = STOPPED;
+#endif
                return;
        }
 
        for (i = 1; i < data; i++) {
                if ((memory[i] = (BYTE *)malloc(segsize)) == NULL) {
                        printf("can't allocate memory for bank %d\r\n", i);
+#if 1
+ assert(false);
+#else
                        cpu_error = IOERROR;
                        cpu_state = STOPPED;
+#endif
                        return;
                }
        }
@@ -2331,9 +2418,14 @@ static BYTE mmus_in(void)
 static void mmus_out(BYTE data)
 {
        if (data > maxbnk - 1) {
+#if 1
+ printf("try to select unallocated bank %d\r\n", data);
+ assert(false);
+#else
                printf("%04x: try to select unallocated bank %d\r\n", PC, data);
                cpu_error = IOERROR;
                cpu_state = STOPPED;
+#endif
                return;
        }
        selbnk = data;
@@ -2357,8 +2449,12 @@ static void mmuc_out(BYTE data)
 {
        if (memory[1] != NULL) {
                printf("Not possible to resize already allocated segments\r\n");
+#if 1
+ assert(false);
+#else
                cpu_error = IOERROR;
                cpu_state = STOPPED;
+#endif
                return;
        }
        segsize = data << 8;
@@ -2594,8 +2690,12 @@ static BYTE delay_in(void)
 static void hwctl_out(BYTE data)
 {
        if (data & 128) {
+#if 1
+ assert(false);
+#else
                cpu_error = IOHALT;
                cpu_state = STOPPED;
+#endif
                return;
        }
 
@@ -2655,8 +2755,10 @@ static void int_timer(int sig)
 {
        sig = sig;      /* to avoid compiler warning */
 
+#if 0
        int_int = 1;
        int_data = 0xff;        /* RST 38H for IM 0, 0FFH for IM 2 */
+#endif
 }
 
 #if defined(NETWORKING) && defined(TCPASYNC)
index 4283981..0dd5a50 100644 (file)
@@ -27,6 +27,7 @@
  * 03-FEB-17 added ROM initialisation
  */
 
+#include <assert.h> // temporary
 #include <stdlib.h>
 #include <stdio.h>
 #include "sim.h"
@@ -44,8 +45,12 @@ void init_memory(void)
        /* allocate the first 64KB bank, so that we have some memory */
        if ((memory[0] = (BYTE *)malloc(65536)) == NULL) {
                printf("can't allocate memory for bank 0\r\n");
+#if 1
+ assert(false);
+#else
                cpu_error = IOERROR;
                cpu_state = STOPPED;
+#endif
                return;
        }
        maxbnk = 1;
index ec3f6da..b548b34 100644 (file)
--- a/sim/sim.h
+++ b/sim/sim.h
@@ -152,9 +152,10 @@ struct softbreak {                 /* structure of a breakpoint */
 };
 #endif
 
-#ifndef isxdigit
-#define isxdigit(c) ((c<='f'&&c>='a')||(c<='F'&&c>='A')||(c<='9'&&c>='0'))
-#endif
+#include <ctype.h>
+//#ifndef isxdigit
+//#define isxdigit(c) ((c<='f'&&c>='a')||(c<='F'&&c>='A')||(c<='9'&&c>='0'))
+//#endif
 
 /*
  *     Structure for the disk images
index dd18359..a3af822 100644 (file)
@@ -52,6 +52,7 @@
  *     the user interface ( mon() ) is called.
  */
 
+#include <assert.h> // temporary
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -67,6 +68,7 @@
 #include "config.h"
 //#include "../../frontpanel/frontpanel.h"
 #include "memory.h"
+#include "z180/z180.h"
 
 #define BUFSIZE        256             /* buffer size for file I/O */
 
@@ -323,6 +325,36 @@ puts(" #####    ###     #####    ###            #####    ###   #     #");
  */
 static void init_cpu(void)
 {
+#if 1
+ z180_device *z180_dev = new z180_device();
+ z180_dev->device_start();
+ *z180_dev->m_icountptr = 0;
+
+ class memory_address_space : public address_space {
+  virtual u8 read_byte(offs_t address) override {
+   return memrdr((WORD)address);
+  }
+  virtual void write_byte(offs_t address, u8 data) override {
+   memwrt((WORD)address, (BYTE)data);
+  }
+ };
+ z180_dev->m_program = new memory_address_space();
+
+ BYTE io_in(BYTE addrl, BYTE addrh);
+ void io_out(BYTE addrl, BYTE addrh, BYTE data);
+ class io_address_space : public address_space {
+  virtual u8 read_byte(offs_t address) override {
+   return io_in((BYTE)address, (BYTE)(address >> 8));
+  }
+  virtual void write_byte(offs_t address, u8 data) override {
+   io_out((BYTE)address, (BYTE)(address >> 8), (BYTE)data);
+  }
+ };
+ z180_dev->m_iospace = new io_address_space();
+
+ z180_dev->device_reset();
+ cpu_dev = z180_dev;
+#else
        /* same for i8080 and Z80 */
        PC = 0;
        SP = rand() % 65536;
@@ -351,6 +383,7 @@ static void init_cpu(void)
                IX = rand() % 65536;
                IY = rand() % 65536;
        }
+#endif
 }
 
 /*
@@ -358,6 +391,9 @@ static void init_cpu(void)
  */
 void reset_cpu(void)
 {
+#if 1
+ cpu_dev->device_reset();
+#else
        IFF = int_int = int_nmi = int_protection = int_mode = 0;
        int_data = -1;
 
@@ -367,6 +403,7 @@ void reset_cpu(void)
                I = 0;
                R = 0L;
        }
+#endif
 }
 
 /*
@@ -374,6 +411,9 @@ void reset_cpu(void)
  */
 static void save_core(void)
 {
+#if 1
+ assert(false);
+#else
        int fd;
 
        if ((fd = open("core.z80", O_WRONLY | O_CREAT, 0600)) == -1) {
@@ -405,6 +445,7 @@ static void save_core(void)
        write(fd, (char *) &IY, sizeof(IY));
        write(fd, (char *) mem_base(), 65536);
        close(fd);
+#endif
 }
 
 /*
@@ -412,6 +453,9 @@ static void save_core(void)
  */
 int load_core(void)
 {
+#if 1
+ assert(false);
+#else
        int fd;
 
        if ((fd = open("core.z80", O_RDONLY)) == -1) {
@@ -445,6 +489,7 @@ int load_core(void)
        close(fd);
 
        return(0);
+#endif
 }
 
 /*
@@ -456,6 +501,9 @@ int load_core(void)
  */
 int load_file(char *s)
 {
+#if 1
+ assert(false);
+#else
        char fn[LENCMD];
        BYTE fileb[5];
        register char *pfn = fn;
@@ -487,8 +535,10 @@ int load_file(char *s)
                close(fd);
                return (load_hex(fn));
        }
+#endif
 }
 
+#if 0
 /*
  *     Loader for binary images with Mostek header.
  *     Format of the first 3 bytes:
@@ -625,3 +675,4 @@ static int checksum(char *s)
        else
                return(1);
 }
+#endif
index b125daa..3d5d303 100644 (file)
@@ -54,6 +54,7 @@
 #include "simglb.h"
 #include "memory.h"
 #include "iodevices/unix_terminal.h"
+#include "z180/z180.h"
 
 int boot(void);
 
@@ -81,28 +82,30 @@ void mon(void)
        set_unix_terminal();
 
        /* start CPU emulation */
+#if 1
+ assert(cpu_dev);
+ while (true) {
+  *cpu_dev->m_icountptr += 1000;
+  cpu_dev->execute_run();
+  //fputc('.', stderr);
+ }
+#else
        cpu_state = CONTIN_RUN;
        cpu_error = NONE;
        switch(cpu) {
        case Z80:
-#if 1
- assert(false);
-#else
                cpu_z80();
-#endif
                break;
        case I8080:
-#if 1
- assert(false);
-#else
                cpu_8080();
-#endif
                break;
        }
+#endif
 
        /* reset terminal */
        reset_unix_terminal();
 
+#if 0
        /* check for CPU emulation errors and report */
        switch (cpu_error) {
        case NONE:
@@ -147,6 +150,7 @@ void mon(void)
                printf("\nUnknown error %d\n", cpu_error);
                break;
        }
+#endif
 }
 
 /*
index bc8cd96..0dc1847 100644 (file)
@@ -49,6 +49,7 @@
  */
 
 #include <stddef.h>
+#include "emu.h"
 #include "sim.h"
 
 #define MAXCHAN 5      /* max number of channels for I/O busy detect */
@@ -58,6 +59,9 @@
  */
 int cpu = DEFAULT_CPU;
 
+#if 1
+cpu_device *cpu_dev;
+#else
 /*
  *     CPU Registers
  */
@@ -82,8 +86,10 @@ int m1_step;                 /* flag for waiting at M1 in single step */
 
 BYTE io_port;                  /* I/O port used */
 BYTE io_data;                  /* data on I/O port */
+#endif
 int busy_loop_cnt[MAXCHAN];    /* counters for I/O busy loop detection */
 
+#if 0
 BYTE cpu_state;                        /* state of CPU emulation */
 int cpu_error;                 /* error status of CPU emulation */
 int int_mode;                  /* CPU interrupt mode (IM 0, IM 1, IM 2) */
@@ -92,6 +98,7 @@ int int_int;                  /* interrupt request */
 int int_data = -1;             /* data from interrupting device on data bus */
 int int_protection;            /* to delay interrupts after EI */
 BYTE bus_request;              /* request address/data bus from CPU */
+#endif
 int tmax;                      /* max t-states to execute in 10ms */
 
 /*
index b9a96de..53b8706 100644 (file)
 
 extern int     cpu;
 
+#if 1
+#include "emu.h"
+extern cpu_device *cpu_dev;
+#else
 extern BYTE    A, B, C, D, E, H, L, A_, B_, C_, D_, E_, H_, L_, I, IFF;
 extern WORD    PC, SP, IX, IY;
 extern int     F, F_;
@@ -63,10 +67,14 @@ extern int  m1_step;
 
 extern BYTE    cpu_state, bus_request;
 extern int     int_data;
+#endif
 
-extern int     s_flag, l_flag, m_flag, x_flag, break_flag, i_flag, f_flag,
+extern int     s_flag, l_flag, m_flag, x_flag, i_flag, f_flag;
+#if 0
+extern int     break_flag,
                cpu_error, int_nmi, int_int, int_mode, parity[], sb_next,
                int_protection;
+#endif
 
 #ifdef Z80_UNDOC
 extern int     u_flag;
index fbc770a..94cfe4b 100644 (file)
@@ -54,6 +54,7 @@
  *     term_int()      : handler for signal SIGTERM when process is killed
  */
 
+#include <assert.h> // temporary
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -97,16 +98,24 @@ static void user_int(int sig)
 {
        sig = sig;      /* to avoid compiler warning */
 
+#if 1
+ assert(false);
+#else
        cpu_error = USERINT;
        cpu_state = STOPPED;
+#endif
 }
 
 static void quit_int(int sig)
 {
        sig = sig;      /* to avoid compiler warning */
 
+#if 1
+ assert(false);
+#else
        cpu_error = USERINT;
        cpu_state = STOPPED;
+#endif
 }
 
 static void term_int(int sig)
index 48e8e78..5b05517 100644 (file)
@@ -50,7 +50,7 @@ Hitachi HD647180 series:
 
  *****************************************************************************/
 
-#include "emu.h"
+//#include "emu.h"
 #include "z180.h"
 //#include "z180dasm.h"
 #include "debugger.h"
@@ -81,14 +81,14 @@ Hitachi HD647180 series:
 //nickDEFINE_DEVICE_TYPE(Z180, z180_device, "z180", "Zilog Z180")
 
 
-//nickz180_device::z180_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+z180_device::z180_device(/*const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock*/)
 //nick : cpu_device(mconfig, Z180, tag, owner, clock)
 //nick , z80_daisy_chain_interface(mconfig, *this)
 //nick , m_program_config("program", ENDIANNESS_LITTLE, 8, 20, 0)
 //nick , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0)
 //nick , m_decrypted_opcodes_config("program", ENDIANNESS_LITTLE, 8, 20, 0)
-//nick{
-//nick}
+{
+}
 
 //nickstd::unique_ptr<util::disasm_interface> z180_device::create_disassembler()
 //nick{
@@ -2160,8 +2160,8 @@ void z180_device::device_start()
 //nick save_item(NAME(m_ioltemp));
 //nick
 //nick save_item(NAME(m_mmu));
-//nick
-//nick set_icountptr(m_icount);
+
+       set_icountptr(m_icount);
 }
 
 /****************************************************************************
index 7e31c68..e16625d 100644 (file)
@@ -5,6 +5,7 @@
 
 #pragma once
 
+#include "emu.h"
 #include "machine/z80daisy.h"
 
 
@@ -129,12 +130,12 @@ class z180_device : public cpu_device, public z80_daisy_chain_interface
 {
 public:
        // construction/destruction
-       z180_device(const machine_config &mconfig, const char *_tag, device_t *_owner, uint32_t _clock);
+       z180_device(/*const machine_config &mconfig, const char *_tag, device_t *_owner, uint32_t _clock*/);
 
        bool get_tend0();
        bool get_tend1();
 
-protected:
+//nickprotected:
        // device-level overrides
        virtual void device_start() override;
        virtual void device_reset() override;
@@ -161,7 +162,7 @@ protected:
        // device_disasm_interface overrides
 //nick virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
 
-private:
+//nickprivate:
 //nick address_space_config m_program_config;
 //nick address_space_config m_io_config;
 //nick address_space_config m_decrypted_opcodes_config;
@@ -188,7 +189,7 @@ private:
        uint8_t   m_dma1_cnt;                       /* dma1 counter / divide by 20 */
        address_space *m_program;
 //nick memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
-       address_space *m_oprogram;
+//nick address_space *m_oprogram;
 //nick memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_ocache;
        address_space *m_iospace;
        uint8_t   m_rtemp;
index 7abef5e..febe58e 100644 (file)
  ***************************************************************/
 inline u8 z180_device::IN(u16 port)
 {
+#if 0 // temporary
        if(((port ^ IO_IOCR) & 0xffc0) == 0)
                return z180_readcontrol(port);
+#endif
        m_extra_cycles += ((IO_DCNTL & (Z180_DCNTL_IWI1 | Z180_DCNTL_IWI0)) >> 4) + 1; // external I/O wait states
        return m_iospace->read_byte(port);
 }
@@ -35,9 +37,11 @@ inline u8 z180_device::IN(u16 port)
  ***************************************************************/
 inline void z180_device::OUT(u16 port, u8 value)
 {
+#if 0 // temporary
        if (((port ^ IO_IOCR) & 0xffc0) == 0) {
                z180_writecontrol(port,value);
        } else
+#endif
        {
                m_extra_cycles += ((IO_DCNTL & (Z180_DCNTL_IWI1 | Z180_DCNTL_IWI0)) >> 4) + 1; // external I/O wait states
                m_iospace->write_byte(port, value);