Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
0d1a642
- corrected to use MONOCHROME_INVERTED
May 29, 2024
eac5313
- added logging of LEDs on write to 0x740000
Jun 2, 2024
49be4d1
- fix for memory sizing tests
Jun 5, 2024
162cc78
- removed nomem_r; just need to test memory bounds wrt *word* offset
Jun 6, 2024
3e906ff
- Display control selftest now passes; no idea what bit 4,5 & 6 repre…
Jun 6, 2024
3e5c404
- map_w tests WRenable before writing
Jun 8, 2024
deb3f44
- added a MAXRAM define to me able select +1MB ram option or +3MB ram…
Jun 8, 2024
53d07b3
- if FC2 do not do address translation; supervisor is pa
Jun 9, 2024
8207717
- added a (required_device) acia device
Jun 9, 2024
cbd4240
- wip getting MMU map_control bits right; we get all the way to VM se…
Jun 11, 2024
2929d2c
- pmackinlay helped decode SysWrEn logic, now passes Virtual Mem sel…
Jun 12, 2024
744f40d
- fixed mouse button mappings for left,middle,right
Jun 12, 2024
a0631b0
- seems to be relying on timer IRQ
Jun 12, 2024
c19e41f
- added timer IRQ.. I think...
Jun 12, 2024
586dced
- enable duart loopback mode iff m_diag & 0x80. Keyboard Interface s…
Jun 13, 2024
6007ec8
- input merger of cnt1 and cnt2 to assert IRQ1
Jun 14, 2024
7dfcf70
- removed unused experiment
Jun 14, 2024
d241e46
- cleaning up more experiments
Jun 14, 2024
5a10bcc
- videoaddr is 16-bit reads/writes
Jun 14, 2024
ae502d5
- made irq1 latch state a member var (m_u244latch)
Jun 15, 2024
04701f0
- added atari ST graycode mouse processing but I think 4404 is expect…
Jun 15, 2024
99917da
- added pretty LEDs at the bottom of the display that are located ins…
Jun 16, 2024
1fbbba5
- nicer layout of LEDs
Jun 17, 2024
c559103
- explicit first value as we use it for array indexing
Jun 17, 2024
be58a32
- fixed wrong log message for cascading TCs
Jun 18, 2024
20d4b2f
- wip
Jun 19, 2024
ff57abd
- more comments
Jun 20, 2024
24891bb
- .noprw() for 0x80004000-0xffffffff since selftest blasts writes at…
Jun 22, 2024
4dc1ee1
- added derived ncr5385 that blinks an LED during activity
Jun 22, 2024
7d27942
- renamed to attachLED()
Jun 23, 2024
8f6cfa4
- fixed xtal for RTC to 32768 Hz
Jun 23, 2024
acdaa96
- honour Invert Video by flipping bits in screen_update
Jun 25, 2024
9695738
- tek4404 selftest writes 0xff as command (invalid command) and expec…
Jun 26, 2024
61c43ff
- some readability tweaks
Jun 27, 2024
625d409
- wip mouse reading; unclear how it expects m_diag to be mixed in
Jun 28, 2024
da05f4b
- wrapping logerror() with LOGWARN macro
Jun 30, 2024
51d98b8
- disable logging
Jun 30, 2024
e9df650
- remove test logging
Jun 30, 2024
965657a
- is there something not right on completing a DATA OUT operation? T…
Jul 14, 2024
6be1e38
- added some more LOG_MOED and LOG_TC logging
Jul 14, 2024
c6b77d6
- added more logging
Jul 14, 2024
bded0ef
- fixing formatting
Jul 14, 2024
00b3dae
- removed derived led_ncr5385
Jul 15, 2024
581b8e5
- log device status lines in the same order as controller lines for m…
Aug 17, 2024
49fae5c
- page PID == 0 does not do page protection
Aug 17, 2024
defabf0
- more logging
Aug 17, 2024
6ef13fb
- adding a 5ms delay before raising BUS_SERVICE on XFI_OUT_REQ allows…
Aug 24, 2024
7db1c78
- getting back to passing selftest again; hunch is the VM mapping is …
Aug 25, 2024
aa58d88
- reading videocntl_r returns hblank status too
Aug 26, 2024
77bef29
- removed hacked extra state and add a 3.5ms delay after XFI_OUT_ACK
Aug 26, 2024
aeab71c
- added m_latched_map_control in front of write to m_map_control that…
Aug 30, 2024
1f7bc6b
- turn off spammy logging
Aug 30, 2024
bb8647c
- wip but passes selftest and begins booting; is there some uninitia…
Aug 30, 2024
f4c955d
- need to clear m_latched_map_control so we dont keep copying..
Aug 30, 2024
62fc6fd
- cleaning up
Aug 31, 2024
648cd5a
- added m68010_tekmmu_device that implements memory_translate()
Aug 31, 2024
4a41077
- Tek4404 needs 3.5 us (not ms!) delay to allow controller to see IRQ…
Sep 28, 2024
7f9e1ea
- USE_MMU to perform mmu translation inside m_write/m_read etc
Sep 28, 2024
c45703f
- log every non-zero PTe
Oct 8, 2024
fba5c28
- trying to use m_readimm16 etc; does not get as far as simple hacki…
Oct 10, 2024
17bbbc5
- trying to fix mmu_translate_address.. still fails selftest whewreas…
Oct 10, 2024
b3e1adf
- formatting
Oct 15, 2024
bc9e295
- get_fc() does not return SR, need to use register variable m_s_flag..
Oct 26, 2024
12d31d7
- use m_s_flag not get_fc()
Oct 28, 2024
1a247e4
- don't make special case of PID=0; selftest fails with it!
Oct 30, 2024
90cf3be
- usec not nsec!
Oct 30, 2024
c3f52a2
- wip to add internal_map to m68010_tekmmu_device predicated on USE_I…
Nov 10, 2024
5f3fef7
- use is_user() method for determining whether to use MMU
Nov 10, 2024
9796643
- removed is_user() since we know get_fc() works as expected
Nov 19, 2024
5879363
- without masking out bits before regenerating, Uniflex does not boot
Dec 22, 2024
4ef6b4d
- fixed wrong log message for cascading TCs
Jun 18, 2024
54b3e10
- fixing formatting
Jul 14, 2024
28a41e5
- added m68010_tekmmu_device that implements memory_translate()
Aug 31, 2024
c135ba6
- restoring SCSI_BUS_SKEW that was changed..
Dec 22, 2024
e737ea2
- bad merge
Dec 22, 2024
5cc28f1
- wip but with fixes from @shattered, now boots and gets to login prompt
Dec 27, 2024
877c146
- fixes for gating VBenable as suggested by @shattered
Dec 28, 2024
2b4181f
- removed masking as its already in master for some reason..
Dec 29, 2024
1045ab4
- dont wait for 250 timeout (@shattered fix); hugely increases HD per…
Dec 29, 2024
0713abe
- less spammy logging
Jan 4, 2025
67af90f
- mouse input kinda works (thanks Phil)
Jan 4, 2025
7d1e33b
- fixed fine scrolling
Jan 4, 2025
b576ffd
- LOG_MMU for map_rw
Jan 4, 2025
78bf13a
- video address panning almost works; something wrong with vertical s…
Jan 4, 2025
7026abe
- nvram stored as 4-bit nybbles (used for MAC address)
Jan 5, 2025
3cab62b
- page 2.1-52 shows WrMapEn coming directly from latch
Jan 14, 2025
8213145
- wip of NS32081 interface
Jan 14, 2025
55cbcd7
- copy m_latched_map_control => m_map_control on every user access
Jan 14, 2025
9c0857e
- ns32081 interface seems to work
Jan 16, 2025
b6dfc78
less spammy
Jan 16, 2025
049f4e4
- fpu_latch... returns enum of result type
Jan 17, 2025
df59ee3
- disable video panning for now; something not right with address calc
Jan 17, 2025
6ba8bc6
- switched to using device/machine/ns32081 for fpu support
Jan 17, 2025
7486538
- easier to read logging of MMU state changes
Jan 19, 2025
0e1b304
- removed MACHINE_NOT_WORKING Woot!
Jan 19, 2025
711c2e0
- added am7990 / lance ethernet controller
Jan 21, 2025
4695fb1
- added x2210 nvram chip
Jan 21, 2025
f659865
- removed junk
Jan 21, 2025
b808b09
- use accurate palette for CRT color
Jan 22, 2025
41bb1db
- tweaked palette
Jan 22, 2025
2b0bc46
- warnings
Jan 23, 2025
e512354
- explicit declaration to get templates to instantiate. Unclear why
Jan 23, 2025
9e2f0b0
- screen panning works; unhappy with the magic offset
Jan 23, 2025
a5b18bf
- disable logging
Jan 23, 2025
09cdb3a
- initialised virtual functions now fixed
Jan 24, 2025
3411ec3
- restored logging level
Jan 24, 2025
5abc6c3
- restore using bitsavers rom dump
Jan 24, 2025
8faa18d
- use constexpr
Jan 24, 2025
9c45c03
- headers in alphabetical order
Jan 24, 2025
fa568ee
- restored logic and logging for buswidth select
Jan 24, 2025
06b3cb7
- restored using logerror
Jan 24, 2025
46189e0
- use corrected SPC name
Jan 24, 2025
9fd3202
- RTC is writing to more than offset#0!
Jan 24, 2025
31d8b74
- am7990 uses Int2
Jan 26, 2025
2b9c6ed
- lance now gets MAC address
Jan 26, 2025
73147af
- unused
Jan 27, 2025
67d174b
- removed static oldmx / oldmy
Jan 27, 2025
3aaa83c
- removed unused map at 0x7ba100 (predates adding mc146818_device?)
Jan 27, 2025
2712deb
- missed removal of declaration of rtc_r / rtc_w
Jan 27, 2025
9824f68
- restored logic dealing with resetting TPInt
Jan 27, 2025
ddf726a
- removed comment
Jan 28, 2025
c1b2bea
- cleanup
Jan 28, 2025
76091ef
- fixed video panning
Jan 28, 2025
86deee9
- added a delay to IRQ_2 delivery for LANCE
Jan 28, 2025
c9417bb
- as far as I can tell lance expects physical memory not virtual
Jan 28, 2025
443c4bd
- lance doesnt hang but 2us delay doesnt fix problem
Jan 28, 2025
be7a510
- selftest loop is 35 cycles, so for 4 loops we need a delay of 14-15us
Jan 29, 2025
4a834b9
- use LOGMASKED(LOG_MMU for MMU logs
Jan 29, 2025
493093f
- need to convert byte offset to word offset for dma
Jan 30, 2025
f655b90
- restoring logs
Jan 30, 2025
f7dcbaa
- restoring formatting
Jan 30, 2025
b9c8c64
- removing dev logging level
Jan 30, 2025
51973a7
- empty line
Jan 30, 2025
320a0f9
- unused enum
Jan 30, 2025
dffd0e1
- formatting
Jan 30, 2025
33f5da2
- was seeing access beyond 0x1f
Jan 30, 2025
57b577d
- removed temp irq2 delay
Jan 30, 2025
65c62b1
- restored unused LOG_OUTPUT_FUNC
Jan 30, 2025
bb73f1f
- give explicit mouse button binding to avoid auto mapping spacebar t…
Jan 30, 2025
babbfa2
- remove test rom data reference
Jan 30, 2025
365801f
- doh, panning needs to use 16-bit arithmetic to avoid very large neg…
Jan 30, 2025
e8381f6
- middle mouse button not showing on Mac...
Jan 31, 2025
46b70eb
- consistent naming for nvram access
Feb 1, 2025
4085647
- Micropolis 1304 activity LED was red
Feb 1, 2025
a278694
- add timestamps to LOG_STATE logs
Feb 3, 2025
1765cff
- missed a log line showing delay hack
Feb 3, 2025
99da289
- more blinky activity LED
Feb 3, 2025
00012e4
- missed rename of nvram access functions
Feb 3, 2025
ec9f806
- revert random change to ncr5385 mapping
Feb 3, 2025
e1bf628
- PM refactor to always progress
Feb 3, 2025
01e9460
- needs to be 40us progression; zero doesn't work
Feb 3, 2025
63a407b
- more timestamps on logs
Feb 4, 2025
cbb2cca
- int_status_r is read from inside the IRQ3, clears internal flag and…
Feb 4, 2025
b30367e
- seems unnecessary
Feb 20, 2025
687b7f0
- not seeing disk hangs with a longer delay
Feb 20, 2025
dc18e76
- we do need m_printer HACK to allow timer to be serviced
Feb 21, 2025
7de4e4e
- int_status_r with much longer delay is much more stable..
Mar 16, 2025
4033730
- added an wrapping <bounds> around elements
Mar 26, 2025
4d40fea
- fix for handling timer IRQ1
Mar 26, 2025
6558c3c
- add Monitor with ActiveWindow before any others
Mar 26, 2025
fa5e435
- added Adam Billyard as author
Mar 26, 2025
654fbe6
- use authors:
Mar 26, 2025
87a26f5
- renamed bootrom from "maincpu" to "bootrom"
Mar 30, 2025
5487388
- restoring sane key mappings
Mar 31, 2025
a998398
- more keymapping madness
Mar 31, 2025
720d8ab
- looking at the tek scsi write loop, it has very specific timings; a…
Apr 10, 2025
ff30d07
- instrumenting sequence of IRQ processing; occasionally the IRQ gets…
Apr 12, 2025
e03b198
- twiddling delays
Apr 23, 2025
06b39fd
- fix for SFSR and LDSR opcodes that dont compute anything
Apr 27, 2025
3ff44ca
- Mackinlay say no..
May 11, 2025
9c89615
- magic delays
May 11, 2025
f594e0b
- disable logging
May 11, 2025
fd833e3
Revert "diserial: reset the receive register when changing frame form…
Jul 3, 2025
5b670a8
- dont use raw printfs!
Jul 7, 2025
8a90825
- dont alter MAP_SYS_WR_ENABLE on memory_w!
Jul 7, 2025
e3696d3
- fill screen with black if turned off
Jul 7, 2025
62f1ba5
- trying to get -validate to succeed
Jul 14, 2025
cefb0a6
- do not override memory_translate(() if we are doing MMU translation…
Jul 18, 2025
6d270c1
- vblank bits
Jul 18, 2025
6b4a9d7
- more vblank bits
Jul 18, 2025
29e51fa
- disable debug hacks for tracking what kernel is doing. use ctrace :-)
Jul 18, 2025
7480bf3
- use new m68010_device ctor that takes a type param; woot, validate …
Jul 20, 2025
1e28766
- tweak feature bits; do we call ncr5385 timing issue a DISK issue?
Jul 20, 2025
34e5823
- make derived class ctor protected
Jul 21, 2025
3a15aff
- keep getting random colors using rgb_t::white()..
Sep 13, 2025
4f4906f
- experiment vblank without using m_vint stuff..
Oct 31, 2025
10c6993
- more random VBL hacks to resolve ncr5385 getting IRQ3 very delayed
Nov 2, 2025
211b6d5
- removing explicit vblank_irq function
Nov 2, 2025
3d36743
- log raising IRQ_3
Nov 2, 2025
7749d65
- VIntEn does double duty to both allow VBlank and also to lower the …
Nov 12, 2025
186ba4a
- merge error
Nov 13, 2025
7243289
- always report SoundRdy ready
Nov 13, 2025
d2baa16
- predicate on USE_TEK4404_CHANGES
Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 100 additions & 22 deletions src/devices/machine/ncr5385.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,38 @@
* - disconnect/reselection
*/


// REQUIRED delay for tek4404 to write successfully

// Tek4404 expects to be able to call 2 functions that clear any pending state and setup an
// internal flag *BEFORE* the IRQ generated by XFI_OUT_ACK is received. Without this delay the IRQ arrives
// before the setup has been executed and IRQ handler fails to process the interrupt. => HANGS
// A correctly functioning call sequence looks like this:

// SCSI_wait
// scsi_update_pending_flags
// IRQ3_handler_scsi
// scsi_read_ncr5385_status

// A broken call sequence looks like this (note the setup functions are run too late)

// IRQ3_handler_scsi
// scsi_read_ncr5385_status
// SCSI_wait
// scsi_update_pending_flags

// scsi write code is ~90 cycles / loop

// then ~240 cycles before setting SR |= 0700

// IRQ6 occasionally arrives between end of scsi write code and getting IRQ3. unclear why it isn't masked out.

// 40us
unsigned constexpr TEK4404_XFI_OUT_ACK_DELAY = 10'000;

// define USE_TEK4404_CHANGES to work on tek4404 driver


#include "emu.h"
#include "ncr5385.h"

Expand Down Expand Up @@ -162,25 +194,35 @@ void ncr5385_device::device_reset()
update_int();
}

attotime ncr5385_device::scsi_data_byte_period()
{
#ifdef USE_TEK4404_CHANGES
return attotime::from_nsec(200);
#else
return attotime::zero;
#endif
}
Comment on lines +199 to +204
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate C/C++ compile switches with a passion. attotime::zero is a fallback that obviously needs changing depending on the controller needs.
Also: where this magic number comes from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change does not make sense and will have no effect; ncr5385_device is not derived from nscsi_full_device.


void ncr5385_device::scsi_ctrl_changed()
{
u32 const ctrl = scsi_bus->ctrl_r();

static char const *const nscsi_phase[] = { "DATA OUT", "DATA IN", "COMMAND", "STATUS", "*", "*", "MESSAGE OUT", "MESSAGE IN" };

if ((ctrl & S_BSY) && !(ctrl & S_SEL))
if (ctrl & S_BSY)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have previously suggested this change, and I confirm it's good; I think this is the only change required to ncr5385.cpp.

{
LOGMASKED(LOG_STATE, "scsi_ctrl_changed 0x%03x phase %s%s%s\n", ctrl, nscsi_phase[ctrl & S_PHASE_MASK],
ctrl & S_REQ ? " REQ" : "", ctrl & S_ACK ? " ACK" : "");
if (ctrl & S_SEL)
LOGMASKED(LOG_STATE, "%10s: scsi_ctrl_changed 0x%03x arbitration/selection\n", machine().time().as_string(8), ctrl);
else
LOGMASKED(LOG_STATE, "%10s: scsi_ctrl_changed 0x%03x phase %s%s%s\n", machine().time().as_string(8), ctrl, nscsi_phase[ctrl & S_PHASE_MASK],
ctrl & S_REQ ? " REQ" : "", ctrl & S_ACK ? " ACK" : "");

if (m_state != IDLE)
m_state_timer->adjust(attotime::zero);
m_state_timer->adjust(attotime::from_usec(80));
}
else if (ctrl & S_BSY)
LOGMASKED(LOG_STATE, "scsi_ctrl_changed 0x%03x arbitration/selection\n", ctrl);
else
{
LOGMASKED(LOG_STATE, "scsi_ctrl_changed 0x%03x BUS FREE\n", ctrl);
LOGMASKED(LOG_STATE, "%10s: scsi_ctrl_changed 0x%03x BUS FREE\n", machine().time().as_string(8), ctrl);

if (m_mode == INITIATOR)
{
Expand Down Expand Up @@ -253,7 +295,7 @@ u8 ncr5385_device::aux_status_r()
if (ctrl & S_INP)
data |= AUX_STATUS_IO;
}
LOGMASKED(LOG_REGR, "aux_status_r 0x%02x (%s)\n", data, machine().describe_context());
LOGMASKED(LOG_REGR, "%10s: aux_status_r 0x%02x (%s)\n", machine().time().as_string(8), data, machine().describe_context());

return data;
}
Expand All @@ -266,7 +308,7 @@ u8 ncr5385_device::own_id_r()
u8 ncr5385_device::int_status_r()
{
u8 const data = m_int_status;
LOGMASKED(LOG_REGR, "int_status_r 0x%02x (%s)\n", data, machine().describe_context());
LOGMASKED(LOG_REGR, "%10s: int_status_r 0x%02x (%s)\n", machine().time().as_string(8), data, machine().describe_context());
m_aux_status &= ~AUX_STATUS_PARITY_ERR;
m_int_status = 0;
update_int();
Expand Down Expand Up @@ -315,7 +357,7 @@ void ncr5385_device::dat_w(u8 data)

void ncr5385_device::cmd_w(u8 data)
{
LOGMASKED(LOG_REGW, "cmd_w 0x%02x (%s)\n", data, machine().describe_context());
LOGMASKED(LOG_REGW, "%10s: cmd_w 0x%02x (%s)\n", machine().time().as_string(8), data, machine().describe_context());
if (!(data & 0x18))
{
// immediate commands
Expand Down Expand Up @@ -449,6 +491,8 @@ template <unsigned N> void ncr5385_device::cnt_w(u8 data)
m_aux_status &= ~AUX_STATUS_TC_ZERO;
else
m_aux_status |= AUX_STATUS_TC_ZERO;

LOGMASKED(LOG_REGW, "%10s: cnt_w %d (%d) \n", machine().time().as_string(8), m_cnt, N);
}

void ncr5385_device::tst_w(u8 data)
Expand Down Expand Up @@ -556,7 +600,7 @@ int ncr5385_device::state_step()
break;

case SEL_START:
LOGMASKED(LOG_STATE, "selection: SEL asserted\n");
LOGMASKED(LOG_STATE, "%10s: selection: SEL asserted\n", machine().time().as_string(8));
m_state = SEL_DELAY;
delay = SCSI_BUS_SKEW * 2;

Expand All @@ -578,7 +622,7 @@ int ncr5385_device::state_step()
case SEL_WAIT_BSY:
if (ctrl & S_BSY)
{
LOGMASKED(LOG_STATE, "selection: BSY asserted by target\n");
LOGMASKED(LOG_STATE, "%10s: selection: BSY asserted by target\n", machine().time().as_string(8));
m_state = SEL_COMPLETE;
delay = SCSI_BUS_SKEW * 2;
}
Expand All @@ -594,7 +638,7 @@ int ncr5385_device::state_step()
}
break;
case SEL_COMPLETE:
LOGMASKED(LOG_STATE, "selection: complete\n");
LOGMASKED(LOG_STATE, "%10s: selection: complete\n", machine().time().as_string(8));
m_int_status |= INT_FUNC_COMPLETE;
m_mode = INITIATOR;
m_state = SEL_WAIT_REQ;
Expand All @@ -610,7 +654,7 @@ int ncr5385_device::state_step()
// don't generate bus service interrupt until the function complete is cleared
if ((ctrl & S_REQ) && !m_int_state)
{
LOGMASKED(LOG_STATE, "selection: REQ asserted by target\n");
LOGMASKED(LOG_STATE, "%10s: selection: REQ asserted by target\n", machine().time().as_string(8));
m_int_status |= INT_BUS_SERVICE;
m_state = IDLE;

Expand Down Expand Up @@ -647,7 +691,7 @@ int ncr5385_device::state_step()
}
else
{
LOGMASKED(LOG_STATE, "xfi_in: %s\n", remaining() ? "phase change" : "transfer complete");
//LOGMASKED(LOG_STATE, "xfi_in: %s\n", remaining() ? "phase change" : "transfer complete");

m_int_status |= INT_BUS_SERVICE;
m_state = IDLE;
Expand All @@ -661,7 +705,7 @@ int ncr5385_device::state_step()
case XFI_IN_DRQ:
m_state = XFI_IN_ACK;

LOGMASKED(LOG_STATE, "xfi_in: data 0x%02x\n", m_dat);
//LOGMASKED(LOG_STATE, "%10s: xfi_in: data 0x%02x\n", machine().time().as_string(8), m_dat);

// assert ACK
scsi_bus->ctrl_w(scsi_refid, S_ACK, S_ACK);
Expand All @@ -675,7 +719,7 @@ int ncr5385_device::state_step()
{
m_cnt--;

LOGMASKED(LOG_STATE, "xfi_in: %d remaining\n", m_cnt);
//LOGMASKED(LOG_STATE, "%10s: xfi_in: %d remaining\n", machine().time().as_string(8), m_cnt);

if (!m_cnt)
m_aux_status |= AUX_STATUS_TC_ZERO;
Expand All @@ -686,6 +730,8 @@ int ncr5385_device::state_step()
// clear ACK except after last byte of message input phase
if (!remaining() && (ctrl & S_PHASE_MASK) == S_PHASE_MSG_IN)
{
//LOGMASKED(LOG_STATE, "xfi_in: INT_FUNC_COMPLETE\n" );

m_int_status |= INT_FUNC_COMPLETE;
m_state = IDLE;

Expand Down Expand Up @@ -715,7 +761,8 @@ int ncr5385_device::state_step()
}
else
{
LOGMASKED(LOG_STATE, "xfi_out: %s\n", remaining() ? "phase change" : "transfer complete");
LOGMASKED(LOG_STATE, "%10s: xfi_out: %s\n", machine().time().as_string(8), remaining() ? "phase change" : "transfer complete");

m_int_status |= INT_BUS_SERVICE;
m_state = IDLE;

Expand All @@ -725,11 +772,12 @@ int ncr5385_device::state_step()
else
delay = -1;
break;

case XFI_OUT_DRQ:
m_state = XFI_OUT_ACK;
m_aux_status &= ~AUX_STATUS_DATA_FULL;

LOGMASKED(LOG_STATE, "xfi_out: data 0x%02x\n", m_dat);
LOGMASKED(LOG_STATE, "%10s: xfi_out: data 0x%02x\n", machine().time().as_string(8), m_dat);

// assert data and ACK
scsi_bus->data_w(scsi_refid, m_dat);
Expand All @@ -750,7 +798,7 @@ int ncr5385_device::state_step()
{
m_cnt--;

LOGMASKED(LOG_STATE, "xfi_out: %d remaining\n", m_cnt);
LOGMASKED(LOG_STATE, "%10s: xfi_out: %d remaining\n", machine().time().as_string(8), m_cnt);

if (!m_cnt)
m_aux_status |= AUX_STATUS_TC_ZERO;
Expand All @@ -761,6 +809,36 @@ int ncr5385_device::state_step()
// clear data and ACK
scsi_bus->data_w(scsi_refid, 0);
scsi_bus->ctrl_w(scsi_refid, 0, S_ACK);

if (m_cnt == 0)
{
#ifdef USE_TEK4404_CHANGES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested simulating a slow hard disk instead of this change, and it can successfully complete the "diskrepair" and reach a login prompt. I don't have the knowledge of this system to test further, but I believe this change is wrong and the delay occur in the target, not this device.

// REQUIRED delay for tek4404 to write successfully

// Tek4404 expects to be able to call 2 functions that clear any pending state and setup an
// internal flag *BEFORE* the IRQ generated here is received. Without this delay the IRQ arrives
// before the setup has been executed and IRQ handler fails to process the interrupt.
// A correctly functioning call sequence looks like this:

// set_flags_handling_clear_pending
// scsi_update_pending_flags
// IRQ3_handler_scsi
// scsi_read_ncr5385_status

// A broken call sequence looks like this (note the setup functions are run too late)

// IRQ3_handler_scsi
// scsi_read_ncr5385_status
// set_flags_handling_clear_pending
// scsi_update_pending_flags

// scsi write code is ~90 cycles / loop

delay = TEK4404_XFI_OUT_ACK_DELAY;
LOGMASKED(LOG_STATE, "%10s: XFI_OUT_ACK delay %d\n", machine().time().as_string(8), delay);
#endif
}

}
else
delay = -1;
Expand All @@ -773,7 +851,7 @@ int ncr5385_device::state_step()
m_state = XFI_OUT_DRQ;
else
{
LOGMASKED(LOG_STATE, "xfi_out: %s\n", remaining() ? "phase change" : "transfer complete");
LOGMASKED(LOG_STATE, "%10s: xfi_out: %s\n", machine().time().as_string(8), remaining() ? "phase change" : "transfer complete");
m_int_status |= INT_BUS_SERVICE;
m_state = IDLE;

Expand Down Expand Up @@ -821,7 +899,7 @@ void ncr5385_device::update_int()

if (m_int_state != int_state)
{
LOG("update_int %d\n", int_state);
LOG("%10s: update_int %d\n", machine().time().as_string(8), int_state);

m_aux_status &= ~(AUX_STATUS_MSG | AUX_STATUS_CD | AUX_STATUS_IO);
if (int_state)
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/ncr5385.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class ncr5385_device
virtual void device_reset() override ATTR_COLD;

// ncsci_device implementation
virtual attotime scsi_data_byte_period();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this is not overriding the base method and manages to compile anyway? Is this ncr5385_device supposed to be a nscsi_full_device, and this function essentially do nothing here?

virtual void scsi_ctrl_changed() override;

// read handlers
Expand Down
8 changes: 4 additions & 4 deletions src/devices/machine/ns32081.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ template <typename T> T ns32081_device_base::read()
return data;
}

logerror("read protocol error (%s)\n", machine().describe_context());
logerror("read protocol error state(%d) issue(%d) expected(%d) (%s)\n", m_state, m_op[2].issued, m_op[2].expected, machine().describe_context());
return 0;
}

Expand All @@ -149,7 +149,7 @@ template <typename T> void ns32081_device_base::write(T data)
}
else
{
LOG("write idbyte 0x%04x (%s)\n", data, machine().describe_context());
LOG("write idbyte 0x%02x (%s)\n", data, machine().describe_context());
if ((data == FORMAT_9) || (data == FORMAT_11) || (type() == NS32381 && data == FORMAT_12))
{
// record idbyte
Expand Down Expand Up @@ -633,9 +633,9 @@ void ns32081_device_base::execute()
}

if (m_status & SLAVE_Q)
LOG("execute %s 0x%x,0x%x exception\n", operation, m_op[0].value, m_op[1].value);
LOG("execute %s 0x%8.8x,0x%8.8x exception\n", operation, m_op[0].value, m_op[1].value);
else
LOG("execute %s 0x%x,0x%x result 0x%x\n", operation, m_op[0].value, m_op[1].value, m_op[2].value);
LOG("execute %s 0x%8.8x,0x%8.8x result 0x%x\n", operation, m_op[0].value, m_op[1].value, m_op[2].value);
}

// write-back floating point register results
Expand Down
4 changes: 3 additions & 1 deletion src/emu/diserial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,10 @@ void device_serial_interface::set_data_frame(int start_bit_count, int data_bit_c
{
m_rcv_bit_count++;
}

#ifndef USE_TEK4404_CHANGES
receive_register_reset();
#endif
Comment on lines +207 to +209
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hacking diserial, do this:

index dbefa1507be..e19716e8661 100644
--- a/src/devices/machine/mc68681.cpp
+++ b/src/devices/machine/mc68681.cpp
@@ -1641,6 +1641,7 @@ void duart_channel::write_chan_reg(int reg, uint8_t data)

 void duart_channel::write_MR(uint8_t data)
 {
+       bool const frame_change = (MR_ptr == 0) ? ((MR1 ^ data) & 0x1f) : ((MR2 ^ data) & 0x0f);
        if (MR_ptr == 0)
        {
                MR1 = data;
@@ -1650,7 +1651,8 @@ void duart_channel::write_MR(uint8_t data)
        {
                MR2 = data;
        }
-       recalc_framing();
+       if (frame_change)
+               recalc_framing();
        update_interrupts();
 }```


}

void device_serial_interface::receive_register_reset()
Expand Down
52 changes: 52 additions & 0 deletions src/mame/layout/tek4404.lay
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<!--
license:CC0-1.0
authors: Elektraglide

Tektronix 4404 Artificial Intelligence System.
-->
<mamelayout version="2">
<element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element>
<element name="led_round" defstate="1">
<disk state="1">
<color red="0.2" green="0.0" blue="0.0" />
</disk>
<disk state="0">
<color red="1.0" green="0.0" blue="0.0" />
</disk>
</element>
<element name="led_rect" defstate="1">
<rect state="1">
<color red="0.2" green="0.0" blue="0.0" />
</rect>
<rect state="0">
<color red="1.0" green="0.1" blue="0.1" />
</rect>
</element>
<view name="Graphics">
<bounds x="0" y="0" width="640" height="496" />

<screen index="0">
<bounds x="0" y="0" width="640" height="480" />
</screen>
<element name="spacer" ref="static_black">
<bounds x="0" y="480" width="640" height="16" />
</element>

<element name="led_1" ref="led_round">
<bounds x="46" y="484" width="8" height="8" />
</element>
<element name="led_2" ref="led_round">
<bounds x="34" y="484" width="8" height="8" />
</element>
<element name="led_4" ref="led_round">
<bounds x="22" y="484" width="8" height="8" />
</element>
<element name="led_8" ref="led_round">
<bounds x="10" y="484" width="8" height="8" />
</element>
<element name="led_disk" ref="led_rect">
<bounds x="614" y="485" width="16" height="6" />
</element>
</view>
</mamelayout>
Loading
Loading