home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume1 / 8711 / microemacs-3.9 / 14 < prev    next >
Text File  |  1987-11-20  |  42KB  |  986 lines

  1. Article 91 of comp.sources.misc:
  2. Path: tut!osu-cis!cbosgd!mandrill!hal!ncoast!allbery
  3. From: nwd@j.cc.purdue.edu (Daniel Lawrence)
  4. Newsgroups: comp.sources.misc
  5. Subject: MicroEmacs 3.9 (Part 14 of 16)
  6. Message-ID: <5690@ncoast.UUCP>
  7. Date: 17 Nov 87 02:36:14 GMT
  8. Sender: allbery@ncoast.UUCP
  9. Lines: 971
  10. Approved: allbery@ncoast.UUCP
  11. X-Archive: comp.sources.misc/microemacs-3.9/13
  12.  
  13. # This is a shar archive.
  14. # Remove everything above this line.
  15. # Run the file through sh, not csh.
  16. # (type `sh mes.14')
  17. # If you do not see the message
  18. #    `mes.14 completed!'
  19. # then the file was incomplete.
  20. echo extracting - z309.c
  21. sed 's/^X//' > z309.c << 'FRIDAY_NIGHT'
  22. X/*
  23. X * The routines in this file provide support for the Zenith Z-100 PC
  24. X * family.  It goes directly to the graphics RAM to do screen output. 
  25. X * It compiles into nothing if not a Zenith driver.
  26. X */
  27. X
  28. X#define    termdef    1            /* don't define "term" external */
  29. X
  30. X#include        <stdio.h>
  31. X#include    "estruct.h"
  32. X#include        "edef.h"
  33. X
  34. X#if     Z309
  35. X
  36. X/* set NROW to 25 for 25-line interlaced mode */
  37. X#define NROW    50                      /* Screen size.                 */
  38. X#define NCOL    80                      /* Edit if you want to.         */
  39. X#define    MARGIN    8            /* size of minimim margin and    */
  40. X#define    SCRSIZ    64            /* scroll size for extended lines */
  41. X#define    NPAUSE    200            /* # times thru update to pause */
  42. X#define BEL     0x07                    /* BEL character.               */
  43. X#define ESC     0x1B                    /* ESC character.               */
  44. X#define    SPACE    32            /* space character        */
  45. X
  46. X#define    SCADC    0xb8000000L        /* CGA address of screen RAM    */
  47. X#define    SCADM    0xb0000000L        /* MONO address of screen RAM    */
  48. X
  49. X#define    CDMONO    0            /* monochrome text card        */
  50. X#define    CDCGA50    1            /* 50-line color graphics card    */
  51. X#define CDCGI25 2            /* 25-line interlaced CGA text    */
  52. X#define CDCGA25 3            /* 25-line color graphics card    */
  53. X#define    CDSENSE    9            /* detect the card type        */
  54. X
  55. Xint dtype = CDCGA50;            /* current display type        */
  56. Xlong scadd;                /* address of screen ram    */
  57. Xint *scptr[NROW];            /* pointer to screen lines    */
  58. Xint sline[NCOL];            /* screen line image        */
  59. Xextern union REGS rg;            /* cpu register for use of DOS calls */
  60. X
  61. Xextern  int     ttopen();               /* Forward references.          */
  62. Xextern  int     ttgetc();
  63. Xextern  int     ttputc();
  64. Xextern  int     ttflush();
  65. Xextern  int     ttclose();
  66. Xextern  int     z309move();
  67. Xextern  int     z309eeol();
  68. Xextern  int     z309eeop();
  69. Xextern  int     z309beep();
  70. Xextern  int     z309open();
  71. Xextern    int    z309rev();
  72. Xextern    int    z309cres();
  73. Xextern    int    z309close();
  74. Xextern    int    z309putc();
  75. Xextern    int    z309kopen();
  76. Xextern    int    z309kclose();
  77. X
  78. X#if    COLOR
  79. Xextern    int    z309fcol();
  80. Xextern    int    z309bcol();
  81. X
  82. Xint    cfcolor = -1;        /* current forground color */
  83. Xint    cbcolor = -1;        /* current background color */
  84. Xint    ctrans[] =        /* ansi to z309 color translation table */
  85. X    {0, 4, 2, 6, 1, 5, 3, 7};
  86. X#endif
  87. X
  88. X/*
  89. X * Standard terminal interface dispatch table. Most of the fields point into
  90. X * "termio" code.
  91. X */
  92. XTERM    term    = {
  93. X    NROW-1,
  94. X        NROW-1,
  95. X        NCOL,
  96. X        NCOL,
  97. X    MARGIN,
  98. X    SCRSIZ,
  99. X    NPAUSE,
  100. X        z309open,
  101. X        z309close,
  102. X    z309kopen,
  103. X    z309kclose,
  104. X        ttgetc,
  105. X    z309putc,
  106. X        ttflush,
  107. X        z309move,
  108. X        z309eeol,
  109. X        z309eeop,
  110. X        z309beep,
  111. X    z309rev,
  112. X    z309cres
  113. X#if    COLOR
  114. X    , z309fcol,
  115. X    z309bcol
  116. X#endif
  117. X};
  118. X
  119. Xextern union REGS rg;
  120. X
  121. X#if    COLOR
  122. Xz309fcol(color)        /* set the current output color */
  123. X
  124. Xint color;    /* color to set */
  125. X
  126. X{
  127. X    cfcolor = ctrans[color];
  128. X}
  129. X
  130. Xz309bcol(color)        /* set the current background color */
  131. X
  132. Xint color;    /* color to set */
  133. X
  134. X{
  135. X        cbcolor = ctrans[color];
  136. X}
  137. X#endif
  138. Xz309move(row, col)
  139. X{
  140. X    rg.h.ah = 2;        /* set cursor position function code */
  141. X    rg.h.dl = col;
  142. X    rg.h.dh = row;
  143. X    rg.h.bh = 0;        /* set screen page number */
  144. X    int86(0x10, &rg, &rg);
  145. X}
  146. X
  147. Xz309eeol()    /* erase to the end of the line */
  148. X
  149. X{
  150. X    int attr;    /* attribute byte mask to place in RAM */
  151. X    int *lnptr;    /* pointer to the destination line */
  152. X    int i;
  153. X    int ccol;    /* current column cursor lives */
  154. X    int crow;    /*       row    */
  155. X
  156. X    /* find the current cursor position */
  157. X    rg.h.ah = 3;        /* read cursor position function code */
  158. X    rg.h.bh = 0;        /* current video page */
  159. X    int86(0x10, &rg, &rg);
  160. X    ccol = rg.h.dl;        /* record current column */
  161. X    crow = rg.h.dh;        /* and row */
  162. X
  163. X    /* build the attribute byte and setup the screen pointer */
  164. X#if    COLOR
  165. X    if (dtype != CDMONO)
  166. X        attr = (((cbcolor & 15) << 4) | (cfcolor & 15)) << 8;
  167. X    else
  168. X        attr = 0x0700;
  169. X#else
  170. X    attr = 0x0700;
  171. X#endif
  172. X    lnptr = &sline[0];
  173. X    for (i=0; i < term.t_ncol; i++)
  174. X        *lnptr++ = SPACE | attr;
  175. X
  176. X#if 0    /* Heath/Zenith builds flicker-less CGAs */
  177. X    if (flickcode) {
  178. X        /* wait for vertical retrace to be off */
  179. X        while ((inp(0x3da) & 8))
  180. X            ;
  181. X    
  182. X        /* and to be back on */
  183. X        while ((inp(0x3da) & 8) == 0)
  184. X            ;
  185. X    }
  186. X#endif
  187. X
  188. X    /* and send the string out */
  189. X    movmem(&sline[0], scptr[crow]+ccol, (term.t_ncol-ccol)*2);
  190. X
  191. X}
  192. X
  193. Xz309putc(ch)    /* put a character at the current position in the
  194. X           current colors */
  195. X
  196. Xint ch;
  197. X
  198. X{
  199. X    rg.h.ah = 14;        /* write char to screen with current attrs */
  200. X    rg.h.al = ch;
  201. X#if    COLOR
  202. X    if (dtype != CDMONO)
  203. X        rg.h.bl = cfcolor;
  204. X    else
  205. X        rg.h.bl = 0x07;
  206. X#else
  207. X    rg.h.bl = 0x07;
  208. X#endif
  209. X    int86(0x10, &rg, &rg);
  210. X}
  211. X
  212. Xz309eeop()
  213. X{
  214. X    int attr;        /* attribute to fill screen with */
  215. X
  216. X    rg.h.ah = 6;        /* scroll page up function code */
  217. X    rg.h.al = 0;        /* # lines to scroll (clear it) */
  218. X    rg.x.cx = 0;        /* upper left corner of scroll */
  219. X/*HERE*/    rg.x.dx = 0x184f;    /* lower right corner of scroll */
  220. X#if    COLOR
  221. X    if (dtype != CDMONO)
  222. X        attr = ((ctrans[gbcolor] & 15) << 4) | (ctrans[gfcolor] & 15);
  223. X    else
  224. X        attr = 0;
  225. X#else
  226. X    attr = 0;
  227. X#endif
  228. X    rg.h.bh = attr;
  229. X    int86(0x10, &rg, &rg);
  230. X}
  231. X
  232. Xz309rev(state)        /* change reverse video state */
  233. X
  234. Xint state;    /* TRUE = reverse, FALSE = normal */
  235. X
  236. X{
  237. X    /* This never gets used under the z309-PC driver */
  238. X}
  239. X
  240. Xz309cres(res)    /* change screen resolution */
  241. X
  242. Xchar *res;    /* resolution to change to */
  243. X
  244. X{
  245. X    if (strcmp(res, "CGA50") == 0) {
  246. X        scinit(CDCGA50);
  247. X        return(TRUE);
  248. X    } else if (strcmp(res, "MONO") == 0) {
  249. X        scinit(CDMONO);
  250. X        return(TRUE);
  251. X    } else
  252. X        return(FALSE);
  253. X}
  254. X
  255. Xz309beep()
  256. X{
  257. X#if    MWC86
  258. X    putcnb(BEL);
  259. X#else
  260. X    bdos(6, BEL, 0);
  261. X#endif
  262. X}
  263. X
  264. Xz309open()
  265. X{
  266. X    scinit(CDSENSE);
  267. X    revexist = TRUE;
  268. X        ttopen();
  269. X}
  270. X
  271. Xz309close()
  272. X
  273. X{
  274. X    rg.h.ah = 101;
  275. X    rg.h.al = 1;    /* 25-line interlace mode */
  276. X    int86(0x10, &rg, &rg); 
  277. X#if    COLOR
  278. X    z309fcol(7);
  279. X    z309bcol(0);
  280. X#endif
  281. X    ttclose();
  282. X}
  283. X
  284. Xz309kopen()    /* open the keyboard */
  285. X
  286. X{
  287. X}
  288. X
  289. Xz309kclose()    /* close the keyboard */
  290. X
  291. X{
  292. X}
  293. X
  294. Xscinit(type)    /* initialize the screen head pointers */
  295. X
  296. Xint type;    /* type of adapter to init for */
  297. X
  298. X{
  299. X    union {
  300. X        long laddr;    /* long form of address */
  301. X        int *paddr;    /* pointer form of address */
  302. X    } addr;
  303. X    int i;
  304. X
  305. X    /* if asked...find out what display is connected */
  306. X    int86(0x11, &rg, &rg);
  307. X    dtype = CDCGA50;
  308. X    scadd = SCADC;
  309. X    strcpy(sres, "CGA50");
  310. X    if ((((rg.x.ax >> 4) & 11) == 3) || type == CDMONO) {
  311. X        strcpy(sres, "MONO");
  312. X        dtype = CDMONO;
  313. X        scadd = SCADM;
  314. X    }
  315. X    else {
  316. X        rg.h.ah = 101;
  317. X/* set al = 1 for 25-line interlace mode */        
  318. X        rg.h.al = 2;    /* 50-line interlace mode */
  319. X        int86(0x10, &rg, &rg); 
  320. X    }
  321. X
  322. X    /* initialize the screen pointer array */
  323. X    for (i = 0; i < NROW; i++) {
  324. X        addr.laddr = scadd + (long)(NCOL * i * 2);
  325. X        scptr[i] = addr.paddr;
  326. X    }
  327. X}
  328. X
  329. Xscwrite(row, outstr, forg, bacg)    /* write a line out*/
  330. X
  331. Xint row;    /* row of screen to place outstr on */
  332. Xchar *outstr;    /* string to write out (must be term.t_ncol long) */
  333. Xint forg;    /* forground color of string to write */
  334. Xint bacg;    /* background color */
  335. X
  336. X{
  337. X    int attr;    /* attribute byte mask to place in RAM */
  338. X    int *lnptr;    /* pointer to the destination line */
  339. X    int i;
  340. X
  341. X    /* build the attribute byte and setup the screen pointer */
  342. X#if    COLOR
  343. X    if (dtype != CDMONO)
  344. X        attr = (((ctrans[bacg] & 15) << 4) | (ctrans[forg] & 15)) << 8;
  345. X    else
  346. X        attr = (((bacg & 15) << 4) | (forg & 15)) << 8;
  347. X#else
  348. X    attr = (((bacg & 15) << 4) | (forg & 15)) << 8;
  349. X#endif
  350. X    lnptr = &sline[0];
  351. X    for (i=0; i<term.t_ncol; i++)
  352. X        *lnptr++ = (outstr[i] & 255) | attr;
  353. X
  354. X#if 0    /* Heath/Zenith builds flicker-less CGAs */
  355. X    if (flickcode) {
  356. X        /* wait for vertical retrace to be off */
  357. X        while ((inp(0x3da) & 8))
  358. X            ;
  359. X    
  360. X        /* and to be back on */
  361. X        while ((inp(0x3da) & 8) == 0)
  362. X            ;
  363. X    }
  364. X#endif    
  365. X
  366. X    /* and send the string out */
  367. X    movmem(&sline[0], scptr[row],term.t_ncol*2);
  368. X}
  369. X
  370. X#if    FLABEL
  371. Xfnclabel(f, n)        /* label a function key */
  372. X
  373. Xint f,n;    /* default flag, numeric argument [unused] */
  374. X
  375. X{
  376. X    /* on machines with no function keys...don't bother */
  377. X    return(TRUE);
  378. X}
  379. X#endif
  380. X#else
  381. Xz309hello()
  382. X{
  383. X}
  384. X#endif
  385. FRIDAY_NIGHT
  386. echo extracting - makefile.mwc
  387. sed 's/^X//' > makefile.mwc << 'FRIDAY_NIGHT'
  388. X#
  389. X# Makefile for MicroEMACS 3.9 on the Atari ST using Mark Williams C
  390. X#
  391. XSRC=.
  392. XCC=cc
  393. XCFLAGS=-I. -A
  394. X
  395. XOBJS=    basic.o bind.o buffer.o crypt.o display.o eval.o exec.o file.o\
  396. X    fileio.o input.o isearch.o line.o main.o random.o region.o search.o\
  397. X    spawn.o st520.o termio.o word.o window.o
  398. X
  399. Xemacs.prg:    $(OBJS)
  400. X        $(CC) -o emacs.prg $(OBJS)
  401. X
  402. Xbasic.o: $(SRC)\basic.c ebind.h epath.h efunc.h edef.h estruct.h
  403. Xbind.o: $(SRC)\bind.c ebind.h epath.h efunc.h edef.h estruct.h
  404. Xbuffer.o: $(SRC)\buffer.c ebind.h epath.h efunc.h edef.h estruct.h
  405. Xcrypt.o: $(SRC)\crypt.c ebind.h epath.h efunc.h edef.h estruct.h
  406. Xdisplay.o: $(SRC)\display.c ebind.h epath.h efunc.h edef.h estruct.h
  407. Xeval.o: $(SRC)\eval.c ebind.h epath.h efunc.h edef.h estruct.h evar.h
  408. Xexec.o: $(SRC)\exec.c ebind.h epath.h efunc.h edef.h estruct.h
  409. Xfile.o: $(SRC)\file.c ebind.h epath.h efunc.h edef.h estruct.h
  410. Xfileio.o: $(SRC)\fileio.c ebind.h epath.h efunc.h edef.h estruct.h
  411. Xinput.o: $(SRC)\input.c ebind.h epath.h efunc.h edef.h estruct.h
  412. Xisearch.o: $(SRC)\isearch.c ebind.h epath.h efunc.h edef.h estruct.h
  413. Xline.o: $(SRC)\line.c ebind.h epath.h efunc.h edef.h estruct.h
  414. Xmain.o: $(SRC)\main.c ebind.h efunc.h edef.h estruct.h
  415. Xrandom.o: $(SRC)\random.c ebind.h epath.h efunc.h edef.h estruct.h
  416. Xregion.o: $(SRC)\region.c ebind.h epath.h efunc.h edef.h estruct.h
  417. Xsearch.o: $(SRC)\search.c ebind.h epath.h efunc.h edef.h estruct.h
  418. Xspawn.o: $(SRC)\spawn.c ebind.h epath.h efunc.h edef.h estruct.h
  419. Xst520.o: $(SRC)\st520.c ebind.h epath.h efunc.h edef.h estruct.h
  420. Xtermio.o: $(SRC)\termio.c ebind.h epath.h efunc.h edef.h estruct.h
  421. Xword.o: $(SRC)\word.c ebind.h epath.h efunc.h edef.h estruct.h
  422. Xwindow.o: $(SRC)\window.c ebind.h epath.h efunc.h edef.h estruct.h
  423. FRIDAY_NIGHT
  424. echo extracting - makefile.unx
  425. sed 's/^X//' > makefile.unx << 'FRIDAY_NIGHT'
  426. XCFLAGS=        -O
  427. X
  428. XOFILES=        ansi.o basic.o bind.o buffer.o crypt.o dg10.o \
  429. X        display.o eval.o exec.o file.o fileio.o \
  430. X        hp110.o hp150.o ibmpc.o input.o isearch.o line.o \
  431. X        lock.o main.o random.o region.o search.o spawn.o \
  432. X        st520.o tcap.o termio.o tipc.o vmsvt.o vt52.o \
  433. X        window.o word.o z309.o
  434. X
  435. XCFILES=        ansi.c basic.c bind.c buffer.c crypt.c dg10.c \
  436. X        display.c eval.c exec.c file.c fileio.c \
  437. X        hp110.c hp150.c ibmpc.c input.c isearch.c line.c \
  438. X        lock.c main.c random.c region.c search.c spawn.c \
  439. X        st520.c tcap.c termio.c tipc.c vmsvt.c vt52.c \
  440. X        window.c word.c z309.c
  441. X
  442. XHFILES=        estruct.h edef.h efunc.h epath.h ebind.h evar.h
  443. X
  444. Xemacs:        $(OFILES)
  445. X        $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs
  446. X
  447. X$(OFILES):    $(HFILES)
  448. FRIDAY_NIGHT
  449. echo extracting - aline.h
  450. sed 's/^X//' > aline.h << 'FRIDAY_NIGHT'
  451. X
  452. X               /***********************************************\
  453. X               *                                               *
  454. X               *                    aline.h                    *
  455. X               *       Common include file for C interface     *
  456. X               *       to low level Line A calls               *
  457. X               *                                               *
  458. X               *       J.R. Bammi                              *
  459. X               *         decvax!cwruecmp!bammi                 *
  460. X               *         bammi%cwru.edu.CSNET                  *
  461. X               *         bammi@cwru.edu.ARPA                   *
  462. X               *         CIS: 71515,155                        *
  463. X               *                                               *
  464. X               \***********************************************/
  465. X
  466. X#define    WORD    int
  467. X#define    VOID    void
  468. X
  469. X/*****************************************************************************\
  470. X*                                                                            *
  471. X*                                 Defines                                     *
  472. X*                                                                            *
  473. X\*****************************************************************************/
  474. X
  475. X/*
  476. X *  Object colors (default pallette)
  477. X *
  478. X */
  479. X#define WHITE    0
  480. X#define BLACK    1
  481. X#define RED      2
  482. X#define GREEN    3
  483. X#define BLUE     4
  484. X#define CYAN     5
  485. X#define YELLOW   6
  486. X#define MAGENTA  7
  487. X#define LWHITE   8
  488. X#define LBLACK   9
  489. X#define LRED     10
  490. X#define LGREEN   11
  491. X#define LBLUE    12
  492. X#define LCYAN    13
  493. X#define LYELLOW  14
  494. X#define LMAGENTA 15
  495. X
  496. X
  497. X/* 
  498. X * Vdi writing modes
  499. X *
  500. X */
  501. X#define MD_REPLACE 1
  502. X#define MD_TRANS   2
  503. X#define MD_XOR     3
  504. X#define MD_ERASE   4
  505. X
  506. X
  507. X/*
  508. X * Raster Op Codes
  509. X *
  510. X */
  511. X#define ALL_WHITE  0
  512. X#define S_AND_D    1
  513. X#define    S_AND_NOTD 2
  514. X#define S_ONLY     3
  515. X#define NOTS_AND_D 4
  516. X#define    D_ONLY     5
  517. X#define S_XOR_D    6
  518. X#define S_OR_D     7
  519. X#define    NOT_SORD   8
  520. X#define    NOT_SXORD  9
  521. X#define D_INVERT  10
  522. X#define    NOT_D     11
  523. X#define    S_OR_NOTD 12
  524. X#define NOTS_OR_D 13
  525. X#define    NOT_SANDD 14
  526. X#define ALL_BLACK 15
  527. X
  528. X/*
  529. X * Sprite formats
  530. X *
  531. X */
  532. X#define SP_VDI     0
  533. X#define SP_XOR     1
  534. X
  535. X/*
  536. X * Line A Opcodes
  537. X *
  538. X */
  539. X#define INIT        0
  540. X#define PUTPIXEL    1
  541. X#define GETPIXEL    2
  542. X#define LINE        3
  543. X#define HLINE        4
  544. X#define RECTANGLE    5
  545. X#define FPOLYGON    6
  546. X#define BITBLT        7
  547. X#define TEXTBLT        8
  548. X#define SHOWMOUSE    9
  549. X#define HIDEMOUSE    10
  550. X#define TRANMOUSE    11
  551. X#define USPRITE        12
  552. X#define DSPRITE        13
  553. X#define CPYRASTER    14
  554. X#define FSEEDFILL    15      /* ROM TOS only */
  555. X
  556. X
  557. X/*****************************************************************************\
  558. X*                                                                            *
  559. X*                                 Types                                       *
  560. X*                                                                            *
  561. X\*****************************************************************************/
  562. X
  563. X       /*
  564. X        * Global Variables at negative offsets from the Line A parameter
  565. X        * block address returned by init. (I have no way of telling if this
  566. X        * list is complete).
  567. X        *
  568. X        */
  569. X/* Name   Offset  Type Description                                          */
  570. X/* --------------------------------------------------------------------------*/
  571. X/* V_Y_MAX    -4   W   Max Y pixel value of the screen                      */
  572. X/* V_STATUS   -6   W   Text Status byte                                     */
  573. X/*                       Bit   Field           Zero            One          */
  574. X/*                       0     cursor flash    disabled        enabled      */
  575. X/*                       1     flash state     off             on           */
  576. X/*                       2     cursor visible  no              yes          */
  577. X/*                       3     end of line     no-wrap         wrap         */
  578. X/*                       4     inverse video   on              off          */
  579. X/*                       5     cursor saved    false           true         */
  580. X/* V_OFF_AD  -10   L   Font offset table address                            */
  581. X/* V_X_MAX   -12   W   Max X pixel value                                    */
  582. X/* V_FNT_WR  -14   W   Width of Font Form in bytes (see type FONT below)    */
  583. X/* V_FNT_ST  -16   W   First font ASCII code (first_ade)                    */
  584. X/* V_FNT_ND  -18   W   Last  font ASCII code (last_ade )                    */
  585. X/* V_FNT_AD  -22   L   Font Form address                                    */
  586. X/*                     Mono Spaced, 8 pixels wide and byte aligned, any ht. */
  587. X/* V_CUR_TIM -23   B   Cursor countdown timer                               */
  588. X/* V_CUR_CNT -24   B   Cursor flash interval( in frames)                    */
  589. X/* V_CUR_CY  -26   W   Y cursor position                                    */
  590. X/* V_CUR_CX  -28   W   X cursor position                                    */
  591. X/* V_CUR_OFF -30   W   Offset from screen base to first cell (bytes)        */
  592. X/* V_CUR_AD  -34   L   Current cursor address                               */
  593. X/* V_COL_FG  -36   W   Foreground color index                               */
  594. X/* V_COL_BG  -38   W   Background color index                               */
  595. X/* V_CEL_WR  -40   W   Offset to next vertical cell (bytes)                 */
  596. X/* V_CEL_MY  -42   W   Max cells high - 1                                   */
  597. X/* V_CEL_MX  -44   W   Max cells across - 1                                 */
  598. X/* V_CEL_HT  -46   W   Cell height in pixels (font form's height)           */
  599. X/* --------------------------------------------------------------------------*/
  600. X
  601. X/*
  602. X * Atari finally named these variables
  603. X * so here they are
  604. X *
  605. X */
  606. Xtypedef struct {
  607. X       WORD    V_CEL_HT;    /* *((WORD  *)((char  *)aline - (char  *)46L)) */
  608. X       WORD    V_CEL_MX;    /* *((WORD  *)((char  *)aline - (char  *)44L)) */
  609. X       WORD    V_CEL_MY;    /* *((WORD  *)((char  *)aline - (char  *)42L)) */
  610. X       WORD    V_CEL_WR;    /* *((WORD  *)((char  *)aline - (char  *)40L)) */
  611. X       WORD    V_COL_BG;    /* *((WORD  *)((char  *)aline - (char  *)38L)) */
  612. X       WORD    V_COL_FG;    /* *((WORD  *)((char  *)aline - (char  *)36L)) */
  613. X       char    *V_CUR_AD;   /* *((char **)((char **)aline - (char **)34L)) */
  614. X       WORD    V_CUR_OFF;   /* *((WORD  *)((char  *)aline - (char  *)30L)) */
  615. X       WORD    V_CUR_CX;    /* *((WORD  *)((char  *)aline - (char  *)28L)) */
  616. X       WORD    V_CUR_CY;    /* *((WORD  *)((char  *)aline - (char  *)26L)) */
  617. X       WORD    V_CUR_CNT;   /* *((char  *)((char  *)aline - (char  *)24L)) */
  618. X/*     char    V_CUR_TIM;    *((char  *)((char  *)aline - (char  *)23L))   */
  619. X       char    **V_FNT_AD;  /* *((char **)((char **)aline - (char **)22L)) */
  620. X       WORD    V_FNT_ND;    /* *((WORD  *)((char  *)aline - (char  *)18L)) */
  621. X       WORD    V_FNT_ST;    /* *((WORD  *)((char  *)aline - (char  *)16L)) */
  622. X       WORD    V_FNT_WR;    /* *((WORD  *)((char  *)aline - (char  *)14L)) */
  623. X       WORD    V_X_MAX;     /* *((WORD  *)((char  *)aline - (char  *)12L)) */
  624. X       char    **V_OFF_AD;  /* *((char **)((char **)aline - (char **)10L)) */
  625. X       WORD    V_STATUS;    /* *((WORD  *)((char  *)aline - (char  *) 6L)) */
  626. X       WORD    V_Y_MAX;     /* *((WORD  *)((char  *)aline - (char  *) 4L)) */
  627. X       WORD    xxdummy;     /* *((WORD  *)((char  *)aline - (char  *) 2L)) */
  628. X} NLINEA;
  629. X
  630. X       /* A pointer to the type LINEA is returned by the Line A init call
  631. X        * ($A000), in registers A0 and D0.
  632. X         * This pointer is saved in the global variable 'aline'.
  633. X        *
  634. X        */
  635. Xtypedef struct {
  636. X
  637. X/* Type    Name       Offset   Function                    Comments                 */
  638. X/* ------------------------------------------------------------------------- */
  639. X   WORD   VPLANES;    /*  0  # of Planes        Also see CurrRez             */
  640. X   WORD   VWRAP;      /*  2  Bytes / scan line    "    "    "                */
  641. X                      /*     VWRAP can be changed to implement special effect*/
  642. X                      /*     Doubling VWRAP will skip every other scan line  */
  643. X                      /*                                                     */
  644. X                      /*                                                     */
  645. X   WORD   *CONTRL;    /*  4  Ptr to CONTRL Array  Contrl gets set to this    */
  646. X   WORD   *INTIN;     /*  8  Ptr to INTIN  Array  Intin  gets set to this    */
  647. X   WORD   *PTSIN;     /* 12  Ptr to PTSIN  Array  Ptsin  gets set to this    */
  648. X   WORD   *INTOUT;    /* 16  Ptr to INTOUT Array  Intout gets set to this    */
  649. X   WORD   *PTSOUT;    /* 20  Ptr to PTSOUT Array  Ptsout gets set to this    */
  650. X                      /*     CONTRL is the control array                     */
  651. X                      /*     INTIN is the array of input parameters          */
  652. X                      /*     PTSIN is the array of input coordinates         */
  653. X                      /*          Even entrys are X coordinate               */
  654. X                      /*          Odd  entrys are corresponding Y coodinates */
  655. X                      /*     INTOUT is the array of output parameters        */
  656. X                      /*     PTSOUT is the array of output coordinates       */
  657. X                      /*        organizes like PTSIN.                        */
  658. X                      /*                                                     */
  659. X   WORD   COLBIT0;    /* 24  Plane 0 Color Value  All Three Rez's            */
  660. X   WORD   COLBIT1;    /* 26  Plane 1 Color Value  Med and Low Rez only       */
  661. X   WORD   COLBIT2;    /* 28  Plane 2 Color Value  Low Rez only               */
  662. X   WORD   COLBIT3;    /* 30  Plane 3 Color Value  Low Rez Only               */
  663. X                      /*     Foreground color COLBIT0 + 2*COLBIT1 + 4*COLBIT2*/
  664. X                      /*                      + 8*COLBIT3                    */
  665. X                      /*                                                     */
  666. X                      /*                                                     */
  667. X   WORD   LSTLIN;     /* 32  Always set to -1, Done for you in init_aline()  */
  668. X                      /*     Does anyone know what it is supposed to be?     */
  669. X                      /*                                                     */
  670. X   WORD   LNMASK;     /* 34  Linemask used when drawing lines, same as Vdi's */
  671. X                      /*     line style                                      */
  672. X                      /*                                                     */
  673. X   WORD   WMODE;      /* 36  Writing mode                                    */
  674. X                      /*     0=Replace Mode-Replace all bits in Dest with src*/
  675. X                      /*     1=Trans. Mode-Only additional bits in src set(OR*/
  676. X                      /*     2=Xor Mode- Src XOR Dest                        */
  677. X                      /*     3=Inverse Trans.- (NOT src) Or Dest             */
  678. X                      /*     Values upto 16 are permitted                    */
  679. X                      /*                                                     */
  680. X   WORD   X1;         /* 38  X1 coordinate used in various calls             */
  681. X                      /*                                                     */
  682. X   WORD   Y1;         /* 40  Y1 coordinate used in various calls             */
  683. X                      /*                                                     */
  684. X   WORD   X2;         /* 42  X2 coordinate used in various calls             */
  685. X                      /*                                                     */
  686. X   WORD   Y2;         /* 44  Y2 coordinate used in various calls             */
  687. X                      /*                                                     */
  688. X                      /*                                                     */
  689. X   WORD   *PATPTR;    /* 46  Pointer to current fill pattern                 */
  690. X                      /*     Must be integral power of 2 (words) in length   */
  691. X   WORD   PATMSK;     /* 50  I don't know why they call it a mask. It is in  */
  692. X                      /*     reality the length in words of the current patt.*/
  693. X   WORD   MFILL;      /* 52  Multi Plane fill flag 1 == Current fill Pattern */
  694. X                      /*     is for Muti Plane.                              */
  695. X                      /*                                                     */
  696. X                      /*                                                     */
  697. X   WORD   CLIP;       /* 54  Clipping Flag 1 == TRUE                         */
  698. X   WORD   XMINCL;     /* 56  Min X of clipping window                        */
  699. X   WORD   YMINCL;     /* 58  Min Y of clipping window                        */
  700. X   WORD   XMAXCL;     /* 60  Max X of clipping window                        */
  701. X   WORD   YMAXCL;     /* 62  Max Y of clipping window                        */
  702. X                      /*                                                     */
  703. X                      /*                                                     */
  704. X   WORD   XDDA;       /* 64  Accumulator for Scaling, Must be set to 0x08000 */
  705. X                      /*     before each call to Text Blt. Done for you in   */
  706. X                      /*     in aline_text()                                 */
  707. X   WORD   DDAINC;     /* 66  Scaling factor - Fractional amount to scale char*/
  708. X                      /*     When scaling up = 256 *(Size-Textsize)/Textsize */
  709. X                      /*     When scaling down = 256*(Size)/Textsize         */
  710. X                      /*     scaling down does not work                      */
  711. X   WORD   SCALDIR;    /* 68  Scaling direction 0 == down                     */
  712. X   WORD   MONO;       /* 70  Mono flag 0== current font is a propotional font*/
  713. X                      /*     Its Ok for Thickening to increase the width of  */
  714. X                      /*     the current character.                          */
  715. X                      /*     1 == current font is mono spaced, so thickening */
  716. X                      /*     may not increase the width of the current char  */
  717. X                      /*                                                     */
  718. X   WORD   SOURCEX;    /* 72  X coordinate of character in the font form      */
  719. X                      /*     SOURCEX is caluclated from info in the font     */
  720. X                      /*     header for the current font (see FONT type)     */
  721. X                      /*     SOURCEX = off_table[char-first_ade]             */
  722. X                      /*     SOURCEX is calculated for you in aline_text()   */
  723. X                      /*     The pointer to a table of font header for the   */
  724. X                      /*     internal fonts is returned in A2 on init (A000) */
  725. X   WORD   SOURCEY;    /* 74  Y coodinate of character in the font form       */
  726. X                      /*     Typically set to 0 (top line of font form)      */
  727. X   WORD   DESTX;      /* 76  X coordinate of character on screen             */
  728. X   WORD   DESTY;      /* 78  Y coordinate of character on screen             */
  729. X   WORD   DELX;       /* 80  Width of Character                              */
  730. X                      /*     Difference between two SOURCEX's                */
  731. X   WORD   DELY;       /* 82  Height of Character                             */
  732. X                      /*     form_height field of FONT_HEAD of current font  */
  733. X   WORD   *FBASE;     /* 84  Pointer to start of font form                   */
  734. X   WORD   FWIDTH;     /* 88  Width of the current font's form                */
  735. X                      /*                                                     */
  736. X   WORD   STYLE;      /* 90  Vector of style flags                           */
  737. X                      /*     Bit 0 = Thicken Flag                            */
  738. X                      /*     Bit 1 = Lighten Flag                            */
  739. X                      /*     Bit 2 = Skewing Flag                            */
  740. X                      /*     Bit 3 = Underline Flag (ignored)                */
  741. X                      /*     Bit 4 = Outline Flag                            */
  742. X                      /*                                                     */
  743. X   WORD   LITEMASK;   /* 92  Mask used for lightening text                   */
  744. X                      /*     The Mask is picked up from the font header      */
  745. X   WORD   SKEWMASK;   /* 94  Mask used for skewing text                      */
  746. X                      /*     The Mask is picked up from the font header      */
  747. X   WORD   WEIGHT;     /* 96  The number of bits by which to thicken text     */
  748. X                      /*     The number is picked up from the font header    */
  749. X   WORD   ROFF;       /* 98  Offset above baseline when skewing              */
  750. X                      /*     Again picked up from the font header            */
  751. X                      /*                                                     */
  752. X   WORD   LOFF;       /* 100 Offset below character baseline when skewing    */
  753. X                      /*     Again picked up from the font header            */
  754. X                      /*                                                     */
  755. X   WORD   SCALE;      /* 102 Scaling Flag 1 == true                          */
  756. X                      /*                                                     */
  757. X   WORD   CHUP;       /* 104 Character rotation vector.                      */
  758. X                      /*     0 = normal (0 degrees)                          */
  759. X                      /*     1800 = 180 degrees                              */
  760. X                      /*     2700 = 270 degrees                              */
  761. X                      /*                                                     */
  762. X   WORD   TEXTFG;     /* 106 Text foreground color                           */
  763. X                      /*                                                     */
  764. X   char   *SCRTCHP;   /* 108 Address of buffer required for creating special */
  765. X                      /*     text effects. The size of this buffer should be */
  766. X                      /*     1K according the Internals. The Atari document  */
  767. X                      /*     of course does not talk about such things :-)   */
  768. X                      /*                                                     */
  769. X   WORD   SCRPT2;     /* 112 The offset of the scaling buffer buffer in above*/
  770. X                      /*     buffer. Internals suggests an offset of 0x0040  */
  771. X                      /*     As usual the Atari document does'nt say a thing */
  772. X                      /*                                                     */
  773. X   WORD   TEXTBG;     /* 114 Text background color (Ram Vdi only)            */
  774. X                      /*     used for the BitBlt writing modes (4-19) only   */
  775. X                      /*                                                     */
  776. X   WORD   COPYTRAN;   /* 116 Copy raster form type flag (Ram vdi only)       */
  777. X                      /*     0 => Opaque type                                */
  778. X                      /*          n-plane source  ->  n-plane dest           */
  779. X                      /*              BitBlt writing modes (4-19)            */
  780. X                      /*    ~0 => Transparent type                           */
  781. X                      /*          1-plane source  ->  n-plane dest           */
  782. X                      /*              Vdi writing modes (1-3)                */
  783. X                      /*                                                     */
  784. X   WORD(*SEEDABORT)();/* 118 Pointer to function returning int, which is     */
  785. X                      /*     called by the fill logic to allow the fill to   */
  786. X                      /*     be aborted. If the routine returns FALSE (0)    */
  787. X                      /*     the fill is not aborted. If it returns TRUE (~0)*/
  788. X                      /*     the fill is aborted                             */
  789. X/* ------------------------------------------------------------------------- */
  790. X
  791. X} LINEA;             /*       P H E W !!!!!                                  */
  792. X
  793. X
  794. X
  795. X /* A pointer to array of type FONT is returned by the Line A init call
  796. X  * ($A000), in regsister A1.
  797. X  * This pointer is saved in the global array variable 'fonts[]'.
  798. X  *
  799. X  */
  800. X
  801. Xtypedef struct _font {
  802. X
  803. X/* Type    Name       Offset   Function                    Comments          */
  804. X/* ------------------------------------------------------------------------- */
  805. X   WORD   font_id;    /*  0 Font face identifier  1 == system font           */
  806. X                      /*                                                     */
  807. X   WORD   size;       /*  2 Font size in points                              */
  808. X                      /*                                                     */
  809. X   char   name[32];   /*  4 Face name                                        */
  810. X                      /*                                                     */
  811. X   WORD   first_ade;  /* 36 Lowest ADE value in the face (lowest ASCII value */
  812. X                      /*    of displayable character).                       */
  813. X                      /*                                                     */
  814. X   WORD   last_ade;   /* 38 Highest ADE value in the face (highest ASCII valu*/
  815. X                      /*    of displayable character).                       */
  816. X                      /*                                                     */
  817. X   WORD   top;        /* 40 Distance of top line relative to baseline        */
  818. X                      /*                                                     */
  819. X   WORD   ascent;     /* 42 Distance of ascent line relative to baseline     */
  820. X                      /*                                                     */
  821. X   WORD   half;       /* 44 Distance of half line relative to baseline       */
  822. X                      /*                                                     */
  823. X   WORD   descent;    /* 46 Distance of decent line relative to baseline     */
  824. X                      /*                                                     */
  825. X   WORD   bottom;     /* 48 Distance of bottom line relative to baseline     */
  826. X                      /*    All distances are measured in absolute values    */
  827. X                      /*    rather than as offsets. They are always +ve      */
  828. X                      /*                                                     */
  829. X WORD max_char_width; /* 50 Width of the widest character in font            */
  830. X                      /*                                                     */
  831. X WORD max_cell_width; /* 52 Width of the widest cell character cell in face  */
  832. X                      /*                                                     */
  833. X   WORD left_offset;  /* 54 Left Offset see Vdi appendix G                   */
  834. X                      /*                                                     */
  835. X   WORD right_offset; /* 56 Right offset   "      "     "                    */
  836. X                      /*                                                     */
  837. X   WORD   thicken;    /* 58 Number of pixels by which to thicken characters  */
  838. X                      /*                                                     */
  839. X   WORD   ul_size;    /* 60 Width in  pixels of the underline                */
  840. X                      /*                                                     */
  841. X   WORD   lighten;    /* 62 The mask used to lighten characters              */
  842. X                      /*                                                     */
  843. X   WORD   skew;       /* 64 The mask used to determine when to perform       */
  844. X                      /*    additional rotation on the character to perform  */
  845. X                      /*    skewing                                          */
  846. X                      /*                                                     */
  847. X   WORD   flags;      /* 66 Flags                                            */
  848. X                      /*      bit 0 set if default system font               */
  849. X                      /*      bit 1 set if horiz offset table should be used */
  850. X                      /*      bit 2 byte-swap flag (thanks to Intel idiots)  */
  851. X                      /*      bit 3 set if mono spaced font                  */
  852. X                      /*                                                     */
  853. X   char   *h_table;   /* 68 Pointer to horizontal offset table               */
  854. X                      /*                                                     */
  855. X   WORD   *off_table; /* 72 Pointer to character offset table                */
  856. X                      /*                                                     */
  857. X   char   *dat_table; /* 76 Pointer to font data                             */
  858. X                      /*                                                     */
  859. X   WORD   form_width; /* 80 Form width (#of bytes /scanline in font data)    */
  860. X                      /*                                                     */
  861. X   WORD   form_height;/* 82 Form height (#of scanlines in font data)         */
  862. X                      /*                                                     */
  863. X struct _font *next_font;  /* 84 Pointer to next font in face                */
  864. X                      /*                                                     */
  865. X/* ------------------------------------------------------------------------- */
  866. X} FONT;
  867. X
  868. X       
  869. X       /*
  870. X        * OP_TAB type required for Bit Blt parameter block.
  871. X        * each entry defines the logic operation to apply for
  872. X        * the 4 Fore/Back ground bit combinations
  873. X        */
  874. Xtypedef struct {
  875. X
  876. X/* Type    Name       Offset   Function             Comments                 */
  877. X/* ------------------------------------------------------------------------- */
  878. X   char   fg0bg0;     /* 0     Logic op to employ when both FG and BG are 0  */
  879. X   char   fg0bg1;     /* 1     Logic op to employ when FG = 0 and BG = 1     */
  880. X   char   fg1bg0;     /* 2     Logic op to employ when FG = 1 and BG = 0     */
  881. X   char   fg1bg1;     /* 3     Logic op to employ when both FG and BG are 1  */
  882. X/* ------------------------------------------------------------------------- */
  883. X} OP_TAB;
  884. X
  885. X
  886. X/*
  887. X * Source and destination description blocks
  888. X */
  889. Xtypedef struct  {
  890. X       WORD    bl_xmin;                /* Minimum x                    */
  891. X       WORD    bl_ymin;                /* Minimum y                    */
  892. X       char    *bl_form;               /* Word aligned memory form     */
  893. X       WORD    bl_nxwd;                /* Offset to next word in line  */
  894. X       WORD    bl_nxln;                /* Offset to next line in plane */
  895. X       WORD    bl_nxpl;                /* Offset to next plane         */
  896. X}SDDB;
  897. X
  898. X       /* Offsets to next word in plane */
  899. X#define HI_NXWD        2
  900. X#define MED_NXWD       4
  901. X#define LOW_NXWD       8
  902. X
  903. X       /* Scan line widths of the screen */
  904. X#define HI_NXLN        80
  905. X#define MED_NXLN       160
  906. X#define LOW_NXLN       160
  907. X
  908. X       /*
  909. X        * Offsets between planes - always the same due to
  910. X        * the way the STs video memory is laid out
  911. X         */
  912. X#define NXPL           2
  913. X
  914. X       /* 
  915. X        * Bit Blt Parameter Block Type (for function $A007)
  916. X        *
  917. X        */
  918. X
  919. Xtypedef struct {
  920. X
  921. X/* Type           Name           Offset   Function          Comments         */
  922. X/* ------------------------------------------------------------------------- */
  923. X   WORD           bb_b_wd;     /*       width of block in pixels             */
  924. X   WORD           bb_b_ht;     /*       height of block in pixels            */
  925. X   WORD           bb_plane_ct; /*       number of planes to blit             */
  926. X   WORD           bb_fg_col;   /*       foreground color                     */
  927. X   WORD           bb_bg_col;   /*       back   ground color                  */
  928. X   OP_TAB  bb_op_tab;          /*       logic for fg x bg combination        */
  929. X   SDDB           bb_s;        /*       source info block                    */
  930. X   SDDB           bb_d;        /*       destination info block               */
  931. X   WORD           *bb_p_addr;  /*       pattern buffer address               */
  932. X   WORD           bb_p_nxln;   /*       offset to next line in pattern       */
  933. X   WORD           bb_p_nxpl;   /*       offset to next plane in pattern      */
  934. X   WORD           bb_p_mask;   /*       pattern index mask                   */
  935. X   char           bb_fill[24]; /*       work space                           */
  936. X/* ------------------------------------------------------------------------- */
  937. X} BBPB;
  938. X
  939. X
  940. X/*
  941. X * Memory Form Definition Block
  942. X *
  943. X */
  944. Xtypedef struct
  945. X{
  946. X       char            *fd_addr;    /* Addrerss of upper left corner of firs*/
  947. X                                    /* plane of raster area. If NULL then   */
  948. X                                    /* MFDB is for a physical device        */
  949. X       WORD            fd_w;        /* Form Width in Pixels                 */
  950. X       WORD            fd_h;        /* Form Height in Pixels                */
  951. X       WORD            fd_wdwidth;  /* Form Width in words (fd_w/sizeof(int)*/
  952. X       WORD            fd_stand;    /* Form format 0= device spec 1=standard*/
  953. X       WORD            fd_nplanes;  /* Number of memory planes              */
  954. X       WORD            fd_r1;       /* Reserved                             */
  955. X       WORD            fd_r2;       /* Reserved                             */
  956. X       WORD            fd_r3;       /* Reserved                             */
  957. X} MFDB;
  958. X
  959. X
  960. X
  961. X
  962. X/*
  963. X * Sprite definition block
  964. X *
  965. X */
  966. Xtypedef struct
  967. X{
  968. X       WORD    sp_xhot;                /* Offset to X hot spot           */
  969. X       WORD    sp_yhot;                /* Offset to Y hot spot           */
  970. X       WORD    sp_format;              /* Format SP_VDI or SP_XOR        */
  971. X       WORD    sp_bg;                  /* Background color               */
  972. X       WORD    sp_fg;                  /* Foregroud color                */
  973. X       WORD    sp_data[32];            /* Sprite data -                  */
  974. X                                       /* Alternating words of back/fore */
  975. X                                       /* ground data                    */
  976. X                                       /* Note that:                     */
  977. X                                       /*   sprite save block is         */
  978. X                                       /*  10+VPLANES*64 bytes long      */
  979. X
  980. X} SFORM;
  981. FRIDAY_NIGHT
  982. echo mes.14 completed!
  983. # That's all folks!
  984.  
  985.  
  986.