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