@@ -251,7 +251,7 @@ void MainWindow::on_openbtn_clicked()
251251 infile.getline (tmp,300 );
252252 ui->editor ->insertPlainText (QString::fromStdString (tmp));
253253 ui->editor ->insertPlainText (" \n " );
254- on_reset_btn_clicked () ;
254+ compiled= 0 ;
255255
256256 }
257257
@@ -264,20 +264,20 @@ void MainWindow::on_openbtn_clicked()
264264void MainWindow::on_action_Open_triggered ()
265265{
266266 on_openbtn_clicked ();
267- on_reset_btn_clicked () ;
267+ compiled= 0 ;
268268}
269269
270270void MainWindow::on_action_New_triggered ()
271271{
272272 ui->editor ->clear ();
273273 issaved=" " ;
274- on_reset_btn_clicked () ;
274+ compiled= 0 ;
275275}
276276
277277void MainWindow::on_newbtn_clicked ()
278278{
279279 on_action_New_triggered ();
280- on_reset_btn_clicked () ;
280+ compiled= 0 ;
281281}
282282
283283void MainWindow::on_reset_btn_clicked ()
@@ -370,9 +370,10 @@ void MainWindow::on_compile_btn_clicked()
370370 }
371371 }
372372
373- lc1++;
374- // memoryToLine[lc1]=i;
375373
374+ memoryToLine[lc1]=i;
375+ qDebug ()<<" memory: " <<lc1 <<" ,,, " <<" line :" <<i;
376+ lc1++;
376377
377378 }
378379
@@ -1274,6 +1275,7 @@ void MainWindow::on_next_btn_clicked()
12741275
12751276 else if (riz.at (0 )==" BUN" )
12761277 {
1278+ int Ichecker;
12771279 if (clk==3 )
12781280 {
12791281 clk++;
@@ -1287,13 +1289,20 @@ void MainWindow::on_next_btn_clicked()
12871289
12881290 }
12891291
1292+ qDebug ()<<" go to memory: " <<ram[tmpAR.to_ulong ()].to_ulong ();
1293+ qDebug ()<<" go to line: " <<AR.to_ulong ();
1294+ Ichecker=1 ;
1295+ // lineStep=memoryToLine[AR.to_ulong()]-1;
1296+
1297+
12901298 }
12911299 else
12921300 {
1301+ Ichecker=0 ;
12931302
12941303 }
12951304 // qDebug()<<AR.to_ulong();
1296- // lineStep=memoryToLine[AR.to_ulong()];
1305+ //
12971306 // ui->in_line->setText(QString::number(lineStep));
12981307 }
12991308
@@ -1304,7 +1313,17 @@ void MainWindow::on_next_btn_clicked()
13041313 SC=0 ;
13051314 clk=0 ;
13061315 PC=AR;
1307- lineStep=allDatas[riz.at (1 )+" ," ]-1 ;
1316+ if (Ichecker)
1317+ {
1318+ lineStep=memoryToLine[AR.to_ulong ()]-1 ;
1319+ qDebug ()<<" gotolineStep: " <<lineStep;
1320+ }
1321+ else
1322+ {
1323+ lineStep=allDatas[riz.at (1 )+" ," ]-1 ;
1324+ qDebug ()<<" gotolineStep!!!!!!!!!!!!: " <<lineStep;
1325+ }
1326+
13081327
13091328 lineStep++;
13101329 // ui->in_line->setText(QString::number(lineStep));
@@ -1344,9 +1363,11 @@ void MainWindow::on_next_btn_clicked()
13441363 ui->operation ->setText (" M[AR] <- PC , AR <- AR+1" );
13451364 clk++;
13461365 inrAR ();
1366+ qDebug ()<<" where to write in memory" <<AR.to_ulong ()-1 ;
1367+ qDebug ()<<" write in memory: " <<PC.to_ulong ();
13471368 for (int bitC=0 ;bitC<12 ;bitC++)
13481369 {
1349- ram[AR.to_ulong ()][bitC]=PC[bitC];
1370+ ram[( AR.to_ulong ())- 1 ][bitC]=PC[bitC];
13501371
13511372 }
13521373 }
@@ -1359,6 +1380,7 @@ void MainWindow::on_next_btn_clicked()
13591380 PC=AR;
13601381 lineStep=allDatas[riz.at (1 )+" ," ]; // shak
13611382 lineStep++;
1383+ qDebug ()<<" line: " <<lineStep;
13621384 SC=0 ;
13631385
13641386 memorystep=PC.to_ulong ();
0 commit comments