1 ;-----------------------------------------------------------
\r
3 ; MXTL.ASM - Put tile
\r
4 ; Copyright (c) 1994 by Alessandro Scotti
\r
6 ;-----------------------------------------------------------
\r
12 PUBLIC mxTransPutTile
\r
14 MX_TEXT SEGMENT USE16 PARA PUBLIC 'CODE'
\r
15 ASSUME cs:MX_TEXT, ds:NOTHING, es:NOTHING
\r
17 EXTRN mx_VideoSegment : WORD
\r
18 EXTRN mx_BytesPerLine : WORD
\r
20 ;-----------------------------------------------------------
\r
22 ; Copies a "mode-x" tile from memory to screen.
\r
25 ; Image = pointer to tile
\r
26 ; X, Y = coordinates of destination
\r
27 ; Width = width of image in pixels (Width and 3 = 0)
\r
28 ; Height = height of image in pixels
\r
32 ; no clipping is performed on tiles!
\r
39 Image:DWORD = ARG_SIZE
\r
42 .push ds, si, es, di
\r
44 mov ax, [Y] ; Get pixel address
\r
45 mul [mx_BytesPerLine]
\r
49 mov es, [mx_VideoSegment]
\r
51 lds si, [Image] ; Get tile address
\r
52 .shr [Width], 2 ; Number of bytes per plane
\r
53 mov cl, BYTE PTR [X]
\r
55 mov ah, 11h ; AH = plane mask
\r
56 shl ah, cl ; Align mask to first plane
\r
58 mov [Y], 4 ; Number of planes
\r
59 mov bx, [mx_BytesPerLine]
\r
60 sub bx, [Width] ; Extra bytes per line
\r
64 out dx, ax ; Set write plane
\r
65 mov [X], di ; Save video offset
\r
68 mov cx, [Width] ; Number of bytes to move
\r
70 shr cx, 1 ; Move line
\r
75 add di, bx ; Move video offset to next line
\r
76 dec dx ; Done all lines?
\r
77 jnz @@Loop2 ; No, continue
\r
78 mov di, [X] ; Restore video offset
\r
79 rol ah, 1 ; Next plane
\r
80 adc di, 0 ; Bump video offset if needed
\r
81 dec [Y] ; Any plane left?
\r
82 jnz @@Loop ; Yes, keep looping
\r
89 ;-----------------------------------------------------------
\r
91 ; Copies a "mode-x" tile from memory to screen.
\r
92 ; Skips over color 0.
\r
95 ; Image = pointer to tile
\r
96 ; X, Y = coordinates of destination
\r
97 ; Width = width of image in pixels (Width and 3 = 0)
\r
98 ; Height = height of image in pixels
\r
102 ; no clipping is performed on tiles!
\r
104 mxTransPutTile PROC FAR
\r
109 Image:DWORD = ARG_SIZE
\r
112 .push ds, si, es, di
\r
114 mov ax, [Y] ; Get pixel address
\r
115 mul [mx_BytesPerLine]
\r
119 mov es, [mx_VideoSegment]
\r
121 lds si, [Image] ; Get tile address
\r
122 .shr [Width], 2 ; Number of bytes per plane
\r
123 mov cl, BYTE PTR [X]
\r
125 mov ah, 11h ; AH = plane mask
\r
126 shl ah, cl ; Align mask to first plane
\r
128 mov [Y], 4 ; Number of planes
\r
129 mov bx, [mx_BytesPerLine]
\r
130 sub bx, [Width] ; Extra bytes per line
\r
134 out dx, ax ; Set write plane
\r
135 mov [X], di ; Save video offset
\r
138 mov cx, [Width] ; Number of bytes to move
\r
141 jcxz @@MoveLineDone
\r
154 add di, bx ; Move video offset to next line
\r
155 dec dx ; Done all lines?
\r
156 jnz @@Loop2 ; No, continue
\r
157 mov di, [X] ; Restore video offset
\r
158 rol ah, 1 ; Next plane
\r
159 adc di, 0 ; Bump video offset if needed
\r
160 dec [Y] ; Any plane left?
\r
161 jnz @@Loop ; Yes, keep looping
\r
164 .pop ds, si, es, di
\r
166 mxTransPutTile ENDP
\r