VSCLTOVE.ASM 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. ;***************************************************************************
  19. ;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
  20. ;***************************************************************************
  21. ;* *
  22. ;* Project Name : Westwood 32 bit Library *
  23. ;* *
  24. ;* File Name : VSCALE.ASM *
  25. ;* *
  26. ;* Programmer : Phil W. Gorrow *
  27. ;* *
  28. ;* Start Date : January 16, 1995 *
  29. ;* *
  30. ;* Last Update : January 16, 1995 [PWG] *
  31. ;* *
  32. ;*-------------------------------------------------------------------------*
  33. ;* Functions: *
  34. ;* Linear_Scale_To_Vesa -- Scales a graphic viewport to a vesa viewport *
  35. ;* Vesa_Scale_To_Linear -- Scales a Vesa viewport to a graphic viewport *
  36. ;* Vesa_Scale_To_Vesa -- Scales a vesa viewport to a vesa viewport *
  37. ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
  38. IDEAL
  39. P386
  40. MODEL USE32 FLAT
  41. INCLUDE "mcgaprim.inc"
  42. INCLUDE "gbuffer.inc"
  43. GLOBAL Vesa_Asm_Set_Win : near
  44. GLOBAL cpu_video_page : dword
  45. GLOBAL cpu_page_limit : dword
  46. CODESEG
  47. ;***************************************************************************
  48. ;* LINEAR_SCALE_TO_VESA -- Scales a graphic viewport to a vesa viewport *
  49. ;* *
  50. ;* INPUT: *
  51. ;* *
  52. ;* OUTPUT: *
  53. ;* *
  54. ;* PROTO: *
  55. ;* *
  56. ;* WARNINGS: *
  57. ;* *
  58. ;* HISTORY: *
  59. ;* 01/16/1995 PWG : Created. *
  60. ;*=========================================================================*
  61. PROC Linear_Scale_To_Vesa C near
  62. ;*===================================================================
  63. ;* Define the arguements that our function takes.
  64. ;*===================================================================
  65. ARG this:DWORD ; pointer to source view port
  66. ARG dest:DWORD ; pointer to destination view port
  67. ARG src_x:DWORD ; source x offset into view port
  68. ARG src_y:DWORD ; source y offset into view port
  69. ARG dst_x:DWORD ; dest x offset into view port
  70. ARG dst_y:DWORD ; dest y offset into view port
  71. ARG src_width:DWORD ; width of source rectangle
  72. ARG src_height:DWORD ; height of source rectangle
  73. ARG dst_width:DWORD ; width of dest rectangle
  74. ARG dst_height:DWORD ; width of dest height
  75. ARG trans:DWORD ; is this transparent?
  76. ARG remap:DWORD ; pointer to table to remap source
  77. ;*===================================================================
  78. ;* Define local variables to hold the viewport characteristics
  79. ;*===================================================================
  80. local src_x0 : dword
  81. local src_y0 : dword
  82. local src_x1 : dword
  83. local src_y1 : dword
  84. local dst_x0 : dword
  85. local dst_y0 : dword
  86. local dst_x1 : dword
  87. local dst_y1 : dword
  88. local src_win_width : dword
  89. local dst_win_width : dword
  90. local dy_intr : dword
  91. local dy_frac : dword
  92. local dy_acc : dword
  93. local dx_frac : dword
  94. local dx_intr : dword
  95. local scan_line : dword
  96. local counter_x : dword
  97. local counter_y : dword
  98. local remap_counter :dword
  99. local entry : dword
  100. ;*===================================================================
  101. ;* Check for scale error when to or from size 0,0
  102. ;*===================================================================
  103. cmp [dst_width],0
  104. je ??all_done
  105. cmp [dst_height],0
  106. je ??all_done
  107. cmp [src_width],0
  108. je ??all_done
  109. cmp [src_height],0
  110. je ??all_done
  111. mov eax , [ src_x ]
  112. mov ebx , [ src_y ]
  113. mov [ src_x0 ] , eax
  114. mov [ src_y0 ] , ebx
  115. add eax , [ src_width ]
  116. add ebx , [ src_height ]
  117. mov [ src_x1 ] , eax
  118. mov [ src_y1 ] , ebx
  119. mov eax , [ dst_x ]
  120. mov ebx , [ dst_y ]
  121. mov [ dst_x0 ] , eax
  122. mov [ dst_y0 ] , ebx
  123. add eax , [ dst_width ]
  124. add ebx , [ dst_height ]
  125. mov [ dst_x1 ] , eax
  126. mov [ dst_y1 ] , ebx
  127. ; Clip Source Rectangle against source Window boundaries.
  128. mov esi , [ this ] ; get ptr to src
  129. xor ecx , ecx
  130. xor edx , edx
  131. mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
  132. mov eax , [ src_x0 ]
  133. mov ebx , [ src_x1 ]
  134. shld ecx , eax , 1
  135. inc edi
  136. shld edx , ebx , 1
  137. sub eax , edi
  138. sub ebx , edi
  139. shld ecx , eax , 1
  140. shld edx , ebx , 1
  141. mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
  142. mov eax , [ src_y0 ]
  143. mov ebx , [ src_y1 ]
  144. shld ecx , eax , 1
  145. inc edi
  146. shld edx , ebx , 1
  147. sub eax , edi
  148. sub ebx , edi
  149. shld ecx , eax , 1
  150. shld edx , ebx , 1
  151. xor cl , 5
  152. xor dl , 5
  153. mov al , cl
  154. test dl , cl
  155. jnz ??all_done
  156. or al , dl
  157. jz ??clip_against_dest
  158. mov bl , dl
  159. test cl , 1000b
  160. jz ??src_left_ok
  161. xor eax , eax
  162. mov [ src_x0 ] , eax
  163. sub eax , [ src_x ]
  164. imul [ dst_width ]
  165. idiv [ src_width ]
  166. add eax , [ dst_x ]
  167. mov [ dst_x0 ] , eax
  168. ??src_left_ok:
  169. test cl , 0010b
  170. jz ??src_bottom_ok
  171. xor eax , eax
  172. mov [ src_y0 ] , eax
  173. sub eax , [ src_y ]
  174. imul [ dst_height ]
  175. idiv [ src_height ]
  176. add eax , [ dst_y ]
  177. mov [ dst_y0 ] , eax
  178. ??src_bottom_ok:
  179. test bl , 0100b
  180. jz ??src_right_ok
  181. mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
  182. mov [ src_x1 ] , eax
  183. sub eax , [ src_x ]
  184. imul [ dst_width ]
  185. idiv [ src_width ]
  186. add eax , [ dst_x ]
  187. mov [ dst_x1 ] , eax
  188. ??src_right_ok:
  189. test bl , 0001b
  190. jz ??clip_against_dest
  191. mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
  192. mov [ src_y1 ] , eax
  193. sub eax , [ src_y ]
  194. imul [ dst_height ]
  195. idiv [ src_height ]
  196. add eax , [ dst_y ]
  197. mov [ dst_y1 ] , eax
  198. ; Clip destination Rectangle against source Window boundaries.
  199. ??clip_against_dest:
  200. mov esi , [ dest ] ; get ptr to src
  201. xor ecx , ecx
  202. xor edx , edx
  203. mov edi , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
  204. mov eax , [ dst_x0 ]
  205. mov ebx , [ dst_x1 ]
  206. shld ecx , eax , 1
  207. inc edi
  208. shld edx , ebx , 1
  209. sub eax , edi
  210. sub ebx , edi
  211. shld ecx , eax , 1
  212. shld edx , ebx , 1
  213. mov edi,[ ( VideoViewPort esi) . VIVPHeight ] ; get height into register
  214. mov eax , [ dst_y0 ]
  215. mov ebx , [ dst_y1 ]
  216. shld ecx , eax , 1
  217. inc edi
  218. shld edx , ebx , 1
  219. sub eax , edi
  220. sub ebx , edi
  221. shld ecx , eax , 1
  222. shld edx , ebx , 1
  223. xor cl , 5
  224. xor dl , 5
  225. mov al , cl
  226. test dl , cl
  227. jnz ??all_done
  228. or al , dl
  229. jz ??do_scaling
  230. mov bl , dl
  231. test cl , 1000b
  232. jz ??dst_left_ok
  233. xor eax , eax
  234. mov [ dst_x0 ] , eax
  235. sub eax , [ dst_x ]
  236. imul [ src_width ]
  237. idiv [ dst_width ]
  238. add eax , [ src_x ]
  239. mov [ src_x0 ] , eax
  240. ??dst_left_ok:
  241. test cl , 0010b
  242. jz ??dst_bottom_ok
  243. xor eax , eax
  244. mov [ dst_y0 ] , eax
  245. sub eax , [ dst_y ]
  246. imul [ src_height ]
  247. idiv [ dst_height ]
  248. add eax , [ src_y ]
  249. mov [ src_y0 ] , eax
  250. ??dst_bottom_ok:
  251. test bl , 0100b
  252. jz ??dst_right_ok
  253. mov eax , [ (VideoViewPort esi) . VIVPWidth ] ; get width into register
  254. mov [ dst_x1 ] , eax
  255. sub eax , [ dst_x ]
  256. imul [ src_width ]
  257. idiv [ dst_width ]
  258. add eax , [ src_x ]
  259. mov [ src_x1 ] , eax
  260. ??dst_right_ok:
  261. test bl , 0001b
  262. jz ??do_scaling
  263. mov eax , [ (VideoViewPort esi) . VIVPHeight ] ; get width into register
  264. mov [ dst_y1 ] , eax
  265. sub eax , [ dst_y ]
  266. imul [ src_height ]
  267. idiv [ dst_height ]
  268. add eax , [ src_y ]
  269. mov [ src_y1 ] , eax
  270. ??do_scaling:
  271. cld
  272. mov ebx , [ this ]
  273. mov esi , [ (VideoViewPort ebx) . VIVPOffset ]
  274. mov eax , [ (VideoViewPort ebx) . VIVPXAdd ]
  275. add eax , [ (VideoViewPort ebx) . VIVPWidth ]
  276. mov [ src_win_width ] , eax
  277. mul [ src_y0 ]
  278. add esi , [ src_x0 ]
  279. add esi , eax
  280. mov ebx , [ dest ]
  281. mov edi , [ (VideoViewPort ebx) . VIVPOffset ]
  282. mov eax , [ (VideoViewPort ebx) . VIVPXAdd ]
  283. add eax , [ (VideoViewPort ebx) . VIVPWidth ]
  284. mov [ dst_win_width ] , eax
  285. mul [ dst_y0 ]
  286. add edi , [ dst_x0 ]
  287. add edi , eax
  288. call Vesa_Asm_Set_Win ; set the window
  289. mov eax , [ src_height ]
  290. xor edx , edx
  291. mov ebx , [ dst_height ]
  292. idiv [ dst_height ]
  293. imul eax , [ src_win_width ]
  294. neg ebx
  295. mov [ dy_intr ] , eax
  296. mov [ dy_frac ] , edx
  297. mov [ dy_acc ] , ebx
  298. mov eax , [ src_width ]
  299. xor edx , edx
  300. shl eax , 16
  301. idiv [ dst_width ]
  302. xor edx , edx
  303. shld edx , eax , 16
  304. shl eax , 16
  305. mov ecx , [ dst_y1 ]
  306. mov ebx , [ dst_x1 ]
  307. sub ecx , [ dst_y0 ]
  308. jz ??all_done
  309. sub ebx , [ dst_x0 ]
  310. jz ??all_done
  311. mov [ counter_y ] , ecx
  312. mov [ scan_line ] , ebx
  313. cmp [ trans ] , 0
  314. jnz ??transparency
  315. cmp [ remap ] , 0
  316. jnz ??normal_remap
  317. ; *************************************************************************
  318. ; normal scale
  319. mov ecx , ebx
  320. and ecx , 01fh
  321. lea ecx , [ ecx + ecx * 2 ]
  322. shr ebx , 5
  323. neg ecx
  324. mov [ counter_x ] , ebx
  325. lea ecx , [ ??ref_point + ecx + ecx * 2 ]
  326. mov [ entry ] , ecx
  327. ??outter_loop:
  328. mov ebx , [ scan_line ]
  329. push esi
  330. add ebx , edi
  331. xor ecx , ecx
  332. add ebx , [ cpu_video_page ]
  333. push edi
  334. cmp ebx , [ cpu_page_limit ]
  335. jl ??in_range
  336. mov ebx , [ scan_line ]
  337. jmp ??trailing_entry
  338. ??trailing_bytes:
  339. mov cl , [ esi ]
  340. add ecx , eax
  341. adc esi , edx
  342. mov [ edi ] , cl
  343. inc edi
  344. dec ebx
  345. ??trailing_entry:
  346. cmp edi , 0b0000h
  347. jl ??trailing_bytes
  348. add edi , [ cpu_video_page ]
  349. call Vesa_Asm_Set_Win ; set the window
  350. ??end_of_scanline:
  351. mov cl , [ esi ]
  352. add ecx , eax
  353. adc esi , edx
  354. mov [ edi ] , cl
  355. inc edi
  356. dec ebx
  357. jg ??end_of_scanline
  358. sub [ dword ptr esp ] , 010000h
  359. jmp ??next_line
  360. ??in_range:
  361. mov ebx , [ counter_x ]
  362. jmp [ entry ]
  363. ??inner_loop:
  364. REPT 32
  365. mov cl , [ esi ]
  366. add ecx , eax
  367. adc esi , edx
  368. mov [ edi ] , cl
  369. inc edi
  370. ENDM
  371. ??ref_point:
  372. dec ebx
  373. jge ??inner_loop
  374. ??next_line:
  375. pop edi
  376. pop esi
  377. add edi , [ dst_win_width ]
  378. add esi , [ dy_intr ]
  379. mov ebx , [ dy_acc ]
  380. add ebx , [ dy_frac ]
  381. jle ??skip_line
  382. add esi , [ src_win_width ]
  383. sub ebx , [ dst_height ]
  384. ??skip_line:
  385. dec [ counter_y ]
  386. mov [ dy_acc ] , ebx
  387. jnz ??outter_loop
  388. ret
  389. ; *************************************************************************
  390. ; normal scale with remap
  391. ??normal_remap:
  392. mov ecx , ebx
  393. mov [ dx_frac ] , eax
  394. mov [ dx_intr ] , edx
  395. and ecx , 01fh
  396. mov eax , [ remap ]
  397. shr ebx , 5
  398. imul ecx , - 13
  399. mov [ counter_x ] , ebx
  400. lea ecx , [ ??remapref_point + ecx ]
  401. mov [ entry ] , ecx
  402. ??remapoutter_loop:
  403. mov ebx , [ scan_line ]
  404. push esi
  405. add ebx , edi
  406. xor ecx , ecx
  407. add ebx , [ cpu_video_page ]
  408. push edi
  409. cmp ebx , [ cpu_page_limit ]
  410. jl ??remap_in_range
  411. mov edx , [ scan_line ]
  412. xor ebx , ebx
  413. jmp ??remap_trailing_entry
  414. ??remap_trailing_bytes:
  415. mov bl , [ esi ]
  416. add ecx , [ dx_frac ]
  417. adc esi , [ dx_intr ]
  418. mov cl , [ eax + ebx ]
  419. mov [ edi ] , cl
  420. inc edi
  421. dec edx
  422. ??remap_trailing_entry:
  423. cmp edi , 0b0000h
  424. jl ??remap_trailing_bytes
  425. ??remap_no_trailing:
  426. add edi , [ cpu_video_page ]
  427. call Vesa_Asm_Set_Win ; set the window
  428. ??remap_end_of_scanline:
  429. mov bl , [ esi ]
  430. add ecx , [ dx_frac ]
  431. adc esi , [ dx_intr ]
  432. mov cl , [ eax + ebx ]
  433. mov [ edi ] , cl
  434. inc edi
  435. dec edx
  436. jg ??remap_end_of_scanline
  437. sub [ dword ptr esp ] , 010000h
  438. jmp ??remap_next_line
  439. ??remap_in_range:
  440. mov ebx , [ counter_x ]
  441. push esi
  442. mov [ remap_counter ] , ebx
  443. push edi
  444. mov edx , [ dx_intr ]
  445. xor ecx , ecx
  446. xor ebx , ebx
  447. jmp [ entry ]
  448. ??remapinner_loop:
  449. REPT 32
  450. mov bl , [ esi ]
  451. add ecx , [ dx_frac ]
  452. adc esi , edx
  453. mov cl , [ eax + ebx ]
  454. mov [ edi ] , cl
  455. inc edi
  456. ENDM
  457. ??remapref_point:
  458. dec [ remap_counter ]
  459. jge ??remapinner_loop
  460. ??remap_next_line:
  461. pop edi
  462. pop esi
  463. add edi , [ dst_win_width ]
  464. add esi , [ dy_intr ]
  465. mov ebx , [ dy_acc ]
  466. add ebx , [ dy_frac ]
  467. jle ??remapskip_line
  468. add esi , [ src_win_width ]
  469. sub ebx , [ dst_height ]
  470. ??remapskip_line:
  471. dec [ counter_y ]
  472. mov [ dy_acc ] , ebx
  473. jnz ??remapoutter_loop
  474. ret
  475. ;****************************************************************************
  476. ; scale with transparency
  477. ??transparency:
  478. cmp [ remap ] , 0
  479. jnz ??trans_remap
  480. ; *************************************************************************
  481. ; normal scale with transparency
  482. mov ecx , ebx
  483. and ecx , 01fh
  484. imul ecx , -13
  485. shr ebx , 5
  486. mov [ counter_x ] , ebx
  487. lea ecx , [ ??tr_ref_point + ecx ]
  488. mov [ entry ] , ecx
  489. ??tr_outter_loop:
  490. mov ebx , [ scan_line ]
  491. push esi
  492. add ebx , edi
  493. xor ecx , ecx
  494. add ebx , [ cpu_video_page ]
  495. push edi
  496. cmp ebx , [ cpu_page_limit ]
  497. jl ??tr_in_range
  498. mov ebx , [ scan_line ]
  499. jmp ??tr_trailing_entry
  500. ??tr_trailing_bytes:
  501. mov cl , [ esi ]
  502. test cl , cl
  503. jz ??tr_skip
  504. mov [ edi ] , cl
  505. ??tr_skip:
  506. add ecx , eax
  507. adc esi , edx
  508. inc edi
  509. dec ebx
  510. ??tr_trailing_entry:
  511. cmp edi , 0b0000h
  512. jl ??tr_trailing_bytes
  513. add edi , [ cpu_video_page ]
  514. call Vesa_Asm_Set_Win ; set the window
  515. ??tr_end_of_scanline:
  516. mov cl , [ esi ]
  517. test cl , cl
  518. jz ??tr_skip1
  519. mov [ edi ] , cl
  520. ??tr_skip1:
  521. add ecx , eax
  522. adc esi , edx
  523. inc edi
  524. dec ebx
  525. jg ??tr_end_of_scanline
  526. sub [ dword ptr esp ] , 010000h
  527. jmp ??tr_next_line
  528. ??tr_in_range:
  529. mov ebx , [ counter_x ]
  530. jmp [ entry ]
  531. ??tr_inner_loop:
  532. REPT 32
  533. local skip
  534. mov cl , [ esi ]
  535. test cl , cl
  536. jz skip
  537. mov [ edi ] , cl
  538. skip:
  539. add ecx , eax
  540. adc esi , edx
  541. inc edi
  542. ENDM
  543. ??tr_ref_point:
  544. dec ebx
  545. jge ??tr_inner_loop
  546. ??tr_next_line:
  547. pop edi
  548. pop esi
  549. add edi , [ dst_win_width ]
  550. add esi , [ dy_intr ]
  551. mov ebx , [ dy_acc ]
  552. add ebx , [ dy_frac ]
  553. jle ??tr_skip_line
  554. add esi , [ src_win_width ]
  555. sub ebx , [ dst_height ]
  556. ??tr_skip_line:
  557. dec [ counter_y ]
  558. mov [ dy_acc ] , ebx
  559. jnz ??tr_outter_loop
  560. ret
  561. ; *************************************************************************
  562. ; normal scale with remap and transparency
  563. ??trans_remap:
  564. mov ecx , ebx
  565. mov [ dx_frac ], eax
  566. mov [ dx_intr ] , edx
  567. and ecx , 01fh
  568. mov eax , [ remap ]
  569. shr ebx , 5
  570. imul ecx , - 17
  571. mov [ counter_x ] , ebx
  572. lea ecx , [ ??trans_remapref_point + ecx ]
  573. mov [ entry ] , ecx
  574. ??trans_remapoutter_loop:
  575. mov ebx , [ scan_line ]
  576. push esi
  577. add ebx , edi
  578. xor ecx , ecx
  579. add ebx , [ cpu_video_page ]
  580. push edi
  581. cmp ebx , [ cpu_page_limit ]
  582. jl ??trans_remap_in_range
  583. mov edx , [ scan_line ]
  584. xor ebx , ebx
  585. jmp ??trans_remap_trailing_bytes1
  586. ??trans_remap_trailing_bytes:
  587. mov bl , [ esi ]
  588. test bl , bl
  589. jz ??trans_remp
  590. mov cl , [ eax + ebx ]
  591. mov [ edi ] , cl
  592. ??trans_remp:
  593. add ecx , [ dx_frac ]
  594. adc esi , [ dx_intr ]
  595. inc edi
  596. dec edx
  597. ??trans_remap_trailing_bytes1:
  598. cmp edi , 0b0000h
  599. jl ??trans_remap_trailing_bytes
  600. ??trans_remap_no_trailing:
  601. add edi , [ cpu_video_page ]
  602. call Vesa_Asm_Set_Win ; set the window
  603. ??trans_remap_end_of_scanline:
  604. mov bl , [ esi ]
  605. test bl , bl
  606. jz ??trans_remp1
  607. mov cl , [ eax + ebx ]
  608. mov [ edi ] , cl
  609. ??trans_remp1:
  610. add ecx , [ dx_frac ]
  611. adc esi , [ dx_intr ]
  612. inc edi
  613. dec edx
  614. jg ??trans_remap_end_of_scanline
  615. sub [ dword ptr esp ] , 010000h
  616. jmp ??trans_remap_next_line
  617. ??trans_remap_in_range:
  618. mov ebx , [ counter_x ]
  619. push esi
  620. mov [ remap_counter ] , ebx
  621. push edi
  622. mov edx , [ dx_intr ]
  623. xor ecx , ecx
  624. xor ebx , ebx
  625. jmp [ entry ]
  626. ??trans_remapinner_loop:
  627. REPT 32
  628. local skip
  629. mov bl , [ esi ]
  630. test bl , bl
  631. jz skip
  632. mov cl , [ eax + ebx ]
  633. mov [ edi ] , cl
  634. skip:
  635. add ecx , [ dx_frac ]
  636. adc esi , edx
  637. inc edi
  638. ENDM
  639. ??trans_remapref_point:
  640. dec [ remap_counter ]
  641. jge ??trans_remapinner_loop
  642. ??trans_remap_next_line:
  643. pop edi
  644. pop esi
  645. add edi , [ dst_win_width ]
  646. add esi , [ dy_intr ]
  647. mov ebx , [ dy_acc ]
  648. add ebx , [ dy_frac ]
  649. jle ??trans_remapskip_line
  650. add esi , [ src_win_width ]
  651. sub ebx , [ dst_height ]
  652. ??trans_remapskip_line:
  653. dec [ counter_y ]
  654. mov [ dy_acc ] , ebx
  655. jnz ??trans_remapoutter_loop
  656. ret
  657. ??all_done:
  658. ret
  659. ENDP Linear_Scale_To_Vesa
  660. END