Advertisement
Guest User

Untitled

a guest
Mar 1st, 2017
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. %define REG(r) [REGS + r * 4]
  2. %define PTR(p) [MEM + p]
  3. U5_LE:
  4. mov ecx, 0x200
  5. mov edi, MEM
  6. mov esi, DISK
  7. rep movsb
  8. SPIN:
  9. mov edx, REG(63)
  10. mov edx, PTR(edx)
  11. add WORD REG(63), 4
  12. mov WORD REG(0), 0
  13. mov ebp, edx
  14. shr ebp, 21
  15. and ebp, 77o
  16. mov esi, edx
  17. shr esi, 15
  18. and esi, 77o
  19. mov edi, edx
  20. shr edi, 9
  21. and edi, 77o
  22. mov eax, edx
  23. shr eax, 27
  24. mov eax, [OP_TABLE + eax * 4]
  25. jmp eax
  26. OP_TABLE:
  27. dd OP_LOAD_B, OP_LOAD_H, OP_LOAD_W, 0, OP_STORE_B, OP_STORE_H, OP_STORE_W, \
  28. 0, OP_ADD, OP_MUL, OP_DIV, OP_NOR, 0, 0, 0, 0, OP_MOVI, 0, OP_CMOV, 0, 0, \
  29. 0, 0, 0, OP_IN, OP_OUT, OP_READ, OP_WRITE, 0, 0, 0, OP_HALT
  30. OP_LOAD_W:
  31. mov eax, REG(esi)
  32. add eax, REG(edi)
  33. mov eax, PTR(eax)
  34. mov REG(ebp), eax
  35. jmp SPIN
  36. OP_MUL:
  37. mov eax, REG(esi)
  38. mul DWORD REG(edi)
  39. mov REG(ebp), eax
  40. jmp SPIN
  41. OP_MOVI:
  42. mov eax, edx
  43. mov ecx, edx
  44. shr eax, 5
  45. and eax, 0xffff
  46. and ecx, 37o
  47. shl eax, cl
  48. mov REG(ebp), eax
  49. jmp SPIN
  50. OP_CMOV:
  51. mov eax, REG(edi)
  52. test eax, eax
  53. jz .F
  54. mov eax, REG(esi)
  55. mov REG(ebp), eax
  56. .F:
  57. jmp SPIN
  58. OP_OUT:
  59. push DWORD REG(ebp)
  60. call putchar
  61. add esp, 4
  62. jmp SPIN
  63. OP_READ:
  64. mov ecx, 0x200
  65. mov esi, REG(esi)
  66. shl esi, 9
  67. lea esi, [DISK + esi]
  68. mov edi, REG(ebp)
  69. lea edi, PTR(edi)
  70. rep movsb
  71. jmp SPIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement