Anyone know a reliable, safe way to turn A20 off? [solved]

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Anyone know a reliable, safe way to turn A20 off? [solved]

Post by DavidCooper »

Does anyone know a reliable, safe way to turn A20 off? It may seem like an odd thing to want to do, but I do have a good reason. I'm now working with my OS on flash drives where it sits in subpartitions of what I call a multifloppy partition, and any one of hundreds of floppy-disk-sized subpartitions can be booted from my OS just as if my OS is an MBR, but with the difference that the A20 is already on. Some machines already have the A20 on on booting, so it clearly isn't vital to switch it off for this, but I'm creating a system in which beginners could put their early OS experiments into subpartitions and boot them up from a flash drive, thereby keeping a complete history of the development of their OS all on the same drive, and with every single version being bootable from there (on real hardware).

Incidentally, I also have an idea about posting a binary blob into memory just before booting up another OS such that beginners could use it to see more easily what their code's doing - an INT 3 instruction (a single byte) would transfer control to the binary blob and print out the contents of all registers to the screen, and it would also enable the user to type in addresses to get a display of the contents of memory there, after which it would return control to the bootsector which would continue from where it left off as if nothing had happened. The same functionality could be provided for protected mode, but using a near call to a specific entry point instead of INT 3.

If I decide not to bother trying to switch the A20 off, it shouldn't matter too much as it's easy enough for people to tell if their A20-on code works just by putting their OS in a normal partition and booting it directly, but ideally I'd like to switch the A20 off on any machine which normally boots up with it off. The binary blob could use relocatable code and have its location set from within my OS (and the setting saved so that it doesn't need to be set every time), so it needn't get in the way of where people want to put their OS.
Last edited by DavidCooper on Sun Sep 09, 2012 3:21 pm, edited 1 time in total.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Does anyone know a reliable, safe way to turn A20 off?

Post by bluemoon »

How about INT15/2400?
http://www.ctyme.com/intr/rb-1335.htm

You may also try the IO methods but in my own test those method fail on macbook, probably because there is no such hardware nor emulation.
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: Does anyone know a reliable, safe way to turn A20 off?

Post by DavidCooper »

bluemoon wrote:How about INT15/2400?
http://www.ctyme.com/intr/rb-1335.htm
Thanks - that's absolutely ideal, being both simple and safe. Whenever it works on a machine, that'll be great, but whenever it isn't supported it won't matter too much, and I won't even need to check the result.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Post Reply