Skip to content

Commit

Permalink
EMS: EMM386 emulation is based on the same logic as XMS for free memory,
Browse files Browse the repository at this point in the history
so total memory should use the same calls as well. This fixes EMS
emulation reporting total system memory as available which often exceeds
the free memory reported by XMS.
  • Loading branch information
joncampbell123 committed Jan 27, 2015
1 parent 9b92cae commit 9c6c9a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ints/ems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ struct MoveRegion {
Bit16u dest_page_seg;
};

static Bit16u EMM_GetTotalPages(void) {
Bitu count=MEM_FreeLargest()/4;
if (count>0x7fff) count=0x7fff;
return (Bit16u)count;
}

static Bit16u EMM_GetFreePages(void) {
Bitu count=MEM_FreeTotal()/4;
if (count>0x7fff) count=0x7fff;
Expand Down Expand Up @@ -748,7 +754,7 @@ static Bitu INT67_Handler(void) {
reg_ah=EMM_NO_ERROR;
break;
case 0x42: /* Get number of pages */
reg_dx=(Bit16u)(MEM_TotalPages()/4); //Not entirely correct but okay
reg_dx=EMM_GetTotalPages();
reg_bx=EMM_GetFreePages();
reg_ah=EMM_NO_ERROR;
break;
Expand Down

0 comments on commit 9c6c9a2

Please sign in to comment.