flat assembler
Message board for the users of flat assembler.
Index
> DOS > COM vs EXE Goto page 1, 2 Next |
Author |
|
vid 24 Jan 2006, 11:42
you can read up to DS:FFFF, any (even partial) read higher will cause protection error because your limit in real mode is 10000h. BUt i am not sure what it does when you try to read word from offset FFFF on 8086...
btw, COM's max size is somewhat smaller (by 256 bytes of Program Segment Prefix) |
|||
24 Jan 2006, 11:42 |
|
MazeGen 24 Jan 2006, 11:47
In real mode, you can't address memory above FFFF, otherwise you get hang (INT 6 raised, IIRC)
|
|||
24 Jan 2006, 11:47 |
|
vid 24 Jan 2006, 11:53
same happens on "mov ax,[FFFF]" on 8086? Because there it's not exceeding selector limit, it is something other...
|
|||
24 Jan 2006, 11:53 |
|
a16b03 24 Jan 2006, 11:59
OK That's Protected mode, But What about Real Mode?
And Maby it's beter to use MZ format. |
|||
24 Jan 2006, 11:59 |
|
vid 24 Jan 2006, 12:29
that happens in real mode too
|
|||
24 Jan 2006, 12:29 |
|
MazeGen 24 Jan 2006, 12:38
a16b03: we are still speaking about real mode. And I was probably wrong, it is not INT 6, see below.
vid: I'm not sure. Here is the description of MOV instruction from the Intel manual: Quote:
#GP is INT 13dec, #SS is INT 12dec, #UD is INT 6. There should be a note about it in System programming manual, but don't have time to find it now. |
|||
24 Jan 2006, 12:38 |
|
Octavio 24 Jan 2006, 17:20
a16b03 wrote: I'm wondering about COM format addresing. files should be smaller than 64k ,there must be also space for the psp and the stack. a .COM program can acces all the memory,in protected or unreal mode the same as a .EXE program or any other format. |
|||
24 Jan 2006, 17:20 |
|
Remy Vincent 25 Jan 2006, 00:02
With a COM progrm, bounds controls are not needed at all, I think, because... because bounds can be SET BY the COM program,
So..., I think, may be it could be very usefull if a COM program could "say" to the MICROPROCESSOR: "I'm sorry but I don't need any bounds control of any kind..."... FASTER or NOT ??? _________________ Groups lower your IQ |
|||
25 Jan 2006, 00:02 |
|
vid 25 Jan 2006, 07:11
Remy: That setting which you mean is very tricky (and originally undocumented) thing. And it's possible to do it from any real-mode code, EXE too. It isn't feature of COM f
|
|||
25 Jan 2006, 07:11 |
|
bogdanontanu 25 Jan 2006, 07:20
For 8086 / 8088 there are NO bounds control. It is only the way of calcuating the physycal address that wraps at 0xFFFF and if you try to access something at 0xFFFF:0XFFFF then the behaviour depends on the CPU.
MY guess is that on Intel CPU it will actually wrap towards zero... That is why the A20 line was introduced in new 386 motherboards : to emulate this kind of behaviour for very old 8086 tricky applications. And YES, logically it is faster not to check bounds... however this is not possible in "modern" CPUs. If you "buy" the logical quiz that some operations are "costless" and "very fast" ... well happy shopping Again this is useless in modern hardware since you can not disable "bounds checking at every operation". The only thing you can disable is paging ... And it will not help you much using the old 8086 because the clock is a few orders of magnitude lower than today CPU's so you can not really compete with new CPUs... |
|||
25 Jan 2006, 07:20 |
|
vid 25 Jan 2006, 09:57
bugdanontanu: So you say that reading word from 0:FFFF really reads entire word at absolute address FFFF, eg. byte at FFFF and byte at 10000h?
|
|||
25 Jan 2006, 09:57 |
|
Tomasz Grysztar 25 Jan 2006, 10:41
On 386 in real mode this causes the pseudo-protection exception, unless you enabled FRM - and with FRM it just reads bytes from FFFF and 10000. On 8086, as I recall, it was wrapping inside the segment, so reading word from offset FFFF read byte from FFFF and byte from 0 (still in the same segment).
|
|||
25 Jan 2006, 10:41 |
|
a16b03 25 Jan 2006, 10:48
Whel that's readin a word from FFFF, but sill i need a way to get access to any byte in entire memoty
|
|||
25 Jan 2006, 10:48 |
|
Tomasz Grysztar 25 Jan 2006, 10:58
You can either use FRM, though I guess it's not for beginner; or just swap the segments - I mean, write other value to DS or ES segment to access any other memory in conventional memory area. To access the extended memory use XMS or EMS.
|
|||
25 Jan 2006, 10:58 |
|
a16b03 25 Jan 2006, 11:11
FRM? What's the full mane? I'll check it out.
|
|||
25 Jan 2006, 11:11 |
|
vid 25 Jan 2006, 12:49
|
|||
25 Jan 2006, 12:49 |
|
a16b03 25 Jan 2006, 20:46
Thank's to all of You!
I've got to admit that I screwed up this time. segment registers =16bit general registers =16bit 16+16=32 2^32=4'294'967'296 = 4Gb = All the possible memory in x86. All i heve to do now is to chose which mode is best for me. Thank's Tomasz P.S. I gues i should quit night programming |
|||
25 Jan 2006, 20:46 |
|
Borsuc 25 Jan 2006, 20:55
a16b03 wrote:
I don't think it's that simple. In Real Mode, the physical address is calculated as segment*16 + offset. Basically, once you load a segment register, the processor updates the descriptor tables so that the base is segment*16.. In conclusion, using 16-bit segments and 16-bit general registers, you can only address 20 bits of physical address (16MB). What flat real mode really does is that you still use the same addressing scheme, but the general registers are 32-bits, so you can have up to 4 GB of physical memory. Theoretically, you can address more than 4GB, but the limit is set to 4GB I think. In protected mode there's a slightly different story, because segments are selectors... PS: Please correct me and I'm sorry if I'm wrong, but I think this is how it really goes. |
|||
25 Jan 2006, 20:55 |
|
vid 25 Jan 2006, 21:56
protected mode: segment registers hold "selector", which is kind-of pointers (or indexes? i am not sure) into table of "descriptors", called "global descriptor table" (GDT), "local descriptor table" (LDT), "interrupt descriptor table" (IDT) etc. "descriptor" is structure which contains information about segment of memory. eg. where it starts, how long it is, access rights etc. And these are 32bit, so you can let segment be 4Gb long.
Usualy in flat-real or unreal mode, you set all segments length to 4Gb. |
|||
25 Jan 2006, 21:56 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.