Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27353

VS 2010 C# to VB.NET problem

$
0
0
Good day,

Im trying todo a C# tutorial on how to make a VM from:

http://www.codeproject.com/KB/recipe...hine1/VMCS.pdf

And i did a line-by-line check and vb.net convertion but i came to an halt on this particulair part:

C# Version:
Code:

...
if (Instruction == 0x02) // LDX #<value>
    {
    Register_X = (ushort)((B32Memory[(InstructionPointer + 2)]) << 8);
    Register_X += B32Memory[(InstructionPointer + 1)];
    ProgLength -= 2;
    InstructionPointer += 3;
    UpdateRegisterStatus();
    continue;
    }
...

VB.NET Version:
Code:

...
If Instruction = &H2 Then
  ' LDX #<value>
  Register_X = CUShort((B32Memory((InstructionPointer + 2))) << 8)
  Register_X += B32Memory((InstructionPointer + 1))
  ProgLength -= 2
  InstructionPointer += 3
  UpdateDebug()
  Continue While
 End If
...

Input is identical ;
The pointer = 4098 + 2 that would come down to memory address B32Memory[4100]
and in both cases it contains the value: 160 (Byte)

In the C# case the Register_X = 40960 (Correct)
and with vb.net Register_X = 160 (Incorrect)

What do i miss here, ive been trying to figure it out for hours, drives me nuts.

Help is much appr.

Viewing all articles
Browse latest Browse all 27353

Trending Articles