1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY| without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "../../platform/atari/symbols.h"
.global SYM(asm_draw_4bpl_sprite)
.global SYM(asm_draw_8bpl_sprite)
.text
| extern void asm_draw_4bpl_sprite(uint16 *dstBuffer, const uint16 *srcBuffer, const uint16 *srcMask,
| uint destX, uint destY, uint dstPitch, uint w, uint h);
|
SYM(asm_draw_4bpl_sprite):
movem.l d0-d7/a0-a2,-(sp) | 11 longs
#ifdef __FASTCALL__
move.l a0,a2 | a2: dstBuffer
| a1: srcBuffer
move.l (4+11*4,sp),a0 | a0: srcMask
| d0.w: destX
| d1.w: destY
move.l d2,d3 | d3.w: dstPitch
ext.l d3 | d3.l: dstPitch
move.l (8+11*4,sp),d6 | d6.w: w
lsr.w #4,d6 | d6.w: w/16
move.l (12+11*4,sp),d7 | d7.w: h
#else
move.l (4+11*4,sp),a2 | a2: dstBuffer
move.l (8+11*4,sp),a1 | a1: srcBuffer
move.l (12+11*4,sp),a0 | a0: srcMask
move.l (16+11*4,sp),d0 | d0.w: destX
move.l (20+11*4,sp),d1 | d1.w: destY
move.l (24+11*4,sp),d3 | d3.w: dstPitch
ext.l d3 | d3.l: dstPitch
move.l (28+11*4,sp),d6 | d6.w: w
lsr.w #4,d6 | d6.w: w/16
move.l (32+11*4,sp),d7 | d7.w: h
#endif
| Draws a 4 bitplane sprite at any position on screen.
| (c) 1999 Pieter van der Meer (EarX)
|
| INPUT: d0.w: x position of sprite on screen (left side)
| d1.w: y position of sprite on screen (top side)
| d6.w: number of 16pixel X blocks to do
| d7.w: number of Y lines to to
| a0: address of maskdata
| a1: address of bitmapdata
| a2: screen start address
move.w d0,d2 | / Calculate the
andi.w #0b111111110000,d0 | | number of bits
sub.w d0,d2 | \ to shift right.
lsr.w #1,d0 | / Add x-position to
adda.w d0,a2 | \ screenaddress.
mulu.w d3,d1 | / Add y-position to
adda.l d1,a2 | \ screenaddress.
move.w d6,d1 | / Prepare
lsl.w #3,d1 | | offset
move.l d3,d4 | | to next
sub.w d1,d4 | \ screenline.
subq.w #1,d7 | Adjust for dbra.
subq.w #1,d6 | Adjust for dbra.
move.w d6,d5 | Backup xloopcount in d5.w.
moveq #16,d1 | Size of two chunks.
sprite4_yloop:
move.w d5,d6 | Restore xloop counter.
sprite4_xloop:
moveq #0xffffffff,d0 | Prepare for maskshifting.
move.w (a0)+,d0 | Get 16pixel mask in d0.w.
ror.l d2,d0 | Shift it!
and.w d0,(a2)+ | Mask bitplane 0.
and.w d0,(a2)+ | Mask bitplane 1.
and.w d0,(a2)+ | Mask bitplane 2.
and.w d0,(a2)+ | Mask bitplane 3.
swap d0 | Get overspill in loword.
and.w d0,(a2)+ | Mask overspill bitplane 0.
and.w d0,(a2)+ | Mask overspill bitplane 1.
and.w d0,(a2)+ | Mask overspill bitplane 2.
and.w d0,(a2)+ | Mask overspill bitplane 3.
suba.l d1,a2 | Return to blockstart.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 0.
swap d0 | Get overspill in loword.
or.w d0,6(a2) | Paint overspill bitplane 0.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 1.
swap d0 | Get overspill in loword.
or.w d0,6(a2) | Paint overspill bitplane 1.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 2.
swap d0 | Get overspill in loword.
or.w d0,6(a2) | Paint overspill bitplane 2.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 3.
swap d0 | Get overspill in loword.
or.w d0,6(a2) | Paint overspill bitplane 3.
dbra d6,sprite4_xloop | Loop until blocks done.
adda.l d4,a2 | Goto next screenline.
dbra d7,sprite4_yloop | Loop until lines done.
movem.l (sp)+,d0-d7/a0-a2
rts
| extern void asm_draw_8bpl_sprite(uint16 *dstBuffer, const uint16 *srcBuffer, const uint16 *srcMask,
| uint destX, uint destY, uint dstPitch, uint w, uint h);
|
SYM(asm_draw_8bpl_sprite):
movem.l d0-d7/a0-a2,-(sp) | 11 longs
#ifdef __FASTCALL__
move.l a0,a2 | a2: dstBuffer
| a1: srcBuffer
move.l (4+11*4,sp),a0 | a0: srcMask
| d0.w: destX
| d1.w: destY
move.l d2,d3 | d3.w: dstPitch
ext.l d3 | d3.l: dstPitch
move.l (8+11*4,sp),d6 | d6.w: w
lsr.w #4,d6 | d6.w: w/16
move.l (12+11*4,sp),d7 | d7.w: h
#else
move.l (4+11*4,sp),a2 | a2: dstBuffer
move.l (8+11*4,sp),a1 | a1: srcBuffer
move.l (12+11*4,sp),a0 | a0: srcMask
move.l (16+11*4,sp),d0 | d0.w: destX
move.l (20+11*4,sp),d1 | d1.w: destY
move.l (24+11*4,sp),d3 | d3.w: dstPitch
ext.l d3 | d3.l: dstPitch
move.l (28+11*4,sp),d6 | d6.w: w
lsr.w #4,d6 | d6.w: w/16
move.l (32+11*4,sp),d7 | d7.w: h
#endif
move.w d0,d2 | / Calculate the
andi.w #0b111111110000,d0 | | number of bits
sub.w d0,d2 | \ to shift right.
adda.w d0,a2 | Add x-position to screenaddress.
mulu.w d3,d1 | / Add y-position to
adda.l d1,a2 | \ screenaddress.
move.w d6,d1 | / Prepare
lsl.w #4,d1 | | offset
move.l d3,d4 | | to next
sub.w d1,d4 | \ screenline.
subq.w #1,d7 | Adjust for dbra.
subq.w #1,d6 | Adjust for dbra.
move.w d6,d5 | Backup xloopcount in d5.w.
moveq #32,d1 | Size of two chunks.
sprite8_yloop:
move.w d5,d6 | Restore xloop counter.
sprite8_xloop:
moveq #0xffffffff,d0 | Prepare for maskshifting.
move.w (a0)+,d0 | Get 16pixel mask in d0.w.
ror.l d2,d0 | Shift it!
and.w d0,(a2)+ | Mask bitplane 0.
and.w d0,(a2)+ | Mask bitplane 1.
and.w d0,(a2)+ | Mask bitplane 2.
and.w d0,(a2)+ | Mask bitplane 3.
and.w d0,(a2)+ | Mask bitplane 4.
and.w d0,(a2)+ | Mask bitplane 5.
and.w d0,(a2)+ | Mask bitplane 6.
and.w d0,(a2)+ | Mask bitplane 7.
swap d0 | Get overspill in loword.
and.w d0,(a2)+ | Mask overspill bitplane 0.
and.w d0,(a2)+ | Mask overspill bitplane 1.
and.w d0,(a2)+ | Mask overspill bitplane 2.
and.w d0,(a2)+ | Mask overspill bitplane 3.
and.w d0,(a2)+ | Mask overspill bitplane 4.
and.w d0,(a2)+ | Mask overspill bitplane 5.
and.w d0,(a2)+ | Mask overspill bitplane 6.
and.w d0,(a2)+ | Mask overspill bitplane 7.
suba.l d1,a2 | Return to blockstart.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 0.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 0.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 1.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 1.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 2.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 2.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 3.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 3.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 4.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 4.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 5.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 5.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 6.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 6.
moveq #0,d0 | Prepare for bitmapshifting.
move.w (a1)+,d0 | Get bitplaneword in d0.w.
ror.l d2,d0 | Shift it.
or.w d0,(a2)+ | Paint bitplane 7.
swap d0 | Get overspill in loword.
or.w d0,14(a2) | Paint overspill bitplane 7.
dbra d6,sprite8_xloop | Loop until blocks done.
adda.l d4,a2 | Goto next screenline.
dbra d7,sprite8_yloop | Loop until lines done.
movem.l (sp)+,d0-d7/a0-a2
rts
.bss
.even
save_pal:
ds.l 256+16/2 | old colours (sized for falcon+ste palette)
save_video:
ds.b 32+12+2 | old video regs (size of falcon regs)
|