Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. | LOAD: ;load some consts
  2. 0x00 | load (const1), 1
  3. 0x02 | load (span), 0x70
  4. 0x04 | load (code-start), 0 #
  5. 0x06 | load (data-offset), 0x3C
  6. 0x08 | load (code-len), 0x46
  7. 0x0A | load (data-len), 0x0A
  8. |
  9. | COPY_LOOP: ;copy current code to 0x70
  10. 0x0C | mov (code-start), (crnt-addr)
  11. 0x0E | add (zero), (code-start), (code-len) ;init loop var
  12. |
  13. 0x10 | store (crnt-addr), [pos1](0x17) #
  14. 0x12 | add (tmp), (crnt-addr), (span)
  15. 0x14 | store (tmp), [pos2](0x19) #
  16. |
  17. 0x16 | mov (tmp), <pos1>
  18. 0x18 | store (tmp), <pos2> ;copy
  19. |
  20. 0x1A | add (crnt-addr), (crnt-addr), (const1) ;increment addr
  21. 0x1C | jmp (crnt-addr), .MODIFY_LOOP #
  22. 0x1E | jmp (zero), COPY_LOOP + 4 #
  23. |
  24. |
  25. | MODIFY_LOOP: ;modify copied code
  26. 0x20 | add (crnt-addr), (code-start), (data-offset)
  27. 0x22 | add (zero), (crnt-addr), (data-len) ;init loop var
  28. |
  29. 0x24 | store (crnt-addr), [pos3](0x27) #
  30. |
  31. 0x26 | mov (tmp), <pos3> ;get code offset
  32. 0x28 | add (tmp), (tmp), (span)
  33. 0x2A | add (tmp), (tmp), (code-start) ;get code addr
  34. 0x2C | store (tmp), [pos4](0x31) #
  35. 0x2E | store (tmp), [pos5](0x35) #
  36. |
  37. 0x30 | mov (tmp), <pos4> ;load code
  38. 0x32 | add (tmp), (tmp), (span) ;modify code
  39. 0x34 | store (tmp), <pos5> ;write back
  40. |
  41. 0x36 | add (crnt-addr), (crnt-addr), (const1) ;increment addr
  42. 0x38 | jmp (crnt-addr), 0x70 #
  43. 0x3A | jmp (zero), .MODIFY_LOOP + 4 #
  44. |
  45. |
  46. | DATA: ;offsets to modify later
  47. 0x3C | 0x05, 0x11,
  48. 0x3E | 0x15, 0x1D,
  49. 0x40 | 0x1F, 0x25,
  50. 0x42 | 0x2D, 0x2F,
  51. 0x44 | 0x39, 0x3B
  52. 0x46 |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement