VOGONS


First post, by theelf

User metadata
Rank Oldbie
Rank
Oldbie

Hi all,

I am writing a small window manager for DOS, for 286 ,i would like to use extended memory for some things

I have some questions for you guys im not sure

1. Does HIMEM.SYS use LOADALL (0F 05) on a 286 for the XMS move function, or does it use INT 15h AH=87h?

2. Is LOADALL really faster than INT 15h AH=87h for block copies?

3. Is it a bad idea to use LOADALL myself with HIMEM loaded? I think I would be touching memory that HIMEM has already given to other programs, so I plan to use the XMS API instead. Is that the right way?

My plan is to measure XMS move against my own LOADALL test, but I prefer to ask before I break something.

Thanks!

Reply 1 of 1, by wierd_w

User metadata
Rank l33t
Rank
l33t

The 286 is unable to leave protected/flat mode once it enters it, and lacks v86 mode. For realmode programs to get memory above 1mb on a 286, there isn't another way.

To get around that, clever developers discovered they could use the LOADALL instruction to set configurations of status registers not normally permissible. This is how most DOS extenders for 286s work, INCLUDING old versions of HIMEM.SYS.

Per Wikipedia:

Usage

As an example of the usefulness of these techniques, LOADALL can set up the CPU to allow access to all memory from real mode, without having to switch it into unreal mode (which requires switching into protected mode, accessing memory and finally switching back to real mode). Programs such as the pre-XMS versions of RAMDRIVE.SYS (1985),[3][1][4] SMARTDRV.SYS (1986)[4] as well as HIMEM.SYS (2.03, 1988-08-04; 2.04, 1988-08-17)[4] drivers in MS-DOS, Uniform Software Systems' The Extender (1985) and The Connector (1985) for Lotus 1-2-3, Above Disk (1986)[5] (a LIMulator by Above Software (formerly Tele-Ware West aka Los Angeles Securities Group) that converted hard disk space or extended memory into expanded memory), and OS/2 1.0[3][1] and 1.1[6] used the 286 LOADALL instruction. DOS 3.3 and 4.0 reserved a 102-byte buffer at 0070:0100h (which was normally occupied by DOS BIOS data) so that there was no need to save & restore it for LOADALL. Microsoft's EMM386.EXE special-cases both the 286 and 386 LOADALL instructions in its invalid opcode handler.[7] Examination of the virtual-machine monitor code in Windows/386 2.10 shows that it uses both the 286[citation needed] and the even less known 386 variant[citation needed]. Microsoft's HIMEM.SYS version 2.06[8] also used LOADALL to quickly copy to and from extended memory on 286 systems.

It gives this page as citation for HIMEM.SYS using LOADALL.
https://www.os2museum.com/wp/more-on-loadall-and-os2/