emustudio / edigen

Emulator Disassembler Generator
GNU General Public License v3.0
4 stars 0 forks source link

Fixed reading bits in decoder #16

Closed vbmacher closed 9 years ago

vbmacher commented 9 years ago

For example, read(2,3) for 11011111 did not return 011.

a = 11011111 & 00111111 << 2 = 01111100
b = 11011111 & 11111000 >> 3 = 00011011

You cannot do result = (a | b) if you operate on the same byte, only if start+length > 8.

read(6,3):
a = 11011111 & 00000011 << 1 = 00000110
b = 00000000 & 10000000 >> 7 = 00000000

result = a|b, correct.