home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GraphicsCode / c / gcc / Graphics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-01  |  7.8 KB  |  289 lines

  1. /* C Include file for my graphics functions */
  2. /* @ Paul Callaghan 1995 */
  3. /* $VER: Misc_Include v1.002 (22 Oct 1995) */
  4.  
  5. #ifndef Misc
  6. #define Misc
  7.  
  8. ////*Initialisation Routines*/
  9.  
  10. extern __inline VOID Graphics_Init(VOID);
  11. extern __inline VOID Graphics_Close(VOID);
  12.  
  13. extern __inline struct Screen_Store *
  14. Open_Screen (LONG width,LONG height,LONG depth,LONG vmode,APTR cmap)
  15. {
  16.     register struct Screen_Store * _res  __asm("d0");
  17.     register LONG d0 __asm("d0") = width;       /* the incoming data */
  18.     register LONG d1 __asm("d1") = height;
  19.     register LONG d2 __asm("d2") = depth;
  20.     register LONG d3 __asm("d3") = vmode;
  21.     register APTR a0 __asm("a0") = cmap;
  22.     __asm __volatile ("bsr _Open_Screen"        /* the function call */
  23.     : "=r" (_res)                               /* the return value */
  24.     : "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (a0)     /* the registers used by the call */
  25.     : "a0","a1","d0","d1","d2","d3");      /* not quite sure */
  26.     return _res;
  27. }
  28.  
  29. extern __inline VOID
  30. Close_Screen (APTR screen)
  31. {
  32.     register APTR a0 __asm("a0") = screen;       /* the incoming data */
  33.     __asm __volatile ("bsr _Close_Screen"        /* the function call */
  34.     : /* no output */
  35.     : "r" (a0)     /* the registers used by the call */
  36.     : "a0","a1","d0","d1");      /* not quite sure */
  37. }
  38.  
  39. extern __inline struct MaskPlane *
  40. Init_Mask (LONG x_min,LONG y_min,LONG x_max,LONG y_max, LONG screen_x,LONG screen_y)
  41. {
  42.     register struct MaskPlane * _res  __asm("d0");
  43.     register LONG d0 __asm("d0") = x_min;
  44.     register LONG d1 __asm("d1") = y_min;
  45.     register LONG d2 __asm("d2") = x_max;
  46.     register LONG d3 __asm("d3") = y_max;
  47.     register LONG d4 __asm("d4") = screen_x;
  48.     register LONG d5 __asm("d5") = screen_y;
  49.     __asm __volatile ("bsr _Init_Mask"
  50.     : "=r" (_res)                               /* the return value */
  51.     : "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (d4), "r" (d5)   /* the registers used by the call */
  52.     : "a0","a1","d0","d1","d2","d3","d4","d5");      /* not quite sure */
  53.     return _res;
  54. }
  55.  
  56. extern __inline VOID
  57. Free_Mask (APTR mask)
  58. {
  59.     register APTR a0 __asm("a0") = mask;       /* the incoming data */
  60.     __asm __volatile ("bsr _Free_Mask"        /* the function call */
  61.     : /* no output */
  62.     : "r" (a0)     /* the registers used by the call */
  63.     : "a0","a1","d0","d1");      /* not quite sure */
  64. }
  65. ///
  66.  
  67. ////*Drawing Routines*/
  68. extern __inline VOID
  69. Fill_Polygon (APTR screen, APTR vertex, LONG npoints, LONG colour)
  70. {
  71.     register APTR a0 __asm("a0") = screen;
  72.     register APTR a1 __asm("a1") = vertex;
  73.     register LONG d0 __asm("d0") = npoints;
  74.     register LONG d1 __asm("d1") = colour;
  75.     __asm __volatile ("bsr _Fill_Polygon"
  76.     : /* no output */
  77.     : "r" (a0), "r" (a1), "r" (d0), "r" (d1)
  78.     : "a0","a1","d0","d1");
  79. }
  80.  
  81. extern __inline VOID
  82. Draw_Polygon (APTR screen, APTR vertex, LONG npoints, LONG colour)
  83. {
  84.     register APTR a0 __asm("a0") = screen;
  85.     register APTR a1 __asm("a1") = vertex;
  86.     register LONG d0 __asm("d0") = npoints;
  87.     register LONG d1 __asm("d1") = colour;
  88.     __asm __volatile ("bsr _Draw_Polygon"
  89.     : /* no output */
  90.     : "r" (a0), "r" (a1), "r" (d0), "r" (d1)
  91.     : "a0","a1","d0","d1");
  92. }
  93.  
  94. extern __inline VOID
  95. Draw_Line (APTR screen, LONG x1, LONG y1, LONG x2, LONG y2, BYTE colour)
  96. {
  97.     register APTR a0 __asm("a0") = screen;
  98.     register LONG d0 __asm("d0") = x1;
  99.     register LONG d1 __asm("d1") = y1;
  100.     register LONG d2 __asm("d2") = x2;
  101.     register LONG d3 __asm("d3") = y2;
  102.     register BYTE d4 __asm("d4") = colour;
  103.     __asm __volatile ("bsr _Draw_Line"
  104.     : /* no output */
  105.     : "r" (a0), "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (d4)
  106.     : "d0","d1","d2","d3","d4","a0","a1");
  107. }
  108.  
  109. extern __inline VOID
  110. Write_Pixel (APTR screen, LONG x, LONG y, BYTE colour)
  111. {
  112.     register APTR a0 __asm("a0") = screen;
  113.     register LONG d0 __asm("d0") = x;
  114.     register LONG d1 __asm("d1") = y;
  115.     register BYTE d2 __asm("d2") = colour;
  116.     __asm __volatile ("bsr _Write_Pixel"
  117.     : /* no output */
  118.     : "r" (a0), "r" (d0), "r" (d1), "r" (d2)
  119.     : "a0","d0","d1","d2");
  120. }
  121.  
  122. extern __inline VOID
  123. Screen_Clear (APTR screen)
  124. {
  125.     register APTR a0 __asm("a0") = screen;
  126.     __asm __volatile ("bsr _Screen_Clear"
  127.     : /* no output */
  128.     : "r" (a0)
  129.     : "a0","a1","d0","d1");
  130. }
  131.  
  132. extern __inline VOID
  133. Show (APTR screen)
  134. {
  135.     register APTR __asm("a0") = screen;
  136.     __asm __volatile "bsr _Show"
  137.     : /* no output */
  138.     : "r" (a0)
  139.     : "a0","a1","d0","d1");
  140. }
  141.  
  142.  
  143. ///
  144.  
  145. ////*Fade Routines*/
  146. extern __inline VOID
  147. Fade_To_White (APTR screen, APTR cmap)
  148. {
  149.     register APTR a0 __asm("a0") = screen;
  150.     register APTR a1 __asm("a1") = cmap;
  151.     __asm __volatile ("bsr _Fade_To_White"
  152.     : /* no output */
  153.     : "r" (a0), "r" (a1)
  154.     : "a0","a1","d0","d1");
  155. }
  156.  
  157. extern __inline VOID
  158. Fade_To_Black (APTR screen, APTR cmap)
  159. {
  160.     register APTR a0 __asm("a0") = screen;
  161.     register APTR a1 __asm("a1") = cmap;
  162.     __asm __volatile ("bsr _Fade_To_Black"
  163.     : /* no output */
  164.     : "r" (a0), "r" (a1)
  165.     : "a0","a1","d0","d1");
  166. }
  167.  
  168. extern __inline VOID
  169. Fade (APTR screen, APTR source_cmap, APTR dest_cmap)
  170. {
  171.     register APTR a0 __asm("a0") = screen;
  172.     register APTR a1 __asm("a1") = source_cmap;
  173.     register APTR a2 __asm("a2") = dest_cmap;
  174.     __asm __volatile ("bsr _Fade"
  175.     : /* no output */
  176.     : "r" (a0), "r" (a1), "r" (a2)
  177.     : "a0","a1","a2","d0","d1");
  178. }
  179.  
  180. ///
  181.  
  182. ////*IFF File routines*/
  183. extern __inline VOID
  184. Load_IFF (APTR screen, STRPTR file)
  185. {
  186.     register APTR a1 __asm("a1") = screen;
  187.     register STRPTR a0 __asm("a0") = file;
  188.     __asm __volatile ("bsr _Load_IFF"
  189.     : /* no output */
  190.     : "r" (a0), "r" (a1)
  191.     : "d0","d1","a0","a1");
  192. }
  193.  
  194. extern __inline VOID
  195. Save_IFF (APTR screen, STRPTR file)
  196. {
  197.     register APTR a1 __asm("a1") = screen;
  198.     register STRPTR a0 __asm("a0") = file;
  199.     __asm __volatile ("bsr _Save_IFF"
  200.     : /* no output */
  201.     : "r" (a0), "r" (a1)
  202.     : "d0","d1","a0","a1");
  203. }
  204. ///
  205.  
  206. ////*File Handline Routines*/
  207. extern __inline VOID
  208. Load_Data (STRPTR file, LONG length, APTR dest)
  209. {
  210.     register STRPTR a0 __asm("a0") = file;
  211.     register LONG d0 __asm("d0") = length;
  212.     register APTR a1 __asm("a1") = dest;
  213.     __asm __volatile ("bsr _Load_Data"
  214.     : /* no output */
  215.     : "r" (a0), "r" (d0), "r" (a1)
  216.     : "d0","d1","a0","a1");
  217. }
  218.  
  219. extern __inline VOID
  220. Save_Data (STRPTR file, LONG length, APTR source)
  221. {
  222.     register STRPTR a0 __asm("a0") = file;
  223.     register LONG d0 __asm("d0") = length;
  224.     register APTR a1 __asm("a1") = source;
  225.     __asm __volatile ("bsr _Save_Data"
  226.     : /* no output */
  227.     : "r" (a0), "r" (d0), "r" (a1)
  228.     : "d0","d1","a0","a1");
  229. }
  230. ///
  231.  
  232. ////*Text Functions*/
  233. extern __inline VOID
  234. Write_Text(APTR screen, STRPTR text, LONG x, LONG y, LONG colour, LONG length)
  235. {
  236.     register APTR a0 __asm("a0") = screen;
  237.     register STRPTR a1 __asm("a1") = text;
  238.     register LONG d0 __asm("d0") = x;
  239.     register LONG d1 __asm("d1") = y;
  240.     register LONG d2 __asm("d2") = colour;
  241.     register LONG d3 __asm("d3") = length;
  242.     __asm __volatile ("bsr _Write_Text"
  243.     : /* no output */
  244.     : "r" (a0), "r" (a1), "r" (d0), "r" (d1), "r" (d2), "r" (d3)
  245.     : "a0","a1","d0","d1","d2","d3");
  246. }
  247.  
  248. extern __inline STRPTR
  249. Num_To_String (WORD num)
  250. {
  251.     register STRPTR _res __asm("a1");
  252.     register WORD d0 __asm("d0") = num;
  253.     __asm __volatile ("bsr _Num_To_String"
  254.     : "=r" (_res)
  255.     : "r" (d0)
  256.     : "a0","a1","d0","d1");
  257.     return _res;
  258. }
  259. ///
  260.  
  261. ////*Copper Functions*/
  262. extern __inline VOID
  263. Add_Copper (APTR screen, APTR copper)
  264. {
  265.     register APTR a0 __asm("a0") = screen;
  266.     register APTR a1 __asm("a1") = copper;
  267.     __asm __volatile ("bsr _Add_Copper"
  268.     : /* no output */
  269.     : "r" (a0), "r" (a1)
  270.     : "a0","a1","d0","d1");
  271. }
  272. ///
  273.  
  274. ////*Input Functions*/
  275. extern __inline BYTE
  276. GetKey (VOID)
  277. {
  278.     register BYTE _res __asm("d0");
  279.     __asm __volatile ("bsr _GetKey"
  280.     : "=r" (_res)
  281.     : /* no input */
  282.     : "a0","a1","d0","d1");
  283.     return _res;
  284. }
  285. ///
  286.  
  287. #endif
  288.  
  289.