Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import os
  2. import random
  3.  
  4. #x = random.randint(0, 2 ** 100)
  5. #y = random.randint(0, 2 ** 100)
  6. x = 600000000000000000000000000000000
  7. y = 170000000000000000000000000000000
  8. z = x + y
  9.  
  10. with open("C:\\emu8086\\FLOPPY_0", "wb") as fileFirst:
  11. x_bytes = ((x.bit_length() - 1) // 8 + 1)
  12. fileFirst.write(x.to_bytes(x_bytes, byteorder="little", signed=False))
  13.  
  14. with open("C:\\emu8086\\FLOPPY_1", "wb") as fileSecond:
  15. y_bytes = ((y.bit_length() - 1) // 8 + 1)
  16. fileSecond.write(y.to_bytes(y_bytes, byteorder="little", signed=False))
  17.  
  18.  
  19. print("Wait emu")
  20. input()
  21.  
  22. with open("C:\\emu8086\\FLOPPY_2", "rb") as fileRes:
  23. res = fileRes.read()
  24. res_int = int.from_bytes(res, byteorder="little", signed=False)
  25.  
  26. print(z, " ",res_int )
  27. if res_int == z:
  28. print("Ok")
  29. else:
  30. print("Fail")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement