]> 4ch.mooo.com Git - 16.git/blob - 16/xw__/mxtl.asm
16_ca needs huge amounts of work and I should remember what needs to be done soon...
[16.git] / 16 / xw__ / mxtl.asm
1 .387
2                 PUBLIC  MXPUTTILE
3                 PUBLIC  MXTRANSPUTTILE
4                 EXTRN   MX_BYTESPERLINE:BYTE
5                 EXTRN   MX_VIDEOSEGMENT:BYTE
6 MX_TEXT         SEGMENT PARA PUBLIC USE16 'CODE'
7                 ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
8 MXPUTTILE:
9         push            bp
10         mov             bp,sp
11         sub             sp,0
12         push            ds
13         push            si
14         push            es
15         push            di
16         mov             ax,word ptr 0aH[bp]
17         mul             word ptr cs:MX_BYTESPERLINE
18         mov             di,word ptr 0cH[bp]
19         shr             di,1
20         shr             di,1
21         add             di,ax
22         mov             es,word ptr cs:MX_VIDEOSEGMENT
23         lds             si,dword ptr 0eH[bp]
24         shr             word ptr 8[bp],1
25         shr             word ptr 8[bp],1
26         mov             cl,byte ptr 0cH[bp]
27         and             cl,3
28         mov             ah,11H
29         shl             ah,cl
30         mov             word ptr 0aH[bp],4
31         mov             bx,word ptr cs:MX_BYTESPERLINE
32         sub             bx,word ptr 8[bp]
33 L$1:
34         mov             al,2
35         mov             dx,3c4H
36         out             dx,ax
37         mov             word ptr 0cH[bp],di
38         mov             dx,word ptr 6[bp]
39 L$2:
40         mov             cx,word ptr 8[bp]
41         shr             cx,1
42         rep movsw
43         rcl             cx,1
44         rep movsb
45         add             di,bx
46         dec             dx
47         jne             L$2
48         mov             di,word ptr 0cH[bp]
49         rol             ah,1
50         adc             di,0
51         dec             word ptr 0aH[bp]
52         jne             L$1
53         xor             ax,ax
54         pop             di
55         pop             es
56         pop             si
57         pop             ds
58         mov             sp,bp
59         pop             bp
60         retf            0cH
61 MXTRANSPUTTILE:
62         push            bp
63         mov             bp,sp
64         sub             sp,0
65         push            ds
66         push            si
67         push            es
68         push            di
69         mov             ax,word ptr 0aH[bp]
70         mul             word ptr cs:MX_BYTESPERLINE
71         mov             di,word ptr 0cH[bp]
72         shr             di,1
73         shr             di,1
74         add             di,ax
75         mov             es,word ptr cs:MX_VIDEOSEGMENT
76         lds             si,dword ptr 0eH[bp]
77         shr             word ptr 8[bp],1
78         shr             word ptr 8[bp],1
79         mov             cl,byte ptr 0cH[bp]
80         and             cl,3
81         mov             ah,11H
82         shl             ah,cl
83         mov             word ptr 0aH[bp],4
84         mov             bx,word ptr cs:MX_BYTESPERLINE
85         sub             bx,word ptr 8[bp]
86 L$3:
87         mov             al,2
88         mov             dx,3c4H
89         out             dx,ax
90         mov             word ptr 0cH[bp],di
91         mov             dx,word ptr 6[bp]
92 L$4:
93         mov             cx,word ptr 8[bp]
94         jcxz            L$7
95 L$5:
96         mov             al,byte ptr [si]
97         test            al,al
98         je              L$6
99         mov             byte ptr es:[di],al
100 L$6:
101         inc             si
102         inc             di
103         dec             cx
104         jne             L$5
105 L$7:
106         add             di,bx
107         dec             dx
108         jne             L$4
109         mov             di,word ptr 0cH[bp]
110         rol             ah,1
111         adc             di,0
112         dec             word ptr 0aH[bp]
113         jne             L$3
114         xor             ax,ax
115         pop             di
116         pop             es
117         pop             si
118         pop             ds
119         mov             sp,bp
120         pop             bp
121         retf            0cH
122 MX_TEXT         ENDS
123                 END