]> 4ch.mooo.com Git - 16.git/blobdiff - 16/WOLFSRC/WHACK_A.ASM
got 8086 port of wolf3d to work and sod to work
[16.git] / 16 / WOLFSRC / WHACK_A.ASM
diff --git a/16/WOLFSRC/WHACK_A.ASM b/16/WOLFSRC/WHACK_A.ASM
new file mode 100755 (executable)
index 0000000..45fd098
--- /dev/null
@@ -0,0 +1,112 @@
+; WOLFHACK.ASM\r
+\r
+.386C\r
+IDEAL\r
+MODEL  MEDIUM,C\r
+\r
+\r
+;============================================================================\r
+\r
+DATASEG\r
+\r
+EXTRN  mr_rowofs:WORD\r
+EXTRN  mr_count:WORD\r
+EXTRN  mr_xstep:WORD\r
+EXTRN  mr_ystep:WORD\r
+EXTRN  mr_xfrac:WORD\r
+EXTRN  mr_yfrac:WORD\r
+EXTRN  mr_dest:WORD\r
+\r
+FARDATA\r
+\r
+planepics      db      8192 dup(?)     ;       // 4k of ceiling, 4k of floor\r
+PUBLIC planepics\r
+\r
+\r
+;============================================================================\r
+\r
+CODESEG\r
+\r
+;============================\r
+;\r
+; MapRow\r
+;\r
+;\r
+;============================\r
+\r
+PROC   MapRow\r
+PUBLIC MapRow\r
+       push    esi\r
+       push    edi\r
+       push    ebp\r
+       push    ds\r
+\r
+       mov     bp,[mr_rowofs]\r
+       mov             cx,[mr_count]\r
+       mov             dx,[mr_ystep]\r
+       ;begin 8086 hack\r
+       ;shl            edx,16\r
+       push cx\r
+       mov             cl,16\r
+       shl             edx,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       mov             dx,[mr_xstep]\r
+       mov             si,[mr_yfrac]\r
+       ;begin 8086 hack\r
+       ;shl            esi,16\r
+       push cx\r
+       mov             cl,16\r
+       shl             esi,cl\r
+       pop cx\r
+       ;end 8086 hack\r
+       mov             si,[mr_xfrac]\r
+       mov             di,[mr_dest]\r
+       mov             ax,SEG planepics\r
+       mov             ds,ax\r
+       mov             ax,0a000h\r
+       mov             es,ax\r
+       mov             ax,1111111111110b\r
+\r
+; eax          color lookup\r
+; ebx          scratch offset and pixel values\r
+; ecx          loop counter\r
+; edx          packed x / y step values\r
+; esi          packed x / y fractional values\r
+; edi          write pointer\r
+; ebp          toprow to bottomrow delta\r
+; es:          screenseg\r
+; ds:          pictures\r
+\r
+; mov  al,[esi]\r
+; mov  al,[eax]\r
+; mov  [edi],al\r
+\r
+; mov   ax,[_variable+ebx+2]\r
+\r
+\r
+pixelloop:\r
+       shld    ebx,esi,22                              ; shift y units in\r
+       shld    ebx,esi,7                               ; shift x units in and one extra bit\r
+       and             bx,63*65*2                              ; mask off extra top bits and 0 low bit\r
+       add             esi,edx                                 ; position += step\r
+       mov             al,[bx]\r
+       mov             al,[eax]\r
+       mov     [es:di],al                      ; write ceiling pixel\r
+       mov             al,[bx+1]\r
+       mov             al,[eax]\r
+       mov     [es:di+bp],al                   ; write floor pixel\r
+       inc             di\r
+       loop    pixelloop\r
+\r
+       pop             ds\r
+       pop             ebp\r
+       pop             edi\r
+       pop             esi\r
+\r
+       retf\r
+\r
+ENDP\r
+\r
+END\r
+\r