GUI: Added display of PC and SP to the registers window
This commit is contained in:
parent
deed349cd1
commit
41fed482fe
30
gui.c
30
gui.c
@ -455,9 +455,13 @@ int update_general_registers(struct simdata_t *simdata){
|
||||
else{
|
||||
int center_x_offset=((width-2)-35*per_line)/2;
|
||||
int lines_used=(8/(int)per_line<8/(float)per_line)?8/per_line+1:8/per_line;
|
||||
int center_y_offset=((height-2)-(lines_used+2))/2;
|
||||
|
||||
if((lines_used+2)>(height-2)||width<37)
|
||||
int lines_for_special_registers;
|
||||
lines_for_special_registers=( width < 22+27+8 )?2:1;
|
||||
|
||||
int center_y_offset=((height-2)-(lines_used+lines_for_special_registers+1))/2;
|
||||
|
||||
if((lines_used+lines_for_special_registers+1)>(height-2)||width<37)
|
||||
mvwprintw(general_registers,1,1,"too small window");
|
||||
else{
|
||||
int n=0,y=0;
|
||||
@ -478,8 +482,28 @@ int update_general_registers(struct simdata_t *simdata){
|
||||
for(int i=0;i<35*per_line;i++)
|
||||
mvwaddch(general_registers,1+center_y_offset+lines_used,center_x_offset+i,ACS_HLINE);
|
||||
|
||||
int spec_reg_1_offset, spec_reg_2_offset;
|
||||
|
||||
if(lines_for_special_registers==2){
|
||||
spec_reg_1_offset=((width-2)/2)-(23/2);
|
||||
spec_reg_2_offset=((width-2)/2)-(27/2);
|
||||
}else{
|
||||
spec_reg_1_offset=((width-2)/2)-(22+27+8)/2;
|
||||
spec_reg_2_offset=spec_reg_1_offset+22+8;
|
||||
}
|
||||
|
||||
wattron(general_registers,A_BOLD);
|
||||
mvwprintw(general_registers,1+center_y_offset+lines_used+1,1+center_x_offset," ZERO");
|
||||
mvwprintw(general_registers,1+center_y_offset+lines_used+1,spec_reg_1_offset," PC");
|
||||
wattroff(general_registers,A_BOLD);
|
||||
wprintw(general_registers,": %06X ",simdata->registers->PC);
|
||||
|
||||
wattron(general_registers,A_BOLD);
|
||||
wprintw(general_registers,"SP");
|
||||
wattroff(general_registers,A_BOLD);
|
||||
wprintw(general_registers,": %06X ",simdata->registers->SP);
|
||||
|
||||
wattron(general_registers,A_BOLD);
|
||||
mvwprintw(general_registers,center_y_offset+lines_used+1+lines_for_special_registers,spec_reg_2_offset," ZERO");
|
||||
wattroff(general_registers,A_BOLD);
|
||||
wprintw(general_registers,": %c ",(simdata->registers->FLAGS&1)?'1':'0');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user