Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
-----A20 GATE STATUS-----------DOS 7.1 STUB ROUTINE------------------
A beautiful example of bad programming in action:-
=DC9:107DL8
00C9:107D 80 00 00 00 90 00 FF FF
=UC9:1085L1F
00C9:1085 9C PUSHF
00C9:1086 1E PUSH DS
00C9:1087 06 PUSH ES
00C9:1088 51 PUSH CX
00C9:1089 56 PUSH SI
00C9:108A 57 PUSH DI
00C9:108B 2E C5 36 7D 10 LDS SI,CS:[107D]
00C9:1090 2E C4 3E 81 10 LES DI,CS:[1081]
00C9:1095 B9 04 00 MOV CX,0004
00C9:1098 FC CLD
00C9:1099 F3 A7 REPZ CMPSW
00C9:109B 74 07 JZ 10A4
00C9:109D 5F POP DI
00C9:109E 5E POP SI
00C9:109F 59 POP CX
00C9:10A0 07 POP ES
00C9:10A1 1F POP DS
00C9:10A2 9D POPF
00C9:10A3 C3 RET
=^C
This is from DOS 7.1 COMMAND.COM when DOS is in HMA. If you
DEBUG on the IVT the vectors for DOS all point to a little stub
that, before calling the DOS routine (in HMA) checks the A20 line
status and enables it if it is not on.
I won't go over the rest of the code at 10A4 as it is, like most
system code nowadays, massively long-winded, and ugly. It is enough
to say that this little 'routine' is supposed to determine the A20 line
status, jumping to 10A4 if it is off and returning so the DOS routine
can be immediately called if it is on.
The routine simply compares 8 bytes at 0:80 with 8 bytes at FFFF:90.
These bytes most certainly will be equal if A20 is off, since they are
then representing the same address range. The same is not certainly true
however if the A20 is on. The 8 bytes compared will be from different
addresses, but of course that does not imply they will be not equal.
I think that the DOS code probably knows, since FFFF:90 is in memory that
contains more DOS, that they have to be inequal. The 8 byte at 0:80 represent
the vectors 020h and 021h, both of which are DOS owned again. It is likely
that DOS rigs these to ensure inequality when A20 is on. It most likely
uses the 8 bytes at FFFF:90 expressly to save the NOT of the 2 vectors
at 0:80 on initialisation.
So, it works, but this does not excuse it from being extremely bad
programming.
-----A20 GATE STATUS-----------DOS 7.1 STUB ROUTINE------------------