Skip to content

Adding two new 8008 homebrew computers #13208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

jeng
Copy link

@jeng jeng commented Jan 10, 2025

The first driver is for the 8008-SBC written by Jim Loos.

The second one is for the 8008-Super written by Dr. Scott Baker.

I have uploaded the ROMS to https://github.com/jeng/homebrew-8008-mame-roms

A writeup and demos of the drivers are at Mame Master Blaster

Copy link
Member

@cuavas cuavas left a comment

Choose a reason for hiding this comment

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

Please rework the code to take advantage of MAME’s framework, e.g. the memory system.

Comment on lines 19936 to 19941
@source:homebrew/sbc8008.cpp
sbc8008 // Jim Loos - 8008-SBC

@source:homebrew/super8008.cpp
super8008 // Dr. Scott M. Baker - 8008-Super

Copy link
Member

Choose a reason for hiding this comment

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

Please keep this file sorted. “S” does not come after “Z”.

Copy link
Author

Choose a reason for hiding this comment

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

These should be in the correct order now.

Comment on lines 314 to 337
<group ref="b1_leds">
<bounds x="0" y="345" width="10" height="47" />
</group>
<group ref="b2_leds">
<bounds x="7" y="345" width="10" height="47" />
</group>
<group ref="b3_leds">
<bounds x="14" y="345" width="10" height="47" />
</group>
<group ref="b4_leds">
<bounds x="21" y="345" width="10" height="47" />
</group>
<group ref="b5_leds">
<bounds x="28" y="345" width="10" height="47" />
</group>
<group ref="b6_leds">
<bounds x="35" y="345" width="10" height="47" />
</group>
<group ref="b7_leds">
<bounds x="42" y="345" width="10" height="47" />
</group>
<group ref="b8_leds">
<bounds x="49" y="345" width="10" height="47" />
</group>
Copy link
Member

Choose a reason for hiding this comment

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

You could use a <repeat> to make this more terse.

You should be able to use a <repeat> to generate the groups and label elements themselves to reduce copy/paste as well.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the tip on repeat. I've made those changes.

Comment on lines 52 to 75
<element name="led0" ref="orange_led">
<bounds x="32" y="2.5" width="5" height="5" />
</element>
<element name="led1" ref="orange_led">
<bounds x="37" y="2.5" width="5" height="5" />
</element>
<element name="led2" ref="orange_led">
<bounds x="42" y="2.5" width="5" height="5" />
</element>
<element name="led3" ref="orange_led">
<bounds x="47" y="2.5" width="5" height="5" />
</element>
<element name="led4" ref="orange_led">
<bounds x="52" y="2.5" width="5" height="5" />
</element>
<element name="led5" ref="orange_led">
<bounds x="57" y="2.5" width="5" height="5" />
</element>
<element name="led6" ref="orange_led">
<bounds x="62" y="2.5" width="5" height="5" />
</element>
<element name="led7" ref="orange_led">
<bounds x="67" y="2.5" width="5" height="5" />
</element>
Copy link
Member

Choose a reason for hiding this comment

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

You can use a <repeat> to place these LEDs.

Copy link
Author

Choose a reason for hiding this comment

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

The <repeat> has been added.

Comment on lines 28 to 33
#include "cpu/i8008/i8008.h"
#include "machine/clock.h"
#include "machine/i8251.h"
#include "machine/ram.h"
#include "bus/rs232/rs232.h"
#include "bus/super8008/super8008.h"
Copy link
Member

Choose a reason for hiding this comment

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

Please keep these sorted so they’re easier to keep track of as the list grows.

Copy link
Author

Choose a reason for hiding this comment

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

These headers are sorted now.

Comment on lines 77 to 85
// This function sets up the machine configuration
void super8008(machine_config &config);

protected:
//TODO(jhe): Do we have another way to get the S0, S1 and S2 so we know when the PC has been halted?

// address maps for program memory and io memory
void super8008_mem(address_map &map);
void super8008_io(address_map &map);
Copy link
Member

Choose a reason for hiding this comment

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

Please add ATTR_COLD for cold lifecycle functions.

Copy link
Author

Choose a reason for hiding this comment

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

ATTR_COLD added to machine_start

Comment on lines 117 to 120
void super8008_blaster_device::device_start()
{
m_leds.resolve();
}
Copy link
Member

Choose a reason for hiding this comment

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

Remember to save data members.

Copy link
Author

Choose a reason for hiding this comment

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

The m_take_state is being saved.

Comment on lines 192 to 193

RAM(config, m_ram).set_default_size("32K");
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn’t be using ram_device for this – use a memory_share_creator or something.

Copy link
Author

Choose a reason for hiding this comment

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

A memory_share_creator is being used now.

Comment on lines 171 to 176
void super8008_blaster_device::blaster_mem(address_map &map)
{
map(0x0000, 0x3fff).rw(
FUNC(super8008_blaster_device::blaster_memory_read),
FUNC(super8008_blaster_device::blaster_memory_write));
}
Copy link
Member

Choose a reason for hiding this comment

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

Please use a memory_view to deal with swapping the RAM in and out rather than the trampoline functions. You can attach a callback to the jumper input so the view entry can be updated when it changes.

Copy link
Author

