Mem[$0: $417] in Borland Pascal

i'm worcking in borland pascal at protected mode and i try to access this address [$0:$417] but program not worck with RunTime Error (216).

As you now the Byte $417  is used to make control to keys(Num, Caps, Scroll,
,Alt, ShR, ShL, CtrlL, CtrlR)

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bakry99Author Commented:
As you now the Byte $417  is used to make control to keys(Alt, ShR, ShL, CtrlL, CtrlR)

Mem[$0:$417]:=(Mem[$0:$417])and 1
 that meen Shift right pressed
I'm sorry to say that you can't access that memory in protected mode. not in that way you're trying to anyway...

The memory in protected mode does not work like it does in real mode.
MEM[0:$417] points to one physical location in realmode and another one in protected mode. If you want to use Ctrl, Shift etc... you should use your DPMI handler to map that memory area into a valid protectedmode segment.
Fortunatley, you don't have to do that... since pascal maps that memoryblock on startup. Instead of using mem[0:$417] you should use mem[Seg0040:$17], it works in both real and protected mode. (you know that mem[0:$417] = mem[$40:$17]?)

Seg0040 points to the realmode segment $0040 in protectedmode.

Use mem[Seg0040:$17] when you work in protectedmode instead of mem[0:$417]!!!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bakry99Author Commented:
thanks Hypo
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.