]> git.sur5r.net Git - cc65/commitdiff
New TGI routines tgi_getaspectratio/tgi_setaspectratio.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 1 May 2011 18:40:38 +0000 (18:40 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 1 May 2011 18:40:38 +0000 (18:40 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5009 b7a2c559-68d2-44c3-8de9-860c34a00d81

asminc/tgi-kernel.inc
include/tgi.h
libsrc/tgi/Makefile
libsrc/tgi/tgi_getaspectratio.s [new file with mode: 0644]
libsrc/tgi/tgi_setaspectratio.s [new file with mode: 0644]
samples/tgidemo.c

index 5f43fc00760c0a46c37092d0d46082e0f4e26116..76f96f1353015efa8907c69be5ce5b27dfc6231c 100644 (file)
@@ -84,7 +84,7 @@ TGI_FONT_BITMAP         = 0
 TGI_FONT_VECTOR         = 1
 
 TGI_TEXT_HORIZONTAL     = 0
-TGI_TEXT_VERTICAL       = 1  
+TGI_TEXT_VERTICAL       = 1
 
 ;----------------------------------------------------------------------------
 ; Results of tgi_outcode
@@ -182,6 +182,7 @@ TGI_CLIP_TOP            = $08
         .global _tgi_clear
         .global _tgi_done
         .global _tgi_ellipse
+       .global _tgi_getaspectratio
         .global _tgi_getcolor
         .global _tgi_getcolorcount
         .global _tgi_getdefpalette
@@ -207,7 +208,8 @@ TGI_CLIP_TOP            = $08
         .global _tgi_load_driver
         .global _tgi_outtext
         .global _tgi_outtextxy
-        .global _tgi_pieslice
+        .global _tgi_pieslice     
+       .global _tgi_getaspectratio
         .global _tgi_setcolor
         .global _tgi_setdrawpage
         .global _tgi_setpalette
index 19bd782de570f3f57513f09df44508c239d1334f..a3f35bdea50c5e3925967fa7ede500ba7e5e2120 100644 (file)
@@ -187,6 +187,16 @@ unsigned __fastcall__ tgi_getmaxy (void);
  * getmaxy() + 1
  */
 
+unsigned __fastcall__ tgi_getaspectratio (void);
+/* Returns the aspect ratio for the loaded driver. The aspect ratio is an
+ * 8.8 fixed point value.
+ */
+
+void __fastcall__ tgi_setaspectratio (unsigned aspectratio);
+/* Set a new aspect ratio for the loaded driver. The aspect ratio is an
+ * 8.8 fixed point value.
+ */
+
 unsigned char __fastcall__ tgi_getpixel (int x, int y);
 /* Get the color value of a pixel. */
 
index a7f053ca36c64a1bbe6a92dfe109de431e1a00f0..6571d000da4808511fd75a42f7856a2fad34704a 100644 (file)
@@ -44,6 +44,7 @@ S_OBJS =              tgi-kernel.o            \
                 tgi_done.o              \
                 tgi_ellipse.o           \
                 tgi_free_vectorfont.o   \
+               tgi_getaspectratio.o    \
                 tgi_getcolor.o          \
                 tgi_getcolorcount.o     \
                 tgi_getdefpalette.o     \
@@ -72,6 +73,7 @@ S_OBJS =              tgi-kernel.o            \
                 tgi_outtextxy.o         \
                 tgi_popxy.o             \
                 tgi_popxy2.o            \
+               tgi_setaspectratio.o    \
                 tgi_setcolor.o          \
                 tgi_setdrawpage.o       \
                 tgi_setpalette.o        \
diff --git a/libsrc/tgi/tgi_getaspectratio.s b/libsrc/tgi/tgi_getaspectratio.s
new file mode 100644 (file)
index 0000000..9c43995
--- /dev/null
@@ -0,0 +1,19 @@
+;
+; Ullrich von Bassewitz, 2011-05-01
+;
+; unsigned __fastcall__ tgi_getaspectratio (void);
+; /* Returns the aspect ratio for the loaded driver. The aspect ratio is an
+;  * 8.8 fixed point value.
+;  */
+;
+
+        .include        "tgi-kernel.inc"
+
+.proc   _tgi_getaspectratio
+
+        lda     _tgi_aspectratio
+        ldx     _tgi_aspectratio+1
+        rts
+
+.endproc
+
diff --git a/libsrc/tgi/tgi_setaspectratio.s b/libsrc/tgi/tgi_setaspectratio.s
new file mode 100644 (file)
index 0000000..c46d6de
--- /dev/null
@@ -0,0 +1,19 @@
+;
+; Ullrich von Bassewitz, 2011-05-01
+;
+; void __fastcall__ tgi_setaspectratio (unsigned aspectratio);
+; /* Set a new aspect ratio for the loaded driver. The aspect ratio is an
+;  * 8.8 fixed point value.
+;  */
+;
+
+        .include        "tgi-kernel.inc"
+
+.proc   _tgi_setaspectratio
+
+        sta     _tgi_aspectratio
+        stx     _tgi_aspectratio+1
+        rts
+
+.endproc
+
index 3a042ef6f57948ed8782f9be121ae652daa65c10..5502021cae97757e89cf1f06e19026a22c7ba33b 100644 (file)
@@ -71,7 +71,7 @@ static void DoCircles (void)
         tgi_line (0, MaxY, MaxX, 0);
         tgi_setcolor (Color);
         for (I = 10; I < 240; I += 10) {
-            tgi_ellipse (X, Y, I, tgi_imulround (I, tgi_aspectratio));
+            tgi_ellipse (X, Y, I, tgi_imulround (I, tgi_getaspectratio ()));
         }
        Color = Color == COLOR_FORE ? COLOR_BACK : COLOR_FORE;
     }