]> 4ch.mooo.com Git - 16.git/blob - 16/xw_/mxpp.asm
code miraculously works on real hardware
[16.git] / 16 / xw_ / mxpp.asm
1                 PUBLIC  MXGETPIXEL
2                 PUBLIC  MXPUTPIXEL
3                 EXTRN   MX_CLIPX1:BYTE
4                 EXTRN   MX_CLIPX2:BYTE
5                 EXTRN   MX_CLIPY1:BYTE
6                 EXTRN   MX_CLIPY2:BYTE
7                 EXTRN   MX_VIDEOSEGMENT:BYTE
8                 EXTRN   MX_BYTESPERLINE:BYTE
9 MX_TEXT         SEGMENT PARA PUBLIC USE16 'CODE'
10                 ASSUME CS:MX_TEXT, DS:DGROUP, SS:DGROUP
11 MXGETPIXEL:
12         push            bp
13         mov             bp,sp
14         sub             sp,0
15         push            ds
16         push            si
17         xor             ax,ax
18         mov             si,word ptr 8[bp]
19         cmp             si,word ptr cs:MX_CLIPX1
20         jl              L$1
21         cmp             si,word ptr cs:MX_CLIPX2
22         jg              L$1
23         mov             bx,word ptr 6[bp]
24         cmp             bx,word ptr cs:MX_CLIPY1
25         jl              L$1
26         cmp             bx,word ptr cs:MX_CLIPY2
27         jg              L$1
28         mov             al,4
29         mov             ah,byte ptr 8[bp]
30         and             ah,3
31         mov             dx,3ceH
32         out             dx,ax
33         mov             ds,word ptr cs:MX_VIDEOSEGMENT
34         mov             ax,bx
35         mul             word ptr cs:MX_BYTESPERLINE
36         shr             si,1
37         shr             si,1
38         add             si,ax
39         mov             al,byte ptr [si]
40         xor             ah,ah
41 L$1:
42         pop             si
43         pop             ds
44         mov             sp,bp
45         pop             bp
46         retf            4
47 MXPUTPIXEL:
48         push            bp
49         mov             bp,sp
50         sub             sp,0
51         push            ds
52         push            si
53         mov             si,word ptr 0aH[bp]
54         cmp             si,word ptr cs:MX_CLIPX1
55         jl              L$2
56         cmp             si,word ptr cs:MX_CLIPX2
57         jg              L$2
58         mov             ax,word ptr 8[bp]
59         cmp             ax,word ptr cs:MX_CLIPY1
60         jl              L$2
61         cmp             ax,word ptr cs:MX_CLIPY2
62         jg              L$2
63         mov             ds,word ptr cs:MX_VIDEOSEGMENT
64         mul             word ptr cs:MX_BYTESPERLINE
65         shr             si,1
66         shr             si,1
67         add             si,ax
68         mov             cl,byte ptr 0aH[bp]
69         and             cl,3
70         mov             ax,102H
71         shl             ah,cl
72         mov             dx,3c4H
73         out             dx,ax
74         mov             al,byte ptr 6[bp]
75         mov             byte ptr [si],al
76 L$2:
77         xor             ax,ax
78         pop             si
79         pop             ds
80         mov             sp,bp
81         pop             bp
82         retf            6
83 MX_TEXT         ENDS
84                 END