[net.micro.atari16] Line-A, TextBlt, and the contest!!!!!!!!!!!!

UC.BRI%DEEP-THOUGHT@EDDIE.MIT.EDU (Brian Totty) (08/20/86)

	I know this is long, but if you have any knowledge of line-A
stuff, I would appreciate you looking this over.  Think of it as a contest.
Whoever gets this working first will get netwide recognition...(or whatever
will make you give me the solution...)

			----------------------

	o o
	 o	"The problem follows..."
	\_/

			----------------------

	Okay.  I need some help badly!  I have been trying for weeks
(or at least days) to get the line A TextBlt routine to work.  I need this for
a project I am doing and have to finish by the end of the summer.  I am writing
a GEM application, and I want to write an assembly binding to be called from
C to do the TextBlt stuff.

	I have most of the font information I need.  The font data I have
organized in a raster form , and is described by an MFDB called
FontActualMFDB.

	Here is the C calling routine I use.  The routine TypeChar is called
with x and y coordinates an an integer value for the character.  There are
some external routines and globals variables, but they should be okay.  The
assembly routine that is called is AsmTextBlt.

			-----------------------

	VOID TypeChar(x,y,c)
	WORD x,y,c;
	{
	
	/*
	 * effects: This routine types the character <c> at [x,y]
	 *
	 */
		WORD sx,sw,sh;
	
		sx = GetOffset(c);
		sw = GetOffset(c + 1) - sx;
		sh = Font_header.form_height;
		AsmTextBlit(FontActualMFDB.fd_addr,
			FontActualMFDB.fd_wdwidth * 2,sx,0,x,y,sw,sh,
			color,Font_header.light_mask,
			Font_header.skew_mask,Font_header.thickening,
			0,0,0,Samp_vregf_buffer,
			1024,Clip_on,Clip_x1,Clip_y1,Clip_x2,Clip_y2);
		return;
	} /* End TypeChar */

			-------------------------

	Okay, now here is the assembly stuff.  I don't really know what
the Alcyon calling conventions are, so most of this is just extrapolation
from other people's code.  Likewise, I don't know what registers must be saved,
etc.  If someone can tell me why this doesn't work, or, if they can send me
some working sample code, I would be ENORMOUSLY appreciative!!!!!!!!!!!

			-------------------------
.globl _AsmTextBlit


***************************************************************
*                                                             *
*    AsmTextBlit(form_addr,form_width,sx,sy,dx,dy,w,h,        *
*               effects,lmask,smask,thick,roffset,loffset,    *
*               mono_flag,buffer,scrpt2,clip_flag,            *
*               clipx1,clipy1,clipx2,clipy2)                  *
*                                                             *
***************************************************************

*
* stack frame
* -----------
*
* SP --> |______________________|
* A6 --> |       old A6         | (A6 + 0)
*        |                      |
*        |                      |
*        |______________________|              ^
*        |    return address    | (A6 + 4)     | Growing towards
*        |                      |              |  lower memory...
*        |                      |              |
*        |______________________|
*        |    <form_address>    | (A6 + 8)
*        |                      |
*        |                      |
*        |______________________|
*        |    <form_width>      | (A6 + 12)
*        |______________________|
*        |         <sx>         | (A6 + 14)
*        |______________________|
*        |         <sy>         | (A6 + 16)
*        |______________________|
*        |         <dx>         | (A6 + 18)
*        |______________________|
*        |         <dy>         | (A6 + 20)
*        |______________________|
*        |         <w>          | (A6 + 22)
*        |______________________|
*        |         <h>          | (A6 + 24)
*        |______________________|
*        |      <effects>       | (A6 + 26)
*        |______________________|
*        |       <lmask>        | (A6 + 28)
*        |______________________|
*        |       <smask>        | (A6 + 30)
*        |______________________|
*        |       <thick>        | (A6 + 32)
*        |______________________|
*        |      <roffset>       | (A6 + 34)
*        |______________________|
*        |      <loffset>       | (A6 + 36)
*        |______________________|
*        |     <mono_flag>      | (A6 + 38)
*        |______________________|
*        |       <buffer>       | (A6 + 40)
*        |                      |
*        |                      |
*        |______________________|
*        |      <scrpt2>        | (A6 + 44)
*        |______________________|
*        |     <clip_flag>      | (A6 + 46)
*        |______________________|
*        |       <clipx1>       | (A6 + 48)
*        |______________________|
*        |       <clipy1>       | (A6 + 50)
*        |______________________|
*        |       <clipx2>       | (A6 + 52)
*        |______________________|
*        |       <clipy2>       | (A6 + 54)
*        |______________________|
*

	.text

_AsmTextBlit:

	link A6,#0
	move.l A0,-(SP)		* save A0
	move.l A1,-(SP)		* save A1
	move.l A2,-(SP)		* save A2
	move.l D1,-(SP)		* save D1
	move.l D2,-(SP)		* save D2
	move.l D3,-(SP)		* save D3

	dc.w $a000		* trap to init line A

	move.w #0,36(A0)	* WMODE = 0
	move.w #1,106(A0)	* TEXTFG = 1
	move.w #0,114(A0)	* TEXTBG = 0
	move.l 8(A6),84(A0)	* FBASE = form_addr
	move.w 12(A6),88(A0)	* FWIDTH = form_width
	move.w 14(A6),72(A0)	* SRCX = sx
	move.w #0,74(A0)	* SRCY = 0
	move.w 18(A6),76(A0)	* DSTX = dx
	move.w 20(A6),78(A0)	* DSTY = dy
	move.w 22(A6),80(A0)	* DELX = w
	move.w 24(A6),82(A0)	* DELY = h
	move.w 26(A6),90(A0)	* STYLE = effects
	move.w 28(A6),92(A0)	* LITEMASK = lmask
	move.w 30(A6),94(A0)	* SKEWMASK = smask
	move.w 32(A6),96(A0)	* WEIGHT = thickening
	move.w 34(A6),98(A0)	* ROFF = roffset
	move.w 36(A6),100(A0)	* LOFF = loffset
	move.w 38(A6),70(A0)	* MONO = mono_flag
	move.l 40(A6),108(A0)	* SCRTCHP = buffer
	move.w 44(A6),112(A0)	* SCRPT2 = scrpt2
	move.w #$8000,64(A0)	* XDDA = $8000
	move.w #256,66(A0)	* DDAINC = 256
	move.w #0,68(A0)	* SCALEDIR = 0
	move.w 46(A6),54(A0)	* CLIP = clip_flag
	move.w 48(A6),56(A0)	* XMINCL = clipx1
	move.w 50(A6),58(A0)	* YMINCL = clipy1
	move.w 52(A6),60(A0)	* XMAXCL = clipx2
	move.w 54(A6),62(A0)	* YMAXCL = clipy2
	move.w #0,102(A0)	* SCALE = 0
	move.w #0,104(A0)	* CHUP = 0

	dc.w $a008		* trap to TextBlt

	move.l (SP)+,D3		* restore D3
	move.l (SP)+,D2		* restore D2
	move.l (SP)+,D1		* restore D1
	move.l (SP)+,A2		* restore A2
	move.l (SP)+,A1		* restore A1
	move.l (SP)+,A0		* restore A0

	unlk A6
	rts

	.end

			-------------------------

	Thank you for putting up with this.  I really am about ready to give
up.

						--- Bri

					uc.bri@deep-thought.mit.edu
					...!mit-eddie!bri
-------