DOS 7.1 programming for Intel EP80579

Started by suryakant, March 09, 2010, 05:19:14 AM

Previous topic - Next topic

redskull

Simply put, you can't.  To summarize the options already stated:

1) Switch into protected mode, setup a segment register, and switch back
2) Switch into protected mode forever
3) Use a Dos Extender to do automate either of the first two steps for you.

None of the three options are "easy", and probably can't be done in VS2008.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

MichaelW

There is at least one other possibility, use the BIOS Move Block functions. This method will not work under Windows, probably will not work in the presence of a 386 memory manager, and possibly will not work with an extended memory manager (e.g. HIMEM.SYS) loaded. The attachment contains an example.

If I wanted a simple method I would use the first one, were the memory access is done through an otherwise unused segment register set up with a 32-bit limit. The amount of code required is much less than for the other methods.

eschew obfuscation

redskull

Quote from: MichaelW on March 20, 2010, 09:41:48 AM
...use the BIOS Move Block functions...

Interesting!  I hadn't heard of that one before (http://www.ctyme.com/intr/rb-1527.htm), thanks for pointing it out.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

FORTRANS

Hi,

   It seems to work on my DOS box without cleaning the memory
managers out of CONFIG.SYS.  That surprised me a bit.  Of note,
you seem to be accessing memory that is not visable to MS-DOS
6.2.  This could let me do something scary with the unused
memory over 64M I suppose.

Thanks,

Steve

japheth

Quote from: MichaelW on March 20, 2010, 09:41:48 AM
There is at least one other possibility, use the BIOS Move Block functions. This method will not work under Windows, probably will not work in the presence of a 386 memory manager, and possibly will not work with an extended memory manager (e.g. HIMEM.SYS) loaded. The attachment contains an example.

The situation is far better - the BIOS "block move" works in Windows and also under EMM / XMS. FreeDOS DEBUG.COM uses this function to implement its "dx" command.

MichaelW

My statement should have been more like: In my tests even a read of linear address 0fffff0h would not work with the Windows 2000 NTVDM:

Exception number: 40000005 (vdm event)

*----> Stack Back Trace <----*

FramePtr ReturnAd Param#1  Param#2  Param#3  Param#4  Function Name
016AFC08 69B01461 40000005 00000000 00000004 69B04160 kernel32!RaiseException
016AFC48 69B0139B 0000000E 69B01387 7FFDF000 016AFC74 ntvdmd!xxxDbgIsDebuggee
016AFC60 77F8806C 69B00000 FFFFFFFF 00000000 69B012F0 ntvdmd!<nosymbols>
016AFC80 77F8AB2F 69B012F0 69B00000 00000002 00000000 ntdll!LdrInitializeThunk
016AFD1C 77F91B93 016AFD30 77F80000 00000000 00010017 ntdll!LdrShutdownThread
00000000 0070018B 039D0016 0070018B 0070018B 021006B9 ntdll!KiUserApcDispatcher
00A71068 00000000 00000000 00000000 00000000 00000000 <nosymbols>


The name Move Block is from a Phoenix BIOS reference. Hans-Peter Messmer also used that name in his Indispensable PC Hardware books. The AMI reference uses Move Extended Memory Block, which is not exactly accurate because the function is not limited to extended memory.

Steve,

Thanks for testing. Re the memory managers, I probably should not have used the term "probably"  :lol

I chose an address at the top of the address space for testing purposes, because for the test system I knew what was there.

eschew obfuscation

suryakant

Hi,

What about "far pointers"??? I think using them we can access the memory... At least for my code it seems to be working.... I dont have debugger so I am not able to confirm and my code is not yet completed for testing the exact result

Following are the lines... the variable Pointer is assigned the address we want to access.

les bx,cs:Pointer        ; load base address
mov eax, es:[bx]        ;Store away

Please comment.

MichaelW

The maximum segment address that will fit in a segment register is FFFFh. So the highest address that can be reached from real mode without extending the segment limit is FFFF:FFFF in segment:offset format, or 10FFEFh, and this is far short of 300B1000h.
eschew obfuscation

suryakant

Quote from: redskull on March 19, 2010, 12:13:21 PM

1) Switch into protected mode, setup a segment register, and switch back


Will someone provide me sample of this option? I searched on net, i got few samples but they are confusing? also none of them worked well.
I would like to set GS or FS segment register with base address 0 & segment limit of 4GB.

Thanks in advance.

hutch--

I confess to being well out of practice with the old stuff but to write a 32 bit value in 16 bit mode you make 2 writes, one to the start of the address and the second to 2 bytes higher up.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

suryakant

Quote from: hutch-- on March 24, 2010, 10:29:44 AM
I confess to being well out of practice with the old stuff but to write a 32 bit value in 16 bit mode you make 2 writes, one to the start of the address and the second to 2 bytes higher up.

I dont want to write 32 bit VALUE but to a 32bit location...

FORTRANS

Hi,

   I liked this site back when.  Not that I really used it.

http://www.nondot.org/sabre/os/articles/ProtectedMode/

   I don't know how it might compare to another, but it
had a bunch of information in one spot.  YMMV.

HTH,

Steve N.

suryakant

as per the source code, whenever LGDT is executed, my processor hangs...  :(

dedndave

OSDev.org has a forum
they have contests for writing boot sectors that switch to protected mode
look through the entries - there are all kinds of examples

http://forum.osdev.org/viewtopic.php?f=2&t=21423&p=171859&hilit=contest#p171859

redskull

Many DOS-based memory managers run in protected mode, and then run DOS "inside" as a v86 task.  Ensure such drivers are disabled.  Also, if you are using a 16-bit debugger to test the code, they can often have spotty support for protected mode, and can easily "get lost" when tracing.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government