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]!!!