Choose a reason for hiding this comment

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

A memory_view is being used now.

Comment on lines 135 to 137
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
Copy link
Member

Choose a reason for hiding this comment

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

Please use ATTR_COLD for cold lifecycle members.

Copy link
Author

Choose a reason for hiding this comment

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

ATTR_COLD added to device_start

Comment on lines 98 to 104
void super8008_bus_device::device_reset()
{
}

void super8008_bus_device::device_post_load()
{
}
Copy link
Member

Choose a reason for hiding this comment

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

You don’t need to override these if you aren’t doing anything special.

Copy link
Author

Choose a reason for hiding this comment

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

I've removed these.

Copy link
Author

@jeng jeng left a comment

Choose a reason for hiding this comment

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

Thanks for the review. I think I have all of the changes made.

Also, apologies in advance about any spam from the one-off comments. I had forgotten for a minute how github worked.

Comment on lines 296 to 321
void super8008_state::super8008_state::ext_stat_w(offs_t offset, uint8_t data)
{
switch(offset)
{
case 0:
//logerror("ext_stat_w %04X take data %02X\n", offset, data);
take_state = data;
m_bus->ext_take(data);
break;//take
case 1:
//logerror("ext_stat_w %04X int data %02X\n", offset, data);
m_bus->ext_int();
break;//int
case 2:
//logerror("ext_stat_w %04X req data %02X\n", offset, data);
m_bus->ext_req();
break;//req
case 3:
//logerror("ext_stat_w %04X reset data %02X\n", offset, data);
m_bus->ext_reset();
break;//reset

default:
logerror("ext_stat_w INVALID %04X data %02X\n", offset, data);break;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

These have been moved to the address map.

Comment on lines 325 to 327
uint8_t index = offset & MMAP_MASK;
mmap[index] = data & 0xff;
//logerror("super-8008 memory mapper write ($%04X) masked ($%04X) data %04X \n", offset, index, mmap[index]);
Copy link
Author

Choose a reason for hiding this comment

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

Good point about masking the uint8_t. I've removed that. I wasn't really sure how to use mirror in a way that simulates a 4x4 register.

Comment on lines 385 to 386
//and bit 3 is used for issuing an external chip select.
map(0x0C, 0x0F).w(FUNC(super8008_state::memory_mapper_w));
Copy link
Author

Choose a reason for hiding this comment

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

I've fixed these.

Comment on lines 98 to 104
void super8008_bus_device::device_reset()
{
}

void super8008_bus_device::device_post_load()
{
}
Copy link
Author

Choose a reason for hiding this comment

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

I've removed these.

Comment on lines 135 to 137
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_post_load() override;
Copy link
Author

Choose a reason for hiding this comment

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

ATTR_COLD added to device_start

@@ -94,6 +94,8 @@ void i8008_device::device_start()
for (int addrnum = 0; addrnum < 8; addrnum++)
state_add(I8008_ADDR1 + addrnum, string_format("ADDR%d", addrnum + 1).c_str(), m_ADDR[addrnum].w.l).mask(0xfff);

state_add(I8008_STOPPED, "STOPPED", m_HALT);
Copy link
Author

Choose a reason for hiding this comment

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

I've removed this.

Comment on lines 57 to 86
// This function sets up the machine configuration
void sbc8008(machine_config &config);

protected:
// address maps for program memory and io memory
void sbc8008_mem(address_map &map);
void sbc8008_io(address_map &map);

required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_memory_region m_rom;
required_memory_bank m_rom_bank;
required_device<rs232_port_device> m_rs232;
output_finder<8> m_leds;
output_finder<> m_run_led;
output_finder<> m_txd_led;
output_finder<> m_rxd_led;

uint8_t bitbang_read();
void bitbang_write(uint8_t data);
uint8_t port_1_read();
void port_9_write(uint8_t data);
void port_10_write(uint8_t data);

virtual void machine_start() override;

bool start = true;

uint8_t memory_read(offs_t offset);
void memory_write(offs_t offset, uint8_t data);
Copy link
Author

Choose a reason for hiding this comment

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

These have been corrected.

Comment on lines 108 to 124
uint8_t sbc8008_state::memory_read(offs_t offset)
{
if (start && 0 <= offset && offset < SBC8008_ROM_SIZE)
{
return ((uint8_t*)m_rom_bank->base())[offset];
}
else if (0 <= offset && offset < m_ram->size())
{
return m_ram->pointer()[offset];
}
else
{
logerror("%s:ld invalid mode read ($%02X) start %d size %d\n",
machine().describe_context(), offset, start, m_ram->size());
return 0xff;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

A memory_view is being used now.

Comment on lines 126 to 132
void sbc8008_state::memory_write(offs_t offset, uint8_t data)
{
if (0 <= offset && offset < m_ram->size())
{
m_ram->pointer()[offset] = data;
}
}
Copy link
Author

Choose a reason for hiding this comment

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

The custom memory_write has been removed

Comment on lines 155 to 159
uint8_t sbc8008_state::port_1_read()
{
start = false;
return (uint8_t)start; //Is this value used in the monitor?
}
Copy link
Author

Choose a reason for hiding this comment

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

port_1_read is using the memory_view now to avoid side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants