]> 4ch.mooo.com Git - 16.git/blob - 16/wf3d8086/whack_a.asm
reference to the bbocg
[16.git] / 16 / wf3d8086 / whack_a.asm
1 ; WOLFHACK.ASM\r
2 \r
3 .386C\r
4 IDEAL\r
5 MODEL   MEDIUM,C\r
6 \r
7 \r
8 ;============================================================================\r
9 \r
10 DATASEG\r
11 \r
12 EXTRN   mr_rowofs:WORD\r
13 EXTRN   mr_count:WORD\r
14 EXTRN   mr_xstep:WORD\r
15 EXTRN   mr_ystep:WORD\r
16 EXTRN   mr_xfrac:WORD\r
17 EXTRN   mr_yfrac:WORD\r
18 EXTRN   mr_dest:WORD\r
19 \r
20 FARDATA\r
21 \r
22 planepics       db      8192 dup(?)     ;       // 4k of ceiling, 4k of floor\r
23 PUBLIC  planepics\r
24 \r
25 \r
26 ;============================================================================\r
27 \r
28 CODESEG\r
29 \r
30 ;============================\r
31 ;\r
32 ; MapRow\r
33 ;\r
34 ;\r
35 ;============================\r
36 \r
37 PROC    MapRow\r
38 PUBLIC  MapRow\r
39         push    esi\r
40         push    edi\r
41         push    ebp\r
42         push    ds\r
43 \r
44         mov     bp,[mr_rowofs]\r
45         mov             cx,[mr_count]\r
46         mov             dx,[mr_ystep]\r
47         ;begin 8086 hack\r
48         ;shl            edx,16\r
49         push cx\r
50         mov             cl,16\r
51         shl             edx,cl\r
52         pop cx\r
53         ;end 8086 hack\r
54         mov             dx,[mr_xstep]\r
55         mov             si,[mr_yfrac]\r
56         ;begin 8086 hack\r
57         ;shl            esi,16\r
58         push cx\r
59         mov             cl,16\r
60         shl             esi,cl\r
61         pop cx\r
62         ;end 8086 hack\r
63         mov             si,[mr_xfrac]\r
64         mov             di,[mr_dest]\r
65         mov             ax,SEG planepics\r
66         mov             ds,ax\r
67         mov             ax,0a000h\r
68         mov             es,ax\r
69         mov             ax,1111111111110b\r
70 \r
71 ; eax           color lookup\r
72 ; ebx           scratch offset and pixel values\r
73 ; ecx           loop counter\r
74 ; edx           packed x / y step values\r
75 ; esi           packed x / y fractional values\r
76 ; edi           write pointer\r
77 ; ebp           toprow to bottomrow delta\r
78 ; es:           screenseg\r
79 ; ds:           pictures\r
80 \r
81 ; mov   al,[esi]\r
82 ; mov   al,[eax]\r
83 ; mov   [edi],al\r
84 \r
85 ; mov   ax,[_variable+ebx+2]\r
86 \r
87 \r
88 pixelloop:\r
89         shld    ebx,esi,22                              ; shift y units in\r
90         shld    ebx,esi,7                               ; shift x units in and one extra bit\r
91         and             bx,63*65*2                              ; mask off extra top bits and 0 low bit\r
92         add             esi,edx                                 ; position += step\r
93         mov             al,[bx]\r
94         mov             al,[eax]\r
95         mov     [es:di],al                      ; write ceiling pixel\r
96         mov             al,[bx+1]\r
97         mov             al,[eax]\r
98         mov     [es:di+bp],al                   ; write floor pixel\r
99         inc             di\r
100         loop    pixelloop\r
101 \r
102         pop             ds\r
103         pop             ebp\r
104         pop             edi\r
105         pop             esi\r
106 \r
107         retf\r
108 \r
109 ENDP\r
110 \r
111 END\r
112 \r