Amélioration de l'interface, mise en place de l'initialisation de la VM et rafraichissement des registres
This commit is contained in:
parent
f5e71076cb
commit
fe633ab032
77
ia86.cpp
77
ia86.cpp
|
@ -18,7 +18,7 @@
|
||||||
std::string intToHexString(int intValue, int size) {
|
std::string intToHexString(int intValue, int size) {
|
||||||
string hexStr;
|
string hexStr;
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
sstream << std::setfill ('0') << std::setw(size) << std::hex << (int)intValue;
|
sstream << std::uppercase << std::setfill ('0') << std::setw(size) << std::hex << (int)intValue;
|
||||||
hexStr= sstream.str();
|
hexStr= sstream.str();
|
||||||
sstream.clear();
|
sstream.clear();
|
||||||
return hexStr;
|
return hexStr;
|
||||||
|
@ -319,7 +319,7 @@ std::vector<std::array<std::string, 5>> Desassembler::Desassemble(Code *code)
|
||||||
{
|
{
|
||||||
std::string *bytes = new std::string("");
|
std::string *bytes = new std::string("");
|
||||||
for (size_t k = 0; k < insn[j].size; k++)
|
for (size_t k = 0; k < insn[j].size; k++)
|
||||||
*bytes=*bytes+intToHexString((int)insn[j].bytes[k], 1);
|
*bytes=*bytes+intToHexString((int)insn[j].bytes[k], 2);
|
||||||
std::string adresse = intToHexString((int)insn[j].address, 8);
|
std::string adresse = intToHexString((int)insn[j].address, 8);
|
||||||
std::string *menmonic = new std::string((char *)insn[j].mnemonic);
|
std::string *menmonic = new std::string((char *)insn[j].mnemonic);
|
||||||
std::string *op_str = new std::string((char *)insn[j].op_str);
|
std::string *op_str = new std::string((char *)insn[j].op_str);
|
||||||
|
@ -748,17 +748,25 @@ void Menu::AdjustWindows()
|
||||||
screen.setGeometry ( FPoint { 105, 18 }, FSize{80, 25} );
|
screen.setGeometry ( FPoint { 105, 18 }, FSize{80, 25} );
|
||||||
debug.setGeometry ( FPoint { 42, 17 }, FSize{60, 27} );
|
debug.setGeometry ( FPoint { 42, 17 }, FSize{60, 27} );
|
||||||
scenar.setGeometry ( FPoint { 187, 01 }, FSize{23, 55} );
|
scenar.setGeometry ( FPoint { 187, 01 }, FSize{23, 55} );
|
||||||
flags.hide();
|
this->hide();
|
||||||
stack.hide();
|
flags.hide();
|
||||||
mem.hide();
|
stack.hide();
|
||||||
screen.hide();
|
mem.hide();
|
||||||
if (goals[scenar.getselected()].level > 3)
|
screen.hide();
|
||||||
|
log.show();
|
||||||
|
edit.show();
|
||||||
|
view.show();
|
||||||
|
regs.show();
|
||||||
|
tuto.show();
|
||||||
|
debug.show();
|
||||||
|
scenar.show();
|
||||||
|
if (goals[scenar.getselected()].level > 3)
|
||||||
flags.show();
|
flags.show();
|
||||||
if (goals[scenar.getselected()].level > 5)
|
if (goals[scenar.getselected()].level > 5)
|
||||||
stack.show();
|
stack.show();
|
||||||
if (goals[scenar.getselected()].level > 2)
|
if (goals[scenar.getselected()].level > 2)
|
||||||
mem.show();
|
mem.show();
|
||||||
if (goals[scenar.getselected()].level > 6)
|
if (goals[scenar.getselected()].level > 6)
|
||||||
screen.show();
|
screen.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,6 +797,8 @@ void Menu::initMenus()
|
||||||
Breakpoint.setStatusbarMessage ("Enlève ou met un point d'arrêt");
|
Breakpoint.setStatusbarMessage ("Enlève ou met un point d'arrêt");
|
||||||
End.addAccelerator (FKey::F6);
|
End.addAccelerator (FKey::F6);
|
||||||
End.setStatusbarMessage ("Termine le programme et remet à zéro la machine IA86");
|
End.setStatusbarMessage ("Termine le programme et remet à zéro la machine IA86");
|
||||||
|
Init.addAccelerator (FKey::F3);
|
||||||
|
Init.setStatusbarMessage ("Initialise la machine IA86");
|
||||||
About.setStatusbarMessage ("A propos de IA86");
|
About.setStatusbarMessage ("A propos de IA86");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,6 +852,17 @@ void Menu::initMenusCallBack()
|
||||||
this,
|
this,
|
||||||
&Menu::end
|
&Menu::end
|
||||||
);
|
);
|
||||||
|
About.addCallback
|
||||||
|
(
|
||||||
|
"clicked",
|
||||||
|
this,
|
||||||
|
&Menu::about
|
||||||
|
);
|
||||||
|
Init.addCallback (
|
||||||
|
"clicked",
|
||||||
|
this,
|
||||||
|
&Menu::initIA
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::initMisc()
|
void Menu::initMisc()
|
||||||
|
@ -898,7 +919,6 @@ void Menu::loadGoal()
|
||||||
|
|
||||||
void Menu::end()
|
void Menu::end()
|
||||||
{
|
{
|
||||||
regs.set("En attente d'initialisation...");
|
|
||||||
vm.Halt(code);
|
vm.Halt(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,6 +928,32 @@ void Menu::compile()
|
||||||
debug.set(unasmer.Desassemble(code));
|
debug.set(unasmer.Desassemble(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Menu::about()
|
||||||
|
{
|
||||||
|
log.hide();
|
||||||
|
edit.hide();
|
||||||
|
view.hide();
|
||||||
|
regs.hide();
|
||||||
|
flags.hide();
|
||||||
|
stack.hide();
|
||||||
|
mem.hide();
|
||||||
|
tuto.hide();
|
||||||
|
screen.hide();
|
||||||
|
debug.hide();
|
||||||
|
scenar.hide();
|
||||||
|
this->show();
|
||||||
|
this->redraw();
|
||||||
|
this->Info.redraw();
|
||||||
|
//((finalcut::FApplication*)this->getParent())->sendQueuedEvents();
|
||||||
|
sleep(3);
|
||||||
|
AdjustWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Menu::initIA()
|
||||||
|
{
|
||||||
|
vm.Prepare(&goals[scenar.getselected()].init,code);
|
||||||
|
}
|
||||||
|
|
||||||
bool Menu::verify()
|
bool Menu::verify()
|
||||||
{
|
{
|
||||||
if (!code->assembled)
|
if (!code->assembled)
|
||||||
|
@ -916,7 +962,7 @@ bool Menu::verify()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!code->initialized)
|
if (!code->initialized)
|
||||||
vm.Prepare(&goals[scenar.getselected()].init,code);
|
initIA();
|
||||||
if (!code->initialized)
|
if (!code->initialized)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -925,9 +971,15 @@ bool Menu::verify()
|
||||||
void Menu::refresh()
|
void Menu::refresh()
|
||||||
{
|
{
|
||||||
if (!code->executed)
|
if (!code->executed)
|
||||||
|
{
|
||||||
finalcut::FApplication::setDarkTheme();
|
finalcut::FApplication::setDarkTheme();
|
||||||
|
regs.set("En attente d'initialisation...");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
finalcut::FApplication::setDefaultTheme();
|
finalcut::FApplication::setDefaultTheme();
|
||||||
|
regs.set(vm.getRegs(goals[scenar.getselected()].level));
|
||||||
|
}
|
||||||
auto root_widget = getRootWidget();
|
auto root_widget = getRootWidget();
|
||||||
root_widget->resetColors();
|
root_widget->resetColors();
|
||||||
root_widget->redraw();
|
root_widget->redraw();
|
||||||
|
@ -938,7 +990,6 @@ void Menu::exec()
|
||||||
{
|
{
|
||||||
if (!verify()) return;
|
if (!verify()) return;
|
||||||
vm.Run(code,code->address,code->address+code->size,0);
|
vm.Run(code,code->address,code->address+code->size,0);
|
||||||
regs.set(vm.getRegs(goals[scenar.getselected()].level));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::trace()
|
void Menu::trace()
|
||||||
|
|
4
ia86.h
4
ia86.h
|
@ -320,9 +320,10 @@ class Menu final : public finalcut::FDialog
|
||||||
void trace();
|
void trace();
|
||||||
void step();
|
void step();
|
||||||
bool verify();
|
bool verify();
|
||||||
|
void about();
|
||||||
void AdjustWindows();
|
void AdjustWindows();
|
||||||
void initWindows();
|
void initWindows();
|
||||||
void splash();
|
void initIA();
|
||||||
void initLayout() override;
|
void initLayout() override;
|
||||||
void adjustSize() override;
|
void adjustSize() override;
|
||||||
// Event handler
|
// Event handler
|
||||||
|
@ -341,6 +342,7 @@ class Menu final : public finalcut::FDialog
|
||||||
finalcut::FMenuItem Assemble{"&Compilation", &Tools};
|
finalcut::FMenuItem Assemble{"&Compilation", &Tools};
|
||||||
finalcut::FMenuItem Rearange{"&Ordonne les fenêtres", &Tools};
|
finalcut::FMenuItem Rearange{"&Ordonne les fenêtres", &Tools};
|
||||||
finalcut::FMenu Debug{"&Déboguage", &Menubar};
|
finalcut::FMenu Debug{"&Déboguage", &Menubar};
|
||||||
|
finalcut::FMenuItem Init{"&Initialiser", &Debug};
|
||||||
finalcut::FMenuItem Run{"&Exécuter", &Debug};
|
finalcut::FMenuItem Run{"&Exécuter", &Debug};
|
||||||
finalcut::FMenuItem End{"&Terminer", &Debug};
|
finalcut::FMenuItem End{"&Terminer", &Debug};
|
||||||
finalcut::FMenuItem TraceInto{"Pas à pas &détaillé", &Debug};
|
finalcut::FMenuItem TraceInto{"Pas à pas &détaillé", &Debug};
|
||||||
|
|
Loading…
Reference in New Issue