]> 4ch.mooo.com Git - plz.git/blobdiff - u2plz/SPLINE.ASM
wwww
[plz.git] / u2plz / SPLINE.ASM
diff --git a/u2plz/SPLINE.ASM b/u2plz/SPLINE.ASM
new file mode 100755 (executable)
index 0000000..44a8362
--- /dev/null
@@ -0,0 +1,89 @@
+       IDEAL\r
+       MODEL large\r
+       P386\r
+\r
+EXTRN  C kx:word, C ky:word, C kz:word\r
+EXTRN  C dis:word, C tx:word, C ty:word\r
+EXTRN  C ls_kx:word, C ls_ky:word, C ls_kz:word\r
+\r
+CODESEG\r
+\r
+PUBLIC C getspl\r
+\r
+LABEL  buu     WORD\r
+INCLUDE 'rata.inc'\r
+\r
+LABEL splinecoef WORD\r
+INCLUDE "spline.inc"\r
+\r
+PROC C getspl\r
+\r
+       ARG     position:word\r
+\r
+       push    ds bp si di\r
+\r
+       mov     si, OFFSET buu\r
+       push    cs\r
+       pop     ds\r
+       mov     di, [position]\r
+\r
+       MASM\r
+\r
+       ;ds:si=pointer to spline\r
+       ;di=position in spline, add 256 for next point\r
+\r
+       mov     ax,di\r
+       shr     ax,8\r
+       shl     ax, 4d\r
+       add     si,ax\r
+       and     di,255\r
+       shl     di,1\r
+\r
+       ccc=0\r
+       REPT 8\r
+       mov     ax,ds:[si+3*2*8+ccc]\r
+       imul    cs:splinecoef[di]\r
+       mov     bx,ax\r
+       mov     cx,dx\r
+       mov     ax,ds:[si+2*2*8+ccc]\r
+       imul    cs:splinecoef[di+64*8]\r
+       add     bx,ax\r
+       adc     cx,dx\r
+       mov     ax,ds:[si+1*2*8+ccc]\r
+       imul    cs:splinecoef[di+128*8]\r
+       add     bx,ax\r
+       adc     cx,dx\r
+       mov     ax,ds:[si+0*2*8+ccc]\r
+       imul    cs:splinecoef[di+192*8]\r
+       add     bx,ax\r
+       adc     cx,dx\r
+       shld    cx,bx,1\r
+       push    cx\r
+       ccc=ccc+2\r
+       ENDM\r
+\r
+       mov     ax,  SEG kx\r
+       mov     ds, ax\r
+       pop     cx\r
+       mov     [ls_ky], cx\r
+       pop     cx\r
+       mov     [ls_kx], cx\r
+       pop     cx\r
+       mov     [kz], cx\r
+       pop     cx\r
+       mov     [ky], cx\r
+       pop     cx\r
+       mov     [kx], cx\r
+       pop     cx\r
+       mov     [dis], cx\r
+       pop     cx\r
+       mov     [ty], cx\r
+       pop     cx\r
+       mov     [tx], cx\r
+\r
+       pop     di si bp ds\r
+       ret\r
+       IDEAL\r
+ENDP\r
+\r
+END
\ No newline at end of file