|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 2199 (0x897)
Types: TextFile
Notes: UNIX file
Names: »dtext.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »hr/src/desk/dtext.c«
#include "desk.h"
static BLTSTRUCT blt;
int D_StrW(s, slen)
char *s;
int slen;
{
register int len;
register int width;
GETPTR f;
len = 0;
f.gfid = SYS_FID;
while ( slen-- > 0 )
{
f.gch = *s++;
if ( (width = FM_getch(&f)) == -1 )
return 0;
len += width;
}
return (len);
}
D_Str(s, slen, dp)
char *s;
int slen;
POINT dp;
{
register int len;
register int width;
GETPTR f;
RECT rect;
len = 0;
f.gfid = SYS_FID;
while ( slen-- > 0 )
{
f.gch = *s++;
if ( (width = FM_getch(&f)) == -1 )
return;
if ( width == -2 )
continue;
blt.src = &f.gbmap;
rect.origin = dp;
dp.x += width;
rect.corner.y = rect.origin.y + f.gdescent;
rect.origin.y -= f.gascent;
rect.corner.x = rect.origin.x + f.gawdth;
blt.dr = R_Intersection(rect, dskClip);
blt.sp.x = blt.dr.origin.x - rect.origin.x + f.gpoint.x;
blt.sp.y = blt.dr.origin.y - rect.origin.y + f.gpoint.y;
charblt();
}
}
static
charblt()
{
register uint *sp,
*dp,
smask,
dmask;
register int n,
nx,
ny;
uint Dmask,
Smask;
int swidth, /* bytes to next src raster */
dwidth; /* bytes to next dst raster */
if ( (nx = blt.dr.corner.x - blt.dr.origin.x) <= 0 )
return;
if ( (ny = blt.dr.corner.y - blt.dr.origin.y) <= 0 )
return;
dwidth = 2*DIS_WIDTH/BPW - ((blt.dr.corner.x>>SBPW) - (blt.dr.origin.x>>SBPW) << 1);
swidth = 2*blt.src->width/BPW - (((blt.sp.x + nx)>>SBPW) - (blt.sp.x>>SBPW) << 1);
Dmask = (uint) 0x8000 >> (blt.dr.origin.x & (BPW - 1));
Smask = (uint) 0x8000 >> (blt.sp.x & (BPW - 1));
if ( blt.dr.origin.y >= YSPLIT )
dp = SEG1 + (blt.dr.origin.y - YSPLIT) * (DIS_WIDTH/BPW);
else
dp = SEG0 + blt.dr.origin.y * (DIS_WIDTH/BPW);
dp = addptr(dp, blt.dr.origin.x >> SBPW << 1);
sp = addptr(blt.src->base, (blt.src->width >> SBPW << 1) * blt.sp.y);
sp = addptr(sp, blt.sp.x >> SBPW << 1);
while ( ny-- )
{
dmask = Dmask;
smask = Smask;
for ( n = nx; n ; n-- )
{
if ( *sp & smask )
*dp ^= dmask;
if ( (smask >>= 1) == 0 )
{
smask = 0x8000;
sp++;
}
if ( (dmask >>= 1) == 0 )
{
dmask = 0x8000;
dp = addptr(dp, sizeof(int));
}
}
sp = addptr(sp, swidth);
dp = addptr(dp, dwidth);
}
}