Skip to content

Commit f6a0415

Browse files
committed
osd/modules/debugger/debuggdbstub.cpp: proper Z80 architecture support in the gdbstub
assisted: GLM-5.1 ref: https://sourceware.org/git/\?p\=binutils-gdb.git\;a\=blob_plain\;f\=gdb/features/z80.c\;hb\=HEAD
1 parent 420968c commit f6a0415

5 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/devices/cpu/z80/kc82.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class kc82_device : public z80_device
2323
public:
2424
enum
2525
{
26-
KC82_B1 = Z80_WZ + 1, KC82_B2, KC82_B3, KC82_B4,
26+
KC82_B1 = Z80__LAST + 1, KC82_B2, KC82_B3, KC82_B4,
2727
KC82_A1, KC82_A2, KC82_A3
2828
};
2929

src/devices/cpu/z80/z80.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ void z80_device::device_start()
675675
save_item(NAME(m_tmp_irq_vector));
676676
save_item(NAME(m_shared_data.w));
677677
save_item(NAME(m_shared_data2.w));
678-
save_item(NAME(m_rtemp));
678+
save_item(NAME(m_irtmp.w));
679679
save_item(NAME(m_ref));
680680

681681
// Reset registers to their initial values
@@ -710,7 +710,7 @@ void z80_device::device_start()
710710
m_busack_state = 0;
711711
m_ea = 0;
712712
m_service_attention = 0;
713-
m_rtemp = 0;
713+
m_irtmp.w = 0;
714714

715715
space(AS_PROGRAM).cache(m_args);
716716
space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_opcodes);
@@ -744,8 +744,9 @@ void z80_device::device_start()
744744
state_add(Z80_DE2, "DE2", m_de2.w);
745745
state_add(Z80_HL2, "HL2", m_hl2.w);
746746
state_add(Z80_WZ, "WZ", WZ);
747-
state_add(Z80_R, "R", m_rtemp).callimport().callexport();
747+
state_add(Z80_R, "R", m_irtmp.b.l).callimport().callexport();
748748
state_add(Z80_I, "I", m_i);
749+
state_add(Z80_IR, "IR", m_irtmp.w).noshow().callimport().callexport();
749750
state_add(Z80_IM, "IM", m_im).mask(0x3);
750751
state_add(Z80_IFF1, "IFF1", m_iff1).mask(0x1);
751752
state_add(Z80_IFF2, "IFF2", m_iff2).mask(0x1);
@@ -844,9 +845,12 @@ void z80_device::state_import(const device_state_entry &entry)
844845
case Z80_F: case Z80_AF:
845846
set_f(F);
846847
break;
848+
case Z80_IR:
849+
m_i = m_irtmp.b.h;
850+
[[fallthrough]];
847851
case Z80_R:
848-
m_r = m_rtemp & 0x7f;
849-
m_r2 = m_rtemp & 0x80;
852+
m_r = m_irtmp.b.l & 0x7f;
853+
m_r2 = m_irtmp.b.l & 0x80;
850854
break;
851855

852856
default:
@@ -861,8 +865,8 @@ void z80_device::state_export(const device_state_entry &entry)
861865
case Z80_F: case Z80_AF:
862866
F = get_f();
863867
break;
864-
case Z80_R:
865-
m_rtemp = (m_r & 0x7f) | (m_r2 & 0x80);
868+
case Z80_IR: case Z80_R:
869+
m_irtmp.w = (m_i << 8) | ((m_r & 0x7f) | (m_r2 & 0x80));
866870
break;
867871

868872
default:

src/devices/cpu/z80/z80.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ enum
2222
Z80_AF, Z80_BC, Z80_DE, Z80_HL,
2323
Z80_IX, Z80_IY, Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2,
2424
Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT,
25-
Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_WZ
25+
Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_WZ, Z80_IR,
26+
Z80__LAST = Z80_IR
2627
};
2728

2829
class z80_device : public cpu_device, public z80_daisy_chain_interface
@@ -208,7 +209,7 @@ class z80_device : public cpu_device, public z80_daisy_chain_interface
208209
int m_tmp_irq_vector;
209210
PAIR16 m_shared_data;
210211
PAIR16 m_shared_data2;
211-
u8 m_rtemp;
212+
PAIR16 m_irtmp;
212213

213214
u32 m_ref;
214215
u8 m_m1_cycles;

src/devices/cpu/z80/z84c015.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
enum
1818
{
19-
Z84_WCR = Z80_WZ + 1, Z84_MWBR, Z84_CSBR, Z84_MCR
19+
Z84_WCR = Z80__LAST + 1, Z84_MWBR, Z84_CSBR, Z84_MCR
2020
};
2121

2222
/***************************************************************************

src/osd/modules/debugger/debuggdbstub.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static const gdb_register_map gdb_register_map_z80 =
359359
"z80",
360360
{
361361
{
362-
"mame.z80",
362+
"org.gnu.gdb.z80.cpu",
363363
{
364364
{ "AF", "af", false, TYPE_INT },
365365
{ "BC", "bc", false, TYPE_INT },
@@ -373,6 +373,7 @@ static const gdb_register_map gdb_register_map_z80 =
373373
{ "IY", "iy", false, TYPE_INT },
374374
{ "SP", "sp", true, TYPE_DATA_POINTER },
375375
{ "PC", "pc", true, TYPE_CODE_POINTER },
376+
{ "IR", "ir", false, TYPE_INT },
376377
}
377378
}
378379
}

0 commit comments

Comments
 (0)