Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1.  
  2. Procedure SaveMap905608; stdcall; //New opcode 1A
  3. Begin
  4.  
  5. asm
  6. push ebp
  7. push ebx
  8. push esi
  9. push edi
  10. xor eax,eax
  11. xor ebx,ebx
  12. xor edx,edx
  13. xor edi,edi
  14. mov al, byte ptr [$CC0964]
  15. mov dx, word ptr [eax*2+$CC0CF8]
  16. mov esi,[$CBF5E8]
  17.  
  18. mov ax, word ptr [esi+edx+01] // From
  19. mov di, word ptr [esi+edx+03] // To
  20. mov ecx, [esi+edx+05] // Value (if From is FFFF)
  21. mov dl, byte ptr [esi+edx+09] // Flag (1= 8 bit, 2=16 bit, 3=24 bit, 4= 32 bit)
  22. // Flag also allows 0x10 for pointers from, 0x20 pointers to
  23. //Valid values are therefore, 1,2,3,4, 11,12,13,14, 21,22,23,24, 31,32,33,34 hex
  24.  
  25.  
  26. @Label700:
  27.  
  28.  
  29. {from}
  30. cmp ax,$FFFF
  31. je @label500
  32. cmp ax,$10F5
  33. jg @Label501
  34. mov esi,$DBFD38 //main save map base
  35. jmp @Label500
  36. @LABEL501:
  37. cmp ax,$50FF
  38. jg @EndLabel
  39. cmp ax,$5000
  40. jl @EndLabel
  41. sub ax,$5000
  42. mov esi,$CC14D0 // temp bank base
  43.  
  44. @LABEL500:
  45.  
  46. {to}
  47. cmp di,$10F5
  48. jg @Label601
  49. mov ebp,$DBFD38 //main save map base
  50. jmp @Label600
  51. @LABEL601:
  52. cmp di,$50FF
  53. jg @EndLabel
  54. cmp di,$5000
  55. jl @EndLabel
  56. sub di,$5000
  57. mov ebp,$CC14D0 // temp bank base
  58. @LABEL600:
  59.  
  60. cmp bl,$FE
  61. jae @LABEL200
  62.  
  63. mov bl,dl
  64. and bl,$10
  65. test bl,bl
  66. je @label200
  67. mov eax, [eax + esi] // if From holds a pointer.
  68. mov bl,$FE // flag to make sure only one final check is made.
  69. jmp @Label700
  70. @LABEL200:
  71.  
  72. cmp bl,$FF
  73. je @LABEL201
  74.  
  75. mov bl,dl
  76. and bl,$20
  77. test bl,bl
  78. je @label201
  79. mov edi, [edi + ebp] // if To holds a pointer.
  80. mov bl,$FF // flag to make sure only one final check is made.
  81. jmp @Label500
  82.  
  83. @LABEL201:
  84.  
  85. and dl,$F
  86. cmp dl,0
  87. jne @label300
  88. mov dl,1
  89. @LABEL300: //dl now holds only values from 1-8
  90.  
  91. cmp di, $04
  92. jb @EndLabel //Jump to end if trying to write to checksum.
  93.  
  94. cmp ax, $FFFF
  95. je @FromNotUsed
  96.  
  97. jmp @labelstart
  98.  
  99. @FROMNOTUSED:
  100. mov eax, ecx //eax now holds an absolute VALUE
  101.  
  102. @LABELSTART:
  103.  
  104. cmp dl,1
  105. jne @label1
  106. mov byte ptr [edi + ebp], al
  107. jmp @EndLabel
  108.  
  109. @LABEL1:
  110.  
  111. cmp dl,2
  112. jne @label2
  113. mov word ptr [edi + ebp], ax
  114. jmp @EndLabel
  115.  
  116. @LABEL2:
  117.  
  118. cmp dl,3
  119. jne @label3
  120. mov byte ptr [edi + ebp + 2], al
  121. shl eax,16
  122. mov word ptr [edi + ebp], ax
  123. jmp @EndLabel
  124.  
  125. @LABEL3:
  126. mov [edi + ebp], eax
  127.  
  128. @ENDLABEL:
  129.  
  130. xor edx,edx
  131. mov byte ptr dl,[$CC0964]
  132. add word ptr [edx*2+$CC0CF8],$0A //advance script by 10 bytes
  133.  
  134. pop edi
  135. pop esi
  136. pop ebx
  137. pop ebp
  138.  
  139. xor eax,eax
  140. end;
  141.  
  142. End;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement