Page 1 of 1

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

Posted: Sun Sep 09, 2012 2:28 pm
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.

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

Posted: Sun Sep 09, 2012 2:48 pm
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.

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

Posted: Sun Sep 09, 2012 3:18 pm
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.