Skip to content

Commit cd2aa4c

Browse files
committed
ibm5100: improve program memory handling
* force execution from ros during interrupts * correct lower-case 'u' in character font * fix l32/r32 display mode on 5110
1 parent 82ce30d commit cd2aa4c

File tree

3 files changed

+65
-46
lines changed

3 files changed

+65
-46
lines changed

src/devices/cpu/palm/palm.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ DEFINE_DEVICE_TYPE(PALM, palm_device, "palm", "IBM PALM")
3636

3737
palm_device::palm_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
3838
: cpu_device(mconfig, PALM, tag, owner, clock)
39-
, m_ros_config("ros", ENDIANNESS_BIG, 16, 16)
39+
, m_pgm_config("pgm", ENDIANNESS_BIG, 16, 16)
4040
, m_rws_config("rws", ENDIANNESS_BIG, 16, 16)
4141
, m_ioc_config("ioc", ENDIANNESS_BIG, 8, 4)
4242
, m_iod_config("iod", ENDIANNESS_BIG, 8, 4)
4343
, m_getb_bus(*this)
44-
, m_select_ros(*this)
4544
, m_program_level(*this)
45+
, m_select_ros(*this)
4646
, m_icount(0)
4747
, m_r{}
4848
{
@@ -77,7 +77,7 @@ void palm_device::device_start()
7777
save_item(NAME(m_il));
7878
save_item(NAME(m_ff));
7979

80-
space(AS_ROS).specific(m_ros);
80+
space(AS_PGM).specific(m_pgm);
8181
space(AS_RWS).specific(m_rws);
8282
space(AS_IOC).specific(m_ioc);
8383
space(AS_IOD).specific(m_iod);
@@ -90,11 +90,11 @@ void palm_device::device_reset()
9090
// select instruction source
9191
m_ff = FF_IPL | FF_MSS;
9292
m_select_ros((m_ff & FF_MSS) && !(m_ff & FF_IPL));
93-
m_program_level(0);
9493

95-
// read initial PC from ROS
94+
// read initial PC from program memory
9695
m_il = 0;
97-
m_pc = m_r[m_il][0] = m_ros.read_word(0);
96+
m_program_level(0);
97+
m_pc = m_r[m_il][0] = m_pgm.read_word(0);
9898
}
9999

100100
#define Rx r[IBIT(op, 4, 4)]
@@ -126,7 +126,7 @@ void palm_device::execute_run()
126126
debugger_instruction_hook(r[0] & ~1);
127127

128128
// fetch instruction
129-
u16 const op = m_ros.read_word(r[0] & ~1);
129+
u16 const op = m_pgm.read_word(r[0] & ~1);
130130

