News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

.386 vs .486 vs .586

Started by Sergiu FUNIERU, February 19, 2010, 11:45:43 PM

Previous topic - Next topic

Sergiu FUNIERU

1. When should I use each? Is is okay to use nowadays only the .586? I want my code to run on Windows XP and later. Windows XP can't be installed on 486, so why use .386 and .486?

2. Are any significant diffrences between them?

What tutorial should I read to understand these?

BlackVortex

It is an assembler directive (it starts with a dot!) so it should be mentioned in Microsoft's MASM documentation.

I think it only changes the machiine type in the pe header and throws warnings if you try to use unsupported opcodes for the system you have specified (someone correct me if I'm wrong)

You can safely use ".586p", I do it and it makes me feel elite !  :green

It's pretty much useless for 32bit coding, for example, the GoAsm assembler doesn't even support/need this declaration   :thumbu

jj2007

The .x86 limits the instruction set. The "application" below assembles fine with .486 but throws "error A2085:instruction or register not accepted in current CPU mode" with .386

include \masm32\include\masm32rt.inc
.486

.code
AppName db "Masm32:", 0

start: bswap eax
inkey "Masm32 is great"
exit
end start


Below an excerpt from masm32rt.inc. As you can see, .486 is the default, i.e. what you get if you don't specify anything after the include line. I use for my own code

.nolist     ; prevents Masm from writing a megabyte listing to disk
include \masm32\include\masm32rt.inc
.686    ; ok for a really trusty old Pentium
.xmm
.listall     ; resumes the listing for the 1 or 2 kbytes of your own code ;-)


\masm32\include\masm32rt.inc
      .486                                      ; create 32 bit code
      .model flat, stdcall                      ; 32 bit memory model
      option casemap :none                      ; case sensitive

;     include files
;     ~~~~~~~~~~~~~
      include \masm32\include\windows.inc       ; main windows include file
      include \masm32\include\masm32.inc        ; masm32 library include

    ; -------------------------
    ; Windows API include files
    ; -------------------------
      include \masm32\include\gdi32.inc
      include \masm32\include\user32.inc
      include \masm32\include\kernel32.inc
      include \masm32\include\Comctl32.inc
      include \masm32\include\comdlg32.inc
      include \masm32\include\shell32.inc
      include \masm32\include\oleaut32.inc
      include \masm32\include\ole32.inc
      include \masm32\include\msvcrt.inc

      include \masm32\include\dialogs.inc       ; macro file for dialogs
      include \masm32\macros\macros.asm         ; masm32 macro file

dedndave

i know that the CPUID instruction requires .586 or higher
it can be helpful when you want to write a program that will run on a 386, too
it will prevent you from using instructions that aren't supported on the 80386
windows 95 can be installed on a 386 machine (i think), so if you want to write a program for win 95...

hutch--

Sergiu,

The lead code below will get you the lot on masm 9.0


    .686p                       ; create 32 bit code
    .mmx                        ; enable MMX instructions
    .xmm                        ; enable SSE instructions
    .model flat, stdcall        ; 32 bit memory model
    option casemap :none        ; case sensitive


These days unless you are designing for an old processor, you can safely assume at least MMX and with some testing you can now usually use up to SSE2.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

i thought all that stuff went after the model   :(
now i remember - you should specify a processor before the model
then, you can change it afterwards if you like   :U
i got so used to using masm32rt.inc, i forgot what all was in it

MichaelW

Quote from: dedndave on February 20, 2010, 03:09:36 AM
i thought all that stuff went after the model
The position of the first processor directive relative to the model directive sets the segment word size, 32 bit if a 386 higher processor directive precedes the model directive, otherwise 16 bit.
eschew obfuscation

Magnum

Quote from: Sergiu FUNIERU on February 19, 2010, 11:45:43 PM
1. When should I use each? Is is okay to use nowadays only the .586? I want my code to run on Windows XP and later. Windows XP can't be installed on 486, so why use .386 and .486?

I am running XP Pro on a .386.

Have a great day,
                         Andy

Sergiu FUNIERU

Quote from: Magnum on February 20, 2010, 05:58:12 PMI am running XP Pro on a .386.
Wow! According to this:
http://www.microsoft.com/windowsxp/sysreqs/pro.mspx
it seems that the minimum frequency required to run Windows XP Professional is 233 MHz.

According to Wikipedia
http://en.wikipedia.org/wiki/Intel_80386
it seems that the maximum frequency for a .386 processor is 40MHz.

I guess your system runs very slow if you get under the minimum requirements.

ecube

thanks for bringing this up, it never even occured to me that made a difference, :)

Astro

So specifying .586 simply warns when things will not work on older processors?

Doesn't XP REQUIRE an FPU?

Best regards,
Robin.

dedndave

XP requires a pentium, all of which have on-chip FPU's
windows 3.1 will run on a 386
for win 95 though, i think you can run on a 386 with no FPU (it may be a 486 - i don't remember)
win 98 and up require an FPU, whether it is on-chip or not

the place you are most likely to see pre-pentium processors nowdays is in embedded systems
(and at Steve and Michael's houses)

Astro

I have an XT kicking around (and it still works).  :U  :cheekygreen:

Best regards,
Robin.

Magnum

Quote from: Sergiu FUNIERU on February 20, 2010, 06:12:18 PM
Quote from: Magnum on February 20, 2010, 05:58:12 PMI am running XP Pro on a .386.
Wow! According to this:
http://www.microsoft.com/windowsxp/sysreqs/pro.mspx
it seems that the minimum frequency required to run Windows XP Professional is 233 MHz.


I guess your system runs very slow if you get under the minimum requirements.

I am running a 700 Mhz processor.
It is not as slow as many think.

It plays DVDs without any skipping.
Music does use about 75% of the CPU.

Andy

Have a great day,
                         Andy