GUI: small improvements to the hex dump window
This commit is contained in:
parent
988b6802bb
commit
ee6481e9de
10
gui.c
10
gui.c
@ -147,9 +147,11 @@ int update_general_memdump(struct simdata_t *simdata){
|
|||||||
if(width<16){
|
if(width<16){
|
||||||
mvwprintw(general_memdump,1,1,"too small window");
|
mvwprintw(general_memdump,1,1,"too small window");
|
||||||
}else{
|
}else{
|
||||||
int n=(width-12)/4;
|
int n=(width-12)/4; // bytes in each line
|
||||||
uint32_t ADDRESS=0;
|
int usable_height=height-3-(width-12)%2;
|
||||||
for(int h=0;h<height-3;h++){
|
|
||||||
|
uint32_t ADDRESS=(simdata->PC-n*usable_height/2)&0x00FFFFFF;
|
||||||
|
for(int h=0;h<usable_height;h++){
|
||||||
wmove(general_memdump,h+2,2+(width-12)%2);
|
wmove(general_memdump,h+2,2+(width-12)%2);
|
||||||
wprintw(general_memdump,"%06x ",ADDRESS);
|
wprintw(general_memdump,"%06x ",ADDRESS);
|
||||||
uint32_t temp_address=ADDRESS;
|
uint32_t temp_address=ADDRESS;
|
||||||
@ -157,7 +159,7 @@ int update_general_memdump(struct simdata_t *simdata){
|
|||||||
wprintw(general_memdump,"%02x ",simdata->RAM[temp_address++]);
|
wprintw(general_memdump,"%02x ",simdata->RAM[temp_address++]);
|
||||||
for (int i=0;i<n;i++){
|
for (int i=0;i<n;i++){
|
||||||
wprintw(general_memdump,"%c",(simdata->RAM[ADDRESS]>=0x20&&simdata->RAM[ADDRESS]<0x7F)?simdata->RAM[ADDRESS]:'.');
|
wprintw(general_memdump,"%c",(simdata->RAM[ADDRESS]>=0x20&&simdata->RAM[ADDRESS]<0x7F)?simdata->RAM[ADDRESS]:'.');
|
||||||
ADDRESS++;
|
ADDRESS=(ADDRESS+1)&0xFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ struct simdata_t *init_simdata(){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret->PC=0;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user