d_spr8.asm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887
  1. .386P
  2. .model FLAT
  3. externdef _d_zistepu:dword
  4. externdef _d_pzbuffer:dword
  5. externdef _d_zistepv:dword
  6. externdef _d_zrowbytes:dword
  7. externdef _d_ziorigin:dword
  8. externdef _r_turb_s:dword
  9. externdef _r_turb_t:dword
  10. externdef _r_turb_pdest:dword
  11. externdef _r_turb_spancount:dword
  12. externdef _r_turb_turb:dword
  13. externdef _r_turb_pbase:dword
  14. externdef _r_turb_sstep:dword
  15. externdef _r_turb_tstep:dword
  16. externdef _r_bmodelactive:dword
  17. externdef _d_sdivzstepu:dword
  18. externdef _d_tdivzstepu:dword
  19. externdef _d_sdivzstepv:dword
  20. externdef _d_tdivzstepv:dword
  21. externdef _d_sdivzorigin:dword
  22. externdef _d_tdivzorigin:dword
  23. externdef _sadjust:dword
  24. externdef _tadjust:dword
  25. externdef _bbextents:dword
  26. externdef _bbextentt:dword
  27. externdef _cacheblock:dword
  28. externdef _d_viewbuffer:dword
  29. externdef _cachewidth:dword
  30. externdef _d_pzbuffer:dword
  31. externdef _d_zrowbytes:dword
  32. externdef _d_zwidth:dword
  33. externdef _d_scantable:dword
  34. externdef _r_lightptr:dword
  35. externdef _r_numvblocks:dword
  36. externdef _prowdestbase:dword
  37. externdef _pbasesource:dword
  38. externdef _r_lightwidth:dword
  39. externdef _lightright:dword
  40. externdef _lightrightstep:dword
  41. externdef _lightdeltastep:dword
  42. externdef _lightdelta:dword
  43. externdef _lightright:dword
  44. externdef _lightdelta:dword
  45. externdef _sourcetstep:dword
  46. externdef _surfrowbytes:dword
  47. externdef _lightrightstep:dword
  48. externdef _lightdeltastep:dword
  49. externdef _r_sourcemax:dword
  50. externdef _r_stepback:dword
  51. externdef _colormap:dword
  52. externdef _blocksize:dword
  53. externdef _sourcesstep:dword
  54. externdef _lightleft:dword
  55. externdef _blockdivshift:dword
  56. externdef _blockdivmask:dword
  57. externdef _lightleftstep:dword
  58. externdef _r_origin:dword
  59. externdef _r_ppn:dword
  60. externdef _r_pup:dword
  61. externdef _r_pright:dword
  62. externdef _ycenter:dword
  63. externdef _xcenter:dword
  64. externdef _d_vrectbottom_particle:dword
  65. externdef _d_vrectright_particle:dword
  66. externdef _d_vrecty:dword
  67. externdef _d_vrectx:dword
  68. externdef _d_pix_shift:dword
  69. externdef _d_pix_min:dword
  70. externdef _d_pix_max:dword
  71. externdef _d_y_aspect_shift:dword
  72. externdef _screenwidth:dword
  73. externdef _vright:dword
  74. externdef _vup:dword
  75. externdef _vpn:dword
  76. externdef _BOPS_Error:dword
  77. externdef _snd_scaletable:dword
  78. externdef _paintbuffer:dword
  79. externdef _snd_linear_count:dword
  80. externdef _snd_p:dword
  81. externdef _snd_vol:dword
  82. externdef _snd_out:dword
  83. externdef _r_leftclipped:dword
  84. externdef _r_leftenter:dword
  85. externdef _r_rightclipped:dword
  86. externdef _r_rightenter:dword
  87. externdef _modelorg:dword
  88. externdef _xscale:dword
  89. externdef _r_refdef:dword
  90. externdef _yscale:dword
  91. externdef _r_leftexit:dword
  92. externdef _r_rightexit:dword
  93. externdef _r_lastvertvalid:dword
  94. externdef _cacheoffset:dword
  95. externdef _newedges:dword
  96. externdef _removeedges:dword
  97. externdef _r_pedge:dword
  98. externdef _r_framecount:dword
  99. externdef _r_u1:dword
  100. externdef _r_emitted:dword
  101. externdef _edge_p:dword
  102. externdef _surface_p:dword
  103. externdef _surfaces:dword
  104. externdef _r_lzi1:dword
  105. externdef _r_v1:dword
  106. externdef _r_ceilv1:dword
  107. externdef _r_nearzi:dword
  108. externdef _r_nearzionly:dword
  109. externdef _edge_aftertail:dword
  110. externdef _edge_tail:dword
  111. externdef _current_iv:dword
  112. externdef _edge_head_u_shift20:dword
  113. externdef _span_p:dword
  114. externdef _edge_head:dword
  115. externdef _fv:dword
  116. externdef _edge_tail_u_shift20:dword
  117. externdef _r_apverts:dword
  118. externdef _r_anumverts:dword
  119. externdef _aliastransform:dword
  120. externdef _r_avertexnormals:dword
  121. externdef _r_plightvec:dword
  122. externdef _r_ambientlight:dword
  123. externdef _r_shadelight:dword
  124. externdef _aliasxcenter:dword
  125. externdef _aliasycenter:dword
  126. externdef _a_sstepxfrac:dword
  127. externdef _r_affinetridesc:dword
  128. externdef _acolormap:dword
  129. externdef _d_pcolormap:dword
  130. externdef _r_affinetridesc:dword
  131. externdef _d_sfrac:dword
  132. externdef _d_ptex:dword
  133. externdef _d_pedgespanpackage:dword
  134. externdef _d_tfrac:dword
  135. externdef _d_light:dword
  136. externdef _d_zi:dword
  137. externdef _d_pdest:dword
  138. externdef _d_pz:dword
  139. externdef _d_aspancount:dword
  140. externdef _erroradjustup:dword
  141. externdef _errorterm:dword
  142. externdef _d_xdenom:dword
  143. externdef _r_p0:dword
  144. externdef _r_p1:dword
  145. externdef _r_p2:dword
  146. externdef _a_tstepxfrac:dword
  147. externdef _r_sstepx:dword
  148. externdef _r_tstepx:dword
  149. externdef _a_ststepxwhole:dword
  150. externdef _zspantable:dword
  151. externdef _skintable:dword
  152. externdef _r_zistepx:dword
  153. externdef _erroradjustdown:dword
  154. externdef _d_countextrastep:dword
  155. externdef _ubasestep:dword
  156. externdef _a_ststepxwhole:dword
  157. externdef _a_tstepxfrac:dword
  158. externdef _r_lstepx:dword
  159. externdef _a_spans:dword
  160. externdef _erroradjustdown:dword
  161. externdef _d_pdestextrastep:dword
  162. externdef _d_pzextrastep:dword
  163. externdef _d_sfracextrastep:dword
  164. externdef _d_ptexextrastep:dword
  165. externdef _d_countextrastep:dword
  166. externdef _d_tfracextrastep:dword
  167. externdef _d_lightextrastep:dword
  168. externdef _d_ziextrastep:dword
  169. externdef _d_pdestbasestep:dword
  170. externdef _d_pzbasestep:dword
  171. externdef _d_sfracbasestep:dword
  172. externdef _d_ptexbasestep:dword
  173. externdef _ubasestep:dword
  174. externdef _d_tfracbasestep:dword
  175. externdef _d_lightbasestep:dword
  176. externdef _d_zibasestep:dword
  177. externdef _zspantable:dword
  178. externdef _r_lstepy:dword
  179. externdef _r_sstepy:dword
  180. externdef _r_tstepy:dword
  181. externdef _r_zistepy:dword
  182. externdef _D_PolysetSetEdgeTable:dword
  183. externdef _D_RasterizeAliasPolySmooth:dword
  184. externdef float_point5:dword
  185. externdef Float2ToThe31nd:dword
  186. externdef izistep:dword
  187. externdef izi:dword
  188. externdef FloatMinus2ToThe31nd:dword
  189. externdef float_1:dword
  190. externdef float_particle_z_clip:dword
  191. externdef float_minus_1:dword
  192. externdef float_0:dword
  193. externdef fp_16:dword
  194. externdef fp_64k:dword
  195. externdef fp_1m:dword
  196. externdef fp_1m_minus_1:dword
  197. externdef fp_8:dword
  198. externdef entryvec_table:dword
  199. externdef advancetable:dword
  200. externdef sstep:dword
  201. externdef tstep:dword
  202. externdef pspantemp:dword
  203. externdef counttemp:dword
  204. externdef jumptemp:dword
  205. externdef reciprocal_table:dword
  206. externdef DP_Count:dword
  207. externdef DP_u:dword
  208. externdef DP_v:dword
  209. externdef DP_32768:dword
  210. externdef DP_Color:dword
  211. externdef DP_Pix:dword
  212. externdef DP_EntryTable:dword
  213. externdef pbase:dword
  214. externdef s:dword
  215. externdef t:dword
  216. externdef sfracf:dword
  217. externdef tfracf:dword
  218. externdef snext:dword
  219. externdef tnext:dword
  220. externdef spancountminus1:dword
  221. externdef zi16stepu:dword
  222. externdef sdivz16stepu:dword
  223. externdef tdivz16stepu:dword
  224. externdef zi8stepu:dword
  225. externdef sdivz8stepu:dword
  226. externdef tdivz8stepu:dword
  227. externdef reciprocal_table_16:dword
  228. externdef entryvec_table_16:dword
  229. externdef ceil_cw:dword
  230. externdef single_cw:dword
  231. externdef fp_64kx64k:dword
  232. externdef pz:dword
  233. externdef spr8entryvec_table:dword
  234. _TEXT SEGMENT
  235. LClampHigh0:
  236. mov esi,ds:dword ptr[_bbextents]
  237. jmp LClampReentry0
  238. LClampHighOrLow0:
  239. jg LClampHigh0
  240. xor esi,esi
  241. jmp LClampReentry0
  242. LClampHigh1:
  243. mov edx,ds:dword ptr[_bbextentt]
  244. jmp LClampReentry1
  245. LClampHighOrLow1:
  246. jg LClampHigh1
  247. xor edx,edx
  248. jmp LClampReentry1
  249. LClampLow2:
  250. mov ebp,2048
  251. jmp LClampReentry2
  252. LClampHigh2:
  253. mov ebp,ds:dword ptr[_bbextents]
  254. jmp LClampReentry2
  255. LClampLow3:
  256. mov ecx,2048
  257. jmp LClampReentry3
  258. LClampHigh3:
  259. mov ecx,ds:dword ptr[_bbextentt]
  260. jmp LClampReentry3
  261. LClampLow4:
  262. mov eax,2048
  263. jmp LClampReentry4
  264. LClampHigh4:
  265. mov eax,ds:dword ptr[_bbextents]
  266. jmp LClampReentry4
  267. LClampLow5:
  268. mov ebx,2048
  269. jmp LClampReentry5
  270. LClampHigh5:
  271. mov ebx,ds:dword ptr[_bbextentt]
  272. jmp LClampReentry5
  273. align 4
  274. public _D_SpriteDrawSpans
  275. _D_SpriteDrawSpans:
  276. push ebp
  277. push edi
  278. push esi
  279. push ebx
  280. fld ds:dword ptr[_d_sdivzstepu]
  281. fmul ds:dword ptr[fp_8]
  282. mov edx,ds:dword ptr[_cacheblock]
  283. fld ds:dword ptr[_d_tdivzstepu]
  284. fmul ds:dword ptr[fp_8]
  285. mov ebx,ds:dword ptr[4+16+esp]
  286. fld ds:dword ptr[_d_zistepu]
  287. fmul ds:dword ptr[fp_8]
  288. mov ds:dword ptr[pbase],edx
  289. fld ds:dword ptr[_d_zistepu]
  290. fmul ds:dword ptr[fp_64kx64k]
  291. fxch st(3)
  292. fstp ds:dword ptr[sdivz8stepu]
  293. fstp ds:dword ptr[zi8stepu]
  294. fstp ds:dword ptr[tdivz8stepu]
  295. fistp ds:dword ptr[izistep]
  296. mov eax,ds:dword ptr[izistep]
  297. ror eax,16
  298. mov ecx,ds:dword ptr[8+ebx]
  299. mov ds:dword ptr[izistep],eax
  300. cmp ecx,0
  301. jle LNextSpan
  302. LSpanLoop:
  303. fild ds:dword ptr[4+ebx]
  304. fild ds:dword ptr[0+ebx]
  305. fld st(1)
  306. fmul ds:dword ptr[_d_sdivzstepv]
  307. fld st(1)
  308. fmul ds:dword ptr[_d_sdivzstepu]
  309. fld st(2)
  310. fmul ds:dword ptr[_d_tdivzstepu]
  311. fxch st(1)
  312. faddp st(2),st(0)
  313. fxch st(1)
  314. fld st(3)
  315. fmul ds:dword ptr[_d_tdivzstepv]
  316. fxch st(1)
  317. fadd ds:dword ptr[_d_sdivzorigin]
  318. fxch st(4)
  319. fmul ds:dword ptr[_d_zistepv]
  320. fxch st(1)
  321. faddp st(2),st(0)
  322. fxch st(2)
  323. fmul ds:dword ptr[_d_zistepu]
  324. fxch st(1)
  325. fadd ds:dword ptr[_d_tdivzorigin]
  326. fxch st(2)
  327. faddp st(1),st(0)
  328. fld ds:dword ptr[fp_64k]
  329. fxch st(1)
  330. fadd ds:dword ptr[_d_ziorigin]
  331. fld st(0)
  332. fmul ds:dword ptr[fp_64kx64k]
  333. fxch st(1)
  334. fdiv st(2),st(0)
  335. fxch st(1)
  336. fistp ds:dword ptr[izi]
  337. mov ebp,ds:dword ptr[izi]
  338. ror ebp,16
  339. mov eax,ds:dword ptr[4+ebx]
  340. mov ds:dword ptr[izi],ebp
  341. mov ebp,ds:dword ptr[0+ebx]
  342. imul ds:dword ptr[_d_zrowbytes]
  343. shl ebp,1
  344. add eax,ds:dword ptr[_d_pzbuffer]
  345. add eax,ebp
  346. mov ds:dword ptr[pz],eax
  347. mov ebp,ds:dword ptr[_d_viewbuffer]
  348. mov eax,ds:dword ptr[4+ebx]
  349. push ebx
  350. mov edx,ds:dword ptr[_tadjust]
  351. mov esi,ds:dword ptr[_sadjust]
  352. mov edi,ds:dword ptr[_d_scantable+eax*4]
  353. add edi,ebp
  354. mov ebp,ds:dword ptr[0+ebx]
  355. add edi,ebp
  356. cmp ecx,8
  357. ja LSetupNotLast1
  358. dec ecx
  359. jz LCleanup1
  360. mov ds:dword ptr[spancountminus1],ecx
  361. fxch st(1)
  362. fld st(0)
  363. fmul st(0),st(4)
  364. fxch st(1)
  365. fmul st(0),st(3)
  366. fxch st(1)
  367. fistp ds:dword ptr[s]
  368. fistp ds:dword ptr[t]
  369. fild ds:dword ptr[spancountminus1]
  370. fld ds:dword ptr[_d_tdivzstepu]
  371. fld ds:dword ptr[_d_zistepu]
  372. fmul st(0),st(2)
  373. fxch st(1)
  374. fmul st(0),st(2)
  375. fxch st(2)
  376. fmul ds:dword ptr[_d_sdivzstepu]
  377. fxch st(1)
  378. faddp st(3),st(0)
  379. fxch st(1)
  380. faddp st(3),st(0)
  381. faddp st(3),st(0)
  382. fld ds:dword ptr[fp_64k]
  383. fdiv st(0),st(1)
  384. jmp LFDIVInFlight1
  385. LCleanup1:
  386. fxch st(1)
  387. fld st(0)
  388. fmul st(0),st(4)
  389. fxch st(1)
  390. fmul st(0),st(3)
  391. fxch st(1)
  392. fistp ds:dword ptr[s]
  393. fistp ds:dword ptr[t]
  394. jmp LFDIVInFlight1
  395. align 4
  396. LSetupNotLast1:
  397. fxch st(1)
  398. fld st(0)
  399. fmul st(0),st(4)
  400. fxch st(1)
  401. fmul st(0),st(3)
  402. fxch st(1)
  403. fistp ds:dword ptr[s]
  404. fistp ds:dword ptr[t]
  405. fadd ds:dword ptr[zi8stepu]
  406. fxch st(2)
  407. fadd ds:dword ptr[sdivz8stepu]
  408. fxch st(2)
  409. fld ds:dword ptr[tdivz8stepu]
  410. faddp st(2),st(0)
  411. fld ds:dword ptr[fp_64k]
  412. fdiv st(0),st(1)
  413. LFDIVInFlight1:
  414. add esi,ds:dword ptr[s]
  415. add edx,ds:dword ptr[t]
  416. mov ebx,ds:dword ptr[_bbextents]
  417. mov ebp,ds:dword ptr[_bbextentt]
  418. cmp esi,ebx
  419. ja LClampHighOrLow0
  420. LClampReentry0:
  421. mov ds:dword ptr[s],esi
  422. mov ebx,ds:dword ptr[pbase]
  423. shl esi,16
  424. cmp edx,ebp
  425. mov ds:dword ptr[sfracf],esi
  426. ja LClampHighOrLow1
  427. LClampReentry1:
  428. mov ds:dword ptr[t],edx
  429. mov esi,ds:dword ptr[s]
  430. shl edx,16
  431. mov eax,ds:dword ptr[t]
  432. sar esi,16
  433. mov ds:dword ptr[tfracf],edx
  434. sar eax,16
  435. add esi,ebx
  436. imul eax,ds:dword ptr[_cachewidth]
  437. add esi,eax
  438. cmp ecx,8
  439. jna LLastSegment
  440. LNotLastSegment:
  441. fld st(0)
  442. fmul st(0),st(4)
  443. fxch st(1)
  444. fmul st(0),st(3)
  445. fxch st(1)
  446. fistp ds:dword ptr[snext]
  447. fistp ds:dword ptr[tnext]
  448. mov eax,ds:dword ptr[snext]
  449. mov edx,ds:dword ptr[tnext]
  450. sub ecx,8
  451. mov ebp,ds:dword ptr[_sadjust]
  452. push ecx
  453. mov ecx,ds:dword ptr[_tadjust]
  454. add ebp,eax
  455. add ecx,edx
  456. mov eax,ds:dword ptr[_bbextents]
  457. mov edx,ds:dword ptr[_bbextentt]
  458. cmp ebp,2048
  459. jl LClampLow2
  460. cmp ebp,eax
  461. ja LClampHigh2
  462. LClampReentry2:
  463. cmp ecx,2048
  464. jl LClampLow3
  465. cmp ecx,edx
  466. ja LClampHigh3
  467. LClampReentry3:
  468. mov ds:dword ptr[snext],ebp
  469. mov ds:dword ptr[tnext],ecx
  470. sub ebp,ds:dword ptr[s]
  471. sub ecx,ds:dword ptr[t]
  472. mov eax,ecx
  473. mov edx,ebp
  474. sar edx,19
  475. mov ebx,ds:dword ptr[_cachewidth]
  476. sar eax,19
  477. jz LIsZero
  478. imul eax,ebx
  479. LIsZero:
  480. add eax,edx
  481. mov edx,ds:dword ptr[tfracf]
  482. mov ds:dword ptr[advancetable+4],eax
  483. add eax,ebx
  484. shl ebp,13
  485. mov ds:dword ptr[sstep],ebp
  486. mov ebx,ds:dword ptr[sfracf]
  487. shl ecx,13
  488. mov ds:dword ptr[advancetable],eax
  489. mov ds:dword ptr[tstep],ecx
  490. mov ecx,ds:dword ptr[pz]
  491. mov ebp,ds:dword ptr[izi]
  492. cmp bp,ds:word ptr[ecx]
  493. jl Lp1
  494. mov al,ds:byte ptr[esi]
  495. cmp al,255
  496. jz Lp1
  497. mov ds:word ptr[ecx],bp
  498. mov ds:byte ptr[edi],al
  499. Lp1:
  500. add ebp,ds:dword ptr[izistep]
  501. adc ebp,0
  502. add edx,ds:dword ptr[tstep]
  503. sbb eax,eax
  504. add ebx,ds:dword ptr[sstep]
  505. adc esi,ds:dword ptr[advancetable+4+eax*4]
  506. cmp bp,ds:word ptr[2+ecx]
  507. jl Lp2
  508. mov al,ds:byte ptr[esi]
  509. cmp al,255
  510. jz Lp2
  511. mov ds:word ptr[2+ecx],bp
  512. mov ds:byte ptr[1+edi],al
  513. Lp2:
  514. add ebp,ds:dword ptr[izistep]
  515. adc ebp,0
  516. add edx,ds:dword ptr[tstep]
  517. sbb eax,eax
  518. add ebx,ds:dword ptr[sstep]
  519. adc esi,ds:dword ptr[advancetable+4+eax*4]
  520. cmp bp,ds:word ptr[4+ecx]
  521. jl Lp3
  522. mov al,ds:byte ptr[esi]
  523. cmp al,255
  524. jz Lp3
  525. mov ds:word ptr[4+ecx],bp
  526. mov ds:byte ptr[2+edi],al
  527. Lp3:
  528. add ebp,ds:dword ptr[izistep]
  529. adc ebp,0
  530. add edx,ds:dword ptr[tstep]
  531. sbb eax,eax
  532. add ebx,ds:dword ptr[sstep]
  533. adc esi,ds:dword ptr[advancetable+4+eax*4]
  534. cmp bp,ds:word ptr[6+ecx]
  535. jl Lp4
  536. mov al,ds:byte ptr[esi]
  537. cmp al,255
  538. jz Lp4
  539. mov ds:word ptr[6+ecx],bp
  540. mov ds:byte ptr[3+edi],al
  541. Lp4:
  542. add ebp,ds:dword ptr[izistep]
  543. adc ebp,0
  544. add edx,ds:dword ptr[tstep]
  545. sbb eax,eax
  546. add ebx,ds:dword ptr[sstep]
  547. adc esi,ds:dword ptr[advancetable+4+eax*4]
  548. cmp bp,ds:word ptr[8+ecx]
  549. jl Lp5
  550. mov al,ds:byte ptr[esi]
  551. cmp al,255
  552. jz Lp5
  553. mov ds:word ptr[8+ecx],bp
  554. mov ds:byte ptr[4+edi],al
  555. Lp5:
  556. add ebp,ds:dword ptr[izistep]
  557. adc ebp,0
  558. add edx,ds:dword ptr[tstep]
  559. sbb eax,eax
  560. add ebx,ds:dword ptr[sstep]
  561. adc esi,ds:dword ptr[advancetable+4+eax*4]
  562. pop eax
  563. cmp eax,8
  564. ja LSetupNotLast2
  565. dec eax
  566. jz LFDIVInFlight2
  567. mov ds:dword ptr[spancountminus1],eax
  568. fild ds:dword ptr[spancountminus1]
  569. fld ds:dword ptr[_d_zistepu]
  570. fmul st(0),st(1)
  571. fld ds:dword ptr[_d_tdivzstepu]
  572. fmul st(0),st(2)
  573. fxch st(1)
  574. faddp st(3),st(0)
  575. fxch st(1)
  576. fmul ds:dword ptr[_d_sdivzstepu]
  577. fxch st(1)
  578. faddp st(3),st(0)
  579. fld ds:dword ptr[fp_64k]
  580. fxch st(1)
  581. faddp st(4),st(0)
  582. fdiv st(0),st(1)
  583. jmp LFDIVInFlight2
  584. align 4
  585. LSetupNotLast2:
  586. fadd ds:dword ptr[zi8stepu]
  587. fxch st(2)
  588. fadd ds:dword ptr[sdivz8stepu]
  589. fxch st(2)
  590. fld ds:dword ptr[tdivz8stepu]
  591. faddp st(2),st(0)
  592. fld ds:dword ptr[fp_64k]
  593. fdiv st(0),st(1)
  594. LFDIVInFlight2:
  595. push eax
  596. cmp bp,ds:word ptr[10+ecx]
  597. jl Lp6
  598. mov al,ds:byte ptr[esi]
  599. cmp al,255
  600. jz Lp6
  601. mov ds:word ptr[10+ecx],bp
  602. mov ds:byte ptr[5+edi],al
  603. Lp6:
  604. add ebp,ds:dword ptr[izistep]
  605. adc ebp,0
  606. add edx,ds:dword ptr[tstep]
  607. sbb eax,eax
  608. add ebx,ds:dword ptr[sstep]
  609. adc esi,ds:dword ptr[advancetable+4+eax*4]
  610. cmp bp,ds:word ptr[12+ecx]
  611. jl Lp7
  612. mov al,ds:byte ptr[esi]
  613. cmp al,255
  614. jz Lp7
  615. mov ds:word ptr[12+ecx],bp
  616. mov ds:byte ptr[6+edi],al
  617. Lp7:
  618. add ebp,ds:dword ptr[izistep]
  619. adc ebp,0
  620. add edx,ds:dword ptr[tstep]
  621. sbb eax,eax
  622. add ebx,ds:dword ptr[sstep]
  623. adc esi,ds:dword ptr[advancetable+4+eax*4]
  624. cmp bp,ds:word ptr[14+ecx]
  625. jl Lp8
  626. mov al,ds:byte ptr[esi]
  627. cmp al,255
  628. jz Lp8
  629. mov ds:word ptr[14+ecx],bp
  630. mov ds:byte ptr[7+edi],al
  631. Lp8:
  632. add ebp,ds:dword ptr[izistep]
  633. adc ebp,0
  634. add edx,ds:dword ptr[tstep]
  635. sbb eax,eax
  636. add ebx,ds:dword ptr[sstep]
  637. adc esi,ds:dword ptr[advancetable+4+eax*4]
  638. add edi,8
  639. add ecx,16
  640. mov ds:dword ptr[tfracf],edx
  641. mov edx,ds:dword ptr[snext]
  642. mov ds:dword ptr[sfracf],ebx
  643. mov ebx,ds:dword ptr[tnext]
  644. mov ds:dword ptr[s],edx
  645. mov ds:dword ptr[t],ebx
  646. mov ds:dword ptr[pz],ecx
  647. mov ds:dword ptr[izi],ebp
  648. pop ecx
  649. cmp ecx,8
  650. ja LNotLastSegment
  651. LLastSegment:
  652. test ecx,ecx
  653. jz LNoSteps
  654. fld st(0)
  655. fmul st(0),st(4)
  656. fxch st(1)
  657. fmul st(0),st(3)
  658. fxch st(1)
  659. fistp ds:dword ptr[snext]
  660. fistp ds:dword ptr[tnext]
  661. mov ebx,ds:dword ptr[_tadjust]
  662. mov eax,ds:dword ptr[_sadjust]
  663. add eax,ds:dword ptr[snext]
  664. add ebx,ds:dword ptr[tnext]
  665. mov ebp,ds:dword ptr[_bbextents]
  666. mov edx,ds:dword ptr[_bbextentt]
  667. cmp eax,2048
  668. jl LClampLow4
  669. cmp eax,ebp
  670. ja LClampHigh4
  671. LClampReentry4:
  672. mov ds:dword ptr[snext],eax
  673. cmp ebx,2048
  674. jl LClampLow5
  675. cmp ebx,edx
  676. ja LClampHigh5
  677. LClampReentry5:
  678. cmp ecx,1
  679. je LOnlyOneStep
  680. sub eax,ds:dword ptr[s]
  681. sub ebx,ds:dword ptr[t]
  682. add eax,eax
  683. add ebx,ebx
  684. imul ds:dword ptr[reciprocal_table-8+ecx*4]
  685. mov ebp,edx
  686. mov eax,ebx
  687. imul ds:dword ptr[reciprocal_table-8+ecx*4]
  688. LSetEntryvec:
  689. mov ebx,ds:dword ptr[spr8entryvec_table+ecx*4]
  690. mov eax,edx
  691. push ebx
  692. mov ecx,ebp
  693. sar ecx,16
  694. mov ebx,ds:dword ptr[_cachewidth]
  695. sar edx,16
  696. jz LIsZeroLast
  697. imul edx,ebx
  698. LIsZeroLast:
  699. add edx,ecx
  700. mov ecx,ds:dword ptr[tfracf]
  701. mov ds:dword ptr[advancetable+4],edx
  702. add edx,ebx
  703. shl ebp,16
  704. mov ebx,ds:dword ptr[sfracf]
  705. shl eax,16
  706. mov ds:dword ptr[advancetable],edx
  707. mov ds:dword ptr[tstep],eax
  708. mov ds:dword ptr[sstep],ebp
  709. mov edx,ecx
  710. mov ecx,ds:dword ptr[pz]
  711. mov ebp,ds:dword ptr[izi]
  712. ret
  713. LNoSteps:
  714. mov ecx,ds:dword ptr[pz]
  715. sub edi,7
  716. sub ecx,14
  717. jmp LEndSpan
  718. LOnlyOneStep:
  719. sub eax,ds:dword ptr[s]
  720. sub ebx,ds:dword ptr[t]
  721. mov ebp,eax
  722. mov edx,ebx
  723. jmp LSetEntryvec
  724. public Spr8Entry2_8
  725. Spr8Entry2_8:
  726. sub edi,6
  727. sub ecx,12
  728. mov al,ds:byte ptr[esi]
  729. jmp LLEntry2_8
  730. public Spr8Entry3_8
  731. Spr8Entry3_8:
  732. sub edi,5
  733. sub ecx,10
  734. jmp LLEntry3_8
  735. public Spr8Entry4_8
  736. Spr8Entry4_8:
  737. sub edi,4
  738. sub ecx,8
  739. jmp LLEntry4_8
  740. public Spr8Entry5_8
  741. Spr8Entry5_8:
  742. sub edi,3
  743. sub ecx,6
  744. jmp LLEntry5_8
  745. public Spr8Entry6_8
  746. Spr8Entry6_8:
  747. sub edi,2
  748. sub ecx,4
  749. jmp LLEntry6_8
  750. public Spr8Entry7_8
  751. Spr8Entry7_8:
  752. dec edi
  753. sub ecx,2
  754. jmp LLEntry7_8
  755. public Spr8Entry8_8
  756. Spr8Entry8_8:
  757. cmp bp,ds:word ptr[ecx]
  758. jl Lp9
  759. mov al,ds:byte ptr[esi]
  760. cmp al,255
  761. jz Lp9
  762. mov ds:word ptr[ecx],bp
  763. mov ds:byte ptr[edi],al
  764. Lp9:
  765. add ebp,ds:dword ptr[izistep]
  766. adc ebp,0
  767. add edx,ds:dword ptr[tstep]
  768. sbb eax,eax
  769. add ebx,ds:dword ptr[sstep]
  770. adc esi,ds:dword ptr[advancetable+4+eax*4]
  771. LLEntry7_8:
  772. cmp bp,ds:word ptr[2+ecx]
  773. jl Lp10
  774. mov al,ds:byte ptr[esi]
  775. cmp al,255
  776. jz Lp10
  777. mov ds:word ptr[2+ecx],bp
  778. mov ds:byte ptr[1+edi],al
  779. Lp10:
  780. add ebp,ds:dword ptr[izistep]
  781. adc ebp,0
  782. add edx,ds:dword ptr[tstep]
  783. sbb eax,eax
  784. add ebx,ds:dword ptr[sstep]
  785. adc esi,ds:dword ptr[advancetable+4+eax*4]
  786. LLEntry6_8:
  787. cmp bp,ds:word ptr[4+ecx]
  788. jl Lp11
  789. mov al,ds:byte ptr[esi]
  790. cmp al,255
  791. jz Lp11
  792. mov ds:word ptr[4+ecx],bp
  793. mov ds:byte ptr[2+edi],al
  794. Lp11:
  795. add ebp,ds:dword ptr[izistep]
  796. adc ebp,0
  797. add edx,ds:dword ptr[tstep]
  798. sbb eax,eax
  799. add ebx,ds:dword ptr[sstep]
  800. adc esi,ds:dword ptr[advancetable+4+eax*4]
  801. LLEntry5_8:
  802. cmp bp,ds:word ptr[6+ecx]
  803. jl Lp12
  804. mov al,ds:byte ptr[esi]
  805. cmp al,255
  806. jz Lp12
  807. mov ds:word ptr[6+ecx],bp
  808. mov ds:byte ptr[3+edi],al
  809. Lp12:
  810. add ebp,ds:dword ptr[izistep]
  811. adc ebp,0
  812. add edx,ds:dword ptr[tstep]
  813. sbb eax,eax
  814. add ebx,ds:dword ptr[sstep]
  815. adc esi,ds:dword ptr[advancetable+4+eax*4]
  816. LLEntry4_8:
  817. cmp bp,ds:word ptr[8+ecx]
  818. jl Lp13
  819. mov al,ds:byte ptr[esi]
  820. cmp al,255
  821. jz Lp13
  822. mov ds:word ptr[8+ecx],bp
  823. mov ds:byte ptr[4+edi],al
  824. Lp13:
  825. add ebp,ds:dword ptr[izistep]
  826. adc ebp,0
  827. add edx,ds:dword ptr[tstep]
  828. sbb eax,eax
  829. add ebx,ds:dword ptr[sstep]
  830. adc esi,ds:dword ptr[advancetable+4+eax*4]
  831. LLEntry3_8:
  832. cmp bp,ds:word ptr[10+ecx]
  833. jl Lp14
  834. mov al,ds:byte ptr[esi]
  835. cmp al,255
  836. jz Lp14
  837. mov ds:word ptr[10+ecx],bp
  838. mov ds:byte ptr[5+edi],al
  839. Lp14:
  840. add ebp,ds:dword ptr[izistep]
  841. adc ebp,0
  842. add edx,ds:dword ptr[tstep]
  843. sbb eax,eax
  844. add ebx,ds:dword ptr[sstep]
  845. adc esi,ds:dword ptr[advancetable+4+eax*4]
  846. LLEntry2_8:
  847. cmp bp,ds:word ptr[12+ecx]
  848. jl Lp15
  849. mov al,ds:byte ptr[esi]
  850. cmp al,255
  851. jz Lp15
  852. mov ds:word ptr[12+ecx],bp
  853. mov ds:byte ptr[6+edi],al
  854. Lp15:
  855. add ebp,ds:dword ptr[izistep]
  856. adc ebp,0
  857. add edx,ds:dword ptr[tstep]
  858. sbb eax,eax
  859. add ebx,ds:dword ptr[sstep]
  860. adc esi,ds:dword ptr[advancetable+4+eax*4]
  861. LEndSpan:
  862. cmp bp,ds:word ptr[14+ecx]
  863. jl Lp16
  864. mov al,ds:byte ptr[esi]
  865. cmp al,255
  866. jz Lp16
  867. mov ds:word ptr[14+ecx],bp
  868. mov ds:byte ptr[7+edi],al
  869. Lp16:
  870. fstp st(0)
  871. fstp st(0)
  872. fstp st(0)
  873. pop ebx
  874. LNextSpan:
  875. add ebx,12
  876. mov ecx,ds:dword ptr[8+ebx]
  877. cmp ecx,0
  878. jg LSpanLoop
  879. jz LNextSpan
  880. pop ebx
  881. pop esi
  882. pop edi
  883. pop ebp
  884. ret
  885. _TEXT ENDS
  886. END