Skip to content

Commit 8cd839b

Browse files
committed
Use 0xFFFF0 mask with ES for int 13h
1 parent 6aca954 commit 8cd839b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/drivers/disk/disk.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ static int load_sector_via_reallibrary_data(
1414
unsigned int lba,
1515
unsigned char count) {
1616
// assumes count <= 128
17-
int es = (MEMORY_REALLIBRARY_DATA_ADDRESS&0xF0000)>>4;
18-
int es_address = MEMORY_REALLIBRARY_DATA_ADDRESS&0xFFFF;
17+
int es = (MEMORY_REALLIBRARY_DATA_ADDRESS&0xFFFF0)>>4;
18+
int es_address = MEMORY_REALLIBRARY_DATA_ADDRESS&0x000F;
1919
int cylinder_head = (lba/63);
2020
int sector_index = lba%63 + 1;
2121
// https://en.wikipedia.org/wiki/INT_13H#INT_13h_AH=02h:_Read_Sectors_From_Drive

src/drivers/disk/disk_16.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ int load_sectors(unsigned int full_address,
1212
unsigned int count) {
1313
// we don't expect disk_16 (used by bootloader) to load more than 255 sectors.
1414

15-
int es = (full_address&0xF0000)>>4;
16-
int es_address = full_address&0xFFFF;
15+
int es = (full_address&0xFFFF0)>>4;
16+
int es_address = full_address&0x000F;
1717
int cylinder_head = (lba/63);
1818
int sector_index = lba%63 + 1;
1919
// https://en.wikipedia.org/wiki/INT_13H#INT_13h_AH=02h:_Read_Sectors_From_Drive

0 commit comments

Comments
 (0)