|
-
February 18th, 2004, 10:18 AM
#16
OK
my previous application was 16-bit application ... near pointer, 64 KB for segment, .... and so on
but now its 32-bit, i use the new and delete for dynamic allocation, its running correctly but i ask this question as a precautionary issue.
snd from Sam infromation i think it must continue working without any problem
is that true Sam ?
-
February 18th, 2004, 12:29 PM
#17
Sam,
I wouldn't say that what I said was incorrect. Certainly what I posted wasn't a white paper but a quick synopsys of programming history with regards to memory models..
That depends on what processor. The original IBM PC uses a 8088 processor, which is 16-bit and capable of accessing 1 MB of memory.
What you're talking about is how much memory the Machine could physically address 640k for the 8086/8088. What I was talking about is how much memory a segment in a process could address. Either way what you said is wrong. The 8086 and 8088 could only access 640k of memory. It was the 80286 which introduced extended memory schemes for "protected" mode processes. and the 80386 wich introduced expanded memory which took advantage of the high memory between 640k barior and 1 meg.
Now we can debate whether they actually helped or not. Any windows 2.1 programmer will tell you.... They sucked as I'm sure you would agree with..
It was not the programmers; it was the processor manufacturer that designed the processor to use segments.
poetic liscense....
Not in a pentium processor using 32-bit addressing mode, as does 32-bit Windows does.
Your not wrong here, but neither am I. There are 2 memory models supported in the Pentium architecture.
(Actually it is the 486 and more recent models that support 2 models.)
FLAT MEMORY MODEL
-- The memory model that we use. AND, the memory model that every other manufactures' processors also use.
SEGMENTED MEMORY MODEL
Corned bee is right The segment registers are still there and accessible in 32-bit mode.
There are many other ways to access more data and such. It is possible to allocate memory during execution and address it in a variety of ways, including use of far pointers.
Yes all things are possible depending upon your memory model. For example in small memory model the heap and stack both were resident on the Data Segment. There was only one Data Segment, and that we will agree was limited as all segments were to only 64k.
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
Only if you added another data segment you couldn't acess it with a near pointer
--------------------------------------------------------------------------------
Speak for yourself; I could.
Here for a change your not technically wrong. In realmode programming you of course could tinker with the DS base pointer registar and then use a near pointer to address another Data Segments memory as you allude too. But the gist of my statement had to do with the nature of near and far pointers. near pointers weren't pointers at all but rather offsets which would be combined with a base pointer to address memory inside a 64k data segment. Memory allocated outside this block of memory could only be accessed by far pointers... unless you reset your base address of your data segment which would be crazy. Crazy because then you can't access any of your variables in your original DS. But I supposed in real mode operation even crazy folks have the power.
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
Complicated you say? Yes it was a little complicated. It could get very complicated. That's why early programmers typically hated DOS and 16 bit windows programs for large applications. That's why intel and it's accursed segmented memory structure was cursed through out the land by programmers with nervous twitches and shaky hands. And why Motorola (apple's and NEXT's) and it's flat memory structure was really loved and ultimately addopted by Intel.
--------------------------------------------------------------------------------
The flat memory model was not invented by Motorola.
I did not say that Motorola invented the flat memory model. However Motorola and Intel were the two primary CPU vendors for PC's back in the day and Motorola was widely regarded as superior to Intel. The flat memory model which was incorporated on Motorola's earliest 6800 chips was one of the distinguishing features and highly associated with Motorola as the segmented cluster F*ck was/is associated with Intel.
--------------------------------------------------------------------------------
Originally posted by JMS
Back in the day we had to statically allocate segments and statically allocate how much of the segment we would use for things like the stack and the heap.
--------------------------------------------------------------------------------
All of that could be changed dynamically during execution by assembler programs.
There was no way to dynamically switch stacksize or heap size in a program provided with Microsoft's C compilers predating C++ and the advent of the pentium. Could YOU do it, perhaps. Was it done.. no.
In general folks back in the day lived within the 32meg {solved with DOS 3.1 in 89 } addressable hardisk limit, the 640k computer limitation {helped with the advent of the 386 expanded extened memory and solved with the 486's flat memory} and the 64k segment limitation. { solved with the 486/pentium }
Am I right about every little detail. Perhaps not. Can notable and important information be added; sure. I was there and that's what I remember..
I feel so old now I'm going to rest a while..
You can't rely on anything JMS said since there are so many innacuracies in it.
I don't think I was wrong on much. I think I was accurate and informative and perhaps not quite so dry as a manual. You're best points were issues I didn't address, your worst points were just wrong.
-
February 18th, 2004, 01:43 PM
#18
Originally posted by JMS
The 8086 and 8088 could only access 640k of memory.
Definitely not. The BIOS for an original PC existed in the area just below 1 MB. There is other portions of the 640 KB to 1 MB area that was reserved for various things, such as for the display adapter. Some of the area was available for other uses. Many adapters, especially network and SCSI host adapters, used portions of it such that it became a very limited resource.
Originally posted by JMS
It was the 80286 which introduced extended memory schemes for "protected" mode processes.
As far as I remember, that is correct.
Originally posted by JMS
the 80386 wich introduced expanded memory which took advantage of the high memory between 640k barior and 1 meg.
The term "expanded memory" was semi-officially defined to refer to hardware that was able to swap memory out of and into the 1 MB memory area. It worked for all relevant processor types; that is, 8086, 80286 and above.
Originally posted by JMS
For example in small memory model the heap and stack both were resident on the Data Segment. There was only one Data Segment, and that we will agree was limited as all segments were to only 64k.
Actually I think it is more correct to say that there were at least two data segments; the ES register was specifically for addressing another ("extra") segment.
Originally posted by JMS
near pointers weren't pointers at all but rather offsets which would be combined with a base pointer to address memory inside a 64k data segment.
So what was the "near" Type Declaration for? A "near char *" is a near pointer to a char.
Originally posted by JMS
Memory allocated outside this block of memory could only be accessed by far pointers... unless you reset your base address of your data segment which would be crazy. Crazy because then you can't access any of your variables in your original DS. But I supposed in real mode operation even crazy folks have the power.
It is not crazy. It is normal. For one thing, as said above, it is possible to access a second segment using the ES register. However it was typical to set the DS register to other segments. One very reasonable thing to do is to set the DS register at the beginning of a function. The registers are typically saved to the stack and restored from the stack and then the registers could be set to any value for use by the function. Something such as that is extremely common.
-
February 18th, 2004, 02:48 PM
#19
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
The 8086 and 8088 could only access 640k of memory.
--------------------------------------------------------------------------------
Definitely not. The BIOS for an original PC existed in the area just below 1 MB. There is other portions of the 640 KB to 1 MB area that was reserved for various things, such as for the display adapter. Some of the area was available for other uses. Many adapters, especially network and SCSI host adapters, used portions of it such that it became a very limited resource.
Ummmmm Sam... The original 1981 IBM PC base model sported only 64K of RAM (expandable to 256K). You couldn't even duct tape a meg of ram into it! Latter models upgraded to 640k and fancy new devices like hard drives. Still high memory only came into being after the 286 was introduced around 1984.
There was no such thing as high memory. IBM never thought anybody would need more than 256k when they intoduced the PC..
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
the 80386 wich introduced expanded memory which took advantage of the high memory between 640k barior and 1 meg.
--------------------------------------------------------------------------------
The term "expanded memory" was semi-officially defined to refer to hardware that was able to swap memory out of and into the 1 MB memory area. It worked for all relevant processor types; that is, 8086, 80286 and above.
Expanded memory was introduced with the 80386 cpu as I said. It came after extended memory which was introduced with the 286 which you've already agreed too. No way the 8088 used expanded memory.. I do think you could buy specialized hardware to use expanded memory on a 286... An EMS or something like that.
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
For example in small memory model the heap and stack both were resident on the Data Segment. There was only one Data Segment, and that we will agree was limited as all segments were to only 64k.
--------------------------------------------------------------------------------
Actually I think it is more correct to say that there were at least two data segments; the ES register was specifically for addressing another ("extra") segment.
No no no... Small model supports one data segment and one code segment. All data and code are near by default. Large model supports multiple code and multiple data segments. All data and code are far by default. Medium and compact models are in-between. Medium model supports multiple code and single data segments; compact model supports multiple data segments and a single code segment. Huge model implies individual data items larger than a single segment, but the implementation of huge data items must be coded by the programmer
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
near pointers weren't pointers at all but rather offsets which would be combined with a base pointer to address memory inside a 64k data segment.
--------------------------------------------------------------------------------
So what was the "near" Type Declaration for? A "near char *" is a near pointer to a char.
Near pointers were not physical addresses and were meaningless unless combined with a base address. They were offsets to address memory inside the data segment. When they were used the compiler would translate them to pointers so programmers didn't have to worry unless they were going to try to translate between near and far. This occured a lot due to function parameters which often specified one or the other and were a pain in the butt.
However it was typical to set the DS register to other segments. One very reasonable thing to do is to set the DS register at the beginning of a function. The registers are typically saved to the stack and restored from the stack and then the registers could be set to any value for use by the function. Something such as that is extremely common.
Once again all this is memory model specific. But since the Stack is located in the primary data segment it; along with all your global and local variables would not be availible to you if you tinkered with the base data segment pointer as you suggest.
I didn't know anybody who did that. If you wanted to use two data segments you used medium or large memory models and then your pointers would be far by default and the compiler would allocate out of whichever DS had the availible room. You didn't even have to be aware of it unless you were linking in a libray compiled with a diffeent model and you had to translate..
Last edited by JMS; February 18th, 2004 at 02:57 PM.
-
February 18th, 2004, 03:00 PM
#20
When I find the documentation that verifies what I am saying, will you admit you were mistaken?
-
February 18th, 2004, 03:04 PM
#21
Here, I guess it might be like this:
Early PCs based on Intel 8086/8088 microprocessors could access only 640K of RAM and used the segmented memory model. Consequently, good old DOS allows only 640K of RAM and restricts the programmer to the segmented memory model.
In the segmented model, the address space is divided into segments. Proponents of the segmented model claim that it matches the programmer’s view of memory. They claim that a programmer views memory as different segments containing code, data, stack, and heap. Intel 8086 supports very primitive segmentation. A segment, in the 8086 memory model, has a predefined base address. The length of each segment is also fixed and is equal to 64K. Some programs find a single segment insufficient. Hence, there are a number of memory models under DOS. For example, the tiny model that supports a single segment for code, data, and stack together, or the small model that allows two segments–one for code and the other for data plus stack, and so on. This example shows how the memory management provided by an operating system directly affects the programming environment.
The Intel 80286 (which followed the Intel 8086) could support more than 640K of RAM. Hence, programmers got new interface standards for accessing extended and expanded memory from DOS. Microsoft’s second-generation operating system, Windows 3.1, could run on 80286 in standard mode and used the segmented model of 80286. The 80286 provided better segmentation than the 8086. In 80286’s model, segments can have a programmable base address and size limit. Windows 3.1 had another mode of operation, the enhanced mode, which required the Intel 80386 processor. In the enhanced mode, Windows 3.1 used the paging mechanisms of 80386 to provide additional performance. The virtual 8086 mode was also used to implement multiple DOS boxes on which DOS programs could run.
Please tell me if that is correct, only part of it is also fine...
Thanks a lot
[Yves: When you copy-paste from a website, also cite Where you copy-pasted from. Thank you]
Last edited by Yves M; February 18th, 2004 at 06:21 PM.
-
February 18th, 2004, 03:24 PM
#22
JMS, I believe you are wrong here.
My old XT supported 640K memory and Expanded Memory cards (made popular by Lotus 1-2-3).
Regards,
Paul McKenzie
-
February 18th, 2004, 04:35 PM
#23
x86 Assembly Language FAQ has a lot of answers.
In Protected-Mode Memory Management the use of the segment registers in protected mode is explained. It basicly says that in protected mode the registers are usually called selectors and that they have a totally different function than in real mode. In Real-Mode Memory Management it clearly says that the upper 384KB was reserved as I indicated by the PC.
That is a few references for the processor. I should find some relevant Intel documentation.
Overview of Memory-Management Functionality in MS-DOS and Running Both Extended and Expanded Memory on Your Computer says a lot about memory use by DOS. Probably the reason the 386 seems to have introduced expanded memory is because the 386 introduced features that allowed the emulation of expanded memory.
-
February 18th, 2004, 04:56 PM
#24
-
February 18th, 2004, 05:02 PM
#25
Sam, please 
I mean saying something like a some keywords like "8086" "80286"...searchers can see is enough...
-
February 19th, 2004, 03:38 PM
#26
JMS, I believe you are wrong here.
My old XT supported 640K memory and Expanded Memory cards (made popular by Lotus 1-2-3).
Regards,
Paul McKenzie
Paul, your old XT wasn't the original PC. IBM introduced the IBM PC in 81 your XT or "experimental Technology" was introduced in 83....actually an upgrade to the PC. Same cpu but the XT came with a 10 meg hard drive and 640k of memory optional..
The IBM PC which Sam explicitely stated.. "Original PC" was the one which came with 64k and was upgradable to 256..
There was no such thing as memory above 640k until after the 286 was introduced extended memory.
IBM PC and IBM XP specs from the IBM hall of fame
The big problem with extended memory was that it was only available to programs explicitely written in the 286's "protected" operating mode. Most programs of the day including windows 2.0 ran in real mode and thus could not take advantage of the 286's extended memory.
Expanded memory which you say your XT used was introduced with the 386 and was availible to programs running in real mode on that cpu. Expanded memory of the 386 is associated with the 8088 because the 386 running in protected mode was said to "emulate" multiple 8088 sessions and thus make the extra memory availible to real mode programs... ... But those real mode programs running the expanded memory were running on a 386 emulating an 8088 not actually on an 8088....
In Protected-Mode Memory Management the use of the segment registers in protected mode is explained. It basicly says that in protected mode the registers are usually called selectors and that they have a totally different function than in real mode. In Real-Mode Memory Management it clearly says that the upper 384KB was reserved as I indicated by the PC.
I don't know what your links are supposed to refute or even if I'm addressing the point you were making because you didn't actually refference any point of contension with them. Are you now contending that the 8088 ran in protected mode? Clearly your blurb is reffering to a chip which could run in protected or real mode... that would not be the 8088.
either way thanks for the walk down memory lane. It was confusing enough when it was happenning. I hope we can agree that my original post was not misleading...
Last edited by JMS; February 19th, 2004 at 03:42 PM.
-
February 19th, 2004, 05:22 PM
#27
Originally posted by JMS
The IBM PC which Sam explicitely stated.. "Original PC" was the one which came with 64k and was upgradable to 256..
I had an "Original PC"! I upgraded it with a memory board with 2 MB on the board. The 256 KB limit was for the system board (also known as the motherboard).
In PC Memory Organization the memory layout above 640 KB is clearly shown. It clearly says that the original 8086 IBM PC had an address range of one megabyte.
Note that when a 8086/8088 powers up or is reset, the first instruction executed is at address 0xFFFF0. This is fixed by the processor; there must be something there. The IBM PC BIOS is at that high end of storage.
In IBM PC the original IBM PC is shown and described. It looks just like the one I had. Look at what that article says about Memory.
The Limitations of the IBM PC Architecture article also clearly says that the PC has an address space of 1M byte. It also says that "The space between 640K and 1M is reserved for hardware and operating system use."; in other words, it does exist for a PC and is not available for general use. Look at what it says about "bank-select memory systems"; it describes expanded memory quite well as it originally existed and developed. I think it is also makes it clear that expanded memory preceded the 286.
Originally posted by JMS
There was no such thing as memory above 640k until after the 286 was introduced extended memory.
As explained above, a PC must have memory above 640 KB for BIOS ROM and for video RAM.
Originally posted by JMS
Expanded memory of the 386 is associated with the 8088 because the 386 running in protected mode was said to "emulate" multiple 8088 sessions and thus make the extra memory availible to real mode programs... ... But those real mode programs running the expanded memory were running on a 386 emulating an 8088 not actually on an 8088....
Why would anyone want to do that? What did expanded memory do that made it useful? Do you know anything about how expanded memory works? I provided an article above that describes how expanded memory works; can you find something that describes expanded memory differently? The only reason to emulate expanded memory using a 386 or higher processor is to support programs that are written that require it.
Originally posted by JMS
I hope we can agree that my original post was not misleading...
I don't .
-
February 19th, 2004, 05:36 PM
#28
Re: Expanded memory expanded
Since you did not read the following articles, I will quote some relevant parts.
That says (excerpts):
There is, however, an older standard for accessing memory above 1 MB which is called expanded memory. It uses a protocol called the Expanded Memory Specification or EMS.
EMS was originally created to overcome the 1 MB addressing limitations of the first generation 8088 and 8086 CPUs.
To use EMS, a special adapter board was added to the PC containing additional memory and hardware switching circuits.
The first paragraph says:
Listed below are some memory boards/drivers that are within the specifications of the LIM 4.0 EMS (Lotus-Intel-Microsoft version 4.0 Expanded Memory Specification) standard for MS-DOS. One list below is for 80386 computers, and the other list is for 80286 computers.
Notice it says "memory boards" and "80286 computers"!
-
February 19th, 2004, 09:45 PM
#29
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
There was no such thing as memory above 640k until after the 286 was introduced extended memory.
--------------------------------------------------------------------------------
As explained above, a PC must have memory above 640 KB for BIOS ROM and for video RAM.
So in your world ROM is memory?
I had an "Original PC"! I upgraded it with a memory board with 2 MB on the board. The 256 KB limit was for the system board (also known as the motherboard).
That would be a pretty good trick since the mother board of the original PC didn't have expansion slots. Expansion slots were a feature of the XT.
quote:
--------------------------------------------------------------------------------
Originally posted by JMS
Expanded memory of the 386 is associated with the 8088 because the 386 running in protected mode was said to "emulate" multiple 8088 sessions and thus make the extra memory availible to real mode programs... ... But those real mode programs running the expanded memory were running on a 386 emulating an 8088 not actually on an 8088....
--------------------------------------------------------------------------------
Why would anyone want to do that? What did expanded memory do that made it useful? Do you know anything about how expanded memory works? I provided an article above that describes how expanded memory works; can you find something that describes expanded memory differently? The only reason to emulate expanded memory using a 386 or higher processor is to support programs that are written that require it.
No you're thinking of extened(286 circa 1984) memory which ran in protected mode the grand daddy of Expanded Memory . Expanded memory ran in real mode and was availible to any program. You could use DOS command to load device drivers high for example using expaned memory...
Doskey for example was a popular TSR which would run in expanded meory if you loaded it high.
The reason folks emulated real mode on 386 computers was because when windows 3.0 came out there weren't any programs which ran in windows other than Microsofts. The top spread sheet was Lotus and the top word processor was Word Perfect. These software company's foolishly listened to Microsoft saying that Windows would be nothing. They came out with OS/2 based programs and left windows alone as Microsoft told them too. Thus when windows came out only Microsoft was there with Word and Excel with GUI Window versions and everybody else was left running lotus and word perfect inside of the dos windows in real mode with expanded memory. It was either that or not run windows at all. Only when you did that your Lotus and WP ran slower with less memory than if you didn't have Windows loaded at all.
Anyway I'm done with this argument.
-
February 19th, 2004, 11:03 PM
#30
Originally posted by JMS
So in your world ROM is memory?
Yes, definitely. Read Only Memory is memory.
Originally posted by JMS
That would be a pretty good trick since the mother board of the original PC didn't have expansion slots. Expansion slots were a feature of the XT.
No, the XT supported (1) taller expansion cards, (2) 16-bit expansion cards and (3) I think a few more expansion cards, but the original PC supported expansion cards too. In addition to a memory card, I upgraded my original PC (not an XT) with a hard drive. Other common upgrades were serial and parallel port boards and clock boards. Multifunction boards were common that combined serial and parallel ports and a clock on a single board.
Originally posted by JMS
No you're thinking of extened(286 circa 1984) memory which ran in protected mode the grand daddy of Expanded Memory . Expanded memory ran in real mode and was availible to any program.
No, I was responding to what you said about Expanded memory. Yes, Expanded memory is used (only) by real-mode programs. Read what that page says; it says that expanded memory is "Memory used through EMS" and that "In earlier systems, a dedicated EMS hardware adaptor is needed". Did you not see the "EMS hardware adaptor" part?
Originally posted by JMS
You could use DOS command to load device drivers high for example using expaned memory...
The high memory area (HMA) is defined as memory in the range FFFF:0010-FFFF:FFFF, which is the first 64k above 1 MB; extended memory, not expanded memory. Look at Overview of Memory-Management Functionality in MS-DOS.
Originally posted by JMS
The reason folks emulated real mode on 386 computers was because when windows 3.0 came out there weren't any programs which ran in windows other than Microsofts. The top spread sheet was Lotus and the top word processor was Word Perfect. These software company's foolishly listened to Microsoft saying that Windows would be nothing. They came out with OS/2 based programs and left windows alone as Microsoft told them too. Thus when windows came out only Microsoft was there with Word and Excel with GUI Window versions and everybody else was left running lotus and word perfect inside of the dos windows in real mode with expanded memory. It was either that or not run windows at all. Only when you did that your Lotus and WP ran slower with less memory than if you didn't have Windows loaded at all.
I remember quite clearly the day IBM announced their intent to develop OS/2; it is part of thier System Application Architecture, a standard they developed to standardize their big, middle and small size systems. I have (still have?) OS/2 version 1. One big reason OS/2 did not become more popular is that it lacked software that worked with it. The reason Windows software perfomed so poorly compared to OS/2 when OS/2 was first developed is because Windows was not a pre-emptive multitasking operating system. Not until NT and 32-bit versions of Windows was Windows able to provide the performance that OS/2 did from the beginning.
Expanded memory was not popular. The only reason it was emulated by 386 systems is because some software developed for use in older systems needed it. Most software that did use expanded memory were quickly modified to use extended memory instead of expanded memory, but many people did not upgrade their software and chose to use emulation of expanded memory.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|