First of all, I'd like to ask whether it's possible to disable A20 on Bochs. I tried running this code to make sure it's disabled, but my test function (please see below) still reports it's enabled:
Code: Select all
mov ax, 0x2400
int 0x15
out 0xee,al
This is a link to my code: https://i.imgur.com/micAq3A.pngBefore enabling the A20 with any of the methods described below it is better to test whether the A20 address line was already enabled by the BIOS. This can be achieved by comparing, at boot time in real mode, the bootsector identifier (0xAA55) located at address 0000:7DFE with the value 1 MiB higher which is at address FFFF:7E0E. When the two values are different it means that the A20 is already enabled otherwise if the values are identical it must be ruled out that this is not by mere chance. Therefore the bootsector identifier needs to be changed, for instance by rotating it left by 8 bits, and again compared to the 16 bits word at FFFF:7E0E. When they are still the same then the A20 address line is disabled otherwise it is enabled.