jaihsonk wrote:How can I get 32 bit addressing space then?
You can get 32-bit addressing by fixing your code. Right now your code skips some required initialization steps.
Or, depending on what you're doing with 32-bit addressing, you might instead prefer to use the BIOS INT 0x15 AH=0x87 or unreal mode. Those methods have the added benefit that you can continue to use other BIOS functions, such as INT 0x13 to read the disk; you can't use the BIOS once you've switched to protected mode.
jaihsonk wrote:Should I enable a20 in bootloader instead of kernel loader?
You should enable A20 before directly accessing any address above 1MB. (You shouldn't enable A20 before using INT 0x15 AH=0x87.)
jaihsonk wrote:If you know of any good articles that'd be appreciated thanks
This article has a brief overview of the steps required to switch to protected mode. (Personally, I don't think it's necessary to disable NMI - if one arrives while you're switching modes, it means there's a hardware problem.)
Or, if you're interested in unreal mode,
you can read more about it here. Keep in mind the BIOS can exit unreal mode at any time without warning; you'll have to install a #GP handler that enters unreal mode if you want it to be reliable.
Or, if you're interested in INT 0x15 AH=0x87,
you can read more about it here. This function handles A20 automatically, and on some PCs it will disable A20 before returning, so you shouldn't call this function after you enable A20.