SHARE
TWEET

QB Shift Logic Pseudocode

a guest Nov 10th, 2015 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if pixels_to_move > 1:
  2.         bytes_to_move = pixels_to_move // 2     #integer division operator
  3.         pixels_to_move -= 2 * bytes_to_move
  4.         for y in range(16):
  5.                 pos = (0x80*y) + 0x40
  6.                 filedata[pos:pos+8] = filedata[pos + bytes_to_move:8-bytes_to_move] + b'\x00' * bytes_to_move   #Easy, right?
  7. if pixels_to_move == 1:
  8.         for y in range(16):
  9.                 pos = (0x80*y) + 0x40
  10.                 for x in range(7):
  11.                         filedata[pos] = filedata[pos] << 4 + filedata[pos+1] >> 4       #Easy, right?
  12.                         #If you're having trouble, it shifts the current byte left 4 and adds the most significant 4 bytes of the next byte
  13.                         pos += 1
  14.                 filedata[pos] = filedata[pos] << 4      #For the last byte
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top