home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1995 December / SOFM_Dec1995.bin / pc / os2 / vpascal / source / tv / tv4vp.pat < prev    next >
Text File  |  1995-10-31  |  167KB  |  4,772 lines

  1. Comparing BP7\OBJECTS.PAS and VP\OBJECTS.PAS 
  2. 10a11,12
  3. > { NOTE: TEmsStream is not implemented.                  }
  4. 13c15
  5. < {$O+,F+,X+,I-,S-}
  6. > {$X+,I-,S-,B-,Cdecl-}
  7. 16a19,20
  8. > uses Use32;
  9. 38c42
  10. <   MaxCollectionSize = 65520 div SizeOf(Pointer);
  11. >   MaxCollectionSize = 512*1024*1024 div SizeOf(Pointer);
  12. 47c51
  13. <   vmtHeaderSize = 8;
  14. >   vmtHeaderSize = 12;
  15. 58c62
  16. <     Lo, Hi: Word;
  17. >     Lo, Hi: SmallWord;
  18. 62c66
  19. <     Ofs, Seg: Word;
  20. >     Ofs: Longint;
  21. 77c81
  22. <   TByteArray = array[0..32767] of Byte;
  23. >   TByteArray = array[0..512*1024*1024] of Byte;
  24. 80c84,87
  25. <   TWordArray = array[0..16383] of Word;
  26. >   TWordArray = array[0..512*1024*1024 div 2] of SmallWord;
  27. >   PLongArray = ^TLongArray;
  28. >   TLongArray = array[0..512*1024*1024 div 4] of Longint;
  29. 81a89,91
  30. >   PPtrArray = ^TPtrArray;
  31. >   TPtrArray = array[0..512*1024*1024 div 4] of Pointer;
  32. 99c109
  33. <     Next: Word;
  34. >     Next: PStreamRec;
  35. 129,133c139
  36. < {$IFDEF Windows}
  37. >   FNameStr = String;
  38. 158c164
  39. <     constructor Init(FileName: FNameStr; Mode, Size: Word);
  40. >     constructor Init(const FileName: FNameStr; Mode, Size: Word);
  41. 169,186d174
  42. < { TEmsStream }
  43. 191,193c179,181
  44. <     SegCount: Integer;
  45. >     BlockCount: Integer;
  46. >     BlockList: PPtrArray;
  47. >     CurBlock: Integer;
  48. 283,284d270
  49. < {$IFNDEF Windows}
  50. 378,379d363
  51. < {$ENDIF}
  52. 385,392d368
  53. < { Longint routines }
  54. 404a381,384
  55. > { Analog to DOS int 21h I/O functions }
  56. > procedure DosFn;
  57. 411,415d390
  58. < { EMS stream state variables }
  59. 439,440d413
  60. < {$IFNDEF Windows }
  61. 455,456d427
  62. < {$ENDIF}
  63. 459,471c430
  64. < {$IFDEF Windows}
  65. > uses Memory, Strings, Os2Base;
  66. 487d445
  67. < {$IFNDEF Windows}
  68. 489d446
  69. < {$ENDIF}
  70. 506c463
  71. <   StreamTypes: Word = 0;
  72. >   StreamTypes: PStreamRec = nil;
  73. 513,531c470,478
  74. < procedure RegisterType(var S: TStreamRec); assembler;
  75. > procedure RegisterType(var S: TStreamRec);
  76. > var
  77. >   P: PStreamRec;
  78. > begin
  79. >   P := StreamTypes;
  80. >   while (P <> nil) and (P^.ObjType <> S.ObjType) do P := P^.Next;
  81. >   if (P <> nil) or (S.ObjType = 0) then RegisterError;
  82. >   S.Next := StreamTypes;
  83. >   StreamTypes := @S;
  84. 543,559c490,502
  85. < { In    AX    = Error info                              }
  86. > { In    eax   = Error info                              }
  87. > {       dl    = Error code                              }
  88. > {       ecx   = Stream object pointer                   }
  89. > { Uses  eax,edx                                         }
  90. > procedure DoStreamError; assembler; {$USES ecx} {$FRAME-}
  91. > asm
  92. >                 movsx   edx,dl
  93. >                 push    edx             { [1]:Integer = Code    }
  94. >                 push    eax             { [2]:Integer = Info    }
  95. >                 push    ecx             { [3]:Pointer = Self    }
  96. >                 mov     eax,[ecx]
  97. >                 Call    DWord Ptr [eax].TStream_Error
  98. 598c541
  99. < function TStream.Get: PObject; assembler;
  100. > function TStream.Get: PObject; assembler; {$USES None} {$FRAME+}
  101. 600,635c543,573
  102. <         PUSH    AX
  103. >                 push    eax
  104. >                 mov     eax,esp
  105. >                 push    eax                     { [1]:Pointer = Buf   }
  106. >                 push    4                       { [2]:DWord   = Count }
  107. >                 mov     eax,Self
  108. >                 push    eax                     { [3]:Pointer = Self  }
  109. >                 mov     eax,[eax]
  110. >                 Call    DWord Ptr [eax].TStream_Read
  111. >                 pop     eax
  112. >                 test    eax,eax                 { Return nil }
  113. >                 jz      @@4
  114. >                 mov     edx,StreamTypes
  115. >                 jmp     @@2
  116. >               @@1:
  117. >                 cmp     eax,[edx].TStreamRec.ObjType
  118. >                 je      @@3
  119. >                 mov     edx,[edx].TStreamRec.Next
  120. >               @@2:
  121. >                 test    edx,edx
  122. >                 jnz     @@1
  123. >                 mov     ecx,Self
  124. >                 mov     dl,stGetError
  125. >                 Call    DoStreamError
  126. >                 xor     eax,eax                 { Return nil }
  127. >                 jmp     @@4
  128. >               @@3:
  129. >                 push    Self                    { [1]:Pointer = TStream }
  130. >                 push    [edx].TStreamRec.VmtLink{ [2]:DWord   = VMT     }
  131. >                 push    0                       { [3]:Pointer = Self = nil: allocate in dynamic memory }
  132. >                 Call    [edx].TStreamRec.Load
  133. >               @@4:                              { Return Self or nil }
  134. 648c586
  135. < procedure TStream.Put(P: PObject); assembler;
  136. > procedure TStream.Put(P: PObject); assembler; {$USES None} {$FRAME+}
  137. 650,688c588,622
  138. <         LES     DI,P
  139. >                 mov     ecx,P
  140. >                 jecxz   @@4
  141. >                 mov     eax,[ecx]               { VMT pointer }
  142. >                 mov     edx,StreamTypes
  143. >                 jmp     @@2
  144. >               @@1:
  145. >                 cmp     eax,[edx].TStreamRec.VmtLink
  146. >                 je      @@3
  147. >                 mov     edx,[edx].TStreamRec.Next
  148. >               @@2:
  149. >                 test    edx,edx
  150. >                 jne     @@1
  151. >                 mov     ecx,Self
  152. >                 mov     dl,stPutError
  153. >                 Call    DoStreamError
  154. >                 jmp     @@5
  155. >               @@3:
  156. >                 mov     ecx,[edx].TStreamRec.ObjType
  157. >               @@4:
  158. >                 push    edx
  159. >                 push    ecx                     { Write object type  }
  160. >                 mov     eax,esp
  161. >                 push    eax                     { [1]:Pointer = Buf  }
  162. >                 push    4                       { [2]:DWord   = Size }
  163. >                 mov     eax,Self                { [3]:Pointer = Self }
  164. >                 push    eax
  165. >                 mov     eax,[eax]
  166. >                 Call    DWord Ptr [eax].TStream_Write
  167. >                 pop     ecx
  168. >                 pop     edx
  169. >                 jecxz   @@5
  170. >                 push    Self                    { [1]:Pointer = TStream }
  171. >                 push    P                       { [2]:Pointer = Self    }
  172. >                 Call    [edx].TStreamRec.Store
  173. >               @@5:
  174. 764a699,700
  175. > {$USES ebx,esi,edi} {$FRAME+}
  176. 769,972c705,877
  177. <         XOR     AX,AX
  178. >                 push    0                       { [1]:DWord = VMT       }
  179. >                 push    Self                    { [2]:Pointer = Self    }
  180. >                 Call    TStream.Init            { Inherited Init;       }
  181. >                 mov     esi,FileName
  182. >                 lea     edi,NameBuf
  183. >                 mov     edx,edi                 { edx = @FName (ASCIIZ) }
  184. >                 xor     eax,eax
  185. >                 cld
  186. >                 lodsb
  187. >                 cmp     al,79
  188. >                 jb      @@1
  189. >                 mov     al,79
  190. >               @@1:
  191. >                 xchg    ecx,eax
  192. >                 rep     movsb                   { File name             }
  193. >                 xchg    eax,ecx
  194. >                 stosb                           { Null terminator       }
  195. >                 xor     ecx,ecx                 { ecx = File attribute  }
  196. >                 mov     eax,Mode                { ah=DosFn,al=Open mode }
  197. >                 Call    DosFn
  198. >                 jnc     @@2                     { eax = File Handle     }
  199. >                 mov     ecx,Self
  200. >                 mov     dl,stInitError
  201. >                 Call    DoStreamError
  202. >                 or      eax,-1
  203. >               @@2:
  204. >                 mov     ecx,Self
  205. >                 mov     [ecx].TDosStream.Handle,eax
  206. > end;
  207. > destructor TDosStream.Done; assembler; {$USES ebx} {$FRAME+}
  208. > asm
  209. >                 mov     eax,Self
  210. >                 mov     ebx,[eax].TDosStream.Handle
  211. >                 cmp     ebx,-1
  212. >                 je      @@1
  213. >                 mov     ah,3Eh                  { Close file            }
  214. >                 Call    DosFn
  215. >               @@1:
  216. >                 push    0                       { [1]:DWord = VMT       }
  217. >                 push    Self                    { [2]:Pointer = Self    }
  218. >                 Call    TStream.Done            { Inherited Done;       }
  219. > end;
  220. > function TDosStream.GetPos: Longint; assembler; {$USES ebx} {$FRAME-}
  221. > asm
  222. >                 mov     eax,Self
  223. >                 cmp     [eax].TDosStream.Status,stOk
  224. >                 jne     @@1
  225. >                 xor     ecx,ecx                 { ecx = Distance        }
  226. >                 mov     ebx,[eax].TDosStream.Handle { ebx = File Handle }
  227. >                 mov     ax,4201h                { Get current position  }
  228. >                 Call    DosFn
  229. >                 jnc     @@2
  230. >                 mov     ecx,Self
  231. >                 mov     dl,stError
  232. >                 Call    DoStreamError           { eax = Current FilePtr }
  233. >               @@1:
  234. >                 or      eax,-1
  235. >               @@2:
  236. > end;
  237. > function TDosStream.GetSize: Longint; assembler; {$USES ebx} {$FRAME-}
  238. > asm
  239. >                 mov     eax,Self
  240. >                 cmp     [eax].TDosStream.Status,stOk
  241. >                 jne     @@1
  242. >                 xor     ecx,ecx                 { ecx = Distance        }
  243. >                 mov     ebx,[eax].TDosStream.Handle
  244. >                 mov     ax,4201h                { ebx = Handle          }
  245. >                 Call    DosFn
  246. >                 push    eax                     { Save current position }
  247. >                 xor     ecx,ecx
  248. >                 mov     ax,4202h                { Move to the EOF       }
  249. >                 Call    DosFn
  250. >                 pop     ecx
  251. >                 push    eax
  252. >                 mov     ax,4200h                { Restore old position  }
  253. >                 Call    DosFn
  254. >                 pop     eax
  255. >                 jnc     @@2
  256. >                 mov     ecx,Self
  257. >                 mov     dl,stError
  258. >                 Call    DoStreamError
  259. >               @@1:
  260. >                 or      eax,-1
  261. >               @@2:
  262. > end;
  263. > procedure TDosStream.Read(var Buf; Count: Word); assembler; {$USES ebx,edi} {$FRAME-}
  264. > asm
  265. >                 mov     edi,Self
  266. >                 cmp     [edi].TDosStream.Status,stOk
  267. >                 jne     @@2
  268. >                 mov     edx,Buf                 { edx = Buffer@         }
  269. >                 mov     ecx,Count               { ecx = Count           }
  270. >                 mov     ebx,[edi].TDosStream.Handle { ebx = File Handle }
  271. >                 mov     ah,3Fh                  { Read file             }
  272. >                 Call    DosFn
  273. >                 mov     dl,stError
  274. >                 jc      @@1
  275. >                 cmp     eax,ecx
  276. >                 je      @@3
  277. >                 xor     eax,eax
  278. >                 mov     dl,stReadError
  279. >               @@1:
  280. >                 mov     ecx,edi
  281. >                 Call    DoStreamError
  282. >               @@2:
  283. >                 mov     edi,Buf
  284. >                 mov     ecx,Count
  285. >                 xor     al,al
  286. >                 cld
  287. >                 rep     stosb
  288. >               @@3:
  289. > end;
  290. > procedure TDosStream.Seek(Pos: Longint); assembler; {$USES ebx} {$FRAME-}
  291. > asm
  292. >                 mov     eax,Self
  293. >                 cmp     [eax].TDosStream.Status,stOk
  294. >                 jne     @@2
  295. >                 mov     ecx,Pos
  296. >                 test    ecx,ecx
  297. >                 jns     @@1
  298. >                 xor     ecx,ecx
  299. >               @@1:
  300. >                 mov     ebx,[eax].TDosStream.Handle
  301. >                 mov     ax,4200h
  302. >                 Call    DosFn
  303. >                 jnc     @@2
  304. >                 mov     ecx,Self
  305. >                 mov     dl,stError
  306. >                 Call    DoStreamError
  307. >               @@2:
  308. > end;
  309. > procedure TDosStream.Truncate; assembler; {$USES ebx} {$FRAME-}
  310. > asm
  311. >                 mov     eax,Self
  312. >                 cmp     [eax].TDosStream.Status,stOk
  313. >                 jne     @@1
  314. >                 xor     ecx,ecx                 { ecx=0: Truncate file  }
  315. >                 mov     ebx,[eax].TDosStream.Handle
  316. >                 mov     ah,40h                  { Write file            }
  317. >                 Call    DosFn
  318. >                 jnc     @@1
  319. >                 mov     ecx,Self
  320. >                 mov     dl,stError
  321. >                 Call    DoStreamError
  322. >               @@1:
  323. > end;
  324. > procedure TDosStream.Write(var Buf; Count: Word); assembler; {$USES ebx} {$FRAME-}
  325. > asm
  326. >                 mov     eax,Self
  327. >                 cmp     [eax].TDosStream.Status,stOk
  328. >                 jne     @@2
  329. >                 mov     edx,Buf
  330. >                 mov     ecx,Count
  331. >                 mov     ebx,[eax].TDosStream.Handle
  332. >                 mov     ah,40h
  333. >                 Call    DosFn
  334. >                 mov     dl,stError
  335. >                 jc      @@1
  336. >                 cmp     eax,ecx
  337. >                 je      @@2
  338. >                 xor     eax,eax
  339. >                 mov     dl,stWriteError
  340. >               @@1:
  341. >                 mov     ecx,Self
  342. >                 Call    DoStreamError
  343. >               @@2:
  344. 979c884
  345. < {       ES:DI = TBufStream pointer                      }
  346. > {       edi   = TBufStream pointer                      }
  347. 982c887
  348. < procedure FlushBuffer; near; assembler;
  349. > procedure FlushBuffer; assembler; {$USES ebx} {$FRAME-}
  350. 984,1014c889,919
  351. <         MOV     CX,ES:[DI].TBufStream.BufPtr
  352. >                 mov     ecx,[edi].TBufStream.BufPtr
  353. >                 sub     ecx,[edi].TBufStream.BufEnd
  354. >                 je      @@3
  355. >                 mov     ebx,[edi].TDosStream.Handle
  356. >                 ja      @@1
  357. >                 cmp     al,1
  358. >                 je      @@4
  359. >                 mov     ax,4201h                { Seek from current position }
  360. >                 Call    DosFn
  361. >                 jmp     @@3
  362. >               @@1:
  363. >                 cmp     al,0
  364. >                 je      @@4
  365. >                 mov     edx,[edi].TBufStream.Buffer
  366. >                 mov     ah,40h
  367. >                 Call    DosFn
  368. >                 mov     dl,stError
  369. >                 jc      @@2
  370. >                 cmp     eax,ecx
  371. >                 je      @@3
  372. >                 xor     eax,eax
  373. >                 mov     dl,stWriteError
  374. >               @@2:
  375. >                 mov     ecx,edi
  376. >                 Call    DoStreamError
  377. >               @@3:
  378. >                 xor     eax,eax
  379. >                 mov     [edi].TBufStream.BufPtr,eax
  380. >                 mov     [edi].TBufStream.BufEnd,eax
  381. >                 cmp     [edi].TStream.Status,stOk
  382. >               @@4:
  383. 1017c922
  384. < constructor TBufStream.Init(FileName: FNameStr; Mode, Size: Word);
  385. > constructor TBufStream.Init(const FileName: FNameStr; Mode, Size: Word);
  386. 1034c939
  387. < procedure TBufStream.Flush; assembler;
  388. > procedure TBufStream.Flush; assembler;  {$USES edi} {$FRAME-}
  389. 1036,1155c941,1052
  390. <         LES     DI,Self
  391. >                 mov     edi,Self
  392. >                 cmp     [edi].TBufStream.Status,stOk
  393. >                 jne     @@1
  394. >                 mov     al,2                    { Read/Write mode }
  395. >                 Call    FlushBuffer
  396. >               @@1:
  397. > end;
  398. > function TBufStream.GetPos: Longint; assembler; {$USES edi} {$FRAME-}
  399. > asm
  400. >                 mov     edi,Self
  401. >                 push    edi
  402. >                 Call    TDosStream.GetPos
  403. >                 test    eax,eax
  404. >                 js      @@1
  405. >                 sub     eax,[edi].TBufStream.BufEnd
  406. >                 add     eax,[edi].TBufStream.BufPtr
  407. >               @@1:
  408. > end;
  409. > function TBufStream.GetSize: Longint; assembler; {$USES None} {$FRAME-}
  410. > asm
  411. >                 mov     eax,Self
  412. >                 push    eax
  413. >                 push    eax
  414. >                 Call    TBufStream.Flush
  415. >                 Call    TDosStream.GetSize
  416. > end;
  417. > procedure TBufStream.Read(var Buf; Count: Word); assembler; {$USES ebx,esi,edi} {$FRAME-}
  418. > asm
  419. >                 mov     edi,Self
  420. >                 cmp     [edi].TBufStream.Status,stOk
  421. >                 jne     @@6
  422. >                 mov     al,1                    { Write mode }
  423. >                 Call    FlushBuffer
  424. >                 jne     @@6
  425. >                 xor     ebx,ebx
  426. >               @@1:
  427. >                 mov     ecx,Count
  428. >                 sub     ecx,ebx
  429. >                 je      @@7
  430. >                 mov     edi,Self
  431. >                 mov     eax,[edi].TBufStream.BufEnd
  432. >                 sub     eax,[edi].TBufStream.BufPtr
  433. >                 ja      @@2
  434. >                 push    ecx
  435. >                 push    ebx
  436. >                 mov     edx,[edi].TBufStream.Buffer
  437. >                 mov     ecx,[edi].TBufStream.BufSize
  438. >                 mov     ebx,[edi].TBufStream.Handle
  439. >                 mov     ah,3Fh
  440. >                 Call    DosFn
  441. >                 pop     ebx
  442. >                 pop     ecx
  443. >                 mov     dl,stError
  444. >                 jc      @@5
  445. >                 and     [edi].TBufStream.BufPtr,0
  446. >                 mov     [edi].TBufStream.BufEnd,eax
  447. >                 test    eax,eax
  448. >                 je      @@4
  449. >               @@2:
  450. >                 cmp     ecx,eax
  451. >                 jb      @@3
  452. >                 mov     ecx,eax
  453. >               @@3:
  454. >                 mov     esi,[edi].TBufStream.Buffer
  455. >                 add     esi,[edi].TBufStream.BufPtr
  456. >                 add     [edi].TBufStream.BufPtr,ecx
  457. >                 mov     edi,Buf
  458. >                 add     edi,ebx
  459. >                 add     ebx,ecx
  460. >                 cld
  461. >                 rep     movsb
  462. >                 jmp     @@1
  463. >               @@4:
  464. >                 mov     dl,stReadError
  465. >               @@5:
  466. >                 mov     ecx,edi
  467. >                 Call    DoStreamError
  468. >               @@6:
  469. >                 mov     edi,Buf
  470. >                 mov     ecx,Count
  471. >                 xor     al,al
  472. >                 cld
  473. >                 rep     stosb
  474. >               @@7:
  475. > end;
  476. > procedure TBufStream.Seek(Pos: Longint); assembler; {$USES edi} {$FRAME-}
  477. > asm
  478. >                 mov     edi,Self
  479. >                 push    edi
  480. >                 Call    TDosStream.GetPos
  481. >                 test    eax,eax
  482. >                 js      @@2
  483. >                 sub     eax,Pos
  484. >                 jne     @@1
  485. >                 test    eax,eax
  486. >                 je      @@1
  487. >                 mov     edx,[edi].TBufStream.BufEnd
  488. >                 sub     edx,eax
  489. >                 jb      @@1
  490. >                 mov     [edi].TBufStream.BufPtr,edx
  491. >                 jmp     @@2
  492. >               @@1:
  493. >                 push    edi
  494. >                 Call    TBufStream.Flush
  495. >                 push    Pos
  496. >                 push    edi
  497. >                 Call    TDosStream.Seek
  498. >               @@2:
  499. 1164,1261c1061
  500. < procedure TBufStream.Write(var Buf; Count: Word); assembler;
  501. > procedure TBufStream.Write(var Buf; Count: Word); assembler; {$USES esi,edi} {$FRAME-}
  502. 1263,1517c1063,1101
  503. <         XOR     AX,AX
  504. >                 mov     edi,Self
  505. >                 cmp     [edi].TBufStream.Status,stOk
  506. >                 jne     @@4
  507. >                 mov     al,0                    { Read mode }
  508. >                 Call    FlushBuffer
  509. >                 jne     @@4
  510. >                 xor     edx,edx
  511. >               @@1:
  512. >                 mov     ecx,Count
  513. >                 sub     ecx,edx
  514. >                 je      @@4
  515. >                 mov     edi,Self
  516. >                 mov     eax,[edi].TBufStream.BufSize
  517. >                 sub     eax,[edi].TBufStream.BufPtr
  518. >                 ja      @@2
  519. >                 push    ecx
  520. >                 push    edx
  521. >                 mov     al,1                    { Write mode }
  522. >                 Call    FlushBuffer
  523. >                 pop     edx
  524. >                 pop     ecx
  525. >                 jne     @@4
  526. >                 mov     eax,[edi].TBufStream.BufSize
  527. >               @@2:
  528. >                 cmp     ecx,eax
  529. >                 jb      @@3
  530. >                 mov     ecx,eax
  531. >               @@3:
  532. >                 mov     eax,[edi].TBufStream.BufPtr
  533. >                 add     [edi].TBufStream.BufPtr,ecx
  534. >                 mov     edi,[edi].TBufStream.Buffer
  535. >                 add     edi,eax
  536. >                 mov     esi,Buf
  537. >                 add     esi,edx
  538. >                 add     edx,ecx
  539. >                 cld
  540. >                 rep     movsb
  541. >                 jmp     @@1
  542. >               @@4:
  543. 1523,1527c1107,1108
  544. <   MaxSegArraySize = 16384;
  545. >   MaxBlockArraySize = 512 * 1024 * 1024 div 4;
  546. >   DefaultBlockSize = 8 * 1024;
  547. 1529,1544c1110,1124
  548. < {$ELSE}
  549. > { Selects TMemoryStream memory block                            }
  550. > { In    edi   = TMemoryStream pointer                           }
  551. > { Out   ecx   = Distance between position and end of block      }
  552. > {       esi   = Position within the selected block              }
  553. > procedure MemSelectBlock; assembler; {$USES None} {$FRAME-}
  554. > asm
  555. >                 mov     eax,[edi].TMemoryStream.Position
  556. >                 xor     edx,edx
  557. >                 mov     ecx,[edi].TMemoryStream.BlockSize
  558. >                 div     ecx
  559. >                 sub     ecx,edx
  560. >                 mov     esi,edx
  561. >                 shl     eax,2
  562. >                 mov     [edi].TMemoryStream.CurBlock,eax
  563. 1550c1130
  564. < constructor TMemoryStream.Init(ALimit: Longint; ABlockSize: Word); assembler;
  565. > constructor TMemoryStream.Init(ALimit: Longint; ABlockSize: Word); assembler; {$USES edi} {$FRAME+}
  566. 1552,1591c1132,1158
  567. <         XOR     AX,AX
  568. >                 push    0
  569. >                 push    Self
  570. >                 Call    TStream.Init
  571. >                 mov     edi,Self
  572. >                 cmp     ABlockSize,0
  573. >                 jnz     @@1
  574. >                 mov     ABlockSize,DefaultBlockSize
  575. >               @@1:
  576. >                 mov     ecx,ABlockSize
  577. >                 mov     eax,ALimit
  578. >                 xor     edx,edx
  579. >                 div     ecx
  580. >                 neg     edx
  581. >                 adc     eax,0
  582. >                 mov     [edi].TMemoryStream.BlockSize,ecx
  583. >                 push    eax                     { [1]:DWord = ALimit    }
  584. >                 push    edi                     { [2]:Pointer = Self    }
  585. >                 Call    ChangeListSize
  586. >                 test    al,al
  587. >                 jnz     @@2
  588. >                 mov     dl,stInitError
  589. >                 mov     ecx,edi
  590. >                 Call    DoStreamError
  591. >                 and     ALimit,0
  592. >               @@2:
  593. >                 mov     eax,ALimit
  594. >                 mov     [edi].TMemoryStream.Size,eax
  595. 1602c1169
  596. <   AItems: PWordArray;
  597. >   AItems: PPtrArray;
  598. 1607,1608c1174,1175
  599. <   if ALimit > MaxSegArraySize then ALimit := MaxSegArraySize;
  600. >   if ALimit > MaxBlockArraySize then ALimit := MaxBlockArraySize;
  601. >   if ALimit <> BlockCount then
  602. 1612c1179
  603. <       AItems := MemAlloc(ALimit * SizeOf(Word));
  604. >       AItems := MemAlloc(ALimit * SizeOf(Pointer));
  605. 1614,1617c1181,1184
  606. <       FillChar(AItems^, ALimit * SizeOf(Word), 0);
  607. >       FillChar(AItems^, ALimit * SizeOf(Pointer), 0);
  608. >       if (BlockCount <> 0) and (BlockList <> nil) then
  609. >         if BlockCount > ALimit then
  610. >           Move(BlockList^, AItems^, ALimit * SizeOf(Pointer))
  611. 1619c1186
  612. <           Move(SegList^, AItems^, SegCount * SizeOf(Word));
  613. >           Move(BlockList^, AItems^, BlockCount * SizeOf(Pointer));
  614. 1621c1188
  615. <     if ALimit < SegCount then
  616. >     if ALimit < BlockCount then
  617. 1624c1191
  618. <       Term := SegCount - 1;
  619. >       Term := BlockCount - 1;
  620. 1627,1628c1194,1195
  621. <         if SegList^[Dif] <> 0 then
  622. >         if BlockList^[Dif] <> nil then
  623. >           FreeMem(BlockList^[Dif], BlockSize);
  624. 1634c1201
  625. <       Dif := SegCount;
  626. >       Dif := BlockCount;
  627. 1638c1205
  628. <         NewBlock := MemAllocSeg(BlockSize);
  629. >         NewBlock := MemAlloc(BlockSize);
  630. 1640c1207
  631. <         else AItems^[Dif] := PtrRec(NewBlock).Seg;
  632. >         else AItems^[Dif] := NewBlock;
  633. 1646,1648c1213,1215
  634. <     if SegCount <> 0 then FreeMem(SegList, SegCount * SizeOf(Word));
  635. >     if BlockCount <> 0 then FreeMem(BlockList, BlockCount * SizeOf(Pointer));
  636. >     BlockList := AItems;
  637. >     BlockCount := ALimit;
  638. 1652,1836c1219,1369
  639. < function TMemoryStream.GetPos: Longint; assembler;
  640. > function TMemoryStream.GetPos: Longint;
  641. > begin
  642. >   if Status = stOk then GetPos := Position else GetPos := -1;
  643. > end;
  644. > function TMemoryStream.GetSize: Longint;
  645. > begin
  646. >   if Status = stOk then GetSize := Size else GetSize := -1;
  647. > end;
  648. > procedure TMemoryStream.Read(var Buf; Count: Word); assembler; {$USES ebx,esi,edi} {$FRAME+}
  649. > asm
  650. >                 mov     edi,Self
  651. >                 cmp     [edi].TMemoryStream.Status,stOk
  652. >                 jne     @@3
  653. >                 xor     ebx,ebx
  654. >                 mov     eax,[edi].TMemoryStream.Position
  655. >                 add     eax,Count
  656. >                 cmp     eax,[edi].TMemoryStream.Size
  657. >                 jbe     @@7
  658. >                 xor     eax,eax
  659. >                 mov     ecx,edi
  660. >                 mov     dl,stReadError
  661. >                 Call    DoStreamError
  662. >               @@3:
  663. >                 mov     edi,Buf
  664. >                 mov     ecx,Count
  665. >                 xor     al,al
  666. >                 cld
  667. >                 rep     stosb
  668. >                 jmp     @@8
  669. >               @@5:
  670. >                 Call    MemSelectBlock
  671. >                 mov     eax,Count
  672. >                 sub     eax,ebx
  673. >                 cmp     ecx,eax
  674. >                 jb      @@6
  675. >                 mov     ecx,eax
  676. >               @@6:
  677. >                 add     [edi].TMemoryStream.Position,ecx
  678. >                 push    edi
  679. >                 mov     edx,[edi].TMemoryStream.CurBlock
  680. >                 mov     eax,[edi].TMemoryStream.BlockList
  681. >                 add     esi,[eax+edx]           { Block base pointer }
  682. >                 mov     edi,Buf
  683. >                 add     edi,ebx
  684. >                 add     ebx,ecx
  685. >                 mov     al,cl
  686. >                 shr     ecx,2
  687. >                 and     al,11b
  688. >                 cld
  689. >                 rep     movsd
  690. >                 mov     cl,al
  691. >                 rep     movsb
  692. >                 pop     edi
  693. >               @@7:
  694. >                 cmp     ebx,Count
  695. >                 jb      @@5
  696. >               @@8:
  697. > end;
  698. > procedure TMemoryStream.Seek(Pos: Longint);
  699. > begin
  700. >   if Status = stOk then
  701. >     if Pos > 0 then Position := Pos else Position := 0;
  702. > end;
  703. > procedure TMemoryStream.Truncate; assembler; {$USES None} {$FRAME-}
  704. > asm
  705. >                 mov     ecx,Self
  706. >                 cmp     [ecx].TMemoryStream.Status,stOk
  707. >                 jne     @@2
  708. >                 mov     eax,[ecx].TMemoryStream.Position
  709. >                 xor     edx,edx
  710. >                 div     [ecx].TMemoryStream.BlockSize
  711. >                 neg     edx
  712. >                 adc     eax,0
  713. >                 push    eax                     { [1]:DWord = ALimit    }
  714. >                 push    ecx                     { [2]:Pointer = Self    }
  715. >                 Call    ChangeListSize
  716. >                 mov     ecx,Self
  717. >                 test    al,al
  718. >                 jnz     @@1
  719. >                 mov     dl,stError
  720. >                 Call    DoStreamError
  721. >                 jmp     @@2
  722. >               @@1:
  723. >                 mov     eax,[ecx].TMemoryStream.Position
  724. >                 mov     [ecx].TMemoryStream.Size,eax
  725. >               @@2:
  726. > end;
  727. > procedure TMemoryStream.Write(var Buf; Count: Word); assembler; {$USES ebx,esi,edi} {$FRAME+}
  728. > asm
  729. >                 mov     edi,Self
  730. >                 cmp     [edi].TMemoryStream.Status,stOk
  731. >                 jne     @@7
  732. >                 xor     ebx,ebx
  733. >                 mov     eax,[edi].TMemoryStream.Position
  734. >                 add     eax,Count
  735. >                 xor     edx,edx
  736. >                 div     [edi].TMemoryStream.BlockSize
  737. >                 neg     edx
  738. >                 adc     eax,0
  739. >                 cmp     eax,[edi].TMemoryStream.BlockCount
  740. >                 jbe     @@4
  741. >                 push    eax                     { [1]:DWord = ALimit    }
  742. >                 push    edi                     { [2]:Pointer = Self    }
  743. >                 Call    ChangeListSize
  744. >                 test    al,al
  745. >                 jnz     @@4
  746. >               @@1:
  747. >                 mov     ecx,edi
  748. >                 mov     dl,stWriteError
  749. >                 Call    DoStreamError
  750. >                 jmp     @@7
  751. >               @@2:
  752. >                 Call    MemSelectBlock
  753. >                 mov     eax,Count
  754. >                 sub     eax,ebx
  755. >                 cmp     ecx,eax
  756. >                 jb      @@3
  757. >                 mov     ecx,eax
  758. >               @@3:
  759. >                 add     [edi].TMemoryStream.Position,ecx
  760. >                 push    edi
  761. >                 mov     edx,[edi].TMemoryStream.CurBlock
  762. >                 mov     eax,[edi].TMemoryStream.BlockList
  763. >                 add     esi,[eax+edx]
  764. >                 mov     edi,esi
  765. >                 mov     esi,Buf
  766. >                 add     esi,ebx
  767. >                 add     ebx,ecx
  768. >                 mov     al,cl
  769. >                 shr     ecx,2
  770. >                 and     al,11b
  771. >                 cld
  772. >                 rep     movsd
  773. >                 mov     cl,al
  774. >                 rep     movsb
  775. >                 pop     edi
  776. >               @@4:
  777. >                 cmp     ebx,Count
  778. >                 jb      @@2
  779. >               @@5:
  780. >                 mov     eax,[edi].TMemoryStream.Position
  781. >                 cmp     eax,[edi].TMemoryStream.Size
  782. >                 jbe     @@7
  783. >               @@6:
  784. >                 mov     [edi].TMemoryStream.Size,eax
  785. >               @@7:
  786. 1845,1852c1378,1390
  787. < procedure CollectionError; near; assembler;
  788. > { Reports collection error                                      }
  789. > { In     al   = Error code                                      }
  790. > {       edx   = Error info                                      }
  791. > {       edi   = TCollection pointer                             }
  792. > procedure CollectionError; assembler; {$USES None} {$FRAME-}
  793. > asm
  794. >                 movsx   eax,al
  795. >                 push    eax                     { [1]:DWord = Error code }
  796. >                 push    edx                     { [2]:DWord = Error info }
  797. >                 push    edi                     { [3]:Pointer = Self     }
  798. >                 mov     eax,[edi]
  799. >                 Call    DWord Ptr [eax].TCollection_Error
  800. 1886c1424
  801. < function TCollection.At(Index: Integer): Pointer; assembler;
  802. > function TCollection.At(Index: Integer): Pointer; assembler; {$USES edi} {$FRAME-}
  803. 1888,1934c1426,1463
  804. <         LES     DI,Self
  805. >                 mov     edi,Self
  806. >                 mov     edx,Index
  807. >                 test    edx,edx
  808. >                 jl      @@1
  809. >                 cmp     edx,[edi].TCollection.Count
  810. >                 jge     @@1
  811. >                 mov     edi,[edi].TCollection.Items
  812. >                 mov     eax,[edi+edx*4]
  813. >                 jmp     @@2
  814. >               @@1:
  815. >                 mov     al,coIndexError
  816. >                 Call    CollectionError
  817. >                 xor     eax,eax
  818. >               @@2:
  819. > end;
  820. > procedure TCollection.AtDelete(Index: Integer); assembler; {$USES esi,edi} {$FRAME-}
  821. > asm
  822. >                 mov     edi,Self
  823. >                 mov     edx,Index
  824. >                 test    edx,edx
  825. >                 jl      @@1
  826. >                 cmp     edx,[edi].TCollection.Count
  827. >                 jge     @@1
  828. >                 dec     [edi].TCollection.Count
  829. >                 mov     ecx,[edi].TCollection.Count
  830. >                 sub     ecx,edx
  831. >                 je      @@2
  832. >                 cld
  833. >                 mov     edi,[edi].TCollection.Items
  834. >                 lea     edi,[edi+edx*4]
  835. >                 lea     esi,[edi+4]
  836. >                 rep     movsd
  837. >                 jmp     @@2
  838. >               @@1:
  839. >                 mov     al,coIndexError
  840. >                 Call    CollectionError
  841. >               @@2:
  842. 1946c1475
  843. < procedure TCollection.AtInsert(Index: Integer; Item: Pointer); assembler;
  844. > procedure TCollection.AtInsert(Index: Integer; Item: Pointer); assembler; {USES esi, edi} {$FRAME-}
  845. 1948,2019c1477,1537
  846. <         LES     DI,Self
  847. >                 mov     edi,Self
  848. >                 mov     edx,Index
  849. >                 test    edx,edx
  850. >                 jl      @@3
  851. >                 mov     ecx,[edi].TCollection.Count
  852. >                 cmp     edx,ecx
  853. >                 jg      @@3
  854. >                 cmp     ecx,[edi].TCollection.Limit
  855. >                 jne     @@1
  856. >                 push    ecx
  857. >                 push    edx
  858. >                 add     ecx,[edi].TCollection.Delta
  859. >                 push    ecx                     { [1]:DWord = ALimit    }
  860. >                 push    edi                     { [2]:Pointer = Self    }
  861. >                 mov     eax,[edi]
  862. >                 Call    DWord Ptr [eax].TCollection_SetLimit
  863. >                 pop     edx
  864. >                 pop     ecx
  865. >                 cmp     ecx,[edi].TCollection.Limit
  866. >                 je      @@4
  867. >               @@1:
  868. >                 inc     [edi].TCollection.Count
  869. >                 std
  870. >                 mov     edi,[edi].TCollection.Items
  871. >                 lea     edi,[edi+ecx*4]
  872. >                 sub     ecx,edx
  873. >                 je      @@2
  874. >                 lea     esi,[edi-4]
  875. >                 rep     movsd
  876. >               @@2:
  877. >                 mov     eax,Item
  878. >                 stosd
  879. >                 cld
  880. >                 jmp     @@6
  881. >               @@3:
  882. >                 mov     al,coIndexError
  883. >                 jmp     @@5
  884. >               @@4:
  885. >                 mov     al,coOverflow
  886. >                 mov     edx,ecx
  887. >               @@5:
  888. >                 Call    CollectionError
  889. >               @@6:
  890. > end;
  891. > procedure TCollection.AtPut(Index: Integer; Item: Pointer); assembler; {$USES edi} {$FRAME-}
  892. > asm
  893. >                 mov     eax,Item
  894. >                 mov     edi,Self
  895. >                 mov     edx,Index
  896. >                 test    edx,edx
  897. >                 jl      @@1
  898. >                 cmp     edx,[edi].TCollection.Count
  899. >                 jge     @@1
  900. >                 mov     edi,[edi].TCollection.Items
  901. >                 mov     [edi+edx*4],eax
  902. >                 jmp     @@2
  903. >               @@1:
  904. >                 mov     al,coIndexError
  905. >                 Call    CollectionError
  906. >               @@2:
  907. 2037c1555
  908. < function TCollection.FirstThat(Test: Pointer): Pointer; assembler;
  909. > function TCollection.FirstThat(Test: Pointer): Pointer; assembler; {$USES ebx} {$FRAME-}
  910. 2039,2095c1557,1596
  911. <         LES     DI,Self
  912. >                 mov     edx,Self
  913. >                 mov     ecx,[edx].TCollection.Count
  914. >                 jecxz   @@3
  915. >                 mov     ebx,Test
  916. >                 mov     edx,[edx].TCollection.Items
  917. >               @@1:
  918. >                 push    edx
  919. >                 push    ecx
  920. >                 push    DWord Ptr [edx]         { [1]:Pointer = Item }
  921. >                 Call    ebx
  922. >                 pop     ecx
  923. >                 pop     edx
  924. >                 test    al,al
  925. >                 jnz     @@2
  926. >                 add     edx,4
  927. >                 loop    @@1
  928. >                 jmp     @@3
  929. >               @@2:
  930. >                 mov     ecx,[edx]
  931. >               @@3:
  932. >                 mov     eax,ecx
  933. > end;
  934. > procedure TCollection.ForEach(Action: Pointer); assembler; {$USES ebx} {$FRAME-}
  935. > asm
  936. >                 mov     edx,Self
  937. >                 mov     ecx,[edx].TCollection.Count
  938. >                 jecxz   @@2
  939. >                 mov     ebx,Action
  940. >                 mov     edx,[edx].TCollection.Items
  941. >               @@1:
  942. >                 push    edx
  943. >                 push    ecx
  944. >                 push    DWord Ptr [edx]         { [1]:Pointer = Item }
  945. >                 Call    ebx
  946. >                 pop     ecx
  947. >                 pop     edx
  948. >                 add     edx,4
  949. >                 loop    @@1
  950. >               @@2:
  951. 2122c1623
  952. < function TCollection.IndexOf(Item: Pointer): Integer; assembler;
  953. > function TCollection.IndexOf(Item: Pointer): Integer; assembler; {$USES edi} {$FRAME-}
  954. 2124,2149c1625,1642
  955. <         MOV     AX,Item.Word[0]
  956. >                 mov     eax,Item
  957. >                 mov     edi,Self
  958. >                 mov     ecx,[edi].TCollection.Count
  959. >                 jecxz   @@1
  960. >                 mov     edi,[edi].TCollection.Items
  961. >                 mov     edx,edi
  962. >                 cld
  963. >                 repne   scasd
  964. >                 jne     @@1
  965. >                 mov     eax,edi
  966. >                 sub     eax,edx
  967. >                 shr     eax,2
  968. >                 dec     eax
  969. >                 jmp     @@2
  970. >               @@1:
  971. >                 xor     eax,eax
  972. >                 dec     eax
  973. >               @@2:
  974. 2157c1650
  975. < function TCollection.LastThat(Test: Pointer): Pointer; assembler;
  976. > function TCollection.LastThat(Test: Pointer): Pointer; assembler; {$USES ebx} {$FRAME-}
  977. 2159,2223c1652,1694
  978. <         LES     DI,Self
  979. >                 mov     edx,Self
  980. >                 mov     ecx,[edx].TCollection.Count
  981. >                 jecxz   @@3
  982. >                 mov     edx,[edx].TCollection.Items
  983. >                 lea     edx,[edx+ecx*4]
  984. >                 mov     ebx,Test
  985. >               @@1:
  986. >                 sub     edx,4
  987. >                 push    edx
  988. >                 push    ecx
  989. >                 push    DWord Ptr [edx]         { [1]:Pointer = Item }
  990. >                 Call    ebx
  991. >                 pop     ecx
  992. >                 pop     edx
  993. >                 test    al,al
  994. >                 jnz     @@2
  995. >                 loop    @@1
  996. >                 jmp     @@3
  997. >               @@2:
  998. >                 mov     ecx,[edx]
  999. >               @@3:
  1000. >                 mov     eax,ecx
  1001. > end;
  1002. > procedure TCollection.Pack; assembler; {$USES esi,edi} {$FRAME-}
  1003. > asm
  1004. >                 mov     edx,Self
  1005. >                 mov     ecx,[edx].TCollection.Count
  1006. >                 jecxz   @@3
  1007. >                 mov     edi,[edx].TCollection.Items
  1008. >                 mov     esi,edi
  1009. >                 cld
  1010. >               @@1:
  1011. >                 lodsd
  1012. >                 test    eax,eax
  1013. >                 jz      @@2
  1014. >                 stosd
  1015. >               @@2:
  1016. >                 loop    @@1
  1017. >                 sub     edi,[edx].TCollection.Items
  1018. >                 shr     edi,2
  1019. >                 mov     [edx].TCollection.Count,edi
  1020. >               @@3:
  1021. 2253c1724
  1022. < procedure DoPutItem(P: Pointer); far;
  1023. > procedure DoPutItem(P: Pointer);
  1024. 2338a1810,1811
  1025. > {$USES esi,edi} {$FRAME-}
  1026. 2341,2359c1814,1832
  1027. <         PUSH    DS
  1028. >                 cld
  1029. >                 xor     eax,eax
  1030. >                 xor     edx,edx
  1031. >                 mov     esi,Key1
  1032. >                 mov     edi,Key2
  1033. >                 lodsb
  1034. >                 mov     dl,[edi]
  1035. >                 inc     edi
  1036. >                 mov     ecx,eax
  1037. >                 cmp     cl,dl
  1038. >                 jbe     @@1
  1039. >                 mov     cl,dl
  1040. >               @@1:
  1041. >                 repe    cmpsb
  1042. >                 je      @@2
  1043. >                 mov     al,[esi-1]
  1044. >                 mov     dl,[edi-1]
  1045. >               @@2:
  1046. >                 sub     eax,edx
  1047. 2399,2400d1871
  1048. < {$IFNDEF Windows }
  1049. 2441c1912
  1050. < function TResourceCollection.KeyOf(Item: Pointer): Pointer; assembler;
  1051. > function TResourceCollection.KeyOf(Item: Pointer): Pointer; assembler; {$USES None} {$FRAME-}
  1052. 2443,2445c1914,1915
  1053. <         MOV     AX,Item.Word[0]
  1054. >                 mov     eax,Item
  1055. >                 add     eax,OFFSET TResourceItem.Key
  1056. 2459,2460d1928
  1057. < {$IFDEF NewExeFormat}
  1058. 2462,2473c1930,1941
  1059. <     eHdrSize:   Word;
  1060. >     eHdrSize:   SmallWord;
  1061. >     eMinAbove:  SmallWord;
  1062. >     eMaxAbove:  SmallWord;
  1063. >     eInitSS:    SmallWord;
  1064. >     eInitSP:    SmallWord;
  1065. >     eCheckSum:  SmallWord;
  1066. >     eInitPC:    SmallWord;
  1067. >     eInitCS:    SmallWord;
  1068. >     eRelocOfs:  SmallWord;
  1069. >     eOvlyNum:   SmallWord;
  1070. >     eRelocTab:  SmallWord;
  1071. >     eSpace:     array [1..30] of Byte;
  1072. 2477,2478d1944
  1073. < {$ENDIF}
  1074. 2480c1946
  1075. <     Signature: Word;
  1076. >     Signature: SmallWord;
  1077. 2483,2485c1949,1951
  1078. <         LastCount: Word;
  1079. >         LastCount: SmallWord;
  1080. >         PageCount: SmallWord;
  1081. >         ReloCount: SmallWord);
  1082. 2487c1953
  1083. <         InfoType: Word;
  1084. >         InfoType: SmallWord;
  1085. 2494,2495d1959
  1086. < {$IFDEF NewExeFormat}
  1087. 2498,2499d1961
  1088. < {$ENDIF}
  1089. 2513,2515c1975
  1090. < {$IFDEF NewExeFormat}
  1091. >         $5A4D:                                  { 'MZ' }
  1092. 2521c1981
  1093. <         $454E:
  1094. >         $584C:                                  { 'LX' }
  1095. 2526c1986
  1096. <         $4246:
  1097. >         $4246:                                  { 'FB' }
  1098. 2530c1990
  1099. <               $5250:                                    {Found Resource}
  1100. >               $5250:                            {'PR': Found Resource}
  1101. 2535,2536c1995,1996
  1102. <               $4C42: Dec(BasePos, Header.InfoSize - 8); {Found BackLink}
  1103. >               $4C42: Dec(BasePos, Header.InfoSize - 8); {'BL': Found BackLink}
  1104. >               $4648: Dec(BasePos, SizeOf(THeader) * 2); {'HF': Found HelpFile}
  1105. 2541,2542c2001,2002
  1106. <         $424E:
  1107. >         $424E:                                  { 'NB' }
  1108. >           if Header.InfoType = $3230 then       { '02': Found Debug Info}
  1109. 2547,2564d2006
  1110. 2665c2107
  1111. < procedure DoCopyResource(Item: PResourceItem); far;
  1112. > procedure DoCopyResource(Item: PResourceItem);
  1113. 2710c2152
  1114. < function TStringList.Get(Key: Word): String; assembler;
  1115. > function TStringList.Get(Key: Word): String; assembler; {$USES ebx,esi,edi} {$FRAME+}
  1116. 2712,2741c2154,2180
  1117. <         PUSH    DS
  1118. >                 mov     esi,Self
  1119. >                 mov     edi,@Result
  1120. >                 cld
  1121. >                 mov     ecx,[esi].TStringList.IndexSize
  1122. >                 jecxz   @@2
  1123. >                 mov     ebx,Key
  1124. >                 mov     esi,[esi].TStringList.Index
  1125. >               @@1:
  1126. >                 mov     edx,ebx
  1127. >                 lodsd
  1128. >                 sub     edx,eax
  1129. >                 lodsd
  1130. >                 cmp     edx,eax
  1131. >                 lodsd
  1132. >                 jb      @@3
  1133. >                 loop    @@1
  1134. >               @@2:
  1135. >                 xor     al,al                   { Empty string }
  1136. >                 stosb
  1137. >                 jmp     @@4
  1138. >               @@3:
  1139. >                 push    edi                     { [1]:Pointer = String  }
  1140. >                 push    eax                     { [2]:DWord   = Offset  }
  1141. >                 push    edx                     { [3]:DWord   = Skip    }
  1142. >                 push    Self                    { [4]:Pointer = Self    }
  1143. >                 Call    TStringList.ReadStr
  1144. >               @@4:
  1145. 2806c2245
  1146. < procedure CheckEmpty; near; assembler;
  1147. > procedure CheckEmpty; assembler; {$USES None} {$FRAME-}
  1148. 2808,2970c2247,2399
  1149. <         MOV     AX,ES:[DI].TRect.A.X
  1150. >                 mov     eax,[edi].TRect.A.X
  1151. >                 cmp     eax,[edi].TRect.B.X
  1152. >                 jge     @@1
  1153. >                 mov     eax,[edi].TRect.A.Y
  1154. >                 cmp     eax,[edi].TRect.B.Y
  1155. >                 jl      @@2
  1156. >               @@1:
  1157. >                 cld
  1158. >                 xor     eax,eax
  1159. >                 stosd
  1160. >                 stosd
  1161. >                 stosd
  1162. >                 stosd
  1163. >               @@2:
  1164. > end;
  1165. > procedure TRect.Assign(XA, YA, XB, YB: Integer); assembler; {$USES edi} {$FRAME-}
  1166. > asm
  1167. >                 mov     edi,Self
  1168. >                 cld
  1169. >                 mov     eax,XA
  1170. >                 stosd
  1171. >                 mov     eax,YA
  1172. >                 stosd
  1173. >                 mov     eax,XB
  1174. >                 stosd
  1175. >                 mov     eax,YB
  1176. >                 stosd
  1177. > end;
  1178. > procedure TRect.Copy(R: TRect); assembler; {$USES esi,edi} {$FRAME-}
  1179. > asm
  1180. >                 mov     esi,R
  1181. >                 mov     edi,Self
  1182. >                 cld
  1183. >                 movsd
  1184. >                 movsd
  1185. >                 movsd
  1186. >                 movsd
  1187. > end;
  1188. > procedure TRect.Move(ADX, ADY: Integer); assembler; {$USES None} {$FRAME-}
  1189. > asm
  1190. >                 mov     ecx,Self
  1191. >                 mov     eax,ADX
  1192. >                 add     [ecx].TRect.A.X,eax
  1193. >                 add     [ecx].TRect.B.X,eax
  1194. >                 mov     eax,ADY
  1195. >                 add     [ecx].TRect.A.Y,eax
  1196. >                 add     [ecx].TRect.B.Y,eax
  1197. > end;
  1198. > procedure TRect.Grow(ADX, ADY: Integer); assembler; {$USES edi} {$FRAME-}
  1199. > asm
  1200. >                 mov     edi,Self
  1201. >                 mov     eax,ADX
  1202. >                 sub     [edi].TRect.A.X,eax
  1203. >                 add     [edi].TRect.B.X,eax
  1204. >                 mov     eax,ADY
  1205. >                 sub     [edi].TRect.A.Y,eax
  1206. >                 add     [edi].TRect.B.Y,eax
  1207. >                 Call    CheckEmpty
  1208. > end;
  1209. > procedure TRect.Intersect(R: TRect); assembler; {$USES esi,edi} {$FRAME-}
  1210. > asm
  1211. >                 mov     esi,R
  1212. >                 mov     edi,Self
  1213. >                 cld
  1214. >                 lodsd
  1215. >                 scasd
  1216. >                 jle     @@1
  1217. >                 sub     edi,4
  1218. >                 stosd
  1219. >               @@1:
  1220. >                 lodsd
  1221. >                 scasd
  1222. >                 jle     @@2
  1223. >                 sub     edi,4
  1224. >                 stosd
  1225. >               @@2:
  1226. >                 lodsd
  1227. >                 scasd
  1228. >                 jge     @@3
  1229. >                 sub     edi,4
  1230. >                 stosd
  1231. >               @@3:
  1232. >                 lodsd
  1233. >                 scasd
  1234. >                 jge     @@4
  1235. >                 sub     edi,4
  1236. >                 stosd
  1237. >               @@4:
  1238. >                 sub     edi,TYPE TRect
  1239. >                 Call    CheckEmpty
  1240. > end;
  1241. > procedure TRect.Union(R: TRect); assembler; {$USES esi,edi} {$FRAME-}
  1242. > asm
  1243. >                 mov     esi,R
  1244. >                 mov     edi,Self
  1245. >                 cld
  1246. >                 lodsd
  1247. >                 scasd
  1248. >                 jge     @@1
  1249. >                 sub     edi,4
  1250. >                 stosd
  1251. >               @@1:
  1252. >                 lodsd
  1253. >                 scasd
  1254. >                 jge     @@2
  1255. >                 sub     edi,4
  1256. >                 stosd
  1257. >               @@2:
  1258. >                 lodsd
  1259. >                 scasd
  1260. >                 jle     @@3
  1261. >                 sub     edi,4
  1262. >                 stosd
  1263. >               @@3:
  1264. >                 lodsd
  1265. >                 scasd
  1266. >                 jle     @@4
  1267. >                 sub     edi,4
  1268. >                 stosd
  1269. >               @@4:
  1270. > end;
  1271. > function TRect.Contains(P: TPoint): Boolean; assembler; {$USES None} {$FRAME-}
  1272. > asm
  1273. >                 mov     ecx,Self
  1274. >                 mov     al,0
  1275. >                 mov     edx,P.X
  1276. >                 cmp     edx,[ecx].TRect.A.X
  1277. >                 jl      @@1
  1278. >                 cmp     edx,[ecx].TRect.B.X
  1279. >                 jge     @@1
  1280. >                 mov     edx,P.Y
  1281. >                 cmp     edx,[ecx].TRect.A.Y
  1282. >                 jl      @@1
  1283. >                 cmp     edx,[ecx].TRect.B.Y
  1284. >                 setl    al
  1285. >               @@1:
  1286. > end;
  1287. > function TRect.Equals(R: TRect): Boolean; assembler; {$USES esi,edi} {$FRAME-}
  1288. > asm
  1289. >                 mov     esi,R
  1290. >                 mov     edi,Self
  1291. >                 mov     ecx,4
  1292. >                 cld
  1293. >                 repe    cmpsd
  1294. >                 sete    al
  1295. 2975,2984c2404,2412
  1296. <         LES     DI,Self
  1297. >                 mov     ecx,Self
  1298. >                 mov     al,1
  1299. >                 mov     edx,[ecx].TRect.A.X
  1300. >                 cmp     edx,[ecx].TRect.B.X
  1301. >                 jge     @@1
  1302. >                 mov     edx,[ecx].TRect.A.Y
  1303. >                 cmp     edx,[ecx].TRect.B.Y
  1304. >                 setge   al
  1305. >               @@1:
  1306. 2987,2988d2414
  1307. < {$ENDIF}
  1308. 3014a2441,2549
  1309. > end;
  1310. > { Peforms services analogous to DOS INT 21h Fns: 3Ch,3Dh,3Eh,3Fh,40h,42h }
  1311. > procedure DosFn; assembler; {$USES ecx} {$FRAME+}
  1312. > var
  1313. >   Written,NewPtr,Handle,Result,Fn: Longint;
  1314. > asm
  1315. >                 cmp     ah,42h
  1316. >                 je      @@Seek
  1317. >                 cmp     ah,3Fh
  1318. >                 je      @@Read
  1319. >                 cmp     ah,40h
  1320. >                 je      @@Write
  1321. >                 cmp     ah,3Eh
  1322. >                 je      @@Close         { 3Ch, 3Dh                      }
  1323. > { Open or create file}
  1324. >                 mov     Fn,eax
  1325. >                 push    0               { [8]:Pointer = @EAs            }
  1326. >                 or      al,40h          { Deny none                     }
  1327. >                 cmp     ah,3Ch
  1328. >                 jne     @@1
  1329. >                 mov     al,42h          { Create: Read/Write access     }
  1330. >               @@1:
  1331. >                 movzx   eax,al
  1332. >                 push    eax             { [7]:DWord = OpenMode          }
  1333. >                 mov     al,1            { If file exist, open it        }
  1334. >                 cmp     Fn.Byte[1],3Dh
  1335. >                 je      @@2
  1336. >                 mov     al,12h          { If file doesn't exist, create it, if exist truncate }
  1337. >               @@2:
  1338. >                 push    eax             { [6]:DWord = OpenFlags         }
  1339. >                 push    ecx             { [5]:DWord = Attr              }
  1340. >                 push    0               { [4]:DWord = File Size         }
  1341. >                 lea     eax,Result      { [3]:Pointer =  @OpenResult    }
  1342. >                 push    eax
  1343. >                 lea     eax,Handle      { [2]:Pointer = @Handle         }
  1344. >                 push    eax
  1345. >                 push    edx             { [1]:Pointer = file name       }
  1346. >                 Call    DosOpen
  1347. >                 add     esp,8*4         { Stack cleanup after "C" call  }
  1348. >                 test    eax,eax
  1349. >                 stc
  1350. >                 jnz     @@RET
  1351. >                 mov     eax,Handle
  1352. >                 jmp     @@OK
  1353. > { Seek file }
  1354. >               @@Seek:
  1355. >                 lea     edx,NewPtr      { [4]:Pointer = @NewPtr         }
  1356. >                 push    edx
  1357. >                 movzx   eax,al          { [3]:DWord = Method            }
  1358. >                 push    eax
  1359. >                 push    ecx             { [2]:DWord = Distance          }
  1360. >                 push    ebx             { [1]:DWord = File Handle       }
  1361. >                 Call    DosSetFilePtr
  1362. >                 add     esp,4*4         { Stack cleanup after "C" call  }
  1363. >                 test    eax,eax
  1364. >                 stc
  1365. >                 jnz     @@RET
  1366. >                 mov     eax,NewPtr
  1367. >                 jmp     @@OK
  1368. > { Read file }
  1369. >               @@Read:
  1370. >                 lea     eax,Written     { [4]:Pointer = @BytesRead      }
  1371. >                 push    eax
  1372. >                 push    ecx             { [3]:DWord   = ReadCount       }
  1373. >                 push    edx             { [2]:Pointer = @Buffer         }
  1374. >                 push    ebx             { [1]:DWord = File Handle       }
  1375. >                 Call    DosRead
  1376. >                 jmp     @@3
  1377. > { Write file }
  1378. >               @@Write:
  1379. >                 jecxz   @@Truncate
  1380. >                 lea     eax,Written
  1381. >                 push    eax             { [4]:Pointer = @BytesWritten   }
  1382. >                 push    ecx             { [3]:DWord   = WriteCount      }
  1383. >                 push    edx             { [2]:Pointer = @Buffer         }
  1384. >                 push    ebx             { [1]:DWord = File Handle       }
  1385. >                 Call    DosWrite
  1386. >               @@3:
  1387. >                 add     esp,4*4         { Stack cleanup after "C" call  }
  1388. >                 test    eax,eax
  1389. >                 stc
  1390. >                 jnz     @@RET
  1391. >                 mov     eax,Written
  1392. >                 jmp     @@OK
  1393. > { Write 0 bytes = Truncate file }
  1394. >               @@Truncate:               { Seek mode: Current Pointer    }
  1395. >                 mov     ax,4201h        { ebx = Handle                  }
  1396. >                 Call    DosFn           { ecx = 0 = Distance            }
  1397. >                 jc      @@RET           { eax = Current File Pointer    }
  1398. >                 push    eax             { [2]:Longint = New File Size   }
  1399. >                 push    ebx             { [1]:Longint = File Handle     }
  1400. >                 Call    DosSetFileSize
  1401. >                 add     esp,2*4
  1402. >                 test    eax,eax
  1403. >                 stc
  1404. >                 jnz     @@RET
  1405. >                 jmp     @@OK
  1406. > { Close file }
  1407. >               @@Close:
  1408. >                 push    ebx             { [1]:DWord = File Handle       }
  1409. >                 Call    DosClose
  1410. >                 test    eax,eax
  1411. >                 stc
  1412. >                 jnz     @@RET
  1413. >               @@OK:
  1414. >                 clc
  1415. >               @@RET:
  1416. Comparing BP7\VALIDATE.PAS and VP\VALIDATE.PAS 
  1417. 13c13
  1418. < {$O+,F+,X+,I-,S-}
  1419. > {$X+,I-,S-,Cdecl-}
  1420. 17c17
  1421. < uses Objects;
  1422. > uses Objects, Use32;
  1423. 168,170d167
  1424. < {$IFDEF Windows}
  1425. 172d168
  1426. < {$ENDIF Windows}
  1427. 255,267d250
  1428. < {$IFDEF Windows}
  1429. 274,275d256
  1430. < {$ENDIF Windows}
  1431. 293c274
  1432. < function IsNumber(Chr: Char): Boolean; near; assembler;
  1433. > function IsNumber(Chr: Char): Boolean; assembler; {$USES None} {$FRAME-}
  1434. 295,302c276,282
  1435. <         XOR     AL,AL
  1436. >                 xor     al,al
  1437. >                 mov     ah,Chr
  1438. >                 cmp     ah,'0'
  1439. >                 jb      @@1
  1440. >                 cmp     ah,'9'
  1441. >                 setbe   al
  1442. >               @@1:
  1443. 305c285
  1444. < function IsLetter(Chr: Char): Boolean; near; assembler;
  1445. > function IsLetter(Chr: Char): Boolean; assembler; {$USES None] {$FRAME-}
  1446. 307,315c287,294
  1447. <         XOR     AL,AL
  1448. >                 xor     al,al
  1449. >                 mov     ah,Chr
  1450. >                 and     ah,0DFH                 { To upper }
  1451. >                 cmp     ah,'A'
  1452. >                 jb      @@1
  1453. >                 cmp     ah,'Z'
  1454. >                 setbe   al
  1455. >               @@1:
  1456. 318,319c297,299
  1457. < function IsSpecial(Chr: Char; const Special: string): Boolean; near;
  1458. > {$USES edi} {$FRAME-}
  1459. > function IsSpecial(Chr: Char; const Special: String): Boolean; assembler;
  1460. 321,331c301,308
  1461. <         XOR     AH,AH
  1462. >                 xor     ecx,ecx
  1463. >                 mov     edi,Special
  1464. >                 mov     cl,[edi]
  1465. >                 inc     edi
  1466. >                 mov     al,Chr
  1467. >                 cld
  1468. >                 repne   scasb
  1469. >                 sete    al
  1470. 337c314,316
  1471. < function NumChar(Chr: Char; const S: string): Byte; near; assembler;
  1472. > {$USES edi} {$FRAME-}
  1473. > function NumChar(Chr: Char; const S: String): Byte; assembler;
  1474. 339,350c318,330
  1475. <         XOR     AH,AH
  1476. >                 xor     ecx,ecx
  1477. >                 xor     eax,eax
  1478. >                 mov     edi,S
  1479. >                 mov     cl,[edi]
  1480. >                 mov     al,Chr
  1481. >               @@1:
  1482. >                 repne   scasb
  1483. >                 jne     @@2
  1484. >                 inc     ah
  1485. >                 test    ecx,ecx
  1486. >                 jnz     @@1
  1487. >               @@2:
  1488. >                 mov     al,ah
  1489. 773,781d752
  1490. < {$IFDEF Windows}
  1491. 787,788d757
  1492. < {$ENDIF Windows}
  1493. 805,819d773
  1494. < {$IFDEF Windows}
  1495. 830,831d783
  1496. < {$ENDIF Windows}
  1497. 907,916d858
  1498. < {$IFDEF Windows}
  1499. 922,923d863
  1500. < {$ENDIF Windows}
  1501. 929,933c869
  1502. <   asm
  1503. >   Str := @S;
  1504. Comparing BP7\APP.PAS and VP\APP.PAS 
  1505. 13c13
  1506. < {$O+,F+,X+,I-,S-}
  1507. > {$X+,I-,S-,Cdecl-}
  1508. 17c17
  1509. < uses Objects, Drivers, Memory, HistList, Views, Menus, Dialogs;
  1510. > uses Objects, Drivers, Memory, HistList, Views, Menus, Dialogs, Use32;
  1511. 240c240
  1512. < uses Dos;
  1513. > uses Dos, Os2Base;
  1514. 379c379
  1515. < function ISqr(X: Integer): Integer; assembler;
  1516. > function ISqr(X: Integer): Integer; assembler; {$USES ebx} {$FRAME-}
  1517. 381,389c381,389
  1518. <         MOV     CX,X
  1519. >                 mov     ecx,X
  1520. >                 xor     ebx,ebx
  1521. >               @@1:
  1522. >                 inc     ebx
  1523. >                 mov     eax,ebx
  1524. >                 imul    eax
  1525. >                 cmp     eax,ecx
  1526. >                 jle     @@1
  1527. >                 lea     eax,[ebx-1]
  1528. 430c430
  1529. <   DividerLoc := LongDiv(LongMul(Hi - Lo, Pos), Num) + Lo;
  1530. >   DividerLoc := ((Hi - Lo) * Pos) div Num + Lo;
  1531. 612a613
  1532. >   DosSleep(31);
  1533. 766d766
  1534. <   SwapVectors;
  1535. 768d767
  1536. <   SwapVectors;
  1537. 770a770
  1538. >   InitKeyboard;
  1539. 809c809
  1540. <   PrintStr('Type EXIT to return...');
  1541. >   PrintStr(#13#10'Type EXIT to return...'#13#10);
  1542. Comparing BP7\COLORSEL.PAS and VP\COLORSEL.PAS 
  1543. 13c13
  1544. < {$O+,F+,X+,I-,S-}
  1545. > {$X+,I-,S-,Cdecl-}
  1546. 17c17
  1547. < uses Objects, Drivers, Views, Dialogs;
  1548. > uses Objects, Drivers, Views, Dialogs, Use32;
  1549. Comparing BP7\DRIVERS.PAS and VP\DRIVERS.PAS 
  1550. 10a11,18
  1551. > { Drivers unit has been rewritten completely.           }
  1552. > { OS/2 system error handler is used, so SysErrorFunc,   }
  1553. > { SystemError,SysColorAttr,SysMonoAttr and SaveInt09    }
  1554. > { are not available. MouseIntFlag variable is not       }
  1555. > { supported also.                                       }
  1556. > { New services are introduced to support keystroke      }
  1557. > { macros.                                               }
  1558. 13,14c21
  1559. < {$X+,I-,S-,P-}
  1560. > {$X+,I-,S-,P-,Cdecl-}
  1561. 18c25
  1562. < uses Objects;
  1563. > uses Objects, Use32;
  1564. 80a88,119
  1565. > { Additional keyboard codes that Borland forgot to define }
  1566. >  kbCtrlA      = $1E01;  kbCtrlB     = $3002;  kbCtrlC     = $2E03;
  1567. >  kbCtrlD      = $2004;  kbCtrlE     = $1205;  kbCtrlF     = $2106;
  1568. >  kbCtrlG      = $2207;  kbCtrlH     = $2308;  kbCtrlI     = $1709;
  1569. >  kbCtrlJ      = $240A;  kbCtrlK     = $250B;  kbCtrlL     = $260C;
  1570. >  kbCtrlM      = $320D;  kbCtrlN     = $310E;  kbCtrlO     = $180F;
  1571. >  kbCtrlP      = $1910;  kbCtrlQ     = $1011;  kbCtrlR     = $1312;
  1572. >  kbCtrlS      = $1F13;  kbCtrlT     = $1414;  kbCtrlU     = $1615;
  1573. >  kbCtrlV      = $2F16;  kbCtrlW     = $1117;  kbCtrlX     = $2D18;
  1574. >  kbCtrlY      = $1519;  kbCtrlZ     = $2C1A;
  1575. > { 101-key AT keyboard }
  1576. >  kbAltTab     = $A500; kbAltDel     = $A300;  kbAltIns    = $A200;
  1577. >  kbAltPgDn    = $A100; kbAltDown    = $A000;  kbAltEnd    = $9F00;
  1578. >  kbAltRight   = $9D00; kbAltLeft    = $9B00;  kbAltPgUp   = $9900;
  1579. >  kbAltUp      = $9800; kbAltHome    = $9700;  kbCtrlTab   = $9400;
  1580. >  kbCtrlGreyPlus=$9000; kbCtrlCenter = $8F00;  kbCtrlMinus = $8E00;
  1581. >  kbCtrlUp     = $8D00; kbAltF12     = $8C00;  kbAltF11    = $8B00;
  1582. >  kbCtrlF12    = $8A00; kbCtrlF11    = $8900;  kbShiftF12  = $8800;
  1583. >  kbShiftF11   = $8700; kbF12        = $8600;  kbF11       = $8500;
  1584. >  kbAltGrayPlus= $4E00; kbCenter     = $4C00;  kbAltGreyAst= $3700;
  1585. >  kbAltSlash   = $3500; kbAltPeriod  = $3400;  kbAltComma  = $3300;
  1586. >  kbAltBackSlash=$2B00; kbAltOpQuote = $2900;  kbAltQuote  = $2800;
  1587. >  kbAltSemicolon=$2700; kbAltRgtBrack= $1B00;  kbAltLftBrack=$1A00;
  1588. >  kbAltEsc     = $0100; kbCtrlDown   = $9100;
  1589. > { Special keys }
  1590. > kbAltShiftBack = $0900;
  1591. 112c151,152
  1592. <           0: (KeyCode: Word);
  1593. >           0: (KeyCode: SmallWord;
  1594. >               ShiftState: Byte);
  1595. 125a166,168
  1596. >   TShiftStateHandler = function(var ShiftState: Byte): Boolean;
  1597. >   TCtrlBreakAction = procedure;
  1598. 134a178,180
  1599. >   GetShiftStateHandler: TShiftStateHandler = nil;
  1600. >   CtrlBreakAction: TCtrlBreakAction = nil;
  1601. >   KeyDownMask: Word = evKeyDown;
  1602. 137,140d182
  1603. 147a190,192
  1604. > { These procedures are called from BASM code, }
  1605. > { so they should not change registers         }
  1606. > {$SAVES ALL}
  1607. 149a195,196
  1608. > procedure UpdateMouseWhere;
  1609. > {$SAVES ebx,esi,edi}
  1610. 169a217
  1611. >   CheckSnow: Boolean = False;   { not used }
  1612. 179d226
  1613. <   CheckSnow: Boolean;
  1614. 181c228
  1615. <   CursorLines: Word;
  1616. >   CursorLines: SmallWord;
  1617. 190,194c237
  1618. < { ******** SYSTEM ERROR HANDLER ******** }
  1619. > { Keyboard }
  1620. 196c239
  1621. <   TSysErrorFunc = function(ErrorCode: Integer; Drive: Byte): Integer;
  1622. > procedure InitKeyboard;
  1623. 198,203d240
  1624. < { Default system error handler routine }
  1625. 206,209c243
  1626. <   SaveInt09: Pointer = nil;
  1627. > const
  1628. 211c245
  1629. <   SaveCtrlBreak: Boolean = False;
  1630. >   SaveCtrlBreak: Boolean = False;       { not used }
  1631. 213c247
  1632. <   FailSysErrors: Boolean = False;
  1633. >   FailSysErrors: Boolean = False;       { not used }
  1634. 245,249c279
  1635. < { ******** EVENT MANAGER ******** }
  1636. > uses Dos, Os2Def, Os2Base, Xcpt;
  1637. 251c281
  1638. <   EventQSize = 16;
  1639. > { ******** EVENT MANAGER ******** }
  1640. 260d289
  1641. <   LastWhere: TPoint;
  1642. 265,269d293
  1643. <   EventCount: Word;
  1644. 271,273c295,297
  1645. < var
  1646. >   hMou: SmallWord;
  1647. >   ProtectArea: NoPtrRect;
  1648. >   MouseMSec: Longint;
  1649. 275c299,301
  1650. < { Detect mouse driver }
  1651. >   VioMode: VioModeInfo;
  1652. >   StartupVioMode: VioModeInfo;
  1653. >   StartupCursor: VioCursorInfo;
  1654. 277,295c303
  1655. < procedure DetectMouse; near; assembler;
  1656. > { Detects mouse driver, moves mouse pointer to the top left corner }
  1657. 297c305,319
  1658. < { Store event in GetMouseEvent and GetKeyEvent }
  1659. > procedure DetectMouse;
  1660. > var
  1661. >   MouLoc: PtrLoc;
  1662. >   Buttons: SmallWord;
  1663. > begin
  1664. >   ButtonCount := 0;
  1665. >   if MouOpen(nil, hMou) = 0 then
  1666. >   begin
  1667. >     MouGetNumButtons(Buttons,hMou);
  1668. >     ButtonCount := Buttons;
  1669. >     MouLoc.Row := 0;
  1670. >     MouLoc.Col := 0;
  1671. >     MouSetPtrPos(MouLoc, hMou);
  1672. >   end;
  1673. > end;
  1674. 299,317c321
  1675. < procedure StoreEvent; near; assembler;
  1676. > { Shows mouse pointer }
  1677. 319,354c323,327
  1678. < procedure GetMouseState; near; assembler;
  1679. > procedure ShowMouse;
  1680. > var
  1681. >   Status: SmallWord;
  1682. > begin
  1683. >   if ButtonCount <> 0 then MouDrawPtr(hMou);
  1684. 357,391c330
  1685. < procedure MouseInt; far; assembler;
  1686. > { Hides mouse pointer }
  1687. 393,425c332,334
  1688. < procedure InitEvents; assembler;
  1689. > procedure HideMouse;
  1690. > begin
  1691. >   if ButtonCount <> 0 then MouRemovePtr(ProtectArea, hMou);
  1692. 428,442c337,357
  1693. < procedure DoneEvents; assembler;
  1694. > { Initializes Turbo Vision's event manager by setting event mask and    }
  1695. > { showing the mouse. Called automatically by TApplication.Init.         }
  1696. > procedure InitEvents;
  1697. > var
  1698. >   MouLoc: PtrLoc;
  1699. >   EventMask: SmallWord;
  1700. > begin
  1701. >   if ButtonCount <> 0 then
  1702. >   begin                                  { Mouse is available    }
  1703. >     DownButtons := 0;
  1704. >     LastDouble  := False;
  1705. >     MouGetPtrPos(MouLoc, hMou);
  1706. >     MouseWhere.X := MouLoc.Col;
  1707. >     MouseWhere.Y := MouLoc.Row;
  1708. >     MouDrawPtr(hMou);
  1709. >     LastButtons := 0;                    { Assume that no button is pressed }
  1710. >     EventMask := $FFFF;
  1711. >     MouSetEventMask(EventMask, hMou);    { Select all events }
  1712. >     MouseEvents := True;
  1713. >   end;
  1714. 445,453c360,373
  1715. < procedure ShowMouse; assembler;
  1716. > { Terminates Turbo Vision's event manager and hides the mouse. Called }
  1717. > { automatically by TApplication.Done.                                 }
  1718. > procedure DoneEvents;
  1719. > var
  1720. >   EventMask: SmallWord;
  1721. > begin
  1722. >   if ButtonCount <> 0 then
  1723. >   begin
  1724. >     HideMouse;
  1725. >     EventMask := 0;
  1726. >     MouSetEventMask(EventMask, hMou);   { Mask all events }
  1727. >     MouseEvents := False;
  1728. >   end;
  1729. 456,464c376,406
  1730. < procedure HideMouse; assembler;
  1731. > { Checks whether a mouse event is available by polling the mouse event  }
  1732. > { queue maintained by OS/2. If a mouse event has occurred, Event.What   }
  1733. > { is set to evMouseDown, evMouseUp,evMouseMove, or evMouseAuto;         }
  1734. > { Event.Buttons is set to mbLeftButton or mbRightButton;                }
  1735. > { Event.Double is set to True or False;
  1736. > { Event.Where is set to the mouse position in global coordinates.       }
  1737. > { If no mouse events are available, Event.What is set to evNothing.     }
  1738. > { GetMouseEvent is called by TProgram.GetEvent.                         }
  1739. > procedure GetMouseEvent(var Event: TEvent);
  1740. > var
  1741. >   MouEvent: MouEventInfo;
  1742. >   MouQInfo: MouQueInfo;
  1743. >   CurTicks: Word;
  1744. >   B1,B2: Byte;
  1745. > const
  1746. >   WaitFlag: SmallWord = mou_NoWait;
  1747. > procedure StoreEvent(MouWhat: Word);
  1748. > begin
  1749. >   LastButtons := MouseButtons;
  1750. >   MouseWhere.X := MouEvent.Col;
  1751. >   MouseWhere.Y := MouEvent.Row;
  1752. >   with Event do
  1753. >   begin
  1754. >     What := MouWhat;
  1755. >     Buttons := MouseButtons;
  1756. >     Double  := LastDouble;
  1757. >     Where.X := MouEvent.Col;
  1758. >     Where.Y := MouEvent.Row;
  1759. >   end;
  1760. 467,528c409,472
  1761. < procedure GetMouseEvent(var Event: TEvent); assembler;
  1762. > { GetMouseEvent body }
  1763. > begin
  1764. >   if not MouseEvents then Event.What := evNothing
  1765. > else
  1766. >   begin
  1767. >     MouGetNumQueEl(MouQInfo, hMou);
  1768. >     if MouQinfo.cEvents = 0 then
  1769. >     begin
  1770. >       MouseButtons := LastButtons;
  1771. >       DosQuerySysInfo(qsv_Ms_Count, qsv_Ms_Count, MouEvent.Time, SizeOf(MouEvent.Time));
  1772. >       MouEvent.Col  := MouseWhere.X;
  1773. >       MouEvent.Row  := MouseWhere.Y;
  1774. >     end
  1775. >    else
  1776. >     begin
  1777. >       MouReadEventQue(MouEvent, WaitFlag, hMou);
  1778. >       if MouseReverse then
  1779. >       begin
  1780. >         B1 := mbRightButton;
  1781. >         B2 := mbLeftButton;
  1782. >       end
  1783. >      else
  1784. >       begin
  1785. >         B1 := mbLeftButton;
  1786. >         B2 := mbRightButton;
  1787. >       end;
  1788. >       if (MouEvent.fs and (mouse_Motion_With_Bn1_Down or mouse_Bn1_Down)) <> 0
  1789. >         then MouseButtons := B1 else MouseButtons := 0;
  1790. >       if (MouEvent.fs and (mouse_Motion_With_Bn2_Down or mouse_Bn2_Down)) <> 0
  1791. >         then MouseButtons := MouseButtons or B2;
  1792. >     end;
  1793. >     { ms -> ticks: 1 DOS timer tick = 55ms }
  1794. >     CurTicks := MouEvent.Time div 55;
  1795. >     MouseMSec := MouEvent.Time;
  1796. >     { Process mouse event }
  1797. >     if (LastButtons <> 0) and (MouseButtons = 0) then StoreEvent(evMouseUp) { button is released }
  1798. >    else
  1799. >     if  LastButtons = MouseButtons then
  1800. >     begin
  1801. >       if (MouEvent.Row <> MouseWhere.Y) or (MouEvent.Col <> MouseWhere.X) then StoreEvent(evMouseMove)
  1802. >      else
  1803. >       if (MouseButtons <> 0) and ((CurTicks - AutoTicks) >= AutoDelay) then
  1804. >       begin
  1805. >         AutoTicks := CurTicks;
  1806. >         AutoDelay := 1;
  1807. >         StoreEvent(evMouseAuto);
  1808. >       end
  1809. >      else StoreEvent(evNothing);
  1810. >     end
  1811. >    else               { CurButton <> 0, LastButton = 0 }
  1812. >     begin
  1813. >       LastDouble := False;
  1814. >       if (MouseButtons = DownButtons) and (MouEvent.Row = DownWhere.Y) and (MouEvent.Col = DownWhere.X)
  1815. >       and ((CurTicks - DownTicks) < DoubleDelay) then LastDouble := True;
  1816. >       DownButtons := MouseButtons;
  1817. >       DownWhere.Y := MouEvent.Row;
  1818. >       DownWhere.X := MouEvent.Col;
  1819. >       DownTicks   := CurTicks;
  1820. >       AutoTicks   := CurTicks;
  1821. >       AutoDelay   := RepeatDelay;
  1822. >       StoreEvent(evMouseDown);
  1823. >     end;
  1824. >   end;
  1825. 531,544c475,485
  1826. < procedure GetKeyEvent(var Event: TEvent); assembler;
  1827. > { Initializes keyboard. Setups keyboard BINARY mode that allows Ctrl-C  }
  1828. > { to be handled in a normal way as an ordinal keystroke.                }
  1829. > procedure InitKeyboard;
  1830. > var
  1831. >   Key: KbdInfo;
  1832. > begin
  1833. >   Key.cb := SizeOf(KbdInfo);
  1834. >   KbdGetStatus(Key,0);        { Disable ASCII & Enable raw (binary) mode}
  1835. >   Key.fsMask := (Key.fsMask and (not keyboard_Ascii_Mode)) or keyboard_Binary_Mode;
  1836. >   KbdSetStatus(Key,0);
  1837. 547,550c488,508
  1838. < function GetShiftState: Byte; assembler;
  1839. > { UpdateMouseWhere is called from Views.WriteView procedure just before }
  1840. > { output to screen is to occur. It's too slow to query mouse pointer    }
  1841. > { location each time this procedure is called. That's why appoximate    }
  1842. > { approach is used instead. Mouse pointer location is queried only      }
  1843. > { after some defined time interval (5ms) elapsed since pointer location }
  1844. > { was known exactly. Surely, this doesn't fix the mouse "dropping"      }
  1845. > { problem completely, however experiments show rather good results.     }
  1846. > procedure UpdateMouseWhere;
  1847. > var
  1848. >   MouLoc: PtrLoc;
  1849. >   MSec: Longint;
  1850. > begin
  1851. >   DosQuerySysInfo(qsv_Ms_Count, qsv_Ms_Count, MSec, SizeOf(MSec));
  1852. >   if MSec - MouseMSec >= 5 then
  1853. >   begin
  1854. >     MouseMSec := MSec;
  1855. >     MouGetPtrPos(MouLoc, hMou);
  1856. >     MouseWhere.X := MouLoc.Col;
  1857. >     MouseWhere.Y := MouLoc.Row;
  1858. >   end;
  1859. 553c511,514
  1860. < { ******** SCREEN MANAGER ******** }
  1861. > { Checks whether a keyboard event is available. If a key has been       }
  1862. > { pressed, Event.What is set to evKeyDown and Event.KeyCode is set to   }
  1863. > { the scan code of the key. Otherwise, Event.What is set to evNothing.  }
  1864. > { GetKeyEvent is called by TProgram.GetEvent.                           }
  1865. 554a516
  1866. > procedure GetKeyEvent(var Event: TEvent);
  1867. 556,558c518,527
  1868. <   Equipment: Word absolute $40:$10;
  1869. >   Key: KbdKeyInfo;
  1870. >   I: Integer;
  1871. > { Keyboard scan codes }
  1872. > const
  1873. >   scSpace    = $39;  scIns      = $52;  scDel      = $53;
  1874. >   scBack     = $0E;  scUp       = $48;  scDown     = $50;
  1875. >   scLeft     = $4B;  scRight    = $4D;  scHome     = $47;
  1876. >   scEnd      = $4F;  scPgUp     = $49;  scPgDn     = $51;
  1877. >   scCtrlIns  = $92;  scCtrlDel  = $93;  scCtrlUp   = $8D;
  1878. >   scCtrlDown = $91;
  1879. 560c529,530
  1880. < { Save registers and call video interrupt }
  1881. > const
  1882. >   kbShift    = kbLeftShift + kbRightShift;
  1883. 562,568c532,583
  1884. < procedure VideoInt; near; assembler;
  1885. > type
  1886. >   KeyTransEntry = record
  1887. >     Scan:  Byte;
  1888. >     Shift: Byte;
  1889. >     Code:  Word;
  1890. >   end;
  1891. > const
  1892. >   KeyTranslateTable : array [1..15] of KeyTransEntry =
  1893. >     (( Scan: scSpace   ; Shift: kbAltShift   ; Code: kbAltSpace ),   { Alt-Space     }
  1894. >      ( Scan: scIns     ; Shift: kbCtrlShift  ; Code: kbCtrlIns  ),   { Ctrl-Ins      }
  1895. >      ( Scan: scCtrlIns ; Shift: kbCtrlShift  ; Code: kbCtrlIns  ),   { Ctrl-Ins      }
  1896. >      ( Scan: scIns     ; Shift: kbLeftShift  ; Code: kbShiftIns ),   { Shift-Ins     }
  1897. >      ( Scan: scIns     ; Shift: kbRightShift ; Code: kbShiftIns ),   { Shift-Ins     }
  1898. >      ( Scan: scIns     ; Shift: kbShift      ; Code: kbShiftIns ),   { Shift-Ins     }
  1899. >      ( Scan: scDel     ; Shift: kbCtrlShift  ; Code: kbCtrlDel  ),   { Ctrl-Del      }
  1900. >      ( Scan: scCtrlDel ; Shift: kbCtrlShift  ; Code: kbCtrlDel  ),   { Ctrl-Del      }
  1901. >      ( Scan: scDel     ; Shift: kbLeftShift  ; Code: kbShiftDel ),   { Shift-Del     }
  1902. >      ( Scan: scDel     ; Shift: kbRightShift ; Code: kbShiftDel ),   { Shift-Del     }
  1903. >      ( Scan: scDel     ; Shift: kbShift      ; Code: kbShiftDel ),   { Shift-Del     }
  1904. >      ( Scan: scBack    ; Shift: kbAltShift+kbLeftShift ; Code: kbAltShiftBack), { Alt-Shift-Backspace }
  1905. >      ( Scan: scBack    ; Shift: kbAltShift+kbRightShift; Code: kbAltShiftBack), { Alt-Shift-Backspace }
  1906. >      ( Scan: scBack    ; Shift: kbAltShift+kbShift     ; Code: kbAltShiftBack), { Alt-Shift-Backspace }
  1907. >      ( Scan: scBack    ; Shift: kbAltShift   ; Code: kbAltBack  ));  { Alt-Backspace }
  1908. > begin
  1909. >   KbdCharIn(Key, io_NoWait, 0);
  1910. >   if (Key.fbStatus and kbdtrf_Final_Char_In) = 0 then Event.What := evNothing
  1911. >  else
  1912. >   begin
  1913. >     with Event do                       { Key is ready }
  1914. >     begin
  1915. >       What := KeyDownMask;
  1916. >       CharCode := Key.chChar;
  1917. >       ScanCode := Key.chScan;
  1918. >       ShiftState := Key.fsState;
  1919. >       for I := Low(KeyTranslateTable) to High(KeyTranslateTable) do
  1920. >         with KeyTranslateTable[I] do
  1921. >         begin
  1922. >           if (Scan = Key.chScan ) and ((Shift and Key.fsState) = Shift) then
  1923. >           begin
  1924. >             KeyCode := Code;
  1925. >             Break;
  1926. >           end;
  1927. >         end;
  1928. >       if (CharCode = #$E0) and (ScanCode in
  1929. >           [scUp,scDown,scLeft,scRight,scIns,scDel,scHome,scEnd,scPgUp,scPgDn,
  1930. >           Hi(kbCtrlHome), Hi(kbCtrlEnd)  , Hi(kbCtrlPgUp), Hi(kbCtrlPgDn),
  1931. >           Hi(kbCtrlLeft), Hi(kbCtrlRight),    scCtrlUp,       scCtrlDown])
  1932. >         then CharCode := #0;                          { Grey Keys   }
  1933. >       if KeyCode = $E00D then KeyCode := kbEnter;     { Grey Enter  }
  1934. >     end;
  1935. >   end;
  1936. 571c586,588
  1937. < { Return CRT mode in AX and dimensions in DX }
  1938. > { Returns a byte containing the current Shift key state, as reported by }
  1939. > { OS/2. The return value contains a combination of the kbXXXX constants }
  1940. > { for shift states.                                                     }
  1941. 573,586c590,604
  1942. < procedure GetCrtMode; near; assembler;
  1943. > function GetShiftState: Byte;
  1944. > var
  1945. >   Key: KbdInfo;
  1946. >   ShiftState: Byte;
  1947. >   Handled: Boolean;
  1948. > begin
  1949. >   if @GetShiftStateHandler <> nil then Handled := GetShiftStateHandler(ShiftState)
  1950. >  else Handled := False;
  1951. >   if not Handled then
  1952. >   begin
  1953. >     Key.cb := SizeOf(KbdInfo);
  1954. >     KbdGetStatus(Key, 0);
  1955. >     ShiftState := Key.fsState;
  1956. >   end;
  1957. >   GetShiftState := ShiftState;
  1958. 589c607
  1959. < { Set CRT mode to value in AX }
  1960. > { ******** SCREEN MANAGER ******** }
  1961. 591,623c609,626
  1962. < procedure SetCrtMode; near; assembler;
  1963. > { Returns current CRT mode }
  1964. > function GetCrtMode: Word;
  1965. > var
  1966. >   Mode: Word;
  1967. > begin
  1968. >   VioMode.cb := SizeOf(VioMode);
  1969. >   VioGetMode(VioMode, 0);
  1970. >   with VioMode do
  1971. >   begin
  1972. >     if (fbType and vgmt_DisableBurst) = 0
  1973. >       then Mode := smCO80 else Mode := smBW80;
  1974. >     if Color = 0 then Mode := smMono;
  1975. >     if Row > 25 then Inc(Mode, smFont8x8);
  1976. >     GetCrtMode := Mode;
  1977. >     if ((VioMode.fbType and vgmt_Graphics) <> 0) or
  1978. >       (Col <> 80) then GetCrtMode := 0;
  1979. >   end;
  1980. 626c629
  1981. < { Fix CRT mode in AX if required }
  1982. > { Setups CRT mode }
  1983. 628,637c631,669
  1984. < procedure FixCrtMode; near; assembler;
  1985. > procedure SetCrtMode(Mode: Word);
  1986. > var
  1987. >   BiosMode: Byte;
  1988. >   CurData: VioCursorInfo;
  1989. >   VideoConfig: VioConfigInfo;
  1990. > begin
  1991. >   BiosMode := Lo(Mode);
  1992. >   VideoConfig.cb := SizeOf(VideoConfig);
  1993. >   VioGetConfig(0, VideoConfig, 0);
  1994. >   with VioMode do
  1995. >   begin
  1996. >     cb := SizeOf(VioMode);
  1997. >     fbType := vgmt_Other;
  1998. >     Color := colors_16;         { Color }
  1999. >     Row := 25;                  { 80x25 }
  2000. >     Col := 80;
  2001. >     VRes := 400;
  2002. >     HRes := 720;
  2003. >     if (Mode and smFont8x8) <> 0 then
  2004. >     case VideoConfig.Adapter of { 80x43 }
  2005. >       display_Monochrome..display_CGA: ;
  2006. >       display_EGA:
  2007. >         begin
  2008. >           Row := 43; VRes := 350; HRes := 640;
  2009. >         end;
  2010. >       else                      { 80x50 }
  2011. >         begin
  2012. >           Row := 50; VRes := 400; HRes := 720;
  2013. >         end;
  2014. >     end;
  2015. >     case BiosMode of            { Black and white }
  2016. >       smBW80: fbType := vgmt_Other + vgmt_DisableBurst;
  2017. >       smMono:
  2018. >         begin                   { Monochrome }
  2019. >           HRes := 720; VRes := 350; Color := 0; fbType := 0;
  2020. >         end;
  2021. >     end;
  2022. >   end;
  2023. >   VioSetMode(VioMode, 0);
  2024. 640c672
  2025. < { Set CRT data areas and mouse range }
  2026. > { Fix CRT mode if required }
  2027. 642,685c674,679
  2028. < procedure SetCrtData; near; assembler;
  2029. > function FixCrtMode(Mode: Word): Word;
  2030. > begin
  2031. >   case Lo(Mode) of
  2032. >     smMono,smCO80,smBW80: FixCrtMode := Mode
  2033. >     else                  FixCrtMode := smCO80;
  2034. >   end;
  2035. 688c682
  2036. < { Detect video modes }
  2037. > { Sets CRT data areas and mouse range }
  2038. 690,694c684,708
  2039. < procedure DetectVideo; assembler;
  2040. > procedure SetCrtData;
  2041. > var
  2042. >   VideoConfig: VioConfigInfo;
  2043. >   BufSize: SmallWord;
  2044. >   CurData: VioCursorInfo;
  2045. > begin
  2046. >   ScreenMode := GetCrtMode;
  2047. >   ScreenHeight := VioMode.Row;
  2048. >   ScreenWidth := VioMode.Col;
  2049. >   ProtectArea.Row := 0;
  2050. >   ProtectArea.Col := 0;
  2051. >   ProtectArea.cRow := ScreenHeight - 1;
  2052. >   ProtectArea.cCol := ScreenWidth - 1;
  2053. >   ShowMouse;
  2054. >   HiResScreen  := False;
  2055. >   VideoConfig.cb := SizeOf(VideoConfig);
  2056. >   if (VioGetConfig(0, VideoConfig, 0) = 0) then
  2057. >     if VideoConfig.Adapter >= display_EGA then HiResScreen := True;
  2058. >   VioGetBuf(ScreenBuffer,BufSize,0);
  2059. >   SelToFlat(ScreenBuffer);
  2060. >   VioGetCurType(CurData, 0);                    { Get cursor lines }
  2061. >   WordRec(CursorLines).Hi := CurData.yStart;
  2062. >   WordRec(CursorLines).Lo := CurData.cEnd;
  2063. >   CurData.attr := $FFFF;
  2064. >   VioSetCurType(CurData,0);                     { Hide cursor }
  2065. 697,705c711,716
  2066. < procedure InitVideo; assembler;
  2067. > { Detects video modes }
  2068. > procedure DetectVideo;
  2069. > begin
  2070. >   ScreenMode := FixCrtMode(GetCrtMode);
  2071. >   StartupVioMode := VioMode;
  2072. 708,721c719,730
  2073. < procedure DoneVideo; assembler;
  2074. > { Initializes Turbo Vision's video manager. Saves the current screen    }
  2075. > { mode in StartupMode, and switches the screen to the mode indicated by }
  2076. > { ScreenMode. The ScreenWidth, ScreenHeight, HiResScreen, ScreenBuffer, }
  2077. > { and CursorLines variables are updated accordingly.InitVideo is called }
  2078. > { automatically by TApplication.Init.                                   }
  2079. > procedure InitVideo;
  2080. > begin
  2081. >   VioGetCurType(StartupCursor, 0);
  2082. >   StartupMode := GetCrtMode;
  2083. >   if StartupMode <> ScreenMode then SetCrtMode(ScreenMode);
  2084. >   SetCrtData;
  2085. 724,729c733,742
  2086. < procedure SetVideoMode(Mode: Word); assembler;
  2087. > { Terminates Turbo Vision's video manager by restoring the initial      }
  2088. > { screen mode, clearing the screen, and restoring the cursor. Called    }
  2089. > { automatically by TApplication.Done.                                   }
  2090. > procedure DoneVideo;
  2091. > begin
  2092. >   if (StartupMode <> $FFFF) and (StartupMode <> ScreenMode) then
  2093. >     VioSetMode(StartupVioMode, 0);
  2094. >   ClearScreen;
  2095. >   VioSetCurType(StartupCursor, 0);
  2096. 732,754c745,748
  2097. < procedure ClearScreen; assembler;
  2098. > { Sets the video mode. Mode is one of the constants smCO80, smBW80, or smMono, }
  2099. > { optionally with smFont8x8 added to select 43- or 50-line mode on an EGA or   }
  2100. > { VGA. SetVideoMode initializes the same variables as InitVideo (except for    }
  2101. > { the StartupMode variable, which isn't affected).                             }
  2102. 756c750,754
  2103. < const
  2104. > procedure SetVideoMode(Mode: Word);
  2105. > begin
  2106. >   SetCrtMode(FixCrtMode(Mode));
  2107. >   SetCrtData;
  2108. > end;
  2109. 758c756
  2110. < { System error messages }
  2111. > { Clears the screen, moves cursor to the top left corner }
  2112. 760,794c758,764
  2113. <   SCriticalError:  string[31] = 'Critical disk error on drive %c';
  2114. > procedure ClearScreen;
  2115. > const
  2116. >   Cell: SmallWord = $0720;      { Space character, white on black }
  2117. > begin
  2118. >   VioScrollUp(0, 0, 65535, 65535, 65535, Cell, 0);
  2119. >   VioSetCurPos(0, 0, 0);
  2120. > end;
  2121. 796c766
  2122. < { System error handler routines }
  2123. > { ********************* SYSTEM ERROR HANDLER ************************** }
  2124. 798,799c768,771
  2125. < procedure InitSysError; external;
  2126. > { No critical error handler is implemented for OS/2.                    }
  2127. > { Default OS/2 system error handler traps all critical errors.          }
  2128. > { Unlike DOS critical error handler it doesn't corrupt user screen.     }
  2129. > { That's why it is not so interesting to write one more of your own.    }
  2130. 801,818c773,775
  2131. < procedure SwapStatusLine(var Buffer); near; assembler;
  2132. > { Ctrl-Break signal handler. Sets CtrlBreakHit to True whenever         }
  2133. > { Ctrl-Break is hit. Note: when keyboard is switched to the raw         }
  2134. > { (binary mode) mode xcpt_Signal_Intr signal (Ctrl-C) is not reported.  }
  2135. 820,846c777,791
  2136. < function SelectKey: Integer; near; assembler;
  2137. > function CtrlBreakHandler(Report:       PExceptionReportRecord;
  2138. >                           Registration: PExceptionRegistrationRecord;
  2139. >                           Context:      PContextRecord;
  2140. >                           P:            Pointer): ULong; cdecl;
  2141. > begin
  2142. >   CtrlBreakHandler := xcpt_Continue_Search;
  2143. >   if (Report^.ExceptionNum = xcpt_Signal) then
  2144. >     case Report^.ExceptionInfo[0] of
  2145. >       xcpt_Signal_Intr,xcpt_Signal_Break:
  2146. >         begin
  2147. >           CtrlBreakHit := True;
  2148. >           if Assigned(CtrlBreakAction) then CtrlBreakAction;
  2149. >           CtrlBreakHandler := xcpt_Continue_Execution;
  2150. >         end;
  2151. >     end;
  2152. 849c794,796
  2153. < {$V-}
  2154. > { Initializes Turbo Vision's system error handler. Called automatically }
  2155. > { by TApplication.Init. Since no error handler is available,InitSysError}
  2156. > { sets SysErrActive to True and does nothing.                           }
  2157. 851,856c798
  2158. < function SystemError(ErrorCode: Integer; Drive: Byte): Integer;
  2159. > procedure InitSysError;
  2160. 858,874c800
  2161. <   if FailSysErrors then
  2162. >   SysErrActive := True;
  2163. 877c803,810
  2164. < {$V+}
  2165. > { Terminates Turbo Vision's system error handler. Called automatically  }
  2166. > { by TApplication.Done. Since no error handler is available,DoneSysError}
  2167. > { sets SysErrActive to False and does nothing.                          }
  2168. > procedure DoneSysError;
  2169. > begin
  2170. >   SysErrActive := False;
  2171. > end;
  2172. 959,961c892,907
  2173. < { String formatting routines }
  2174. > { A generalized string formatting routine. Given a string in Format     }
  2175. > { that includes format specifiers and a list of parameters in Params,   }
  2176. > { FormatStr produces a formatted output string in Result.               }
  2177. > { Format specifiers are of the form %[-][nnn]X, where                   }
  2178. > {   % indicates the beginning of a format specifier                     }
  2179. > {  [-] is an optional minus sign (-) indicating the parameter is to be  }
  2180. > {      left-justified (by default, parameters are right-justified)      }
  2181. > { [nnn] is an optional, decimal-number width specifier in the range     }
  2182. > {      0..255 (0 indicates no width specified, and non-zero means to    }
  2183. > {      display in a field of nnn characters)                            }
  2184. > {   X  is a format character:                                           }
  2185. > {   's' means the parameter is a pointer to a string.                   }
  2186. > {   'd' means the parameter is a Longint to be displayed in decimal.    }
  2187. > {   'c' means the low byte of the parameter is a character.             }
  2188. > {   'x' means the parameter is a Longint to be displayed in hexadecimal.}
  2189. > {   '#' sets the parameter index to nnn.                                }
  2190. 964c910,915
  2191. < external {FORMAT};
  2192. >   assembler; {$USES ebx,esi,edi} {$FRAME+}
  2193. > var
  2194. >   ParOfs: Longint;
  2195. >   Buffer: array [1..12] of Byte;
  2196. > const
  2197. >   HexDigits: array [0..15] of Char = '0123456789ABCDEF';
  2198. 966,978c917,1092
  2199. < procedure PrintStr(const S: String); assembler;
  2200. > { Convert next parameter to string              }
  2201. > { EXPECTS:      al    = Conversion character    }
  2202. > { RETURNS:      esi   = Pointer to string       }
  2203. > {               ecx   = String length           }
  2204. > procedure Convert; assembler; {$USES None} {$FRAME-}
  2205. > asm
  2206. >                 mov     edx,eax
  2207. >                 mov     esi,Params
  2208. >                 lodsd
  2209. >                 mov     Params,esi
  2210. >                 xor     ecx,ecx
  2211. >                 lea     esi,Buffer[TYPE Buffer]
  2212. >                 and     dl,0DFh         { UpCase(ConversionChar) }
  2213. >                 cmp     dl,'C'
  2214. >                 je      @@ConvertChar
  2215. >                 cmp     dl,'S'
  2216. >                 je      @@ConvertStr
  2217. >                 cmp     dl,'D'
  2218. >                 je      @@ConvertDec
  2219. >                 cmp     dl,'X'
  2220. >                 jne     @@Done
  2221. > { ConvertHex }
  2222. >               @@1:
  2223. >                 mov     edx,eax
  2224. >                 and     edx,0Fh
  2225. >                 mov     dl,HexDigits.Byte[edx]
  2226. >                 dec     esi
  2227. >                 inc     ecx
  2228. >                 mov     [esi],dl
  2229. >                 shr     eax,4
  2230. >                 jnz     @@1
  2231. >                 jmp     @@Done
  2232. > @@ConvertDec:
  2233. >                 push    esi
  2234. >                 mov     ebx,eax
  2235. >                 mov     ecx,10
  2236. >                 test    eax,eax
  2237. >                 jns     @@2
  2238. >                 neg     eax
  2239. >               @@2:
  2240. >                 xor     edx,edx
  2241. >                 dec     esi
  2242. >                 div     ecx
  2243. >                 add     dl,'0'
  2244. >                 mov     [esi],dl
  2245. >                 test    eax,eax
  2246. >                 jnz     @@2
  2247. >                 pop     ecx
  2248. >                 sub     ecx,esi
  2249. >                 test    ebx,ebx
  2250. >                 jns     @@Done
  2251. >                 mov     al,'-'
  2252. > @@ConvertChar:
  2253. >                 inc     ecx
  2254. >                 dec     esi
  2255. >                 mov     [esi],al
  2256. >                 jmp     @@Done
  2257. > @@ConvertStr:
  2258. >                 test    eax,eax
  2259. >                 jz      @@Done
  2260. >                 mov     esi,eax
  2261. >                 lodsb
  2262. >                 mov     cl,al
  2263. >               @@Done:
  2264. > end;
  2265. > { FormatStr body }
  2266. > asm
  2267. >                 mov     eax,Params
  2268. >                 mov     ParOfs,eax
  2269. >                 xor     eax,eax
  2270. >                 mov     esi,Format
  2271. >                 mov     edi,Result
  2272. >                 inc     edi
  2273. >                 cld
  2274. >                 lodsb
  2275. >                 mov     ecx,eax
  2276. >               @@1:
  2277. >                 jecxz   @@9
  2278. >                 lodsb
  2279. >                 dec     ecx
  2280. >                 cmp     al,'%'
  2281. >                 je      @@3
  2282. >               @@2:
  2283. >                 stosb
  2284. >                 jmp     @@1
  2285. >               @@3:
  2286. >                 jecxz   @@9
  2287. >                 lodsb
  2288. >                 dec     ecx
  2289. >                 cmp     al,'%'
  2290. >                 je      @@2             { bh = Justify (0:right, 1:left) }
  2291. >                 mov     ebx,' '         { bl = Filler character          }
  2292. >                 xor     edx,edx         { edx = Field width (0:no width) }
  2293. >                 cmp     al,'0'
  2294. >                 jne     @@4
  2295. >                 mov     bl,al
  2296. >               @@4:
  2297. >                 cmp     al,'-'
  2298. >                 jne     @@5
  2299. >                 inc     bh
  2300. >                 jecxz   @@9
  2301. >                 lodsb
  2302. >                 dec     ecx
  2303. >               @@5:
  2304. >                 cmp     al,'0'
  2305. >                 jb      @@6
  2306. >                 cmp     al,'9'
  2307. >                 ja      @@6
  2308. >                 sub     al,'0'
  2309. >                 xchg    eax,edx
  2310. >                 mov     ah,10
  2311. >                 mul     ah
  2312. >                 add     al,dl
  2313. >                 xchg    eax,edx
  2314. >                 jecxz   @@9
  2315. >                 lodsb
  2316. >                 dec     ecx
  2317. >                 jmp     @@5
  2318. >               @@6:
  2319. >                 cmp     al,'#'
  2320. >                 jne     @@10
  2321. >                 shl     edx,2
  2322. >                 add     edx,ParOfs
  2323. >                 mov     Params,edx
  2324. >                 jmp     @@1
  2325. >               @@9:
  2326. >                 mov     eax,Result
  2327. >                 mov     ecx,edi
  2328. >                 sub     ecx,eax
  2329. >                 dec     ecx
  2330. >                 mov     [eax],cl
  2331. >                 jmp     @@Done
  2332. >               @@10:
  2333. >                 push    esi
  2334. >                 push    ecx
  2335. >                 push    edx
  2336. >                 push    ebx
  2337. >                 Call    Convert
  2338. >                 pop     ebx
  2339. >                 pop     edx
  2340. >                 test    edx,edx
  2341. >                 jz      @@12
  2342. >                 sub     edx,ecx
  2343. >                 jae     @@12
  2344. >                 test    bh,bh
  2345. >                 jnz     @@11
  2346. >                 sub     esi,edx
  2347. >               @@11:
  2348. >                 add     ecx,edx
  2349. >                 xor     edx,edx
  2350. >               @@12:
  2351. >                 test    bh,bh
  2352. >                 jz      @@13
  2353. >                 rep     movsb           { Copy formated parm (left-justified)}
  2354. >               @@13:
  2355. >                 xchg    ecx,edx
  2356. >                 mov     al,bl
  2357. >                 rep     stosb           { Fill unused space }
  2358. >                 xchg    ecx,edx
  2359. >                 rep     movsb           { Copy formated parm (right-justified)}
  2360. >                 pop     ecx
  2361. >                 pop     esi
  2362. >                 jmp     @@1
  2363. >               @@Done:
  2364. > end;
  2365. > { Prints the string on the screen }
  2366. > procedure PrintStr(const S: String);
  2367. > var
  2368. >   WCount: ULong;
  2369. > begin
  2370. >   DosWrite(1, S[1], Length(S), WCount);
  2371. 982a1097,1103
  2372. > { Moves text and video attributes into a buffer. Count bytes are moved  }
  2373. > { from Source into the low bytes of corresponding words in Dest. The    }
  2374. > { high bytes of the words in Dest are set to Attr, or remain unchanged  }
  2375. > { if Attr is zero.                                                      }
  2376. > {$USES esi,edi} {$FRAME-}
  2377. 985,1003c1106,1130
  2378. <         MOV     CX,Count
  2379. >                 mov     ecx,Count
  2380. >                 jecxz   @@4
  2381. >                 mov     edi,Dest
  2382. >                 mov     esi,Source
  2383. >                 mov     ah,Attr
  2384. >                 cld
  2385. >                 test    ah,ah
  2386. >                 jz      @@3
  2387. >               @@1:
  2388. >                 lodsb
  2389. >                 stosw
  2390. >                 loop    @@1
  2391. >                 jmp     @@4
  2392. >               @@2:
  2393. >                 inc     edi
  2394. >               @@3:
  2395. >                 movsb
  2396. >                 loop    @@2
  2397. >               @@4:
  2398. > end;
  2399. > { Moves characters into a buffer. The low bytes of the first Count      }
  2400. > { words of Dest are set to C, or remain unchanged if C = #0. The high   }
  2401. > { bytes of the words are set to Attr, or remain unchanged if Attr is    }
  2402. > { zero.                                                                 }
  2403. 1004a1132,1133
  2404. > {$USES edi} {$FRAME-}
  2405. 1007,1024c1136,1170
  2406. <         MOV     CX,Count
  2407. >                 mov     ecx,Count
  2408. >                 jecxz   @@4
  2409. >                 mov     edi,Dest
  2410. >                 mov     al,C
  2411. >                 mov     ah,Attr
  2412. >                 cld
  2413. >                 test    al,al
  2414. >                 jz      @@1
  2415. >                 test    ah,ah
  2416. >                 jz      @@3
  2417. >                 mov     edx,eax
  2418. >                 shl     eax,16
  2419. >                 mov     ax,dx
  2420. >                 shr     ecx,1
  2421. >                 rep     stosd
  2422. >                 adc     ecx,ecx
  2423. >                 rep     stosw
  2424. >                 jmp     @@4
  2425. >               @@1:
  2426. >                 mov     al,ah
  2427. >               @@2:
  2428. >                 inc     edi
  2429. >               @@3:
  2430. >                 stosb
  2431. >                 loop    @@2
  2432. >               @@4:
  2433. > end;
  2434. > { Moves a two-colored string into a buffer. The characters in Str are   }
  2435. > { moved into the low bytes of corresponding words in Dest. The high     }
  2436. > { bytes of the words are set to Lo(Attr) or Hi(Attr). Tilde characters  }
  2437. > { (~) in the string toggle between the two attribute bytes passed in    }
  2438. > { the Attr word.                                                        }
  2439. > {$USES esi,edi} {$FRAME-}
  2440. 1028,1047c1174,1198
  2441. <         MOV     DX,DS
  2442. >                 xor     ecx,ecx
  2443. >                 mov     esi,Str
  2444. >                 cld
  2445. >                 lodsb
  2446. >                 mov     cl,al
  2447. >                 jecxz   @@3
  2448. >                 mov     edi,Dest
  2449. >                 mov     edx,Attrs
  2450. >                 mov     ah,dl
  2451. >               @@1:
  2452. >                 lodsb
  2453. >                 cmp     al,'~'
  2454. >                 je      @@2
  2455. >                 stosw
  2456. >                 loop    @@1
  2457. >                 jmp     @@3
  2458. >               @@2:
  2459. >                 xchg    ah,dh
  2460. >                 loop    @@1
  2461. >               @@3:
  2462. > end;
  2463. > { Moves a string into a buffer. The characters in Str are moved into    }
  2464. > { the low bytes of corresponding words in Dest. The high bytes of the   }
  2465. > { words are set to Attr, or remain unchanged if Attr is zero.           }
  2466. 1049,1070c1200
  2467. < procedure MoveStr(var Dest; const Str: String; Attr: Byte); assembler;
  2468. > {$USES esi,edi} {$FRAME-}
  2469. 1072c1202
  2470. < function CStrLen(const S: String): Integer; assembler;
  2471. > procedure MoveStr(var Dest; const Str: String; Attr: Byte); assembler;
  2472. 1074,1086c1204,1249
  2473. <         LES     DI,S
  2474. >                 xor     ecx,ecx
  2475. >                 mov     esi,Str
  2476. >                 cld
  2477. >                 lodsb
  2478. >                 mov     cl,al
  2479. >                 jecxz   @@4
  2480. >                 mov     edi,Dest
  2481. >                 mov     ah,Attr
  2482. >                 test    ah,ah
  2483. >                 jz      @@3
  2484. >               @@1:
  2485. >                 lodsb
  2486. >                 stosw
  2487. >                 loop    @@1
  2488. >                 jmp     @@4
  2489. >               @@2:
  2490. >                 inc     edi
  2491. >               @@3:
  2492. >                 movsb
  2493. >                 loop    @@2
  2494. >               @@4:
  2495. > end;
  2496. > { Returns the length of string S, where S is a control string using     }
  2497. > { tilde characters ('~') to designate shortcut characters. The tildes   }
  2498. > { are excluded from the length of the string, as they will not appear   }
  2499. > { on the screen.                                                        }
  2500. > function CStrLen(const S: String): Integer; assembler; {$USES edi} {$FRAME-}
  2501. > asm
  2502. >                 xor     ecx,ecx
  2503. >                 mov     edi,S
  2504. >                 mov     cl,[edi]
  2505. >                 inc     edi
  2506. >                 mov     edx,ecx
  2507. >                 jecxz   @@2
  2508. >                 mov     al,'~'
  2509. >                 cld
  2510. >               @@1:
  2511. >                 repne   scasb
  2512. >                 jne     @@2
  2513. >                 dec     edx
  2514. >                 test    esp,esp
  2515. >                 jmp     @@1
  2516. >               @@2:
  2517. >                 mov     eax,edx
  2518. 1092a1256
  2519. >   Times: ULong;
  2520. 1094c1258
  2521. < procedure ExitDrivers; far;
  2522. > procedure ExitDrivers;
  2523. 1097a1262
  2524. >   MouClose(hMou);
  2525. 1101a1267
  2526. >   InitKeyboard;
  2527. 1105a1272,1273
  2528. >   DosSetSignalExceptionFocus(True, Times);
  2529. >   SetExceptionHandler(@CtrlBreakHandler);
  2530. Comparing BP7\EDITORS.PAS and VP\EDITORS.PAS 
  2531. 17c17
  2532. < uses Drivers, Objects, Views, Dialogs;
  2533. > uses Drivers, Objects, Views, Dialogs, Use32;
  2534. 96c96
  2535. <   TEditBuffer = array[0..65519] of Char;
  2536. >   TEditBuffer = array[0..512*1024*1024-1] of Char;
  2537. 323c323
  2538. <   sfSearchFailed = $FFFF;
  2539. >   sfSearchFailed = $FFFFFFFF;
  2540. 326c326
  2541. <   FirstKeys: array[0..37 * 2] of Word = (37,
  2542. >   FirstKeys: array[0..37 * 2] of SmallWord = (37,
  2543. 346c346
  2544. <   QuickKeys: array[0..8 * 2] of Word = (8,
  2545. >   QuickKeys: array[0..8 * 2] of SmallWord = (8,
  2546. 351c351
  2547. <   BlockKeys: array[0..5 * 2] of Word = (5,
  2548. >   BlockKeys: array[0..5 * 2] of SmallWord = (5,
  2549. 486c486
  2550. <         if TPoint(Info).Y <= T.Y then
  2551. >         if TPoint(Info^).Y <= T.Y then
  2552. 494,527c494,496
  2553. < function Min(X, Y: Integer): Integer; near; assembler;
  2554. > function Min(X, Y: Integer): Integer;
  2555. > begin
  2556. >   if X <= Y then Min := X else Min := Y;
  2557. 530,542c499,501
  2558. < function CountLines(var Buf; Count: Word): Integer; near; assembler;
  2559. > function Max(X, Y: Integer): Integer;
  2560. > begin
  2561. >   if X >= Y then Max := X else Max := Y;
  2562. 545c504
  2563. < function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word; near; assembler;
  2564. > function CountLines(var Buf; Count: Word): Integer; assembler; {$USES edi} {$FRAME-}
  2565. 547,564c506,535
  2566. <         PUSH    DS
  2567. >                 mov     edi,Buf
  2568. >                 mov     ecx,Count
  2569. >                 xor     edx,edx
  2570. >                 mov     al,0Dh
  2571. >                 cld
  2572. >               @@1:
  2573. >                 jecxz   @@2
  2574. >                 repne   scasb
  2575. >                 jne     @@2
  2576. >                 inc     edx
  2577. >                 jmp     @@1
  2578. >               @@2:
  2579. >                 mov     eax,edx
  2580. > end;
  2581. > function ScanKeyMap(KeyMap: Pointer; KeyCode: Word): Word;
  2582. > var
  2583. >   I,Key: Word;
  2584. >   KeyTable: PWordArray absolute KeyMap;
  2585. > begin
  2586. >   for I := 1 to KeyTable^[0] do
  2587. >   begin
  2588. >     Key := KeyTable^[I*2-1];
  2589. >     if (Lo(Key) = Lo(KeyCode)) and ((Hi(Key) = 0) or (Hi(Key) = Hi(KeyCode))) then
  2590. >     begin
  2591. >       ScanKeyMap := KeyTable^[I*2];
  2592. >       Exit;
  2593. >     end;
  2594. >   end;
  2595. >   ScanKeyMap := 0;
  2596. 567c538
  2597. < function Scan(var Block; Size: Word; Str: String): Word; near; assembler;
  2598. > function Scan(var Block; Size: Word; Str: String): Word; assembler; {$USES ebx,esi,edi} {$FRAME-}
  2599. 569,612c540,586
  2600. <         PUSH    DS
  2601. >                 mov     edi,block
  2602. >                 mov     esi,Str
  2603. >                 mov     ecx,Size
  2604. >                 jecxz   @@3
  2605. >                 cld
  2606. >                 lodsb
  2607. >                 cmp     al,1
  2608. >                 jb      @@5
  2609. >                 ja      @@1
  2610. >                 lodsb
  2611. >                 repne   scasb
  2612. >                 jne     @@3
  2613. >                 jmp     @@5
  2614. >               @@1:
  2615. >                 movzx   ebx,al
  2616. >                 dec     ebx
  2617. >                 mov     edx,ecx
  2618. >                 sub     edx,eax
  2619. >                 jb      @@3
  2620. >                 lodsb
  2621. >                 inc     edx
  2622. >                 inc     edx
  2623. >               @@2:
  2624. >                 dec     edx
  2625. >                 mov     ecx,edx
  2626. >                 repne   scasb
  2627. >                 jne     @@3
  2628. >                 mov     edx,ecx
  2629. >                 mov     ecx,ebx
  2630. >                 rep     cmpsb
  2631. >                 je      @@4
  2632. >                 sub     ecx,ebx
  2633. >                 add     esi,ecx
  2634. >                 add     edi,ecx
  2635. >                 inc     edi
  2636. >                 test    edx,edx
  2637. >                 jne     @@2
  2638. >               @@3:
  2639. >                 xor     eax,eax
  2640. >                 jmp     @@6
  2641. >               @@4:
  2642. >                 sub     edi,ebx
  2643. >               @@5:
  2644. >                 mov     eax,edi
  2645. >                 sub     eax,Block
  2646. >               @@6:
  2647. >                 dec     eax
  2648. 615c589
  2649. < function IScan(var Block; Size: Word; Str: String): Word; near; assembler;
  2650. > function IScan(var Block; Size: Word; Str: String): Word; assembler; {$USES ebx,esi,edi} {$FRAME+}
  2651. 619,682c593,661
  2652. <         PUSH    DS
  2653. >                 lea     edi,S
  2654. >                 mov     esi,Str
  2655. >                 xor     eax,eax
  2656. >                 lodsb
  2657. >                 stosb
  2658. >                 mov     ecx,eax
  2659. >                 mov     ebx,eax
  2660. >                 jecxz   @@9
  2661. >               @@1:
  2662. >                 lodsb
  2663. >                 cmp     al,'a'
  2664. >                 jb      @@2
  2665. >                 cmp     al,'z'
  2666. >                 ja      @@2
  2667. >                 sub     al,'a'-'A'
  2668. >               @@2:
  2669. >                 stosb
  2670. >                 loop    @@1
  2671. >                 sub     edi,ebx
  2672. >                 mov     esi,Block
  2673. >                 mov     ecx,Size
  2674. >                 jecxz   @@8
  2675. >                 cld
  2676. >                 sub     ecx,ebx
  2677. >                 jb      @@8
  2678. >                 inc     ecx
  2679. >               @@4:
  2680. >                 mov     ah,[edi]
  2681. >                 and     ah,0DFh
  2682. >               @@5:
  2683. >                 lodsb
  2684. >                 and     al,0DFh
  2685. >                 cmp     al,ah
  2686. >                 loopne  @@5
  2687. >                 jne     @@8
  2688. >                 dec     esi
  2689. >                 mov     edx,ecx
  2690. >                 mov     ecx,ebx
  2691. >               @@6:
  2692. >                 repe    cmpsb
  2693. >                 je      @@10
  2694. >                 mov     al,[esi-1]
  2695. >                 cmp     al,'a'
  2696. >                 jb      @@7
  2697. >                 cmp     al,'z'
  2698. >                 ja      @@7
  2699. >                 sub     al,'a'-'A'
  2700. >               @@7:
  2701. >                 cmp     al,[edi-1]
  2702. >                 je      @@6
  2703. >                 sub     ecx,ebx
  2704. >                 lea     esi,[esi+ecx+1]
  2705. >                 add     edi,ecx
  2706. >                 mov     ecx,edx
  2707. >                 test    ecx,ecx
  2708. >                 jne     @@4
  2709. >               @@8:
  2710. >                 xor     eax,eax
  2711. >                 jmp     @@11
  2712. >               @@9:
  2713. >                 mov     eax,1
  2714. >                 jmp     @@11
  2715. >               @@10:
  2716. >                 sub     esi,ebx
  2717. >                 mov     eax,esi
  2718. >                 sub     eax,Block
  2719. >                 inc     eax
  2720. >               @@11:
  2721. >                 dec     eax
  2722. 736c715
  2723. <   if (Longint(Location) <> Longint(ALocation)) or
  2724. >   if (Location.X <> ALocation.X) or (Location.Y <> ALocation.Y) or
  2725. 794c773
  2726. < function TEditor.BufChar(P: Word): Char; assembler;
  2727. > function TEditor.BufChar(P: Word): Char; assembler; {$USES None} {$FRAME-}
  2728. 796,802c775,782
  2729. <         LES     DI,Self
  2730. >                 mov     ecx,Self
  2731. >                 mov     edx,P
  2732. >                 cmp     edx,[ecx].TEditor.CurPtr
  2733. >                 jb      @@1
  2734. >                 add     edx,[ecx].TEditor.GapLen
  2735. >               @@1:
  2736. >                 add     edx,[ecx].TEditor.Buffer
  2737. >                 mov     al,[edx]
  2738. 805c785
  2739. < function TEditor.BufPtr(P: Word): Word; assembler;
  2740. > function TEditor.BufPtr(P: Word): Word; assembler; {$USES None} {$FRAME-}
  2741. 807,812c787,792
  2742. <         LES     DI,Self
  2743. >                 mov     ecx,Self
  2744. >                 mov     eax,P
  2745. >                 cmp     eax,[ecx].TEditor.CurPtr
  2746. >                 jb      @@1
  2747. >                 add     eax,[ecx].TEditor.GapLen
  2748. >               @@1:
  2749. 875d854
  2750. <   ShiftState: Byte absolute $40:$17;
  2751. 880c859
  2752. <     if (ShiftState and $03 <> 0) and
  2753. >     if (GetShiftState and $03 <> 0) and
  2754. 953c932
  2755. <         I := EditorDialog(edReplacePrompt, Pointer(C));
  2756. >         I := EditorDialog(edReplacePrompt, @C);
  2757. 997c976
  2758. <   B: array[0..MaxLineLength - 1] of Word;
  2759. >   B: array[0..MaxLineLength - 1] of SmallWord;
  2760. 1028c1007
  2761. <   Width: Integer; Colors: Word); assembler;
  2762. >   Width: Integer; Colors: Word); assembler; {$USES ebx,esi,edi} {$FRAME+}
  2763. 1030,1083c1009,1070
  2764. <         PUSH    DS
  2765. >                 mov     ebx,Self
  2766. >                 mov     edi,DrawBuf
  2767. >                 mov     esi,LinePtr
  2768. >                 xor     edx,edx
  2769. >                 cld
  2770. >                 mov     ah,Colors.Byte[0]
  2771. >                 mov     ecx,[ebx].TEditor.SelStart
  2772. >                 Call    @@10
  2773. >                 mov     ah,Colors.Byte[1]
  2774. >                 mov     ecx,[ebx].TEditor.CurPtr
  2775. >                 Call    @@10
  2776. >                 add     esi,[ebx].TEditor.GapLen
  2777. >                 mov     ecx,[ebx].TEditor.SelEnd
  2778. >                 add     ecx,[ebx].TEditor.GapLen
  2779. >                 Call    @@10
  2780. >                 mov     ah,Colors.Byte[0]
  2781. >                 mov     ecx,[ebx].TEditor.BufSize
  2782. >                 Call    @@10
  2783. >                 jmp     @@31
  2784. >               @@10:
  2785. >                 sub     ecx,esi
  2786. >                 ja      @@11
  2787. >                 ret
  2788. >               @@11:
  2789. >                 mov     ebx,[ebx].TEditor.Buffer
  2790. >                 add     esi,ebx
  2791. >                 mov     ebx,Width
  2792. >               @@12:
  2793. >                 lodsb
  2794. >                 cmp     al,' '
  2795. >                 jb      @@20
  2796. >               @@13:
  2797. >                 stosw
  2798. >                 inc     edx
  2799. >               @@14:
  2800. >                 cmp     edx,ebx
  2801. >                 jae     @@30
  2802. >                 loop    @@12
  2803. >                 mov     ebx,Self
  2804. >                 sub     esi,[ebx].TEditor.Buffer
  2805. >                 ret
  2806. >               @@20:
  2807. >                 cmp     al,0Dh
  2808. >                 je      @@30
  2809. >                 cmp     al,09h
  2810. >                 jne     @@13
  2811. >                 mov     al,' '
  2812. >               @@21:
  2813. >                 stosw
  2814. >                 inc     edx
  2815. >                 test    dl,7
  2816. >                 jne     @@21
  2817. >                 jmp     @@14
  2818. >               @@30:
  2819. >                 pop     ecx
  2820. >               @@31:
  2821. >                 mov     al,' '
  2822. >                 mov     ecx,Width
  2823. >                 sub     ecx,edx
  2824. >                 jbe     @@32
  2825. >                 rep     stosw
  2826. >               @@32:
  2827. 1104d1090
  2828. <   ShiftState: Byte absolute $40:$17;
  2829. 1125c1111
  2830. <   if Selecting or (ShiftState and $03 <> 0) then SelectMode := smExtend;
  2831. >   if Selecting or (GetShiftState and $03 <> 0) then SelectMode := smExtend;
  2832. 1256c1242
  2833. <     if (NewSize > $FFF0) or not SetBufSize(NewSize) then
  2834. >     if not SetBufSize(NewSize) then
  2835. 1322c1308
  2836. < function TEditor.LineEnd(P: Word): Word; assembler;
  2837. > function TEditor.LineEnd(P: Word): Word; assembler; {$USES ebx,esi,edi} {$FRAME-}
  2838. 1324,1347c1310,1335
  2839. <         PUSH    DS
  2840. >                 mov     esi,Self
  2841. >                 mov     ebx,[esi].TEditor.Buffer
  2842. >                 mov     edi,P
  2843. >                 mov     al,0Dh
  2844. >                 cld
  2845. >                 mov     ecx,[esi].TEditor.CurPtr
  2846. >                 sub     ecx,edi
  2847. >                 jbe     @@1
  2848. >                 add     edi,ebx
  2849. >                 repne   scasb
  2850. >                 je      @@2
  2851. >                 mov     edi,[esi].TEditor.CurPtr
  2852. >               @@1:
  2853. >                 mov     ecx,[esi].TEditor.BufLen
  2854. >                 sub     ecx,edi
  2855. >                 jecxz   @@4
  2856. >                 add     ebx,[esi].TEditor.GapLen
  2857. >                 add     edi,ebx
  2858. >                 repne   scasb
  2859. >                 jne     @@3
  2860. >               @@2:
  2861. >                 dec     edi
  2862. >               @@3:
  2863. >                 sub     edi,ebx
  2864. >               @@4:
  2865. >                 mov     eax,edi
  2866. 1375c1363
  2867. < function TEditor.LineStart(P: Word): Word; assembler;
  2868. > function TEditor.LineStart(P: Word): Word; assembler; {$USES ebx,esi,edi} {$FRAME-}
  2869. 1377,1412c1365,1400
  2870. <         PUSH    DS
  2871. >                 mov     esi,Self
  2872. >                 mov     ebx,[esi].TEditor.Buffer
  2873. >                 mov     edi,P
  2874. >                 mov     al,0Dh
  2875. >                 std
  2876. >                 mov     ecx,edi
  2877. >                 sub     ecx,[esi].TEditor.CurPtr
  2878. >                 jbe     @@1
  2879. >                 add     ebx,[esi].TEditor.GapLen
  2880. >                 lea     edi,[edi+ebx-1]
  2881. >                 repne   scasb
  2882. >                 je      @@2
  2883. >                 sub     ebx,[esi].TEditor.GapLen
  2884. >                 mov     edi,[esi].TEditor.CurPtr
  2885. >               @@1:
  2886. >                 mov     ecx,edi
  2887. >                 jecxz   @@4
  2888. >                 lea     edi,[edi+ebx-1]
  2889. >                 repne   scasb
  2890. >                 jne     @@3
  2891. >               @@2:
  2892. >                 inc     edi
  2893. >                 inc     edi
  2894. >                 sub     edi,ebx
  2895. >                 cmp     edi,[esi].TEditor.CurPtr
  2896. >                 je      @@4
  2897. >                 cmp     edi,[esi].TEditor.BufLen
  2898. >                 je      @@4
  2899. >                 cmp     [ebx+edi].Byte,0Ah
  2900. >                 jne     @@4
  2901. >                 inc     edi
  2902. >                 jmp     @@4
  2903. >               @@3:
  2904. >                 xor     edi,edi
  2905. >               @@4:
  2906. >                 mov     eax,edi
  2907. 1433c1421
  2908. < function TEditor.NextChar(P: Word): Word; assembler;
  2909. > function TEditor.NextChar(P: Word): Word; assembler; {$USES ebx,esi,edi} {$FRAME-}
  2910. 1435,1451c1423,1439
  2911. <         PUSH    DS
  2912. >                 mov     esi,Self
  2913. >                 mov     edi,P
  2914. >                 cmp     edi,[esi].TEditor.BufLen
  2915. >                 je      @@2
  2916. >                 inc     edi
  2917. >                 cmp     edi,[esi].TEditor.BufLen
  2918. >                 je      @@2
  2919. >                 mov     ebx,[esi].TEditor.Buffer
  2920. >                 cmp     edi,[esi].TEditor.CurPtr
  2921. >                 jb      @@1
  2922. >                 add     ebx,[esi].TEditor.GapLen
  2923. >               @@1:
  2924. >                 cmp     [ebx+edi-1].Word,0A0Dh
  2925. >                 jne     @@2
  2926. >                 inc     edi
  2927. >               @@2:
  2928. >                 mov     eax,edi
  2929. 1468c1456
  2930. < function TEditor.PrevChar(P: Word): Word; assembler;
  2931. > function TEditor.PrevChar(P: Word): Word; assembler; {$USES ebx,esi,edi} {$FRAME-}
  2932. 1470,1485c1458,1473
  2933. <         PUSH    DS
  2934. >                 mov     esi,Self
  2935. >                 mov     edi,P
  2936. >                 test    edi,edi
  2937. >                 je      @@2
  2938. >                 dec     edi
  2939. >                 je      @@2
  2940. >                 mov     ebx,[esi].TEditor.Buffer
  2941. >                 cmp     edi,[esi].TEditor.CurPtr
  2942. >                 jb      @@1
  2943. >                 add     ebx,[esi].TEditor.GapLen
  2944. >               @@1:
  2945. >                 cmp     [ebx+edi-1].Word,0A0Dh
  2946. >                 jne     @@2
  2947. >                 dec     edi
  2948. >               @@2:
  2949. >                 mov     eax,edi
  2950. 1569,1570c1557,1558
  2951. <   Longint(CurPos) := 0;
  2952. >   CurPos.X := 0; CurPos.Y := 0;
  2953. >   Delta.X := 0; Delta.Y := 0;
  2954. 1848c1836
  2955. <   if Buffer <> nil then DisposeBuffer(Buffer);
  2956. >   inherited DoneBuffer;
  2957. 1887c1875
  2958. <     if (FSize > $FFF0) or not SetBufSize(Word(FSize)) then
  2959. >     if not SetBufSize(Word(FSize)) then
  2960. 1956a1945
  2961. >   P: Pointer;
  2962. 1958a1948
  2963. >   if NewSize > SizeOf(TEditBuffer) then Exit;
  2964. 1960,1961c1950
  2965. <     if NewSize > $F000 then NewSize := $FFF0 else
  2966. >     NewSize := (NewSize + $0FFF) and $FFFF000;
  2967. 1965c1954,1960
  2968. <       if not SetBufferSize(Buffer, NewSize) then Exit;
  2969. >     begin
  2970. >       P := MemAlloc(NewSize);
  2971. >       if P = nil then Exit;
  2972. >       Move(Buffer^, P^, BufSize);
  2973. >       FreeMem(Buffer, BufSize);
  2974. >       Buffer := P;
  2975. >     end;
  2976. 1968c1963,1973
  2977. <     if NewSize < BufSize then SetBufferSize(Buffer, NewSize);
  2978. >     if NewSize < BufSize then
  2979. >     begin
  2980. >       P := MemAlloc(NewSize);
  2981. >       if P = nil then NewSize := BufSize
  2982. >      else
  2983. >       begin
  2984. >         Move(Buffer^, P^, BufSize);
  2985. >         FreeMem(Buffer, BufSize);
  2986. >         Buffer := P;
  2987. >       end;
  2988. >     end;
  2989. Comparing BP7\MEMORY.PAS and VP\MEMORY.PAS 
  2990. 13c13
  2991. < {$O+,F+,X+,I-,S-,Q-}
  2992. > {$X+,I-,S-,Q-}
  2993. 16a17,18
  2994. > uses Use32;
  2995. 18d19
  2996. <   MaxHeapSize: Word = 655360 div 16;    { 640K }
  2997. 20d20
  2998. <   MaxBufMem: Word = 65536 div 16;       {  64K }
  2999. 28d27
  3000. < function MemAllocSeg(Size: Word): Pointer;
  3001. 36c35
  3002. < {$IFNDEF DPMI}
  3003. > { The following procedure is not implemented
  3004. 38,40c37
  3005. < procedure GetBufMem(var P: Pointer; Size: Word);
  3006. > function MemAllocSeg(Size: Word): Pointer;
  3007. 42c39
  3008. < {$ENDIF}
  3009. > }
  3010. 48c45
  3011. <     Ofs, Seg: Word;
  3012. >     Ofs: Longint;
  3013. 51,52d47
  3014. < {$IFDEF DPMI}
  3015. 57a53,60
  3016. >     Size: Word;
  3017. >     Data: record end;
  3018. >   end;
  3019. >   PBuffer = ^TBuffer;
  3020. >   TBuffer = record
  3021. >     Next: PBuffer;
  3022. >     Size: Word;
  3023. 63a67
  3024. >   BufferList: PBuffer = nil;
  3025. 67,79d70
  3026. < function MemAllocateBlock(HeapHandle, Size, Attributes: Word;
  3027. 101c92
  3028. < function HeapNotify(Size: Word): Integer; far;
  3029. > function HeapNotify(Size: Word): Integer;
  3030. 149,161d139
  3031. < function MemAllocSeg(Size: Word): Pointer;
  3032. 167,169c145
  3033. <   PtrRec(Cache).Ofs := 0;
  3034. >   if MaxAvail >= Size then GetMem(Cache,Size) else Cache := nil;
  3035. 178a155
  3036. >     Cache^.Size := Size;
  3037. 189d165
  3038. <   PtrRec(Cache).Seg := PtrRec(P).Seg;
  3039. 200c176
  3040. <     MemFreeBlock(PtrRec(Cache).Seg);
  3041. >     FreeMem(Cache,Cache^.Size);
  3042. 205,322d180
  3043. < begin
  3044. 324c182
  3045. <   P: Pointer;
  3046. >   Buffer: PBuffer;
  3047. 326,329c184,186
  3048. <   HeapResult := 1;
  3049. >   Inc(Size, SizeOf(TBuffer));
  3050. >   Buffer := MemAlloc(Size);
  3051. >   if Buffer <> nil then
  3052. 331,332c188,191
  3053. <     FreeMem(P, Size);
  3054. >     Buffer^.Next := BufferList;
  3055. >     Buffer^.Size := Size;
  3056. >     BufferList := Buffer;
  3057. >     Inc(PtrRec(Buffer).Ofs, SizeOf(TBuffer));
  3058. 334c193
  3059. <   MemAlloc := P;
  3060. >   P := Buffer;
  3061. 337c196
  3062. < function MemAllocSeg(Size: Word): Pointer;
  3063. > procedure DisposeBuffer(P: Pointer);
  3064. 339c198
  3065. <   P, T: Pointer;
  3066. >   Buffer,PrevBuf: PBuffer;
  3067. 341,342d199
  3068. <   Size := (Size + 7) and $FFF8;
  3069. 345c202,205
  3070. <     if PtrRec(P).Ofs = 0 then
  3071. >     Dec(PtrRec(P).Ofs, SizeOf(TBuffer));
  3072. >     Buffer := BufferList;
  3073. >     PrevBuf := nil;
  3074. >     while (Buffer <> nil) and (P <> Buffer) do
  3075. 347,349c207,210
  3076. <       PtrRec(T).Ofs := Size and 15;
  3077. >       PrevBuf := Buffer;
  3078. >       Buffer := Buffer^.Next;
  3079. >     end;
  3080. >     if Buffer <> nil then
  3081. 351,353c212,213
  3082. <       T := P;
  3083. >       if PrevBuf = nil then BufferList := Buffer^.Next else PrevBuf^.Next := Buffer^.Next;
  3084. >       FreeMem(Buffer,Buffer^.Size);
  3085. 355,511d214
  3086. <     FreeMem(T, 8);
  3087. 515,518c218
  3088. < procedure NewBuffer(var P: Pointer; Size: Word);
  3089. > function GetBufferSize(P: Pointer): Word;
  3090. 520,521c220,221
  3091. <   BufSize := (Size + 15) shr 4 + 1;
  3092. >   if P = nil then GetBufferSize := 0
  3093. >  else
  3094. 523,527c223,224
  3095. <     Buffer := Ptr(BufHeapPtr, 0);
  3096. >     Dec(PtrRec(P).Ofs,SizeOf(TBuffer));
  3097. >     GetBufferSize := PBuffer(P)^.Size;
  3098. 531,542d227
  3099. < procedure DisposeBuffer(P: Pointer);
  3100. 544,545d228
  3101. < var
  3102. 547,548d229
  3103. <   Dec(PtrRec(P).Seg);
  3104. 550,565d230
  3105. <   if BufHeapPtr + NewSize - GetBufSize(P) <= BufHeapEnd then
  3106. 567,582d231
  3107. Comparing BP7\MENUS.PAS and VP\MENUS.PAS 
  3108. 13c13
  3109. < {$O+,F+,X+,I-,S-}
  3110. > {$X+,I-,S-,Cdecl-}
  3111. 17c17
  3112. < uses Objects, Drivers, Views;
  3113. > uses Objects, Drivers, Views, Use32;
  3114. 1126c1126
  3115. <       if I + L < Size.X then
  3116. >       if I + L - 1 < Size.X then                { !!!  -1 is added }
  3117. 1135,1137c1135,1137
  3118. <         MoveChar(B[I], ' ', Byte(Color), 1);
  3119. >        {MoveChar(B[I], ' ', Byte(Color), 1);    !!!!  }
  3120. >         MoveCStr(B[I], T^.Text^, Color);                { [I+1] }
  3121. >         MoveChar(B[I + L], ' ', Byte(CNormal), 1);      { [I+L+1],' ',Byte(Color) }
  3122. 1139c1139
  3123. <       Inc(I, L + 2);
  3124. >       Inc(I, L + 1);                                    { L+2 }
  3125. 1192c1192
  3126. <       K := I + CStrLen(T^.Text^) + 2;
  3127. >       K := I + CStrLen(T^.Text^) + 1;  { !!! + 2 }
  3128. 1222c1222
  3129. <           Event.InfoPtr := nil;
  3130. >           Event.InfoPtr := T;
  3131. Comparing BP7\MSGBOX.PAS and VP\MSGBOX.PAS 
  3132. 13c13
  3133. < {$O+,F+,X+,I-,S-}
  3134. > {$X+,I-,S-}
  3135. 17c17
  3136. < uses Objects;
  3137. > uses Objects, Use32;
  3138. Comparing BP7\TEXTVIEW.PAS and VP\TEXTVIEW.PAS 
  3139. 13c13
  3140. < {$O+,F+,X+,I-,S-}
  3141. > {$X+,I-,S-,Cdecl-}
  3142. 17c17
  3143. < uses Objects, Drivers, Views, Dos;
  3144. > uses Objects, Drivers, Views, Dos, Use32;
  3145. 194c194
  3146. < procedure DecDi; near; assembler;
  3147. > procedure DecEDi; assembler; {$USES None} {$FRAME-}
  3148. 196,199c196,200
  3149. <         CMP     DI,WORD PTR [SI].TTerminal.Buffer
  3150. >                 cmp     edi,[esi].TTerminal.Buffer
  3151. >                 ja      @@1
  3152. >                 add     edi,[esi].TTerminal.BufSize
  3153. >               @@1:
  3154. >                 dec     edi
  3155. 202c203
  3156. < procedure IncDi; near; assembler;
  3157. > procedure IncEDi; assembler; {$USES None} {$FRAME-}
  3158. 204,210c205,211
  3159. <         INC     DI
  3160. >                 inc     edi
  3161. >                 mov     eax,[esi].TTerminal.Buffer
  3162. >                 add     eax,[esi].TTerminal.BufSize
  3163. >                 cmp     edi,eax
  3164. >                 jb      @@1
  3165. >                 mov     edi,[esi].TTerminal.Buffer
  3166. >               @@1:
  3167. 212a214,215
  3168. > {$USES esi,edi} {$FRAME-}
  3169. 217,257c220,266
  3170. <         PUSH    DS
  3171. >                 mov     esi,Self
  3172. >                 mov     edi,[esi].TTerminal.Buffer
  3173. >                 add     edi,Pos
  3174. >               @@1:
  3175. >                 mov     ecx,Lines
  3176. >                 jecxz   @@6
  3177. >                 mov     eax,[esi].TTerminal.QueBack
  3178. >                 add     eax,[esi].TTerminal.Buffer
  3179. >                 cmp     edi,eax
  3180. >                 je      @@7
  3181. >                 Call    DecEDI
  3182. >               @@2:
  3183. >                 mov     eax,[esi].TTerminal.QueBack
  3184. >                 add     eax,[esi].TTerminal.Buffer
  3185. >                 cmp     edi,eax
  3186. >                 ja      @@3
  3187. >                 mov     ecx,edi
  3188. >                 sub     ecx,[esi].TTerminal.Buffer
  3189. >                 jmp     @@4
  3190. >               @@3:
  3191. >                 mov     ecx,edi
  3192. >                 sub     ecx,eax
  3193. >               @@4:
  3194. >                 mov     al,LineSeparator
  3195. >                 inc     ecx
  3196. >                 std
  3197. >                 repne   scasb
  3198. >                 je      @@5
  3199. >                 mov     eax,edi
  3200. >                 sub     eax,[esi].TTerminal.Buffer
  3201. >                 inc     eax
  3202. >                 cmp     eax,[esi].TTerminal.QueBack
  3203. >                 je      @@8
  3204. >                 mov     edi,[esi].TTerminal.Buffer
  3205. >                 add     edi,[esi].TTerminal.BufSize
  3206. >                 dec     edi
  3207. >                 jmp     @@2
  3208. >               @@5:
  3209. >                 dec     Lines
  3210. >                 jnz     @@2
  3211. >               @@6:
  3212. >                 Call    IncEDI
  3213. >                 Call    IncEDI
  3214. >                 mov     eax,edi
  3215. >               @@7:
  3216. >                 sub     eax,[esi].TTerminal.Buffer
  3217. >               @@8:
  3218. 324c333
  3219. <     Filler: Array [1..12] of Char;
  3220. >     Filler: array [1..4] of Char;
  3221. 384c393
  3222. <     Handle := $FFFF;
  3223. >     Handle := $FFFFFFFF;
  3224. Comparing BP7\DIALOGS.PAS and VP\DIALOGS.PAS 
  3225. 13c13
  3226. < {$O+,F+,X+,I-,S-}
  3227. > {$X+,I-,S-,Cdecl-}
  3228. 17c17
  3229. < uses Objects, Drivers, Views, Validate;
  3230. > uses Objects, Drivers, Views, Validate, Use32;
  3231. 633,641d632
  3232. < function Max(A, B: Integer): Integer;
  3233. 1354,1372c1345,1349
  3234. < function TCluster.ButtonState(Item: Integer): Boolean; assembler;
  3235. > function TCluster.ButtonState(Item: Integer): Boolean;
  3236. > begin
  3237. >   if Item > 31
  3238. >     then ButtonState := False
  3239. >     else ButtonState := ((1 shl Item) and EnableMask) <> 0;
  3240. 1585,1613c1562,1581
  3241. < procedure TCluster.SetButtonState(AMask: Longint; Enable: Boolean); assembler;
  3242. > procedure TCluster.SetButtonState(AMask: Longint; Enable: Boolean);
  3243. > var
  3244. >   I,M: Longint;
  3245. > begin
  3246. >   if Enable then EnableMask := EnableMask or AMask
  3247. >             else EnableMask := EnableMask and not AMask;
  3248. >   if Strings.Count <= 32 then
  3249. >   begin
  3250. >     M := 1;
  3251. >     for I := 1 to Strings.Count do
  3252. >     begin
  3253. >       if (M and EnableMask) <> 0 then
  3254. >       begin
  3255. >         Options := Options or ofSelectable;
  3256. >         Exit;
  3257. >       end;
  3258. >       M := M shl 1;
  3259. >     end;
  3260. >     Options := Options and not ofSelectable;
  3261. >   end;
  3262. Comparing BP7\HISTLIST.PAS and VP\HISTLIST.PAS 
  3263. 13c13
  3264. < {$O+,F+,X+,I-,S-}
  3265. > {$X+,I-,S-,Cdecl-}
  3266. 18,21c18,21
  3267. <     Byte Byte String          Byte Byte String
  3268. >      Longint  String        StrLen Longint String        StrLen
  3269. >     +----------------------------+----------------------------+--...--+
  3270. >     |  Id   | History string | L |  Id   | History string | L |
  3271. >     +----------------------------+----------------------------+--...--+
  3272. 27c27
  3273. < uses Objects;
  3274. > uses Objects, Use32;
  3275. 31c31
  3276. <   HistorySize: Word = 1024;
  3277. >   HistorySize: Word = 2*1024;
  3278. 34,36c34,36
  3279. < procedure HistoryAdd(Id: Byte; const Str: String);
  3280. > procedure HistoryAdd(Id: Longint; const Str: String);
  3281. > function HistoryCount(Id: Longint): Word;
  3282. > function HistoryStr(Id: Longint; Index: Integer): String;
  3283. 48c48
  3284. <   CurId: Byte;
  3285. >   CurId: Longint;
  3286. 53c53
  3287. < procedure AdvanceStringPointer; near; assembler;
  3288. > procedure AdvanceStringPointer; assembler; {$USES esi} {$FRAME-}
  3289. 55,77c55,77
  3290. <         PUSH    DS
  3291. >                 mov     ecx,HistoryUsed
  3292. >                 mov     edx,CurId
  3293. >                 mov     esi,CurString
  3294. >                 test    esi,esi
  3295. >                 jz      @@4
  3296. >                 cld
  3297. >                 cmp     esi,HistoryBlock
  3298. >                 jne     @@2
  3299. >                 cmp     esi,ecx
  3300. >                 je      @@3
  3301. >               @@1:
  3302. >                 lodsd                   { History Id  }
  3303. >                 cmp     eax,edx         { edx = CurId }
  3304. >                 je      @@4
  3305. >               @@2:
  3306. >                 movzx   eax,Byte Ptr [esi]
  3307. >                 lea     esi,[esi+eax+2]
  3308. >                 cmp     esi,ecx         { ecx = HistoryUsed }
  3309. >                 jb      @@1
  3310. >               @@3:
  3311. >                 xor     esi,esi
  3312. >               @@4:
  3313. >                 mov     CurString,esi
  3314. 82c82
  3315. < procedure DeleteString; near; assembler;
  3316. > procedure DeleteString; assembler; {$USES esi,edi} {$FRAME-}
  3317. 84,100c84,92
  3318. <         PUSH    DS
  3319. >                 cld
  3320. >                 mov     ecx,HistoryUsed
  3321. >                 mov     esi,CurString
  3322. >                 lea     edi,[esi-TYPE Longint]
  3323. >                 movzx   eax,Byte Ptr [esi]
  3324. >                 lea     esi,[esi+eax+2]
  3325. >                 sub     ecx,esi
  3326. >                 rep     movsb
  3327. >                 mov     HistoryUsed,edi
  3328. 105c97
  3329. < procedure InsertString(Id: Byte; const Str: String); near; assembler;
  3330. > procedure InsertString(Id: Longint; const Str: String); assembler; {$USES ebx,esi,edi} {$FRAME-}
  3331. 107,160c99,139
  3332. <         PUSH    DS
  3333. > { Position edi to the end the buffer  }
  3334. > {          edx to beginning of buffer }
  3335. >                 mov     edx,HistoryBlock
  3336. >                 mov     edi,HistoryUsed
  3337. >                 mov     esi,Str
  3338. >                 movzx   ebx,Byte Ptr [esi]
  3339. >                 add     ebx,TYPE Longint + TYPE Byte + TYPE Byte
  3340. >               @@1:
  3341. >                 mov     eax,edi
  3342. >                 add     eax,ebx
  3343. >                 sub     eax,edx         { edx = HistoryBlock }
  3344. >                 cmp     eax,HistorySize
  3345. >                 jb      @@2
  3346. > { Drop the last string off the end of the list }
  3347. >                 movzx   eax,Byte Ptr [edi-1] { Last string length }
  3348. >                 sub     edi,eax
  3349. >                 sub     edi,TYPE Longint + TYPE Byte + TYPE Byte
  3350. >                 jmp     @@1
  3351. > { Move the table down the size of the string }
  3352. >               @@2:
  3353. >                 std
  3354. >                 mov     esi,edi
  3355. >                 add     edi,ebx
  3356. >                 mov     HistoryUsed,edi
  3357. >                 mov     ecx,esi
  3358. >                 sub     ecx,edx         { edx = HistoryBlock }
  3359. >                 dec     esi
  3360. >                 dec     edi
  3361. >                 rep     movsb
  3362. > { Copy the string into the position }
  3363. >                 cld
  3364. >                 mov     edi,edx         { edx = HistoryBlock }
  3365. >                 mov     eax,Id
  3366. >                 stosd                   { Id     }
  3367. >                 mov     esi,Str
  3368. >                 xor     eax,eax
  3369. >                 lodsb
  3370. >                 stosb                   { StrLen }
  3371. >                 mov     ecx,eax
  3372. >                 rep     movsb           { String }
  3373. >                 stosb                   { StrLen }
  3374. 163c142
  3375. < procedure StartId(Id: Byte); near;
  3376. > procedure StartId(Id: Longint);
  3377. 169c148
  3378. < function HistoryCount(Id: Byte): Word;
  3379. > function HistoryCount(Id: Longint): Word;
  3380. 184c163
  3381. < procedure HistoryAdd(Id: Byte; const Str: String);
  3382. > procedure HistoryAdd(Id: Longint; const Str: String);
  3383. 201c180
  3384. < function HistoryStr(Id: Byte; Index: Integer): String;
  3385. > function HistoryStr(Id: Longint; Index: Integer): String;
  3386. 214,215c193
  3387. <   PChar(HistoryBlock)^ := #0;
  3388. >   HistoryUsed := Longint(HistoryBlock);
  3389. 222c200
  3390. <   Size := HistoryUsed - PtrRec(HistoryBlock).Ofs;
  3391. >   Size := HistoryUsed - Longint(HistoryBlock);
  3392. 233c211
  3393. <   HistoryUsed := PtrRec(HistoryBlock).Ofs + Size;
  3394. >   HistoryUsed := Longint(HistoryBlock) + Size;
  3395. Comparing BP7\OUTLINE.PAS and VP\OUTLINE.PAS 
  3396. 13c13
  3397. < {$O+,F+,X+,I-,S-,R-}
  3398. > {$X+,I-,S-,R-,Cdecl-}
  3399. 17c17
  3400. < uses Objects, Drivers, Views;
  3401. > uses Objects, Drivers, Views, Use32;
  3402. 289c289
  3403. <   const Chars: String): String; assembler;
  3404. >   const Chars: String): String; assembler; {$USES ebx,esi,edi} {$FRAME-}
  3405. 298,299c298
  3406. <         PUSH    DS
  3407. >                 cld
  3408. 302,312c301,311
  3409. <         XOR     BX,BX
  3410. >                 xor     ebx,ebx
  3411. >                 mov     eax,Flags
  3412. >                 mov     Expanded,bl
  3413. >                 shr     eax,1
  3414. >                 adc     Expanded,bl
  3415. >                 mov     Children,bl
  3416. >                 shr     eax,1
  3417. >                 adc     Children,bl
  3418. >                 mov     Last,bl
  3419. >                 shr     eax,1
  3420. >                 adc     Last,bl
  3421. 315,321c314,319
  3422. <         LDS     SI,Chars
  3423. >                 mov     esi,Chars
  3424. >                 inc     esi
  3425. >                 mov     edi,@Result
  3426. >                 inc     edi
  3427. >                 mov     edx,Lines
  3428. >                 inc     Level
  3429. 324,338c322,335
  3430. <         JMP     @@2
  3431. >                 jmp     @@2
  3432. >               @@1:
  3433. >                 xor     ebx,ebx
  3434. >                 shr     edx,1
  3435. >                 rcl     ebx,1
  3436. >                 mov     al,[esi].FillerOrBar[ebx]
  3437. >                 stosb
  3438. >                 mov     al,[esi].FillerOrBar
  3439. >                 mov     ecx,LevWidth
  3440. >                 dec     ecx
  3441. >                 rep     stosb
  3442. >               @@2:
  3443. >                 dec     Level
  3444. >                 jnz     @@1
  3445. 341,365c338,362
  3446. <         MOV     BH,0
  3447. >                 mov     ecx,EndWidth
  3448. >                 dec     ecx
  3449. >                 jz      @@4
  3450. >                 mov     bl,Last
  3451. >                 mov     al,[esi].YorL[ebx]
  3452. >                 stosb
  3453. >                 dec     ecx
  3454. >                 jz      @@4
  3455. >                 dec     ecx
  3456. >                 jz      @@3
  3457. >                 mov     al,[esi].StraightOrTee
  3458. >                 rep     stosb
  3459. >               @@3:
  3460. >                 mov     bl,Children
  3461. >                 mov     al,[esi].StraightOrTee[ebx]
  3462. >                 stosb
  3463. >               @@4:
  3464. >                 mov     bl,Expanded
  3465. >                 mov     al,[esi].Retracted[ebx]
  3466. >                 stosb
  3467. >                 mov     eax,edi
  3468. >                 mov     edi,@Result
  3469. >                 sub     eax,edi
  3470. >                 dec     eax
  3471. >                 stosb
  3472. 370,373c367,370
  3473. < function CallerFrame: Word; inline(
  3474. > function CallerFrame: Word; assembler; {$USES None} {$FRAME-}
  3475. > asm
  3476. >                 mov     eax,[ebp]
  3477. > end;
  3478. 403c400
  3479. < { Called whenever Node is receives focus }
  3480. > { Called whenever Node receives focus }
  3481. 521,522d517
  3482. <   label
  3483. 527c522
  3484. <     Children: Boolean;
  3485. >     Children,Done: Boolean;
  3486. 541a537,544
  3487. >     { IMPORTANT! Virtual Pascal's code generation differs from BP's one.}
  3488. >     { In the prolog of a nested procedure Virtual Pascal uses 'ENTER'   }
  3489. >     { CPU instruction with the appropriate lexical (nested) level.      }
  3490. >     { Exact lexical level of a procedure that issues FirstThat or       }
  3491. >     { ForEach is NOT known here. So I made an assumption that FirstThat }
  3492. >     { or ForEach CANNOT BE ISSUED FROM THE PROCEDURE WITH THE LEXICAL   }
  3493. >     { LEVEL GREATER THAN 3. For example, FirstThat function is called   }
  3494. >     { in a GetFocusedGraphic function which lexical level is 2.         }
  3495. 543,557c546,568
  3496. <         LES     DI,Cur                     { Push Cur }
  3497. >                 push    DWord Ptr [ebp-12] { Preserve local variables   }
  3498. >                 push    DWord Ptr [ebp-8]
  3499. >                 mov     ecx,[ebp-4]     { Load parent frame into ecx    }
  3500. >                 push    ecx             { Save it on stack              }
  3501. >                 push    Cur             { [1] = Cur: Pointer;           }
  3502. >                 push    Level           { [2] = Level: Integer;         }
  3503. >                 push    DWord Ptr [ecx+OFFSET Position] { [3] = Position: Integer; }
  3504. >                 push    Lines           { [4] = Lines: LongInt;         }
  3505. >                 push    Flags           { [5] = Flags: Word;            }
  3506. >                 mov     edx,[ecx+OFFSET CallerFrame]
  3507. >                 mov     eax,[edx-4]     { Copy stack frames of the      }
  3508. >                 mov     [ebp-4],eax     { parents                       }
  3509. >                 mov     eax,[edx-8]
  3510. >                 mov     [ebp-8],eax
  3511. >                 mov     eax,[edx-12]
  3512. >                 mov     [ebp-12],eax
  3513. >                 Call    DWord Ptr [ecx+OFFSET Action]
  3514. >                 pop     ecx
  3515. >                 pop     DWord Ptr [ebp-8]
  3516. >                 pop     DWord Ptr [ebp-12]
  3517. >                 mov     [ebp-4],ecx     { Restore parent frame          }
  3518. >                 and     al,[ecx+OFFSET CheckRslt].Boolean { Force to 0 if CheckRslt False }
  3519. >                 setnz   Done
  3520. 559a571,572
  3521. >     if Done then Exit;
  3522. 574d586
  3523. <   Retn:
  3524. 580c592
  3525. <   asm                           { Convert 0, 1 to 0, FF }
  3526. >   asm   {$SAVES ALL}            { Convert 0, 1 to 0, FF }
  3527. 877c889
  3528. <    
  3529. Comparing BP7\STDDLG.PAS and VP\STDDLG.PAS 
  3530. 13c13
  3531. < {$O+,F+,V-,X+,I-,S-}
  3532. > {$V-,X+,I-,S-,Cdecl-}
  3533. 17c17
  3534. < uses Objects, Drivers, Views, Dialogs, Dos;
  3535. > uses Objects, Drivers, Views, Dialogs, Os2Def, Os2Base, Dos, Use32;
  3536. 27c27
  3537. <   cmChDir       = 804;   { Used by TChDirDialog internally }
  3538. >   cmChangeDir   = 804;   { Used by TChDirDialog internally }
  3539. 46c46
  3540. <     Name: string[12];
  3541. >     Name: String;
  3542. 101c101
  3543. <     procedure ReadDirectory(AWildCard: PathStr);
  3544. >     procedure ReadDirectory(AWildCard: PathStr); virtual;
  3545. 152d151
  3546. <   private
  3547. 213d211
  3548. <   private
  3549. 295a294,296
  3550. > function PathValid(var Path: PathStr): Boolean; { !!! made public }
  3551. > function IsWild(const S: String): Boolean;      { !!! made public }
  3552. > function IsDir(const S: String): Boolean;       { !!! made public }
  3553. 301,319c302,308
  3554. < function DriveValid(Drive: Char): Boolean; near; assembler;
  3555. > function DriveValid(Drive: Char): Boolean;
  3556. > var
  3557. >   DriveNum,LogDrvMap: ULong;
  3558. > begin                   { LogDrvMap: Bit 0: 'A:', Bit 1: 'B:', etc }
  3559. >   if DosQueryCurrentDisk(DriveNum,LogDrvMap) = 0
  3560. >     then DriveValid := ((1 shl (Ord(Drive) - Ord('A'))) and LogDrvMap) <> 0
  3561. >     else DriveValid := False;
  3562. 333a323
  3563. >     FindClose(SR);
  3564. 339c329
  3565. <   IllegalChars = ';,=+<>|"[] \';
  3566. >   IllegalChars = ';,=+<>|"[] ';
  3567. 346c336
  3568. < function Contains(S1, S2: String): Boolean; near; assembler;
  3569. > function Contains(S1, S2: String): Boolean; assembler; {$USES esi,edi}{$FRAME-}
  3570. 348,371c338,363
  3571. <         PUSH    DS
  3572. >                 cld
  3573. >                 xor     eax,eax
  3574. >                 xor     ecx,ecx
  3575. >                 mov     esi,S1
  3576. >                 mov     edx,S2
  3577. >                 lodsb
  3578. >                 test    al,al
  3579. >                 jz      @@4
  3580. >                 mov     ah,al
  3581. >                 mov     cl,[edx]
  3582. >                 inc     edx
  3583. >               @@1:
  3584. >                 push    ecx
  3585. >                 mov     edi,edx
  3586. >                 lodsb
  3587. >                 repne   scasb
  3588. >                 pop     ecx
  3589. >                 je      @@3
  3590. >                 dec     ah
  3591. >                 jnz     @@1
  3592. >               @@2:
  3593. >                 xor     al,al
  3594. >                 jmp     @@4
  3595. >               @@3:
  3596. >                 mov     al,1
  3597. >               @@4:
  3598. 393c385
  3599. <  
  3600. 409a402
  3601. >   FindClose(SR);
  3602. 677a671
  3603. >   FindClose(S);
  3604. 692a687
  3605. >   FindClose(S);
  3606. 708a704
  3607. >       FindClose(S);
  3608. 752c748
  3609. <   Month: array[1..12] of String[3] = 
  3610. >   Month: array[1..12] of String[3] =
  3611. 950c946
  3612. < function NoWildChars(S: String): String; near; assembler;
  3613. > function NoWildChars(S: String): String; assembler; {$USES esi,edi} {$FRAME-}
  3614. 952,972c948,968
  3615. <         PUSH    DS
  3616. >                 mov     esi,S
  3617. >                 xor     eax,eax
  3618. >                 lodsb
  3619. >                 mov     ecx,eax
  3620. >                 mov     edx,@Result
  3621. >                 lea     edi,[edx+1]
  3622. >                 jecxz   @@3
  3623. >               @@1:
  3624. >                 lodsb
  3625. >                 cmp     al,'?'
  3626. >                 je      @@2
  3627. >                 cmp     al,'*'
  3628. >                 je      @@2
  3629. >                 stosb
  3630. >               @@2:
  3631. >                 loop    @@1
  3632. >               @@3:
  3633. >                 mov     eax,edi
  3634. >                 sub     eax,edx
  3635. >                 dec     eax
  3636. >                 mov     [edx],al
  3637. 1076,1078c1072,1074
  3638. <           Directory := NewSTr(FName+'\');
  3639. >           Directory := NewSTr(FName+'\');
  3640. >           if Command <> cmFileInit then FileList^.Select;
  3641. >           FileList^.ReadDirectory(Directory^+WildCard);
  3642. 1179c1175
  3643. < function NewDirEntry(const DisplayText, Directory: String): PDirEntry; near;
  3644. > function NewDirEntry(const DisplayText, Directory: String): PDirEntry;
  3645. 1189,1193c1185,1190
  3646. < function GetCurDrive: Char; near; assembler;
  3647. > function GetCurDrive: Char;
  3648. > var
  3649. >   DriveNum,LogDrvMap: ULong;
  3650. > begin
  3651. >   DosQueryCurrentDisk(DriveNum,LogDrvMap);      { DriveNum: 1='A', 2='B', etc }
  3652. >   GetCurDrive := Chr(DriveNum + Ord('A') - 1);
  3653. 1209c1206
  3654. <         begin
  3655. >         begin
  3656. 1211,1212c1208,1209
  3657. <           begin
  3658. >           begin
  3659. >             S := FirstDir + OldC;
  3660. 1216c1213
  3661. <           AList^.Insert(NewDirEntry(S, OldC + ':\'));
  3662. >           AList^.Insert(NewDirEntry(S, OldC + ':\'));
  3663. 1259,1262c1256,1259
  3664. <         begin
  3665. >         begin
  3666. >           S := FirstDir;
  3667. >           isFirst := False;
  3668. >         end else S := MiddleDir;
  3669. 1266a1264
  3670. >     FindClose(SR);
  3671. Comparing BP7\VIEWS.PAS and VP\VIEWS.PAS 
  3672. 13c13
  3673. < {$O+,F+,X+,I-,S-}
  3674. > {$X+,I-,S-,Cdecl-}
  3675. 17c17
  3676. < uses Objects, Drivers, Memory;
  3677. > uses Objects, Drivers, Memory, Use32;
  3678. 192c192
  3679. <   TDrawBuffer = array[0..MaxViewWidth - 1] of Word;
  3680. >   TDrawBuffer = array[0..MaxViewWidth - 1] of SmallWord;
  3681. 423c423
  3682. <   TVideoBuf = array[0..3999] of Word;
  3683. >   TVideoBuf = array[0..3999] of SmallWord;
  3684. 621a622,623
  3685. > uses Os2Def, Os2Base;
  3686. 642a645,663
  3687. > { Far16 functions cannot be called directly from BASM code because Virtual    }
  3688. > { Pascal calls 16-bit functions via special run-time library thunk routine.   }
  3689. > { That is why these interface function are used instead.                      }
  3690. > function Vio32ShowBuf(BufOfs,Len,VioHandle: Word): ApiRet;
  3691. > begin
  3692. >   VioShowBuf(BufOfs,Len,VioHandle);
  3693. > end;
  3694. > function Vio32SetCurPos(Row,Column: Word; VioHandle: Word): ApiRet;
  3695. > begin
  3696. >   VioSetCurPos(Row,Column,VioHandle);
  3697. > end;
  3698. > function Vio32SetCurType(var CurData: VioCursorInfo; VioHandle: Word): ApiRet;
  3699. > begin
  3700. >   VioSetCurType(CurData,VioHandle);
  3701. > end;
  3702. 647c668
  3703. < procedure MapColor; near; assembler;
  3704. > procedure MapColor; assembler; {$USES ebx} {$FRAME-}
  3705. 649c670
  3706. <   Self = 6;
  3707. >   Self = 8;
  3708. 652,681c673,698
  3709. <         OR      AL,AL
  3710. >                 test    al,al
  3711. >                 jz      @@3
  3712. >                 mov     ecx,[ebp].Self
  3713. >               @@1:
  3714. >                 push    ecx
  3715. >                 push    eax
  3716. >                 push    ecx                     { [1]:Pointer = Self    }
  3717. >                 mov     ecx,[ecx]
  3718. >                 Call    DWord Ptr [ecx].TView_GetPalette
  3719. >                 mov     ebx,eax
  3720. >                 pop     eax
  3721. >                 pop     ecx
  3722. >                 test    ebx,ebx
  3723. >                 jz      @@2
  3724. >                 cmp     al,[ebx]
  3725. >                 ja      @@3
  3726. >                 xlat
  3727. >                 test    al,al
  3728. >                 jz      @@3
  3729. >               @@2:
  3730. >                 mov     ecx,[ecx].TView.Owner
  3731. >                 jecxz   @@4
  3732. >                 jmp     @@1
  3733. >               @@3:
  3734. >                 mov     al,ErrorAttr
  3735. >               @@4:
  3736. 688c705
  3737. < procedure MapCPair; near; assembler;
  3738. > procedure MapCPair; assembler; {$USES None} {$FRAME-}
  3739. 690,695c707,713
  3740. <         OR      AH,AH
  3741. >                 test    ah,ah
  3742. >                 jz      @@1
  3743. >                 xchg    al,ah
  3744. >                 Call    MapColor
  3745. >                 xchg    al,ah
  3746. >               @@1:
  3747. >                 Call    MapColor
  3748. 699,702c717,720
  3749. < { In    AX    = Y coordinate                            }
  3750. > { In    eax   = Y coordinate                            }
  3751. > {       ebx   = X coordinate                            }
  3752. > {       ecx   = Count                                   }
  3753. > {       edi   = Buffer Pointer                          }
  3754. 704c722
  3755. < procedure WriteView; near; assembler;
  3756. > procedure WriteView; assembler; {$USES None} {$FRAME-}
  3757. 706c724
  3758. <   Self   =   6;
  3759. >   Self   =   8;
  3760. 709c727
  3761. <   BufOfs = -10;
  3762. >   BufOfs = -12;
  3763. 711,937c729,935
  3764. <         MOV     [BP].BufOfs,BX
  3765. >                 mov     [ebp].BufOfs,ebx
  3766. >                 mov     [ebp].Buffer[0],edi
  3767. >                 add     ecx,ebx
  3768. >                 xor     edx,edx         { edx = Flag (0:Char&Attr,1:Char only) }
  3769. >                 mov     edi,[ebp].Self
  3770. >                 test    eax,eax
  3771. >                 jl      @@3
  3772. >                 cmp     eax,[edi].TView.Size.Y
  3773. >                 jge     @@3
  3774. >                 test    ebx,ebx
  3775. >                 jge     @@1
  3776. >                 xor     ebx,ebx
  3777. >               @@1:
  3778. >                 cmp     ecx,[edi].TView.Size.X
  3779. >                 jle     @@2
  3780. >                 mov     ecx,[edi].TView.Size.X
  3781. >               @@2:
  3782. >                 cmp     ebx,ecx
  3783. >                 jl      @@10
  3784. >               @@3:
  3785. >                 ret
  3786. >               @@10:
  3787. >                 test    [edi].TView.State,sfVisible
  3788. >                 jz      @@3
  3789. >                 cmp     [edi].TView.Owner,0
  3790. >                 jz      @@3
  3791. >                 mov     [ebp].Target,edi
  3792. >                 add     eax,[edi].TView.Origin.Y
  3793. >                 mov     esi,[edi].TView.Origin.X
  3794. >                 add     ebx,esi
  3795. >                 add     ecx,esi
  3796. >                 add     [ebp].BufOfs,esi
  3797. >                 mov     edi,[edi].TView.Owner
  3798. >                 cmp     eax,[edi].TGroup.Clip.A.Y
  3799. >                 jl      @@3
  3800. >                 cmp     eax,[edi].TGroup.Clip.B.Y
  3801. >                 jge     @@3
  3802. >                 cmp     ebx,[edi].TGroup.Clip.A.X
  3803. >                 jge     @@11
  3804. >                 mov     ebx,[edi].TGroup.Clip.A.X
  3805. >               @@11:
  3806. >                 cmp     ecx,[edi].TGroup.Clip.B.X
  3807. >                 jle     @@12
  3808. >                 mov     ecx,[edi].TGroup.Clip.B.X
  3809. >               @@12:
  3810. >                 cmp     ebx,ecx
  3811. >                 jge     @@3
  3812. >                 mov     edi,[edi].TGroup.Last
  3813. >               @@20:
  3814. >                 mov     edi,[edi].TView.Next
  3815. >                 cmp     edi,[ebp].Target
  3816. >                 je      @@40
  3817. >                 test    [edi].TView.State,sfVisible
  3818. >                 jz      @@20
  3819. >                 mov     esi,[edi].TView.Origin.Y
  3820. >                 cmp     eax,esi
  3821. >                 jl      @@20
  3822. >                 add     esi,[edi].TView.Size.Y
  3823. >                 cmp     eax,esi
  3824. >                 jl      @@23
  3825. >                 test    [edi].TView.State,sfShadow
  3826. >                 jz      @@20
  3827. >                 add     esi,ShadowSize.Y
  3828. >                 cmp     eax,esi
  3829. >                 jge     @@20
  3830. >                 mov     esi,[edi].TView.Origin.X
  3831. >                 add     esi,ShadowSize.X
  3832. >                 cmp     ebx,esi
  3833. >                 jge     @@22
  3834. >                 cmp     ecx,esi
  3835. >                 jle     @@20
  3836. >                 Call    @@30
  3837. >               @@22:
  3838. >                 add     esi,[edi].TView.Size.X
  3839. >                 jmp     @@26
  3840. >               @@23:
  3841. >                 mov     esi,[edi].TView.Origin.X
  3842. >                 cmp     ebx,esi
  3843. >                 jge     @@24
  3844. >                 cmp     ecx,esi
  3845. >                 jle     @@20
  3846. >                 Call    @@30
  3847. >               @@24:
  3848. >                 add     esi,[edi].TView.Size.X
  3849. >                 cmp     ebx,esi
  3850. >                 jge     @@25
  3851. >                 cmp     ecx,esi
  3852. >                 jle     @@31
  3853. >                 mov     ebx,esi
  3854. >               @@25:
  3855. >                 test    [edi].TView.State,sfShadow
  3856. >                 je      @@20
  3857. >                 push    esi
  3858. >                 mov     esi,[edi].TView.Origin.Y
  3859. >                 add     esi,ShadowSize.Y
  3860. >                 cmp     eax,esi
  3861. >                 pop     esi
  3862. >                 jl      @@27
  3863. >                 add     esi,ShadowSize.X
  3864. >               @@26:
  3865. >                 cmp     ebx,esi
  3866. >                 jge     @@27
  3867. >                 inc     edx
  3868. >                 cmp     ecx,esi
  3869. >                 jle     @@27
  3870. >                 Call    @@30
  3871. >                 dec     edx
  3872. >               @@27:
  3873. >                 jmp     @@20
  3874. >               @@30:
  3875. >                 push    DWord Ptr [ebp].Target
  3876. >                 push    DWord Ptr [ebp].BufOfs
  3877. >                 push    edi
  3878. >                 push    esi
  3879. >                 push    edx
  3880. >                 push    ecx
  3881. >                 push    eax
  3882. >                 mov     ecx,esi
  3883. >                 Call    @@20
  3884. >                 pop     eax
  3885. >                 pop     ecx
  3886. >                 pop     edx
  3887. >                 pop     esi
  3888. >                 pop     edi
  3889. >                 pop     DWord Ptr [ebp].BufOfs
  3890. >                 pop     DWord Ptr [ebp].Target
  3891. >                 mov     ebx,esi
  3892. >               @@31:
  3893. >                 ret
  3894. >               @@40:
  3895. >                 mov     edi,[edi].TView.Owner
  3896. >                 mov     esi,[edi].TGroup.Buffer
  3897. >                 test    esi,esi
  3898. >                 jz      @@44
  3899. >                 cmp     esi,ScreenBuffer
  3900. >                 jne     @@43
  3901. >                 Call    UpdateMouseWhere
  3902. >                 cmp     eax,MouseWhere.Y
  3903. >                 jne     @@43
  3904. >                 cmp     ebx,MouseWhere.X
  3905. >                 ja      @@43
  3906. >                 cmp     ecx,MouseWhere.X
  3907. >                 jbe     @@43
  3908. >                 Call    HideMouse
  3909. >                 Call    @@50
  3910. >                 Call    ShowMouse
  3911. >                 jmp     @@44
  3912. >               @@43:
  3913. >                 Call    @@50
  3914. >               @@44:
  3915. >                 cmp     [edi].TGroup.LockFlag,0
  3916. >                 jne     @@31
  3917. >                 jmp     @@10
  3918. > { Copy to Buffer }
  3919. >               @@50:
  3920. >                 push    edi
  3921. >                 push    ecx
  3922. >                 push    ebx
  3923. >                 push    eax
  3924. >                 mul     [edi].TView.Size.X.Byte[0]
  3925. >                 add     eax,ebx
  3926. >                 lea     edi,[esi+eax*2]
  3927. >                 xor     al,al
  3928. >                 mov     ah,ShadowAttr
  3929. >                 sub     ecx,ebx
  3930. >                 xchg    esi,ebx
  3931. >                 sub     esi,[ebp].BufOfs
  3932. >                 shl     esi,1
  3933. >                 add     esi,[ebp].Buffer
  3934. >                 push    edi
  3935. >                 push    ecx
  3936. >                 cld
  3937. >                 test    edx,edx
  3938. >                 jnz     @@52
  3939. >                 shr     ecx,1
  3940. >                 rep     movsd
  3941. >                 adc     ecx,ecx
  3942. >                 rep     movsw
  3943. >                 jmp     @@53
  3944. >               @@52:
  3945. >                 lodsb
  3946. >                 inc     esi
  3947. >                 stosw
  3948. >                 loop    @@52
  3949. >               @@53:
  3950. >                 pop     ecx
  3951. >                 pop     edi
  3952. >                 mov     eax,ScreenBuffer
  3953. >                 cmp     ebx,eax
  3954. >                 jne     @@54
  3955. >                 shl     ecx,1
  3956. >                 sub     edi,eax
  3957. >                 push    edi                     { [1]:DWord = Offset }
  3958. >                 push    ecx                     { [2]:DWord = Length }
  3959. >                 push    0                       { [3]:DWord = Handle }
  3960. >                 Call    Vio32ShowBuf
  3961. >               @@54:
  3962. >                 pop     eax
  3963. >                 pop     ebx
  3964. >                 pop     ecx
  3965. >                 pop     edi
  3966. >                 ret
  3967. 1222c1220
  3968. < procedure TView.GetBounds(var Bounds: TRect); assembler;
  3969. > procedure TView.GetBounds(var Bounds: TRect); assembler; {$USES esi,edi}{$FRAME-}
  3970. 1224,1241c1222,1237
  3971. <         PUSH    DS
  3972. >                 mov     esi,Self
  3973. >                 add     esi,OFFSET TView.Origin
  3974. >                 mov     edi,Bounds
  3975. >                 cld
  3976. >                 lodsd                           {Origin.X}
  3977. >                 mov     ecx,eax
  3978. >                 stosd
  3979. >                 lodsd                           {Origin.Y}
  3980. >                 mov     edx,eax
  3981. >                 stosd
  3982. >                 lodsd                           {Size.X}
  3983. >                 add     eax,ecx
  3984. >                 stosd
  3985. >                 lodsd                           {Size.Y}
  3986. >                 add     eax,edx
  3987. >                 stosd
  3988. 1249c1245
  3989. < function TView.Exposed: Boolean; assembler;
  3990. > function TView.Exposed: Boolean; assembler; {$USES ebx,esi,edi} {$FRAME+}
  3991. 1253,1353c1249,1354
  3992. <         LES     DI,Self
  3993. >                 mov     edi,Self
  3994. >                 test    [edi].TView.State,sfExposed
  3995. >                 je      @@2
  3996. >                 xor     eax,eax
  3997. >                 cmp     eax,[edi].TView.Size.X
  3998. >                 jge     @@2
  3999. >                 cmp     eax,[edi].TView.Size.Y
  4000. >                 jge     @@2
  4001. >               @@1:
  4002. >                 xor     ebx,ebx
  4003. >                 mov     ecx,[edi].TView.Size.X
  4004. >                 push    eax
  4005. >                 Call    @@11
  4006. >                 pop     eax
  4007. >                 jnc     @@3
  4008. >                 mov     edi,Self
  4009. >                 inc     eax
  4010. >                 cmp     eax,[edi].TView.Size.Y
  4011. >                 jl      @@1
  4012. >               @@2:
  4013. >                 mov     al,0
  4014. >                 jmp     @@30
  4015. >               @@3:
  4016. >                 mov     al,1
  4017. >                 jmp     @@30
  4018. >               @@8:
  4019. >                 stc
  4020. >               @@9:
  4021. >                 ret
  4022. >               @@10:
  4023. >                 mov     edi,[edi].TView.Owner
  4024. >                 cmp     [edi].TGroup.Buffer,0
  4025. >                 jne     @@9
  4026. >               @@11:
  4027. >                 mov     Target,edi
  4028. >                 add     eax,[edi].TView.Origin.Y
  4029. >                 mov     esi,[edi].TView.Origin.X
  4030. >                 add     ebx,esi
  4031. >                 add     ecx,esi
  4032. >                 mov     edi,[edi].TView.Owner
  4033. >                 test    edi,edi
  4034. >                 jz      @@9
  4035. >                 cmp     eax,[edi].TGroup.Clip.A.Y
  4036. >                 jl      @@8
  4037. >                 cmp     eax,[edi].TGroup.Clip.B.Y
  4038. >                 jge     @@8
  4039. >                 cmp     ebx,[edi].TGroup.Clip.A.X
  4040. >                 jge     @@12
  4041. >                 mov     ebx,[edi].TGroup.Clip.A.X
  4042. >               @@12:
  4043. >                 cmp     ecx,[edi].TGroup.Clip.B.X
  4044. >                 jle     @@13
  4045. >                 mov     ecx,[edi].TGroup.Clip.B.X
  4046. >               @@13:
  4047. >                 cmp     ebx,ecx
  4048. >                 jge     @@8
  4049. >                 mov     edi,[edi].TGroup.Last
  4050. >               @@20:
  4051. >                 mov     edi,[edi].TView.Next
  4052. >                 cmp     edi,Target
  4053. >                 je      @@10
  4054. >                 test    [edi].TView.State,sfVisible
  4055. >                 jz      @@20
  4056. >                 mov     esi,[edi].TView.Origin.Y
  4057. >                 cmp     eax,esi
  4058. >                 jl      @@20
  4059. >                 add     esi,[edi].TView.Size.Y
  4060. >                 cmp     eax,esi
  4061. >                 jge     @@20
  4062. >                 mov     esi,[edi].TView.Origin.X
  4063. >                 cmp     ebx,esi
  4064. >                 jl      @@22
  4065. >                 add     esi,[edi].TView.Size.X
  4066. >                 cmp     ebx,esi
  4067. >                 jge     @@20
  4068. >                 mov     ebx,esi
  4069. >                 cmp     ebx,ecx
  4070. >                 jl      @@20
  4071. >                 stc
  4072. >                 ret
  4073. >               @@22:
  4074. >                 cmp     ecx,esi
  4075. >                 jle     @@20
  4076. >                 add     esi,[edi].TView.Size.X
  4077. >                 cmp     ecx,esi
  4078. >                 jg      @@23
  4079. >                 mov     ecx,[edi].TView.Origin.X
  4080. >                 jmp     @@20
  4081. >               @@23:
  4082. >                 push    Target
  4083. >                 push    edi
  4084. >                 push    esi
  4085. >                 push    ecx
  4086. >                 push    eax
  4087. >                 mov     ecx,[edi].TView.Origin.X
  4088. >                 Call    @@20
  4089. >                 pop     eax
  4090. >                 pop     ecx
  4091. >                 pop     ebx
  4092. >                 pop     edi
  4093. >                 pop     Target
  4094. >                 jc      @@20
  4095. >                 retn
  4096. >               @@30:
  4097. 1385c1386
  4098. < function TView.GetColor(Color: Word): Word; assembler;
  4099. > function TView.GetColor(Color: Word): Word; assembler; {$USES None} {$FRAME+}
  4100. 1387,1388c1388,1389
  4101. <         MOV     AX,Color
  4102. >                 mov     eax,Color
  4103. >                 Call    MapCPair
  4104. 1405c1406
  4105. < procedure TView.GetExtent(var Extent: TRect); assembler;
  4106. > procedure TView.GetExtent(var Extent: TRect); assembler; {$USES esi,edi}{$FRAME-}
  4107. 1407,1417c1408,1416
  4108. <         PUSH    DS
  4109. >                 mov     esi,Self
  4110. >                 add     esi,OFFSET TView.Size
  4111. >                 mov     edi,Extent
  4112. >                 cld
  4113. >                 xor     eax,eax
  4114. >                 stosd
  4115. >                 stosd
  4116. >                 movsd
  4117. >                 movsd
  4118. 1519a1519,1520
  4119. > {$USES None} {$FRAME-}
  4120. 1522,1537c1523,1536
  4121. <         LES     DI,Self
  4122. >                 mov     ecx,Self
  4123. >                 xor     eax,eax
  4124. >                 mov     edx,eax
  4125. >               @@1:
  4126. >                 add     eax,[ecx].TView.Origin.X
  4127. >                 add     edx,[ecx].TView.Origin.Y
  4128. >                 mov     ecx,[ecx].TView.Owner
  4129. >                 test    ecx,ecx
  4130. >                 jnz     @@1
  4131. >                 add     eax,Source.X
  4132. >                 add     edx,Source.Y
  4133. >                 mov     ecx,Dest
  4134. >                 mov     [ecx].TPoint.X,eax
  4135. >                 mov     [ecx].TPoint.Y,edx
  4136. 1539a1539,1540
  4137. > {$USES None} {$FRAME-}
  4138. 1542,1559c1543,1558
  4139. <         LES     DI,Self
  4140. >                 mov     ecx,Self
  4141. >                 xor     eax,eax
  4142. >                 mov     edx,eax
  4143. >               @@1:
  4144. >                 add     eax,[ecx].TView.Origin.X
  4145. >                 add     edx,[ecx].TView.Origin.Y
  4146. >                 mov     ecx,[ecx].TView.Owner
  4147. >                 test    ecx,ecx
  4148. >                 jnz     @@1
  4149. >                 neg     eax
  4150. >                 neg     edx
  4151. >                 add     eax,Source.X
  4152. >                 add     edx,Source.Y
  4153. >                 mov     ecx,Dest
  4154. >                 mov     [ecx].TPoint.X,eax
  4155. >                 mov     [ecx].TPoint.Y,edx
  4156. 1595c1594
  4157. < function TView.Prev: PView; assembler;
  4158. > function TView.Prev: PView; assembler; {$USES None} {$FRAME-}
  4159. 1597,1607c1596,1602
  4160. <         LES     DI,Self
  4161. >                 mov     edx,Self
  4162. >                 mov     ecx,edx
  4163. >               @@1:
  4164. >                 mov     eax,edx
  4165. >                 mov     edx,[edx].TView.Next
  4166. >                 cmp     edx,ecx
  4167. >                 jne     @@1
  4168. 1635c1630
  4169. <       
  4170. 1665c1660,1662
  4171. < procedure TView.ResetCursor; assembler;
  4172. > procedure TView.ResetCursor; assembler; {$USES esi,edi} {$FRAME-}
  4173. > const
  4174. >   CurData: VioCursorInfo = (yStart: 0; cEnd: 0; cx: 1; attr: 0);
  4175. 1667,1730c1664,1738
  4176. <         LES     DI,Self
  4177. >                 mov     edi,Self
  4178. >                 mov     eax,[edi].TView.State
  4179. >                 not     eax
  4180. >                 test    eax,sfVisible+sfCursorVis+sfFocused
  4181. >                 jne     @@Hide
  4182. >                 mov     eax,[edi].TView.Cursor.Y
  4183. >                 mov     edx,[edi].TView.Cursor.X
  4184. >               @@1:
  4185. >                 test    eax,eax
  4186. >                 jl      @@Hide
  4187. >                 cmp     eax,[edi].TView.Size.Y
  4188. >                 jge     @@Hide
  4189. >                 test    edx,edx
  4190. >                 jl      @@Hide
  4191. >                 cmp     edx,[edi].TView.Size.X
  4192. >                 jge     @@Hide
  4193. >                 add     eax,[edi].TView.Origin.Y
  4194. >                 add     edx,[edi].TView.Origin.X
  4195. >                 mov     ecx,edi
  4196. >                 mov     edi,[edi].TView.Owner
  4197. >                 test    edi,edi
  4198. >                 jz      @@Show
  4199. >                 test    [edi].TView.State,sfVisible
  4200. >                 je      @@Hide
  4201. >                 mov     edi,[edi].TGroup.Last
  4202. >               @@2:
  4203. >                 mov     edi,[edi].TView.Next
  4204. >                 cmp     ecx,edi
  4205. >                 jne     @@3
  4206. >                 mov     edi,[edi].TView.Owner
  4207. >                 jmp     @@1
  4208. >               @@3:
  4209. >                 test    [edi].TView.State,sfVisible
  4210. >                 je      @@2
  4211. >                 mov     esi,[edi].TView.Origin.Y
  4212. >                 cmp     eax,esi
  4213. >                 jl      @@2
  4214. >                 add     esi,[edi].TView.Size.Y
  4215. >                 cmp     eax,esi
  4216. >                 jge     @@2
  4217. >                 mov     esi,[edi].TView.Origin.X
  4218. >                 cmp     edx,esi
  4219. >                 jl      @@2
  4220. >                 add     esi,[edi].TView.Size.X
  4221. >                 cmp     edx,esi
  4222. >                 jge     @@2
  4223. >               @@Hide:
  4224. >                 xor     eax,eax
  4225. >                 dec     eax                     { Color = -1: Invisible }
  4226. >                 xor     ecx,ecx
  4227. >                 jmp     @@4
  4228. > { Set Cursor Position }
  4229. >               @@Show:
  4230. >                 push    eax                     { [1]:DWord = Row       }
  4231. >                 push    edx                     { [2]:DWord = Column    }
  4232. >                 push    0                       { [3]:Word = Handle     }
  4233. >                 Call    Vio32SetCurPos
  4234. > { Set Cursor Shape }
  4235. >                 xor     eax,eax                 { Color: Visible    }
  4236. >                 mov     cx,CursorLines
  4237. >                 mov     edi,Self
  4238. >                 test    [edi].TView.State,sfCursorIns
  4239. >                 jz      @@4
  4240. >                 mov     ch,1
  4241. >                 test    cl,cl
  4242. >                 jne     @@4
  4243. >                 mov     cl,7
  4244. >               @@4:
  4245. >                 lea     edx,CurData
  4246. >                 mov     [edx].VioCursorInfo.attr,ax
  4247. >                 mov     [edx].VioCursorInfo.yStart.Byte,ch
  4248. >                 mov     [edx].VioCursorInfo.cEnd.Byte,cl
  4249. >                 push    edx                     { [1]:Pointer= @CurData }
  4250. >                 push    0                       { [2]:DWord  = Handle   }
  4251. >                 Call    Vio32SetCurType
  4252. 1740c1748
  4253. < procedure TView.SetBounds(var Bounds: TRect); assembler;
  4254. > procedure TView.SetBounds(var Bounds: TRect); assembler; {$USES None} {$FRAME-}
  4255. 1742,1755c1750,1761
  4256. <         PUSH    DS
  4257. >                 mov     edx,Self
  4258. >                 mov     ecx,Bounds
  4259. >                 mov     eax,[ecx].TRect.A.X
  4260. >                 mov     [edx].Origin.X,eax
  4261. >                 mov     eax,[ecx].TRect.A.Y
  4262. >                 mov     [edx].Origin.Y,eax
  4263. >                 mov     eax,[ecx].TRect.B.X
  4264. >                 sub     eax,[ecx].TRect.A.X
  4265. >                 mov     [edx].Size.X,eax
  4266. >                 mov     eax,[ecx].TRect.B.Y
  4267. >                 sub     eax,[ecx].TRect.A.Y
  4268. >                 mov     [edx].Size.Y,eax
  4269. 1824,1827c1830,1837
  4270. <   Longint(Min) := 0;
  4271. >   Min.X := 0;
  4272. >   Min.Y := 0;
  4273. >   if Owner <> nil then Max := Owner^.Size
  4274. >  else
  4275. >   begin
  4276. >     Max.X := MaxLongint;
  4277. >     Max.Y := MaxLongint;
  4278. >   end;
  4279. 1860a1871,1872
  4280. > {$USES ebx,esi,edi} {$FRAME+}
  4281. 1867,1880c1879,1893
  4282. <         CMP     H,0
  4283. >                 cmp     H,0
  4284. >                 jle     @@2
  4285. >               @@1:
  4286. >                 mov     eax,Y
  4287. >                 mov     ebx,X
  4288. >                 mov     ecx,W
  4289. >                 mov     edi,Buf
  4290. >                 Call    WriteView
  4291. >                 mov     eax,W
  4292. >                 shl     eax,1
  4293. >                 add     Buf,eax
  4294. >                 inc     Y
  4295. >                 dec     H
  4296. >                 jnz     @@1
  4297. >               @@2:
  4298. 1882a1896,1897
  4299. > {$USES ebx,esi,edi} {$FRAME+}
  4300. 1890,1914c1905,1937
  4301. <         MOV     AL,Color
  4302. >                 mov     al,Color
  4303. >                 Call    MapColor
  4304. >                 mov     ah,al
  4305. >                 mov     al,C
  4306. >                 mov     ecx,Count
  4307. >                 test    ecx,ecx
  4308. >                 jle     @@2
  4309. >                 cmp     ecx,256
  4310. >                 jle     @@1
  4311. >                 mov     ecx,256
  4312. >               @@1:
  4313. >                 lea     ebx,[ecx*2+2]
  4314. >                 and     ebx,NOT 11b
  4315. >                 sub     esp,ebx
  4316. >                 mov     edi,esp
  4317. >                 mov     edx,eax
  4318. >                 shl     eax,16
  4319. >                 mov     ax,dx
  4320. >                 mov     edx,ecx
  4321. >                 cld
  4322. >                 shr     ecx,1
  4323. >                 rep     stosd
  4324. >                 adc     ecx,ecx
  4325. >                 rep     stosw
  4326. >                 mov     ecx,edx
  4327. >                 mov     edi,esp
  4328. >                 mov     eax,Y
  4329. >                 push    ebx
  4330. >                 mov     ebx,X
  4331. >                 Call    WriteView
  4332. >                 pop     eax
  4333. >                 add     esp,eax
  4334. >               @@2:
  4335. 1916a1940,1941
  4336. > {$USES ebx,esi,edi} {$FRAME+}
  4337. 1923,1933c1948,1959
  4338. <         CMP     H,0
  4339. >                 cmp     H,0
  4340. >                 jle     @@2
  4341. >               @@1:
  4342. >                 mov     eax,Y
  4343. >                 mov     ebx,X
  4344. >                 mov     ecx,W
  4345. >                 mov     edi,Buf
  4346. >                 Call    WriteView
  4347. >                 inc     Y
  4348. >                 dec     H
  4349. >                 jne     @@1
  4350. >               @@2:
  4351. 1935a1962,1963
  4352. > {$USES ebx,esi,edi} {$FRAME+}
  4353. 1942,1970c1970,1996
  4354. <         MOV     AL,Color
  4355. >                 mov     al,Color
  4356. >                 Call    MapColor
  4357. >                 mov     ah,al
  4358. >                 mov     esi,Str
  4359. >                 xor     ecx,ecx
  4360. >                 cld
  4361. >                 lodsb
  4362. >                 mov     cl,al
  4363. >                 jecxz   @@2
  4364. >                 lea     ebx,[ecx*2+2]
  4365. >                 and     ebx,NOT 11b
  4366. >                 sub     esp,ebx
  4367. >                 mov     edi,esp
  4368. >                 mov     edx,ecx
  4369. >               @@1:
  4370. >                 lodsb
  4371. >                 stosw
  4372. >                 loop    @@1
  4373. >                 mov     ecx,edx
  4374. >                 mov     edi,esp
  4375. >                 mov     eax,Y
  4376. >                 push    ebx
  4377. >                 mov     ebx,X
  4378. >                 Call    WriteView
  4379. >                 pop     eax
  4380. >                 add     esp,eax
  4381. >               @@2:
  4382. 1983c2009
  4383. <   Color: Byte); assembler;
  4384. >   Color: Byte); assembler; {$USES ebx,esi,edi} {$FRAME-}
  4385. 1993,2065c2019,2093
  4386. <         LES     BX,Self
  4387. >                 mov     ebx,Self
  4388. >                 mov     edx,[ebx].TFrame.Size.X
  4389. >                 lea     ecx,[edx-2]
  4390. >                 mov     esi,OFFSET InitFrame
  4391. >                 add     esi,N
  4392. >                 lea     edi,FrameMask
  4393. >                 cld
  4394. >                 movsb
  4395. >                 lodsb
  4396. >                 rep     stosb
  4397. >                 movsb
  4398. >                 mov     ebx,[ebx].TFrame.Owner
  4399. >                 mov     ebx,[ebx].TGroup.Last
  4400. >                 dec     edx
  4401. >               @@1:
  4402. >                 mov     ebx,[ebx].TView.Next
  4403. >                 cmp     ebx,Self
  4404. >                 je      @@10
  4405. >               @@2:
  4406. >                 test    [ebx].TView.Options,ofFramed
  4407. >                 je      @@1
  4408. >                 test    [ebx].TView.State,sfVisible
  4409. >                 je      @@1
  4410. >                 mov     eax,Y
  4411. >                 sub     eax,[ebx].TView.Origin.Y
  4412. >                 jl      @@3
  4413. >                 cmp     eax,[ebx].TView.Size.Y
  4414. >                 jg      @@1
  4415. >                 mov     ax,0005h
  4416. >                 jl      @@4
  4417. >                 mov     ax,0A03h
  4418. >                 jmp     @@4
  4419. >               @@3:
  4420. >                 inc     eax
  4421. >                 jne     @@1
  4422. >                 mov     ax,0A06h
  4423. >               @@4:
  4424. >                 mov     esi,[ebx].TView.Origin.X
  4425. >                 mov     edi,[ebx].TView.Size.X
  4426. >                 add     edi,esi
  4427. >                 cmp     esi,1
  4428. >                 jg      @@5
  4429. >                 xor     esi,esi
  4430. >                 inc     esi
  4431. >               @@5:
  4432. >                 cmp     edi,edx
  4433. >                 jl      @@6
  4434. >                 mov     edi,edx
  4435. >               @@6:
  4436. >                 cmp     esi,edi
  4437. >                 jge     @@1
  4438. >                 or      Byte Ptr FrameMask[esi-1],AL
  4439. >                 xor     al,ah
  4440. >                 or      Byte Ptr FrameMask[edi],AL
  4441. >                 test    ah,ah
  4442. >                 jz      @@1
  4443. >                 mov     ecx,edi
  4444. >                 sub     ecx,esi
  4445. >               @@8:
  4446. >                 or      Byte Ptr FrameMask[esi],ah
  4447. >                 inc     esi
  4448. >                 loop    @@8
  4449. >                 jmp     @@1
  4450. >               @@10:
  4451. >                 inc     edx
  4452. >                 mov     ah,Color
  4453. >                 mov     ebx,OFFSET FrameChars
  4454. >                 mov     ecx,edx
  4455. >                 lea     esi,FrameMask
  4456. >                 mov     edi,FrameBuf
  4457. >               @@11:
  4458. >                 lodsb
  4459. >                 xlat
  4460. >                 stosw
  4461. >                 loop    @@11
  4462. 2130c2158
  4463. <       else if Longint(Owner^.Size) = Longint(Max) then
  4464. >       else if (Owner^.Size.X = Max.X) and (Owner^.Size.Y = Max.Y) then
  4465. 2306c2334
  4466. <     GetPos := LongDiv(LongMul(Value - Min, GetSize - 3) + R shr 1, R) + 1;
  4467. >     GetPos := ((Value - Min) * (GetSize - 3) + R shr 1) div R + 1;
  4468. 2388c2416
  4469. <             SetValue(LongDiv(LongMul(P - 1, Max - Min) + S shr 1, S) + Min);
  4470. >             SetValue(((P - 1) * (Max - Min) + S shr 1) div S + Min);
  4471. 2900c2928
  4472. <   EventMask := $FFFF;
  4473. >   EventMask := $FFFFFFFF;
  4474. 2909a2938
  4475. >   SaveESP: Word;
  4476. 2917,2929c2946,2956
  4477. <   asm
  4478. >   asm         {$SAVES ebx,edx,esi}
  4479. >                 mov     SaveESP,esp
  4480. >                 mov     ecx,Count
  4481. >                 shl     ecx,2
  4482. >                 sub     esp,ecx
  4483. >                 mov     FixupList,esp
  4484. >                 mov     edi,esp
  4485. >                 xor     eax,eax
  4486. >                 shr     ecx,2
  4487. >                 cld
  4488. >                 rep     stosd
  4489. 2952a2980
  4490. >   asm   mov esp,SaveESP   end;
  4491. 2977c3005
  4492. < function TGroup.At(Index: Integer): PView; assembler;
  4493. > function TGroup.At(Index: Integer): PView; assembler; {$USES None} {$FRAME-}
  4494. 2979,2985c3007,3012
  4495. <         LES     DI,Self
  4496. >                 mov     eax,Self
  4497. >                 mov     eax,[eax].TGroup.Last
  4498. >                 mov     ecx,Index
  4499. >               @@1:
  4500. >                 mov     eax,[eax].TView.Next
  4501. >                 loop    @@1
  4502. 2990c3017
  4503. <   procedure DoAwaken(P: PView); far;
  4504. >   procedure DoAwaken(P: PView);
  4505. 3003c3030
  4506. < procedure DoCalcChange(P: PView); far;
  4507. > procedure DoCalcChange(P: PView);
  4508. 3014c3041
  4509. <   if Longint(D) = 0 then
  4510. >   if (D.X or D.Y) = 0 then
  4511. 3034c3061
  4512. < procedure AddSubviewDataSize(P: PView); far;
  4513. > procedure AddSubviewDataSize(P: PView);
  4514. 3152c3179
  4515. < function Matches(P: PView): Boolean; far;
  4516. > function Matches(P: PView): Boolean;
  4517. 3162c3189
  4518. < function TGroup.FirstThat(P: Pointer): PView; assembler;
  4519. > function TGroup.FirstThat(P: Pointer): PView; assembler; {$USES None} {$FRAME-}
  4520. 3166,3193c3193,3210
  4521. <         LES     DI,Self
  4522. >                 mov     eax,Self
  4523. >                 mov     eax,[eax].TGroup.Last
  4524. >                 test    eax,eax
  4525. >                 jz      @@2
  4526. >                 mov     ALast,eax
  4527. >               @@1:
  4528. >                 mov     ecx,P
  4529. >                 mov     eax,[eax].TView.Next
  4530. >                 push    eax
  4531. >                 push    eax                     {[1]:Pointer = PView }
  4532. >                 Call    ecx
  4533. >                 test    al,al
  4534. >                 pop     eax
  4535. >                 jnz     @@2
  4536. >                 cmp     eax,ALast
  4537. >                 jne     @@1
  4538. >                 xor     eax,eax
  4539. >               @@2:
  4540. 3221c3238
  4541. < procedure TGroup.ForEach(P: Pointer); assembler;
  4542. > procedure TGroup.ForEach(P: Pointer); assembler; {$USES ebx} {$FRAME-}
  4543. 3225,3249c3242,3259
  4544. <         LES     DI,Self
  4545. >                 mov     ecx,Self
  4546. >                 mov     ecx,[ecx].TGroup.Last
  4547. >                 jecxz   @@4
  4548. >                 mov     ebx,P
  4549. >                 mov     ALast,ecx
  4550. >                 mov     ecx,[ecx].TView.Next
  4551. >               @@1:
  4552. >                 cmp     ecx,ALast
  4553. >                 je      @@3
  4554. >                 push    [ecx].TView.Next
  4555. >                 push    ecx
  4556. >                 Call    ebx
  4557. >                 pop     ecx
  4558. >                 jmp     @@1
  4559. >               @@3:
  4560. >                 push    ecx
  4561. >                 Call    ebx
  4562. >               @@4:
  4563. 3258,3259c3268
  4564. < { Allocate a group buffer if the group is exposed, buffered, and
  4565. > { Allocate a group buffer if the group is exposed and buffered }
  4566. 3261c3270
  4567. < procedure TGroup.GetBuffer; assembler;
  4568. > procedure TGroup.GetBuffer; assembler; {$USES None} {$FRAME-}
  4569. 3263,3282c3272,3289
  4570. <         LES     DI,Self
  4571. >                 mov     ecx,Self
  4572. >                 test    [ecx].State,sfExposed
  4573. >                 jz      @@1
  4574. >                 test    [ecx].Options,ofBuffered
  4575. >                 jz      @@1
  4576. >                 cmp     [ecx].Buffer,0
  4577. >                 jnz     @@1
  4578. >                 mov     eax,[ecx].TView.Size.X
  4579. >                 mul     [ecx].TView.Size.Y
  4580. >                 jo      @@1
  4581. >                 shl     eax,1
  4582. >                 jc      @@1
  4583. >                 js      @@1
  4584. >                 lea     ecx,[ecx].TView.Buffer
  4585. >                 push    ecx             { [1]:Pointer = @ of the buffer@ }
  4586. >                 push    eax             { [2]:Pointer = Buffer Size      }
  4587. >                 Call    NewCache
  4588. >               @@1:
  4589. 3327c3334
  4590. < procedure DoHandleEvent(P: PView); far;
  4591. > procedure DoHandleEvent(P: PView);
  4592. 3338c3345
  4593. < function ContainsMouse(P: PView): Boolean; far;
  4594. > function ContainsMouse(P: PView): Boolean;
  4595. 3363c3370
  4596. < function TGroup.IndexOf(P: PView): Integer; assembler;
  4597. > function TGroup.IndexOf(P: PView): Integer; assembler; {$USES None} {$FRAME-}
  4598. 3365,3385c3372,3386
  4599. <         LES     DI,Self
  4600. >                 mov     ecx,Self
  4601. >                 mov     ecx,[ecx].TGroup.Last
  4602. >                 jecxz   @@2
  4603. >                 mov     edx,ecx
  4604. >                 xor     eax,eax
  4605. >               @@1:
  4606. >                 inc     eax
  4607. >                 mov     ecx,[ecx].TView.Next
  4608. >                 cmp     ecx,P
  4609. >                 je      @@3
  4610. >                 cmp     ecx,edx
  4611. >                 jne     @@1
  4612. >               @@2:
  4613. >                 xor     eax,eax
  4614. >               @@3:
  4615. 3451c3452
  4616. < procedure TGroup.RemoveView(P: PView); assembler;
  4617. > procedure TGroup.RemoveView(P: PView); assembler; {$USES edi} {$FRAME+}
  4618. 3453,3498c3454,3479
  4619. <         PUSH    DS
  4620. >                 mov     edx,Self
  4621. >                 mov     edi,P
  4622. >                 mov     edx,[edx].TGroup.Last
  4623. >                 test    edx,edx
  4624. >                 jz      @@4
  4625. >                 mov     eax,edx
  4626. >               @@1:
  4627. >                 mov     ecx,[edx].TView.Next
  4628. >                 cmp     ecx,edi
  4629. >                 je      @@2
  4630. >                 cmp     ecx,eax
  4631. >                 je      @@4
  4632. >                 mov     edx,ecx
  4633. >                 jmp     @@1
  4634. >               @@2:
  4635. >                 mov     ecx,[edi].TView.Next
  4636. >                 mov     [edx].TView.Next,ecx
  4637. >                 cmp     eax,edi
  4638. >                 jne     @@4
  4639. >                 cmp     ecx,edi
  4640. >                 jne     @@3
  4641. >                 xor     edx,edx
  4642. >               @@3:
  4643. >                 mov     edi,Self
  4644. >                 mov     [edi].TView.Last,edx
  4645. >               @@4:
  4646. 3566c3547
  4647. < procedure DoSetState(P: PView); far;
  4648. > procedure DoSetState(P: PView);
  4649. 3571c3552
  4650. < procedure DoExpose(P: PView); far;
  4651. > procedure DoExpose(P: PView);
  4652. 3600c3581
  4653. < procedure DoPut(P: PView); far;
  4654. > procedure DoPut(P: PView);
  4655. 3627c3608
  4656. < function IsInvalid(P: PView): Boolean; far;
  4657. > function IsInvalid(P: PView): Boolean;
  4658. 3820c3801
  4659. <   if Longint(Size) <> Longint(Max) then
  4660. >   if (Size.X <> Max.X) or (Size.Y <> Max.Y) then
  4661. 3823c3804,3805
  4662. <     Longint(R.A) := 0;
  4663. >     R.A.X := 0;
  4664. >     R.A.Y := 0;
  4665.