A few small formatting cleanups and scope reductions.

This commit is contained in:
Vas Crabb 2022-11-18 04:15:37 +11:00
parent 649ec6fcb2
commit 58df32d790
4 changed files with 136 additions and 138 deletions

View File

@ -14,9 +14,33 @@ TODO:
#include "dmk_dsk.h" #include "dmk_dsk.h"
#include "coretmpl.h"
#include "ioprocs.h" #include "ioprocs.h"
#include "coretmpl.h"
namespace {
uint32_t wide_fm(uint16_t val)
{
uint32_t res = 0;
for (int i = 15; i >= 0; i--) {
res |= (util::BIT(val, i) << (i*2 + 1));
}
return res;
}
uint32_t data_to_wide_fm(uint8_t val)
{
uint16_t res = 0xaaaa; // clock
for (int i = 7; i >= 0; i--) {
res |= (util::BIT(val, i) << i*2); // data
}
return wide_fm(res);
}
} // anonymous namespace
dmk_format::dmk_format() dmk_format::dmk_format()
{ {
@ -83,24 +107,6 @@ int dmk_format::identify(util::random_read &io, uint32_t form_factor, const std:
} }
uint32_t dmk_format::wide_fm(uint16_t val)
{
uint32_t res = 0;
for (int i = 15; i >= 0; i--) {
res |= (util::BIT(val, i) << (i*2 + 1));
}
return res;
}
uint32_t dmk_format::data_to_wide_fm(uint8_t val)
{
uint16_t res = 0xaaaa; // clock
for (int i = 7; i >= 0; i--) {
res |= (util::BIT(val, i) << i*2); // data
}
return wide_fm(res);
}
bool dmk_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const bool dmk_format::load(util::random_read &io, uint32_t form_factor, const std::vector<uint32_t> &variants, floppy_image *image) const
{ {
size_t actual; size_t actual;

View File

@ -28,9 +28,6 @@ public:
virtual const char *description() const override; virtual const char *description() const override;
virtual const char *extensions() const override; virtual const char *extensions() const override;
virtual bool supports_save() const override; virtual bool supports_save() const override;
protected:
static uint32_t wide_fm(uint16_t val);
static uint32_t data_to_wide_fm(uint8_t val);
}; };
extern const dmk_format FLOPPY_DMK_FORMAT; extern const dmk_format FLOPPY_DMK_FORMAT;

View File

@ -247,7 +247,7 @@ with settings like this in the majority of cases.
void mpu4_state::lamp_extend_small(uint8_t data) void mpu4_state::lamp_extend_small(uint8_t data)
{ {
uint8_t lamp_ext_data,column,i; uint8_t lamp_ext_data, column;
column = data & 0x07; column = data & 0x07;
lamp_ext_data = 0x1f - ((data & 0xf8) >> 3);//remove the mux lines from the data lamp_ext_data = 0x1f - ((data & 0xf8) >> 3);//remove the mux lines from the data
@ -256,7 +256,7 @@ void mpu4_state::lamp_extend_small(uint8_t data)
{ {
//One write to reset the drive lines, one with the data, one to clear the lines, so only the 2nd write does anything //One write to reset the drive lines, one with the data, one to clear the lines, so only the 2nd write does anything
//TODO: PWM //TODO: PWM
for (i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
m_lamps[(8*column) + i + 128] = BIT(lamp_ext_data, i); m_lamps[(8*column) + i + 128] = BIT(lamp_ext_data, i);
} }
@ -304,17 +304,15 @@ void mpu4_state::lamp_extend_large(uint8_t data,uint8_t column,bool active)
void mpu4_state::led_write_extender(uint8_t latch, uint8_t data, uint8_t starting_column) void mpu4_state::led_write_extender(uint8_t latch, uint8_t data, uint8_t starting_column)
{ {
uint8_t diff,i,j, ext_strobe; const uint8_t diff = (latch ^ m_last_latch) & latch;
const uint8_t ext_strobe = (7 - starting_column) * 8;
diff = (latch ^ m_last_latch) & latch;
ext_strobe = (7 - starting_column) * 8;
data = ~data;//invert drive lines data = ~data;//invert drive lines
for (i=0; i<5; i++) for (int i = 0; i < 5; i++)
{ {
if (diff & (1<<i)) if (BIT(diff, i))
{ {
for (j=0; j<8; j++) for (int j = 0; j < 8; j++)
{ {
m_mpu4leds[(ext_strobe + i) | j], BIT(data, j); m_mpu4leds[(ext_strobe + i) | j], BIT(data, j);
} }
@ -328,20 +326,19 @@ void mpu4_state::led_write_extender(uint8_t latch, uint8_t data, uint8_t startin
void mpu4_state::update_meters() void mpu4_state::update_meters()
{ {
uint8_t meter;
uint8_t data = ((m_mmtr_data & 0x7f) | m_remote_meter); uint8_t data = ((m_mmtr_data & 0x7f) | m_remote_meter);
switch (m_reel_mux) switch (m_reel_mux)
{ {
case STANDARD_REEL: case STANDARD_REEL:
if (m_hopper_type != TUBES) if (m_hopper_type != TUBES)
{ {
data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements data = (data & 0x0f); //Strip reel data from meter drives, leaving active elements
} }
break; break;
case FIVE_REEL_5TO8: case FIVE_REEL_5TO8:
m_reel[4]->update(((data >> 4) & 0x0f)); m_reel[4]->update(((data >> 4) & 0x0f));
data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements data = (data & 0x0f); //Strip reel data from meter drives, leaving active elements
awp_draw_reel(machine(),"reel5", *m_reel[4]); awp_draw_reel(machine(),"reel5", *m_reel[4]);
break; break;
@ -369,7 +366,7 @@ void mpu4_state::update_meters()
case SIX_REEL_5TO8: // m_reel[4] for this case is already handled in pia_ic5_porta_w case SIX_REEL_5TO8: // m_reel[4] for this case is already handled in pia_ic5_porta_w
m_reel[4]->update(((data >> 4) & 0x0f)); m_reel[4]->update(((data >> 4) & 0x0f));
//data = 0x00; //Strip all reel data from meter drives //data = 0x00; //Strip all reel data from meter drives
data = (data & 0x0F); data = (data & 0x0f);
awp_draw_reel(machine(),"reel5", *m_reel[4]); awp_draw_reel(machine(),"reel5", *m_reel[4]);
break; break;
#endif #endif
@ -388,14 +385,14 @@ void mpu4_state::update_meters()
m_meters->update(7, (data & 0x80)); m_meters->update(7, (data & 0x80));
for (meter = 0; meter < 4; meter ++) for (int meter = 0; meter < 4; meter ++)
{ {
m_meters->update(meter, (data & (1 << meter))); m_meters->update(meter, (data & (1 << meter)));
} }
if (m_reel_mux == STANDARD_REEL) if (m_reel_mux == STANDARD_REEL)
{ {
for (meter = 4; meter < 7; meter ++) for (int meter = 4; meter < 7; meter ++)
{ {
m_meters->update(meter, (data & (1 << meter))); m_meters->update(meter, (data & (1 << meter)));
} }
@ -522,7 +519,6 @@ WRITE_LINE_MEMBER(mpu4_state::ic2_o3_callback)
/* IC3, lamp data lines + alpha numeric display */ /* IC3, lamp data lines + alpha numeric display */
void mpu4_state::pia_ic3_porta_w(uint8_t data) void mpu4_state::pia_ic3_porta_w(uint8_t data)
{ {
uint8_t i;
LOG_IC3(("%s: IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", machine().describe_context(), data)); LOG_IC3(("%s: IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", machine().describe_context(), data));
if(m_ic23_active) if(m_ic23_active)
@ -537,7 +533,7 @@ void mpu4_state::pia_ic3_porta_w(uint8_t data)
if (m_undercurrent_detect) m_undercurrent = true; if (m_undercurrent_detect) m_undercurrent = true;
for (i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
m_lamps[(8*m_input_strobe)+i] = BIT(data, i); m_lamps[(8*m_input_strobe)+i] = BIT(data, i);
} }
@ -548,7 +544,6 @@ void mpu4_state::pia_ic3_porta_w(uint8_t data)
void mpu4_state::pia_ic3_portb_w(uint8_t data) void mpu4_state::pia_ic3_portb_w(uint8_t data)
{ {
uint8_t i;
LOG_IC3(("%s: IC3 PIA Port B Set to %2x (lamp strobes 10 - 17)\n", machine().describe_context(), data)); LOG_IC3(("%s: IC3 PIA Port B Set to %2x (lamp strobes 10 - 17)\n", machine().describe_context(), data));
if (m_ic23_active) if (m_ic23_active)
@ -559,7 +554,7 @@ void mpu4_state::pia_ic3_portb_w(uint8_t data)
if (m_undercurrent_detect) m_undercurrent = true; if (m_undercurrent_detect) m_undercurrent = true;
for (i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
{ {
m_lamps[(8*m_input_strobe)+i+64] = BIT(data, i); m_lamps[(8*m_input_strobe)+i+64] = BIT(data, i);
} }
@ -610,8 +605,7 @@ void mpu4_state::ic23_update()
} }
} }
} }
else else if (m_IC23G2A || m_IC23G2B)
if ((m_IC23G2A)||(m_IC23G2B))
{ {
m_input_strobe = 0x00; m_input_strobe = 0x00;
} }
@ -638,13 +632,11 @@ void mpu4_state::ic24_setup()
if (m_IC23GA) if (m_IC23GA)
{ {
double duration = TIME_OF_74LS123((220*1000),(0.1*0.000001)); double duration = TIME_OF_74LS123((220*1000),(0.1*0.000001));
{
m_ic23_active = true; m_ic23_active = true;
ic24_output(0); ic24_output(0);
m_ic24_timer->adjust(attotime::from_double(duration)); m_ic24_timer->adjust(attotime::from_double(duration));
} }
} }
}
TIMER_CALLBACK_MEMBER(mpu4_state::update_ic24) TIMER_CALLBACK_MEMBER(mpu4_state::update_ic24)
@ -807,7 +799,6 @@ uint8_t mpu4_state::pia_ic5_porta_r()
void mpu4_state::pia_ic5_porta_w(uint8_t data) void mpu4_state::pia_ic5_porta_w(uint8_t data)
{ {
int i;
if (m_hopper_type == HOPPER_NONDUART_A) if (m_hopper_type == HOPPER_NONDUART_A)
{ {
m_hopper1_opto = (data & 0x10); m_hopper1_opto = (data & 0x10);
@ -822,7 +813,7 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data)
} }
else if ((m_led_extender != CARD_A) && (m_led_extender != NO_EXTENDER)) else if ((m_led_extender != CARD_A) && (m_led_extender != NO_EXTENDER))
{ {
for(i=0; i<8; i++) for (int i = 0; i < 8; i++)
{ {
m_mpu4leds[((m_input_strobe | 8) << 3) | i] = BIT(data, i); m_mpu4leds[((m_input_strobe | 8) << 3) | i] = BIT(data, i);
} }
@ -846,7 +837,7 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data)
#if 0 #if 0
if ((m_ic23_active) && m_card_live) if ((m_ic23_active) && m_card_live)
{ {
for(i=0; i<8; i++) for(int i=0; i<8; i++)
{ {
m_mpu4leds[(m_last_b7 << 6) | (m_input_strobe << 3) | i] = BIT(~data, i); m_mpu4leds[(m_last_b7 << 6) | (m_input_strobe << 3) | i] = BIT(~data, i);
} }
@ -863,15 +854,15 @@ void mpu4_state::pia_ic5_porta_w(uint8_t data)
if (m_reel_mux == SIX_REEL_5TO8) if (m_reel_mux == SIX_REEL_5TO8)
{ {
m_reel[4]->update( data &0x0F); m_reel[4]->update( data &0x0f);
m_reel[5]->update((data >> 4)&0x0F); m_reel[5]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel5", *m_reel[4]); awp_draw_reel(machine(),"reel5", *m_reel[4]);
awp_draw_reel(machine(),"reel6", *m_reel[5]); awp_draw_reel(machine(),"reel6", *m_reel[5]);
} }
else if (m_reel_mux == SEVEN_REEL) else if (m_reel_mux == SEVEN_REEL)
{ {
m_reel[1]->update( data &0x0F); m_reel[1]->update( data &0x0f);
m_reel[2]->update((data >> 4)&0x0F); m_reel[2]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel2", *m_reel[1]); awp_draw_reel(machine(),"reel2", *m_reel[1]);
awp_draw_reel(machine(),"reel3", *m_reel[2]); awp_draw_reel(machine(),"reel3", *m_reel[2]);
} }
@ -1011,15 +1002,15 @@ void mpu4_state::pia_ic6_portb_w(uint8_t data)
if (m_reel_mux == SEVEN_REEL) if (m_reel_mux == SEVEN_REEL)
{ {
m_reel[3]->update( data &0x0F); m_reel[3]->update( data &0x0f);
m_reel[4]->update((data >> 4)&0x0F); m_reel[4]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel4", *m_reel[3]); awp_draw_reel(machine(),"reel4", *m_reel[3]);
awp_draw_reel(machine(),"reel5", *m_reel[4]); awp_draw_reel(machine(),"reel5", *m_reel[4]);
} }
else if (m_reels) else if (m_reels)
{ {
m_reel[0]->update( data &0x0F); m_reel[0]->update( data &0x0f);
m_reel[1]->update((data >> 4)&0x0F); m_reel[1]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel1", *m_reel[0]); awp_draw_reel(machine(),"reel1", *m_reel[0]);
awp_draw_reel(machine(),"reel2", *m_reel[1]); awp_draw_reel(machine(),"reel2", *m_reel[1]);
} }
@ -1067,15 +1058,15 @@ void mpu4_state::pia_ic7_porta_w(uint8_t data)
LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", machine().describe_context(), data)); LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", machine().describe_context(), data));
if (m_reel_mux == SEVEN_REEL) if (m_reel_mux == SEVEN_REEL)
{ {
m_reel[5]->update( data &0x0F); m_reel[5]->update( data &0x0f);
m_reel[6]->update((data >> 4)&0x0F); m_reel[6]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel6", *m_reel[5]); awp_draw_reel(machine(),"reel6", *m_reel[5]);
awp_draw_reel(machine(),"reel7", *m_reel[6]); awp_draw_reel(machine(),"reel7", *m_reel[6]);
} }
else if (m_reels) else if (m_reels)
{ {
m_reel[2]->update( data &0x0F); m_reel[2]->update( data &0x0f);
m_reel[3]->update((data >> 4)&0x0F); m_reel[3]->update((data >> 4)&0x0f);
awp_draw_reel(machine(),"reel3", *m_reel[2]); awp_draw_reel(machine(),"reel3", *m_reel[2]);
awp_draw_reel(machine(),"reel4", *m_reel[3]); awp_draw_reel(machine(),"reel4", *m_reel[3]);
} }
@ -1184,7 +1175,7 @@ void mpu4_state::pia_ic8_portb_w(uint8_t data)
WRITE_LINE_MEMBER(mpu4_state::pia_ic8_ca2_w) WRITE_LINE_MEMBER(mpu4_state::pia_ic8_ca2_w)
{ {
LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", machine().describe_context(), state & 0xFF)); LOG_IC8(("%s: IC8 PIA write CA2 (input_strobe bit 2 / LED C) %02X\n", machine().describe_context(), state & 0xff));
m_IC23GC = state; m_IC23GC = state;
ic23_update(); ic23_update();
@ -1193,7 +1184,7 @@ WRITE_LINE_MEMBER(mpu4_state::pia_ic8_ca2_w)
WRITE_LINE_MEMBER(mpu4_state::pia_ic8_cb2_w) WRITE_LINE_MEMBER(mpu4_state::pia_ic8_cb2_w)
{ {
LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", machine().describe_context(), state & 0xFF)); LOG_IC8(("%s: IC8 PIA write CB2 (alpha clock) %02X\n", machine().describe_context(), state & 0xff));
// DM Data pin B // DM Data pin B
@ -1222,22 +1213,21 @@ void mpu4_state::pia_gb_portb_w(uint8_t data)
{ {
if (m_global_volume < 32) m_global_volume++; //steps unknown if (m_global_volume < 32) m_global_volume++; //steps unknown
} }
else else // up
{//up {
if (m_global_volume > 0) m_global_volume--; if (m_global_volume > 0) m_global_volume--;
} }
{
LOG_SS(("%s: GAMEBOARD: Volume Set to %2x\n", machine().describe_context(), data)); LOG_SS(("%s: GAMEBOARD: Volume Set to %2x\n", machine().describe_context(), data));
float percent = (32-m_global_volume)/32.0; float percent = (32-m_global_volume)/32.0;
m_msm6376->set_output_gain(0, percent); m_msm6376->set_output_gain(0, percent);
m_msm6376->set_output_gain(1, percent); m_msm6376->set_output_gain(1, percent);
} }
} }
}
m_msm6376->ch2_w(data & 0x02); m_msm6376->ch2_w(data & 0x02);
m_msm6376->st_w(data & 0x01); m_msm6376->st_w(data & 0x01);
} }
uint8_t mpu4_state::pia_gb_portb_r() uint8_t mpu4_state::pia_gb_portb_r()
{ {
LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n", machine().describe_context())); LOG_SS(("%s: GAMEBOARD: PIA Read of Port B\n", machine().describe_context()));

View File

@ -154,12 +154,17 @@ ht1080z works
#include "emu.h" #include "emu.h"
#include "trs80.h" #include "trs80.h"
#include "machine/input_merger.h" #include "machine/input_merger.h"
#include "sound/ay8910.h" #include "sound/ay8910.h"
#include "softlist_dev.h" #include "softlist_dev.h"
#include "utf8.h"
#include "formats/dmk_dsk.h" #include "formats/dmk_dsk.h"
#include "utf8.h"
void trs80_state::trs80_mem(address_map &map) void trs80_state::trs80_mem(address_map &map)
{ {
map(0x0000, 0x0fff).rom(); map(0x0000, 0x0fff).rom();