@@ -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
135136private:
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
225236void ibm5100_state::cpu_rws_map (address_map &map)
@@ -267,12 +278,12 @@ void ibm5100_state::cpu_iod_map(address_map &map)
267278void 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
702721ROM_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)
739758ROM_END
740759
741760static INPUT_PORTS_START (ibm5100)
0 commit comments