dtools : io regs working now

This commit is contained in:
damdoum 2007-01-05 13:39:45 +00:00
parent 340864c47a
commit b72cfed09a
4 changed files with 116 additions and 68 deletions

View File

@ -1,25 +1,52 @@
#include "callbacks_dtools.h"
/* ***** ***** IO REGISTERS ***** ***** */
static int cpu=0;
static u32 address;
static BOOL hword;
static GtkLabel * reg_address;
static GtkEntry * reg_value;
void display_current_reg() {
char text_address[16];
char text_value[16];
char * patt = "0x%08X";
u32 w = MMU_read32(cpu,address);
if (hword) { patt = "0x%04X"; w &= 0xFFFF; }
sprintf(text_address, "0x%08X", address);
sprintf(text_value, patt, w);
gtk_label_set_text(reg_address, text_address);
gtk_entry_set_text(reg_value, text_value);
}
void display_reg(u32 address_, BOOL hword_) {
address = address_;
hword = hword_;
display_current_reg();
}
void on_wtools_1_combo_cpu_changed (GtkComboBox *widget, gpointer user_data) {
/* c == 0 means ARM9 */
cpu=gtk_combo_box_get_active(widget);
display_current_reg();
}
void on_wtools_1_IOregs_show (GtkWidget *widget, gpointer user_data) {
GtkWidget * b = glade_xml_get_widget(xml_tools, "wtools_1_r_ime");
// do as if we had selected this button
GtkWidget * combo = glade_xml_get_widget(xml_tools, "wtools_1_combo_cpu");
reg_address = (GtkLabel*)glade_xml_get_widget(xml_tools, "wtools_1_REGADRESS");
reg_value = (GtkEntry*)glade_xml_get_widget(xml_tools, "wtools_1_REGVALUE");
// do as if we had selected this button and ARM7 cpu
gtk_toggle_button_set_active((GtkToggleButton*)b, TRUE);
gtk_combo_box_set_active((GtkComboBox*)combo, 0);
}
/* c == 0 means ARM9 */
static u32 val_REG_IME(int c) { return MMU.reg_IME[c]; }
static u32 val_REG_IE(int c) { return MMU.reg_IE[c]; }
static u32 val_REG_IF(int c) { return MMU.reg_IF[c]; }
static u32 val_REG_IPCFIFOCNT(int c) { return ((u16 *)(MMU.MMU_MEM[c][0x40]))[0x184>>1]; }
static u32 val_POWER_CR(int c) { return ((u16 *)(MMU.MMU_MEM[c][0x40]))[0x304>>1]; }
static u32 val_REG_SPICNT(int c) { return ((u16 *)(MMU.MMU_MEM[c][0x40]))[0x1C0>>1]; }
void on_wtools_1_r_ipcfifocnt_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_spicnt_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_ime_toggled (GtkToggleButton *togglebutton, gpointer user_data) { printf("hello\n");}
void on_wtools_1_r_ie_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_if_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_power_cr_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_ipcfifocnt_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_IPCFIFOCNT,TRUE); }
void on_wtools_1_r_spicnt_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_SPICNT,TRUE); }
void on_wtools_1_r_ime_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_IME,TRUE); }
void on_wtools_1_r_ie_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_IE,FALSE); }
void on_wtools_1_r_if_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_IF,FALSE); }
void on_wtools_1_r_power_cr_toggled (GtkToggleButton *togglebutton, gpointer user_data) { display_reg(REG_POWCNT1,TRUE); }

View File

@ -2,6 +2,7 @@
/* ***** ***** IO REGISTERS ***** ***** */
void on_wtools_1_combo_cpu_changed (GtkComboBox *widget, gpointer user_data);
void on_wtools_1_IOregs_show (GtkWidget *widget, gpointer user_data);
void on_wtools_1_r_ipcfifocnt_toggled (GtkToggleButton *togglebutton, gpointer user_data);
void on_wtools_1_r_spicnt_toggled (GtkToggleButton *togglebutton, gpointer user_data);

View File

@ -57,7 +57,7 @@
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
@ -108,57 +108,9 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="wtools_1_REGADRESS">
<property name="visible">True</property>
<property name="label" translatable="yes">(0xADDRESS)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="wtools_1_REGVALUE">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">(0xVALUE)</property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
@ -293,13 +245,80 @@
</packing>
</child>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="wtools_1_REGADRESS">
<property name="visible">True</property>
<property name="label" translatable="yes">(0xADDRESS)</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="wtools_1_REGVALUE">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">False</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">(0xVALUE)</property>
<property name="has_frame">True</property>
<property name="invisible_char">●</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wtools_1_combo_cpu">
<property name="visible">True</property>
<property name="items" translatable="yes">cpu : ARM7
cpu : ARM9</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
<signal name="changed" handler="on_wtools_1_combo_cpu_changed" last_modification_time="Fri, 05 Jan 2007 13:10:42 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget>

View File

@ -13,6 +13,7 @@
#include <glade/glade.h>
#include "../MMU.h"
#include "../registers.h"
#include "../armcpu.h"
#include "../NDSSystem.h"
#include "../cflash.h"