131131
// increment instruction address register
132132
r[0] += 2;
@@ -258,7 +258,7 @@ device_memory_interface::space_config_vector palm_device::memory_space_config()
258258
{
259259
return space_config_vector
260260
{
261-
std::make_pair(AS_ROS, &m_ros_config),
261+
std::make_pair(AS_PGM, &m_pgm_config),
262262
std::make_pair(AS_RWS, &m_rws_config),
263263
std::make_pair(AS_IOC, &m_ioc_config),
264264
std::make_pair(AS_IOD, &m_iod_config),

src/devices/cpu/palm/palm.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ class palm_device : public cpu_device
1515
static unsigned constexpr IRPT_REQ3 = INPUT_LINE_IRQ2;
1616

1717
// four address spaces
18-
static unsigned constexpr AS_ROS = AS_PROGRAM;
18+
static unsigned constexpr AS_PGM = AS_PROGRAM;
1919
static unsigned constexpr AS_RWS = AS_DATA;
2020
static unsigned constexpr AS_IOC = AS_IO;
2121
static unsigned constexpr AS_IOD = 4;
2222

2323
auto getb_bus() { return m_getb_bus.bind(); }
24-
auto select_ros() { return m_select_ros.bind(); }
2524
auto program_level() { return m_program_level.bind(); }
25+
auto select_ros() { return m_select_ros.bind(); }
2626

2727
palm_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
2828

@@ -51,19 +51,19 @@ class palm_device : public cpu_device
5151

5252
private:
5353
// address spaces
54-
address_space_config const m_ros_config;
54+
address_space_config const m_pgm_config;
5555
address_space_config const m_rws_config;
5656
address_space_config const m_ioc_config;
5757
address_space_config const m_iod_config;
5858

59-
memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_ros;
59+
memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_pgm;
6060
memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_rws;
6161
memory_access<4, 0, 0, ENDIANNESS_BIG>::specific m_ioc;
6262
memory_access<4, 0, 0, ENDIANNESS_BIG>::specific m_iod;
6363

6464
devcb_write8 m_getb_bus;
65-
devcb_write_line m_select_ros;
6665
devcb_write_line m_program_level;
66+
devcb_write_line m_select_ros;
6767

6868
// mame state
6969
int m_icount;

src/mame/ibm/ibm5100.cpp

+52-33
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class ibm5100_state : public driver_device
4444
, m_kbd(*this, "kbd")
4545
, m_nxr(*this, { "common", "basic", "apl" })
4646
, m_cgr(*this, "cgr")
47+
, m_pgm(*this, "pgm")
4748
, m_ros(*this, "ros")
4849
, m_conf(*this, "CONF")
4950
, m_disp(*this, "DISP")
@@ -59,7 +60,7 @@ class ibm5100_state : public driver_device
5960
virtual void machine_start() override;
6061
virtual void machine_reset() override;
6162

62-
virtual void cpu_ros_map(address_map &map);
63+
virtual void cpu_pgm_map(address_map &map);
6364
virtual void cpu_rws_map(address_map &map);
6465
virtual void cpu_ioc_map(address_map &map);
6566
virtual void cpu_iod_map(address_map &map);
@@ -87,6 +88,7 @@ class ibm5100_state : public driver_device
8788
required_region_ptr_array<u16, 3> m_nxr;
8889
required_region_ptr<u8> m_cgr; // character generator ROS
8990

91+
memory_view m_pgm;
9092
memory_view m_ros;
9193

9294
required_ioport m_conf;
@@ -108,7 +110,6 @@ class ibm5110_state : public ibm5100_state
108110
ibm5110_state(machine_config const &mconfig, device_type type, char const *tag)
109111
: ibm5100_state(mconfig, type, tag)
110112
, m_alarm(*this, "alarm")
111-
, m_exr(*this, "exr")
112113
, m_jmp(*this, { "L2_1", "L2_2", "K4" })
113114
{
114115
}
@@ -119,7 +120,7 @@ class ibm5110_state : public ibm5100_state
119120
virtual void machine_start() override;
120121
virtual void machine_reset() override;
121122

122-
virtual void cpu_ros_map(address_map &map) override;
123+
virtual void cpu_pgm_map(address_map &map) override;
123124
virtual void cpu_ioc_map(address_map &map) override;
124125

125126
virtual void da0_ctl_w(u8 data) override;
@@ -135,8 +136,6 @@ class ibm5110_state : public ibm5100_state
135136
private:
136137
required_device<beep_device> m_alarm;
137138

138-
memory_view m_exr;
139-
140139
required_ioport_array<3> m_jmp;
141140

142141
u8 m_exr_ff; // executable ROS flip-flops
@@ -203,23 +202,35 @@ void ibm5110_state::machine_reset()
203202
{
204203
ibm5100_state::machine_reset();
205204

206-
m_exr.disable();
207205
m_exr_ff = 0;
208206
}
209207

210-
void ibm5100_state::cpu_ros_map(address_map &map)
208+
void ibm5100_state::cpu_pgm_map(address_map &map)
211209
{
212-
map(0x0000, 0xffff).view(m_ros);
210+
map(0x0000, 0xffff).view(m_pgm);
211+
212+
// normal mode program memory
213+
m_pgm[0](0x0000, 0xffff).view(m_ros);
213214
m_ros[0](0x0000, 0xffff).rom().region("ros", 0);
215+
// m_ros[1] RWS (configurable size)
216+
217+
// interrupt mode program memory
218+
m_pgm[1](0x0000, 0xffff).rom().region("ros", 0);
214219
}
215220

216-
void ibm5110_state::cpu_ros_map(address_map &map)
221+
void ibm5110_state::cpu_pgm_map(address_map &map)
217222
{
218-
map(0x0000, 0xffff).view(m_ros);
219-
m_ros[0](0x0000, 0x7fff).rom().region("l2_1", 0);
220-
m_ros[0](0x0000, 0x7fff).view(m_exr);
221-
m_exr[0](0x0000, 0x7fff).rom().region("l2_2a", 0);
222-
m_exr[1](0x0000, 0x7fff).rom().region("l2_2b", 0);
223+
map(0x0000, 0xffff).view(m_pgm);
224+
225+
// normal mode program memory
226+
m_pgm[0](0x0000, 0xffff).view(m_ros);
227+
m_ros[0](0x0000, 0x7fff).rom().region("ros1", 0);
228+
// m_ros[1] RWS (configurable size)
229+
m_ros[2](0x0000, 0x7fff).rom().region("ros2a", 0);
230+
m_ros[3](0x0000, 0x7fff).rom().region("ros2b", 0);
231+
232+
// interrupt mode program memory
233+
m_pgm[1](0x0000, 0x7fff).rom().region("ros1", 0);
223234
}
224235

225236
void ibm5100_state::cpu_rws_map(address_map &map)
@@ -267,12 +278,12 @@ void ibm5100_state::cpu_iod_map(address_map &map)
267278
void ibm5100_state::common(machine_config &config)
268279
{
269280
PALM(config, m_cpu, 15'091'200);
270-
m_cpu->set_addrmap(palm_device::AS_ROS, &ibm5100_state::cpu_ros_map);
281+
m_cpu->set_addrmap(palm_device::AS_PGM, &ibm5100_state::cpu_pgm_map);
271282
m_cpu->set_addrmap(palm_device::AS_RWS, &ibm5100_state::cpu_rws_map);
272283
m_cpu->set_addrmap(palm_device::AS_IOC, &ibm5100_state::cpu_ioc_map);
273284
m_cpu->set_addrmap(palm_device::AS_IOD, &ibm5100_state::cpu_iod_map);
274285
m_cpu->getb_bus().set([this](offs_t offset, u8 data) { m_getb_bus = data; });
275-
m_cpu->select_ros().set([this](int state) { m_ros.select(state); });
286+
m_cpu->program_level().set([this](int state) { m_pgm.select(state); });
276287

277288
/*
278289
* Display output is 16 rows of 64 characters. Each character cell is 10x12
@@ -288,6 +299,8 @@ void ibm5100_state::ibm5100(machine_config &config)
288299
{
289300
ibm5100_state::common(config);
290301

302+
m_cpu->select_ros().set([this](int state) { m_ros.select(state); });
303+
291304
IBM5100_KEYBOARD(config, m_kbd);
292305
m_kbd->strobe().set(
293306
[this](int state)
@@ -301,13 +314,13 @@ void ibm5110_state::ibm5110(machine_config &config)
301314
{
302315
ibm5100_state::common(config);
303316

304-
m_cpu->program_level().set(
317+
m_cpu->select_ros().set(
305318
[this](int state)
306319
{
307-
if (state || !(m_exr_ff & EXR_ROS2))
308-
m_exr.disable();
320+
if (!state && (m_exr_ff & EXR_ROS2))
321+
m_ros.select(BIT(m_lang->read(), 6) + 2);
309322
else
310-
m_exr.select(BIT(m_lang->read(), 6));
323+
m_ros.select(state);
311324
});
312325

313326
IBM5110_KEYBOARD(config, m_kbd);
@@ -354,7 +367,7 @@ u32 ibm5100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, re
354367

355368
bool const reverse = BIT(disp, 0);
356369
bool const n64 = !BIT(disp, 2);
357-
bool const r32 = BIT(disp, 3);
370+
unsigned const r32 = BIT(disp, 3) ? 32 : 0;
358371

359372
// start with a blank screen
360373
bitmap.fill(c[reverse]);
@@ -370,16 +383,18 @@ u32 ibm5100_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, re
370383
int const y = screen.visible_area().min_y + char_y * 12 * 2;
371384

372385
// compute offset into rws for each row
373-
offs_t offset = 0x200 + char_y * 64 + (r32 ? 32 : 0);
386+
offs_t offset = 0x200 + char_y * 64 + r32;
374387

375388
for (unsigned char_x = 0; char_x < 64; char_x++)
376389
{
390+
// skip alternate columns in l32/r32 mode
391+
if (!n64 && (char_x & 1))
392+
continue;
393+
377394
int const x = screen.visible_area().min_x + char_x * 10;
378395

379-
// read next character if normal mode or even column
380-
u8 char_data = 0;
381-
if (n64 || !(char_x & 1))
382-
char_data = rws[offset++];
396+
// read next character
397+
u8 const char_data = rws[offset++];
383398

384399
// draw 8x12 character cell
385400
for (unsigned cell_y = 0; cell_y < 12; cell_y++)
@@ -461,13 +476,17 @@ void ibm5110_state::exr_ctl_w(u8 data)
461476

462477
if (BIT(data, 7))
463478
{
464-
m_exr.select(BIT(m_lang->read(), 6));
465479
m_exr_ff |= EXR_ROS2;
480+
481+
if (m_ros.entry() != 1)
482+
m_ros.select(BIT(m_lang->read(), 6) + 2);
466483
}
467484
else if (BIT(data, 6))
468485
{
469-
m_exr.disable();
470486
m_exr_ff &= ~EXR_ROS2;
487+
488+
if (m_ros.entry() != 1)
489+
m_ros.select(0);
471490
}
472491
}
473492

@@ -701,16 +720,16 @@ ROM_END
701720

702721
ROM_START(ibm5110)
703722
// Executable ROS
704-
ROM_REGION16_BE(0x8000, "l2_1", 0)
723+
ROM_REGION16_BE(0x8000, "ros1", 0)
705724
ROM_LOAD("l2_1.ros", 0x0000, 0x8000, CRC(0355894f) SHA1(c76a91cbbec226feb942ccde93ecb1637c88a01b))
706725

707726
// APL Executable ROS
708-
ROM_REGION16_BE(0x8000, "l2_2a", 0)
727+
ROM_REGION16_BE(0x8000, "ros2a", 0)
709728
ROM_LOAD("l2_2a.ros", 0x0000, 0x5000, CRC(46918be9) SHA1(bf45a44f77104c55f2ccfa462af06944e6bffe1a))
710729
ROM_FILL(0x5000, 0x3000, 0xff)
711730

712731
// BASIC Executable ROS
713-
ROM_REGION16_BE(0x8000, "l2_2b", 0)
732+
ROM_REGION16_BE(0x8000, "ros2b", 0)
714733
ROM_LOAD("l2_2b.ros", 0x0000, 0x4000, CRC(a69dd0c1) SHA1(ecdc1363e25b72b695c517af145c50a069b6e8dc))
715734
ROM_FILL(0x4000, 0x3000, 0xff)
716735

@@ -732,10 +751,10 @@ ROM_START(ibm5110)
732751
/*
733752
* This data was hand-made based on the character map in the documentation.
734753
* It was assumed that the first 12 bytes of each character store the 8x12
735-
* cell, followed by 8x4 empty bytes.
754+
* cell, followed by 4 empty bytes.
736755
*/
737756
ROM_REGION(0x1000, "cgr", 0)
738-
ROM_LOAD("g2.ros", 0x000, 0x1000, CRC(1f55161c) SHA1(eb22f3177060bd7cb4ba8facaa293147ffeceabc) BAD_DUMP)
757+
ROM_LOAD("g2.ros", 0x000, 0x1000, CRC(86e6a99c) SHA1(7168ba05fbac3f66bd98b8ef9fc135d0d08eb44b) BAD_DUMP)
739758
ROM_END
740759

741760
static INPUT_PORTS_START(ibm5100)

0 commit comments

Comments
 (0)