| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | blt.c -- block image transfer functions for the Atari
|
|---|
| 4 | Version 1 -- 1988-08-15 -- D.N. Lynx Crowe
|
|---|
| 5 | =============================================================================
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "osbind.h"
|
|---|
| 9 |
|
|---|
| 10 | extern short gl_hres; /* horizontal resolution */
|
|---|
| 11 |
|
|---|
| 12 | cpy_raster(src, dst, width )
|
|---|
| 13 | register short *src, *dst, width;
|
|---|
| 14 | {
|
|---|
| 15 | if ((long)src > (long)dst) {
|
|---|
| 16 |
|
|---|
| 17 | while (width--)
|
|---|
| 18 | *dst++ = *src++;
|
|---|
| 19 |
|
|---|
| 20 | } else {
|
|---|
| 21 |
|
|---|
| 22 | while (width--)
|
|---|
| 23 | *(dst + width) = *(src + width);
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | cpy_block(src_x, src_y, src_w, src_h, dst_x, dst_y )
|
|---|
| 28 | short src_x, src_y;
|
|---|
| 29 | register short src_w, src_h;
|
|---|
| 30 | short dst_x, dst_y;
|
|---|
| 31 | {
|
|---|
| 32 | register short *pbase, *src_base, *dst_base;
|
|---|
| 33 |
|
|---|
| 34 | pbase = (short *)Physbase();
|
|---|
| 35 |
|
|---|
| 36 | if (src_y > dst_y) {
|
|---|
| 37 |
|
|---|
| 38 | (long)src_base = (long)pbase + (src_y * gl_hres) + src_x;
|
|---|
| 39 | (long)dst_base = (long)pbase + (dst_y * gl_hres) + dst_x;
|
|---|
| 40 |
|
|---|
| 41 | while (src_h--) {
|
|---|
| 42 |
|
|---|
| 43 | cpy_raster(src_base, dst_base, src_w);
|
|---|
| 44 | src_base += gl_hres;
|
|---|
| 45 | dst_base += gl_hres;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | } else {
|
|---|
| 49 |
|
|---|
| 50 | (long)src_base = (long)pbase + ((src_y + src_h) * gl_hres);
|
|---|
| 51 | (long)dst_base = (long)pbase + ((dst_y + src_h) * gl_hres);
|
|---|
| 52 |
|
|---|
| 53 | while (src_h--) {
|
|---|
| 54 |
|
|---|
| 55 | cpy_raster(src_base, dst_base, src_w);
|
|---|
| 56 | src_base -= gl_hres;
|
|---|
| 57 | dst_base -= gl_hres;
|
|---|
| 58 | }
|
|---|
| 59 | }
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|