Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ames!oliveb!pyramid!uccba!hal!cwruecmp!bammi From: bammi@cwruecmp.UUCP Newsgroups: comp.sys.atari.st Subject: Re: String.c (really fontload.tos) Message-ID: <2151@cwruecmp.UUCP> Date: Fri, 12-Jun-87 02:07:05 EDT Article-I.D.: cwruecmp.2151 Posted: Fri Jun 12 02:07:05 1987 Date-Received: Sat, 13-Jun-87 19:54:48 EDT References: <8705271729.AA20883@ucbvax.Berkeley.EDU> <1102@viper.Lynx.MN.ORG> <2150@cwruecmp.UUCP> Reply-To: bammi@cwruecmp.UUCP (Jwahar R. Bammi) Distribution: world Organization: Case Western Reserve University Lines: 593 -------------cut here------TOS font switcher part 2 of 3------------------- #!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # aline.h # This archive created: Fri Jun 12 01:44:20 1987 # By: Jwahar R. Bammi(Case Western Reserve University) # Uucp: {decvax,sun,cbosgd}!cwruecmp!bammi # Csnet: bammi@cwru.edu # Arpa: bammi@cwru.edu # export PATH; PATH=/bin:$PATH echo shar: extracting "'aline.h'" '(26615 characters)' if test -f 'aline.h' then echo shar: over-writing existing file "'aline.h'" fi sed 's/^X//' << \SHAR_EOF > 'aline.h' X X /***********************************************\ X * * X * aline.h * X * Common include file for C interface * X * to low level Line A calls * X * * X * J.R. Bammi * X * decvax!cwruecmp!bammi * X * bammi%cwru.edu.CSNET * X * bammi@cwru.edu.ARPA * X * CIS: 71515,155 * X * * X \***********************************************/ X X#include "compiler.h" /* Compiler dependent defines */ X X X/*****************************************************************************\ X* * X* Defines * X* * X\*****************************************************************************/ X X/* X * Object colors (default pallette) X * X */ X#define WHITE 0 X#define BLACK 1 X#define RED 2 X#define GREEN 3 X#define BLUE 4 X#define CYAN 5 X#define YELLOW 6 X#define MAGENTA 7 X#define LWHITE 8 X#define LBLACK 9 X#define LRED 10 X#define LGREEN 11 X#define LBLUE 12 X#define LCYAN 13 X#define LYELLOW 14 X#define LMAGENTA 15 X X X/* X * Vdi writing modes X * X */ X#define MD_REPLACE 1 X#define MD_TRANS 2 X#define MD_XOR 3 X#define MD_ERASE 4 X X X/* X * Raster Op Codes X * X */ X#define ALL_WHITE 0 X#define S_AND_D 1 X#define S_AND_NOTD 2 X#define S_ONLY 3 X#define NOTS_AND_D 4 X#define D_ONLY 5 X#define S_XOR_D 6 X#define S_OR_D 7 X#define NOT_SORD 8 X#define NOT_SXORD 9 X#define D_INVERT 10 X#define NOT_D 11 X#define S_OR_NOTD 12 X#define NOTS_OR_D 13 X#define NOT_SANDD 14 X#define ALL_BLACK 15 X X/* X * Sprite formats X * X */ X#define SP_VDI 0 X#define SP_XOR 1 X X/* X * Line A Opcodes X * X */ X#define INIT 0 X#define PUTPIXEL 1 X#define GETPIXEL 2 X#define LINE 3 X#define HLINE 4 X#define RECTANGLE 5 X#define FPOLYGON 6 X#define BITBLT 7 X#define TEXTBLT 8 X#define SHOWMOUSE 9 X#define HIDEMOUSE 10 X#define TRANMOUSE 11 X#define USPRITE 12 X#define DSPRITE 13 X#define CPYRASTER 14 X#define FSEEDFILL 15 /* ROM TOS only */ X X X/*****************************************************************************\ X* * X* Types * X* * X\*****************************************************************************/ X X /* X * Global Variables at negative offsets from the Line A parameter X * block address returned by init. (I have no way of telling if this X * list is complete). X * X */ X/* Name Offset Type Description */ X/* --------------------------------------------------------------------------*/ X/* V_Y_MAX -4 W Max Y pixel value of the screen */ X/* V_STATUS -6 W Text Status byte */ X/* Bit Field Zero One */ X/* 0 cursor flash disabled enabled */ X/* 1 flash state off on */ X/* 2 cursor visible no yes */ X/* 3 end of line no-wrap wrap */ X/* 4 inverse video on off */ X/* 5 cursor saved false true */ X/* V_OFF_AD -10 L Font offset table address */ X/* V_X_MAX -12 W Max X pixel value */ X/* V_FNT_WR -14 W Width of Font Form in bytes (see type FONT below) */ X/* V_FNT_ST -16 W First font ASCII code (first_ade) */ X/* V_FNT_ND -18 W Last font ASCII code (last_ade ) */ X/* V_FNT_AD -22 L Font Form address */ X/* Mono Spaced, 8 pixels wide and byte aligned, any ht. */ X/* V_CUR_TIM -23 B Cursor countdown timer */ X/* V_CUR_CNT -24 B Cursor flash interval( in frames) */ X/* V_CUR_CY -26 W Y cursor position */ X/* V_CUR_CX -28 W X cursor position */ X/* V_CUR_OFF -30 W Offset from screen base to first cell (bytes) */ X/* V_CUR_AD -34 L Current cursor address */ X/* V_COL_FG -36 W Foreground color index */ X/* V_COL_BG -38 W Background color index */ X/* V_CEL_WR -40 W Offset to next vertical cell (bytes) */ X/* V_CEL_MY -42 W Max cells high - 1 */ X/* V_CEL_MX -44 W Max cells across - 1 */ X/* V_CEL_HT -46 W Cell height in pixels (font form's height) */ X/* --------------------------------------------------------------------------*/ X X/* X * Atari finally named these variables X * so here they are X * X */ Xtypedef struct { X WORD V_CEL_HT; /* *((WORD *)((char *)aline - (char *)46L)) */ X WORD V_CEL_MX; /* *((WORD *)((char *)aline - (char *)44L)) */ X WORD V_CEL_MY; /* *((WORD *)((char *)aline - (char *)42L)) */ X WORD V_CEL_WR; /* *((WORD *)((char *)aline - (char *)40L)) */ X WORD V_COL_BG; /* *((WORD *)((char *)aline - (char *)38L)) */ X WORD V_COL_FG; /* *((WORD *)((char *)aline - (char *)36L)) */ X char *V_CUR_AD; /* *((char **)((char **)aline - (char **)34L)) */ X WORD V_CUR_OFF; /* *((WORD *)((char *)aline - (char *)30L)) */ X WORD V_CUR_CX; /* *((WORD *)((char *)aline - (char *)28L)) */ X WORD V_CUR_CY; /* *((WORD *)((char *)aline - (char *)26L)) */ X WORD V_CUR_CNT; /* *((char *)((char *)aline - (char *)24L)) */ X/* char V_CUR_TIM; *((char *)((char *)aline - (char *)23L)) */ X char **V_FNT_AD; /* *((char **)((char **)aline - (char **)22L)) */ X WORD V_FNT_ND; /* *((WORD *)((char *)aline - (char *)18L)) */ X WORD V_FNT_ST; /* *((WORD *)((char *)aline - (char *)16L)) */ X WORD V_FNT_WR; /* *((WORD *)((char *)aline - (char *)14L)) */ X WORD V_X_MAX; /* *((WORD *)((char *)aline - (char *)12L)) */ X char **V_OFF_AD; /* *((char **)((char **)aline - (char **)10L)) */ X WORD V_STATUS; /* *((WORD *)((char *)aline - (char *) 6L)) */ X WORD V_Y_MAX; /* *((WORD *)((char *)aline - (char *) 4L)) */ X WORD xxdummy; /* *((WORD *)((char *)aline - (char *) 2L)) */ X} NLINEA; X X X /* A pointer to the type LINEA is returned by the Line A init call X * ($A000), in registers A0 and D0. X * This pointer is saved in the global variable 'aline'. X * X */ Xtypedef struct { X X/* Type Name Offset Function Comments */ X/* ------------------------------------------------------------------------- */ X WORD VPLANES; /* 0 # of Planes Also see CurrRez */ X WORD VWRAP; /* 2 Bytes / scan line " " " */ X /* VWRAP can be changed to implement special effect*/ X /* Doubling VWRAP will skip every other scan line */ X /* */ X /* */ X WORD *CONTRL; /* 4 Ptr to CONTRL Array Contrl gets set to this */ X WORD *INTIN; /* 8 Ptr to INTIN Array Intin gets set to this */ X WORD *PTSIN; /* 12 Ptr to PTSIN Array Ptsin gets set to this */ X WORD *INTOUT; /* 16 Ptr to INTOUT Array Intout gets set to this */ X WORD *PTSOUT; /* 20 Ptr to PTSOUT Array Ptsout gets set to this */ X /* CONTRL is the control array */ X /* INTIN is the array of input parameters */ X /* PTSIN is the array of input coordinates */ X /* Even entrys are X coordinate */ X /* Odd entrys are corresponding Y coodinates */ X /* INTOUT is the array of output parameters */ X /* PTSOUT is the array of output coordinates */ X /* organizes like PTSIN. */ X /* */ X WORD COLBIT0; /* 24 Plane 0 Color Value All Three Rez's */ X WORD COLBIT1; /* 26 Plane 1 Color Value Med and Low Rez only */ X WORD COLBIT2; /* 28 Plane 2 Color Value Low Rez only */ X WORD COLBIT3; /* 30 Plane 3 Color Value Low Rez Only */ X /* Foreground color COLBIT0 + 2*COLBIT1 + 4*COLBIT2*/ X /* + 8*COLBIT3 */ X /* */ X /* */ X WORD LSTLIN; /* 32 Always set to -1, Done for you in init_aline() */ X /* Does anyone know what it is supposed to be? */ X /* */ X WORD LNMASK; /* 34 Linemask used when drawing lines, same as Vdi's */ X /* line style */ X /* */ X WORD WMODE; /* 36 Writing mode */ X /* 0=Replace Mode-Replace all bits in Dest with src*/ X /* 1=Trans. Mode-Only additional bits in src set(OR*/ X /* 2=Xor Mode- Src XOR Dest */ X /* 3=Inverse Trans.- (NOT src) Or Dest */ X /* Values upto 16 are permitted */ X /* */ X WORD X1; /* 38 X1 coordinate used in various calls */ X /* */ X WORD Y1; /* 40 Y1 coordinate used in various calls */ X /* */ X WORD X2; /* 42 X2 coordinate used in various calls */ X /* */ X WORD Y2; /* 44 Y2 coordinate used in various calls */ X /* */ X /* */ X WORD *PATPTR; /* 46 Pointer to current fill pattern */ X /* Must be integral power of 2 (words) in length */ X WORD PATMSK; /* 50 I don't know why they call it a mask. It is in */ X /* reality the length in words of the current patt.*/ X WORD MFILL; /* 52 Multi Plane fill flag 1 == Current fill Pattern */ X /* is for Muti Plane. */ X /* */ X /* */ X WORD CLIP; /* 54 Clipping Flag 1 == TRUE */ X WORD XMINCL; /* 56 Min X of clipping window */ X WORD YMINCL; /* 58 Min Y of clipping window */ X WORD XMAXCL; /* 60 Max X of clipping window */ X WORD YMAXCL; /* 62 Max Y of clipping window */ X /* */ X /* */ X WORD XDDA; /* 64 Accumulator for Scaling, Must be set to 0x08000 */ X /* before each call to Text Blt. Done for you in */ X /* in aline_text() */ X WORD DDAINC; /* 66 Scaling factor - Fractional amount to scale char*/ X /* When scaling up = 256 *(Size-Textsize)/Textsize */ X /* When scaling down = 256*(Size)/Textsize */ X /* scaling down does not work */ X WORD SCALDIR; /* 68 Scaling direction 0 == down */ X WORD MONO; /* 70 Mono flag 0== current font is a propotional font*/ X /* Its Ok for Thickening to increase the width of */ X /* the current character. */ X /* 1 == current font is mono spaced, so thickening */ X /* may not increase the width of the current char */ X /* */ X WORD SOURCEX; /* 72 X coordinate of character in the font form */ X /* SOURCEX is caluclated from info in the font */ X /* header for the current font (see FONT type) */ X /* SOURCEX = off_table[char-first_ade] */ X /* SOURCEX is calculated for you in aline_text() */ X /* The pointer to a table of font header for the */ X /* internal fonts is returned in A2 on init (A000) */ X WORD SOURCEY; /* 74 Y coodinate of character in the font form */ X /* Typically set to 0 (top line of font form) */ X WORD DESTX; /* 76 X coordinate of character on screen */ X WORD DESTY; /* 78 Y coordinate of character on screen */ X WORD DELX; /* 80 Width of Character */ X /* Difference between two SOURCEX's */ X WORD DELY; /* 82 Height of Character */ X /* form_height field of FONT_HEAD of current font */ X WORD *FBASE; /* 84 Pointer to start of font form */ X WORD FWIDTH; /* 88 Width of the current font's form */ X /* */ X WORD STYLE; /* 90 Vector of style flags */ X /* Bit 0 = Thicken Flag */ X /* Bit 1 = Lighten Flag */ X /* Bit 2 = Skewing Flag */ X /* Bit 3 = Underline Flag (ignored) */ X /* Bit 4 = Outline Flag */ X /* */ X WORD LITEMASK; /* 92 Mask used for lightening text */ X /* The Mask is picked up from the font header */ X WORD SKEWMASK; /* 94 Mask used for skewing text */ X /* The Mask is picked up from the font header */ X WORD WEIGHT; /* 96 The number of bits by which to thicken text */ X /* The number is picked up from the font header */ X WORD ROFF; /* 98 Offset above baseline when skewing */ X /* Again picked up from the font header */ X /* */ X WORD LOFF; /* 100 Offset below character baseline when skewing */ X /* Again picked up from the font header */ X /* */ X WORD SCALE; /* 102 Scaling Flag 1 == true */ X /* */ X WORD CHUP; /* 104 Character rotation vector. */ X /* 0 = normal (0 degrees) */ X /* 1800 = 180 degrees */ X /* 2700 = 270 degrees */ X /* */ X WORD TEXTFG; /* 106 Text foreground color */ X /* */ X char *SCRTCHP; /* 108 Address of buffer required for creating special */ X /* text effects. The size of this buffer should be */ X /* 1K according the Internals. The Atari document */ X /* of course does not talk about such things :-) */ X /* */ X WORD SCRPT2; /* 112 The offset of the scaling buffer buffer in above*/ X /* buffer. Internals suggests an offset of 0x0040 */ X /* As usual the Atari document does'nt say a thing */ X /* */ X WORD TEXTBG; /* 114 Text background color (Ram Vdi only) */ X /* used for the BitBlt writing modes (4-19) only */ X /* */ X WORD COPYTRAN; /* 116 Copy raster form type flag (Ram vdi only) */ X /* 0 => Opaque type */ X /* n-plane source -> n-plane dest */ X /* BitBlt writing modes (4-19) */ X /* ~0 => Transparent type */ X /* 1-plane source -> n-plane dest */ X /* Vdi writing modes (1-3) */ X /* */ X WORD(*SEEDABORT)();/* 118 Pointer to function returning int, which is */ X /* called by the fill logic to allow the fill to */ X /* be aborted. If the routine returns FALSE (0) */ X /* the fill is not aborted. If it returns TRUE (~0)*/ X /* the fill is aborted */ X/* ------------------------------------------------------------------------- */ X X} LINEA; /* P H E W !!!!! */ X X X X /* A pointer to array of type FONT is returned by the Line A init call X * ($A000), in regsister A1. X * This pointer is saved in the global array variable 'fonts[]'. X * X */ X Xtypedef struct _font { X X/* Type Name Offset Function Comments */ X/* ------------------------------------------------------------------------- */ X WORD font_id; /* 0 Font face identifier 1 == system font */ X /* */ X WORD size; /* 2 Font size in points */ X /* */ X char name[32]; /* 4 Face name */ X /* */ X WORD first_ade; /* 36 Lowest ADE value in the face (lowest ASCII value */ X /* of displayable character). */ X /* */ X WORD last_ade; /* 38 Highest ADE value in the face (highest ASCII valu*/ X /* of displayable character). */ X /* */ X WORD top; /* 40 Distance of top line relative to baseline */ X /* */ X WORD ascent; /* 42 Distance of ascent line relative to baseline */ X /* */ X WORD half; /* 44 Distance of half line relative to baseline */ X /* */ X WORD descent; /* 46 Distance of decent line relative to baseline */ X /* */ X WORD bottom; /* 48 Distance of bottom line relative to baseline */ X /* All distances are measured in absolute values */ X /* rather than as offsets. They are always +ve */ X /* */ X WORD max_char_width; /* 50 Width of the widest character in font */ X /* */ X WORD max_cell_width; /* 52 Width of the widest cell character cell in face */ X /* */ X WORD left_offset; /* 54 Left Offset see Vdi appendix G */ X /* */ X WORD right_offset; /* 56 Right offset " " " */ X /* */ X WORD thicken; /* 58 Number of pixels by which to thicken characters */ X /* */ X WORD ul_size; /* 60 Width in pixels of the underline */ X /* */ X WORD lighten; /* 62 The mask used to lighten characters */ X /* */ X WORD skew; /* 64 The mask used to determine when to perform */ X /* additional rotation on the character to perform */ X /* skewing */ X /* */ X WORD flags; /* 66 Flags */ X /* bit 0 set if default system font */ X /* bit 1 set if horiz offset table should be used */ X /* bit 2 byte-swap flag (thanks to Intel idiots) */ X /* bit 3 set if mono spaced font */ X /* */ X char *h_table; /* 68 Pointer to horizontal offset table */ X /* */ X WORD *off_table; /* 72 Pointer to character offset table */ X /* */ X char *dat_table; /* 76 Pointer to font data */ X /* */ X WORD form_width; /* 80 Form width (#of bytes /scanline in font data) */ X /* */ X WORD form_height;/* 82 Form height (#of scanlines in font data) */ X /* */ X struct _font *next_font; /* 84 Pointer to next font in face */ X /* */ X/* ------------------------------------------------------------------------- */ X} FONT; X X X /* X * OP_TAB type required for Bit Blt parameter block. X * each entry defines the logic operation to apply for X * the 4 Fore/Back ground bit combinations X */ Xtypedef struct { X X/* Type Name Offset Function Comments */ X/* ------------------------------------------------------------------------- */ X char fg0bg0; /* 0 Logic op to employ when both FG and BG are 0 */ X char fg0bg1; /* 1 Logic op to employ when FG = 0 and BG = 1 */ X char fg1bg0; /* 2 Logic op to employ when FG = 1 and BG = 0 */ X char fg1bg1; /* 3 Logic op to employ when both FG and BG are 1 */ X/* ------------------------------------------------------------------------- */ X} OP_TAB; X X X/* X * Source and destination description blocks X */ Xtypedef struct { X WORD bl_xmin; /* Minimum x */ X WORD bl_ymin; /* Minimum y */ X char *bl_form; /* Word aligned memory form */ X WORD bl_nxwd; /* Offset to next word in line */ X WORD bl_nxln; /* Offset to next line in plane */ X WORD bl_nxpl; /* Offset to next plane */ X}SDDB; X X /* Offsets to next word in plane */ X#define HI_NXWD 2 X#define MED_NXWD 4 X#define LOW_NXWD 8 X X /* Scan line widths of the screen */ X#define HI_NXLN 80 X#define MED_NXLN 160 X#define LOW_NXLN 160 X X /* X * Offsets between planes - always the same due to X * the way the STs video memory is laid out X */ X#define NXPL 2 X X /* X * Bit Blt Parameter Block Type (for function $A007) X * X */ X Xtypedef struct { X X/* Type Name Offset Function Comments */ X/* ------------------------------------------------------------------------- */ X WORD bb_b_wd; /* width of block in pixels */ X WORD bb_b_ht; /* height of block in pixels */ X WORD bb_plane_ct; /* number of planes to blit */ X WORD bb_fg_col; /* foreground color */ X WORD bb_bg_col; /* back ground color */ X OP_TAB bb_op_tab; /* logic for fg x bg combination */ X SDDB bb_s; /* source info block */ X SDDB bb_d; /* destination info block */ X WORD *bb_p_addr; /* pattern buffer address */ X WORD bb_p_nxln; /* offset to next line in pattern */ X WORD bb_p_nxpl; /* offset to next plane in pattern */ X WORD bb_p_mask; /* pattern index mask */ X char bb_fill[24]; /* work space */ X/* ------------------------------------------------------------------------- */ X} BBPB; X X X/* X * Memory Form Definition Block X * X */ Xtypedef struct X{ X char *fd_addr; /* Addrerss of upper left corner of firs*/ X /* plane of raster area. If NULL then */ X /* MFDB is for a physical device */ X WORD fd_w; /* Form Width in Pixels */ X WORD fd_h; /* Form Height in Pixels */ X WORD fd_wdwidth; /* Form Width in words (fd_w/sizeof(int)*/ X WORD fd_stand; /* Form format 0= device spec 1=standard*/ X WORD fd_nplanes; /* Number of memory planes */ X WORD fd_r1; /* Reserved */ X WORD fd_r2; /* Reserved */ X WORD fd_r3; /* Reserved */ X} MFDB; X X X X X/* X * Sprite definition block X * X */ Xtypedef struct X{ X WORD sp_xhot; /* Offset to X hot spot */ X WORD sp_yhot; /* Offset to Y hot spot */ X WORD sp_format; /* Format SP_VDI or SP_XOR */ X WORD sp_bg; /* Background color */ X WORD sp_fg; /* Foregroud color */ X WORD sp_data[32]; /* Sprite data - */ X /* Alternating words of back/fore */ X /* ground data */ X /* Note that: */ X /* sprite save block is */ X /* 10+VPLANES*64 bytes long */ X X} SFORM; X X X X/*****************************************************************************\ X* * X* Global Variables * X* * X\*****************************************************************************/ X X /* X * Global Variables are defined in alglobal.c, extern every where else X * X */ X#ifndef ALGLOBAL X X /* global vars */ Xextern LINEA *aline; /* Pointer to line a parameter block returned by init*/ X Xextern NLINEA *naline; /* Pointer to line a parameters at negative offsets */ X Xextern FONT **fonts; /* Array of pointers to the three system font headers*/ X /* returned by init (in register A1) */ X Xextern WORD (**funcs)(); /* Array of pointers to the 15 line a functions */ X /* returned by init (in register A2) */ X /* only valid in ROM'ed TOS */ X X /* Functions */ Xextern VOID init_aline(); X#endif /* ALGLOBAL */ SHAR_EOF if test 26615 -ne "`wc -c 'aline.h'`" then echo shar: error transmitting "'aline.h'" '(should have been 26615 characters)' fi # End of shell archive exit 0 -- usenet: {decvax,cbosgd,sun}!cwruecmp!bammi jwahar r. bammi csnet: bammi@cwru.edu <---------Please note change of address arpa: bammi@cwru.edu <---------Please note change of address compuServe: 71515,155