1 ;-----------------------------------------------------------
\r
3 ; MXHL.ASM - Horizontal line mask utility
\r
4 ; Copyright (c) 1993,1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
10 PUBLIC subHorizontalLineInfo
\r
12 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
13 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
15 EXTRN mx_BytesPerLine : WORD
\r
17 tblLeftSize DW 00h, 03h, 02h, 01h
\r
18 tblLeftMask DB 00h, 0Eh, 0Ch, 08h
\r
19 tblRightMask DB 00h, 01h, 03h, 07h
\r
20 tblPatchMask DB 02h, 06h
\r
22 ;-----------------------------------------------------------
\r
24 ; Prepares register for fast horizontal line drawing.
\r
27 ; BX, AX = X, Y address of left pixel
\r
30 ; DI = left pixel offset in video memory
\r
31 ; AL = left block write plane mask (0 = none)
\r
32 ; AH = right block write plane mask (0 = none)
\r
33 ; CX = center block width in 4-pixel blocks
\r
35 subHorizontalLineInfo PROC NEAR
\r
38 mul [mx_BytesPerLine]
\r
42 add di, ax ; Offset of left pixel
\r
45 mov al, tblLeftMask[bx]
\r
47 sub cx, tblLeftSize[bx]
\r
48 jge @@1 ; Ok to continue
\r
50 ; Special case: start and end in the middle of a 4-pixel block.
\r
51 ; There are only three cases:
\r
52 ; Pixels Left mask CX CX+2 Patch mask Result
\r
53 ; 1) ..o. ..xx -1 1 .xx. ..x.
\r
54 ; 2) .oo. .xxx -1 1 .xx. .xx.
\r
55 ; 3) .o.. .xxx -2 0 .x.. .x..
\r
56 ; All other cases are automatically handled with the standard masks.
\r
60 and al, tblPatchMask[bx] ; Combine masks
\r
61 xor ah, ah ; No right block
\r
62 xor cx, cx ; No center block
\r
68 mov ah, tblRightMask[bx]
\r
73 subHorizontalLineInfo ENDP
\r