home *** CD-ROM | disk | FTP | other *** search
- WHAT TYPE CPU?
-
- There are generally two microprocessor families, real-mode processors,
- and protected-mode processors (this term is only used to describe their
- capabilities). The real-mode family is the 8086, 8088, 80186, 80188,
- and the NEC V30 and V20. Protected-mode ones are 80286, 80386DX,
- 80386SX, and 80486. 80386DX and SX are regarded as one type. To
- separate between families, you must find if SP is decremented before or
- after a PUSH. In real-mode processors, SP is decremented before
- PUSHing, in protected-mode processors, SP is decremented after PUSHing.
- The following piece of code will separate real-mode CPUs from protected
- CPUs:
-
- PUSH SP
- POP AX
- CMP SP,AX
- JE AN_8086
- NOTE: The `JE' can also be `JZ', and DEBUG changes `JE' to `JZ'
- automatically.
-
- I don't know how to tell the difference between all real-mode
- processors, so in the programs I'd call them an 8086, because that's
- the sort of `leader' of the group.
- Now you know which family it's in, you have to sort out the 286, 386,
- and 486s. 286s cannot set the Nested Task (NT) bit of the flag
- register, so there's the key. NT is bit 14, which is 4000h
- (hexadecimal, or hex) can be set (or at least tried to be) with the OR
- command. Yes, as you guessed we also have a piece of code for that:
-
- PUSHF
- POP AX
- OR AX,4000h
- PUSH AX
- POPF
- PUSHF
- POP AX
- TEST AX,4000h
- JE A_286
-
- That's out of the way. Now, as you probably know, a 486 has a memory-
- cache built-in. Due to this, on a 386, the write-through bit (bit 29)
- in the CR0 register cannot keep any data. Bit 29 represents 20000000h,
- and this test can be preformed by changing the state of bit 29, and
- testing if the bit is still changed. Of course, here is the code:
-
- MOV EAX,CR0
- MOV EBX,EAX
- XOR EAX,20000000h
- MOV CR0,EAX
- MOV EAX,CR0
- CMP EAX,EBX
- JE A_386
-
- If execution falls down after the `JE A_386' instruction, then the
- processor is a 486. If you're using MASM, remember to put a `.386P'
- WHAT TYPE CPU?
-
- directive to tell the assembler to use 386/486 instructions and
- registers. If you're using an assembler without 386/486 instructions
- allowed, then the following code will do the trick. Basically, you make
- the specified bytes be put in that area in the memory, which, when
- looked at by a 386 or 486 processor, will be interpreted as the
- appropriate registers and instructions:
-
- DB 0Fh,20h,C0h ;MOV EAX,CR0
- DB 60h,8Bh,D8h ;MOV EBX,EAX
- DB 66h,35h,00,00,00,20h ;XOR EAX,20000000h
- DB 0Fh,22h,C0h ;MOV CR0,EAX
- DB 0Fh,20h,C0h ;MOV EAX,CR0
- DB 66h,3Bh,C3h ;CMP EAX,EBX
- JE A_386
-
- That's it for telling what type CPU, the next section is about the
- interrupts in your PC/XT/AT. Only the useful interrupts are shown.
- *NEW PAGE*
- USEFUL I/O PORTS
-
- I/O ports are places in the computer, numbered 0-65535 which contain
- the numbers 0-255 in it. The computer will act differently upon the
- state of these, and I seriously warn you: do NOT experiment writing to
- the I/O ports, physical damage could be done, for they are places in
- the computer which are extremely special. The following is a list of
- useful I/O ports and their states:
-
- 0060h :
- Keyboard data input register
- 0061h :
- Keyboard data output register
-
- 0070h :
- CMOS RAM address port(AT only)
- 0071h :
- CMOS RAM data port, byte in CMOS RAM location specified in port
- 70h. Write to this to set CMOS RAM locations. Read from it to find
- out contents of location.
- 02F8h-02FFh :
- Serial 2; See technical reference manual
- 03F8h-03FFh :
- Serial 1; See technical reference manual
-
-