1

I am trying to learn DCPU.

;Set b to 1
SET B,1 ;00001 (1)
SHL B,1 ;00010 (2)
SHL B,1 ;00100 (4)
SHL B,1 ;01000 (8)
SHL B,1 ;10000 (16)

All I am doing is shifting to the left one so shouldn't it simply double itself each shift. In my code you can see i have the last shift turning the registry B into 16 but when ran B ends up as 10 why is that.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Bevilacqua
  • 465
  • 3
  • 8
  • 19

1 Answers1

7

the register window says 0x0010...

You're getting the correct answer, you're just viewing it in hexadecimal.

Numbers starting with 0x are the standard way of signifying a hexadecimal number; so the number 0x0010 is is really the number 1016 ("one-zero in base sixteen"), which, in decimal, is the number sixteen.

BlueRaja - Danny Pflughoeft
  • 84,206
  • 33
  • 197
  • 283