From a507605a894d458f738746faa3fac4644560c39e Mon Sep 17 00:00:00 2001 From: uz Date: Sun, 1 May 2011 18:40:38 +0000 Subject: [PATCH] New TGI routines tgi_getaspectratio/tgi_setaspectratio. git-svn-id: svn://svn.cc65.org/cc65/trunk@5009 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- asminc/tgi-kernel.inc | 6 ++++-- include/tgi.h | 10 ++++++++++ libsrc/tgi/Makefile | 2 ++ libsrc/tgi/tgi_getaspectratio.s | 19 +++++++++++++++++++ libsrc/tgi/tgi_setaspectratio.s | 19 +++++++++++++++++++ samples/tgidemo.c | 2 +- 6 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 libsrc/tgi/tgi_getaspectratio.s create mode 100644 libsrc/tgi/tgi_setaspectratio.s diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc index 5f43fc007..76f96f135 100644 --- a/asminc/tgi-kernel.inc +++ b/asminc/tgi-kernel.inc @@ -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 diff --git a/include/tgi.h b/include/tgi.h index 19bd782de..a3f35bdea 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -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. */ diff --git a/libsrc/tgi/Makefile b/libsrc/tgi/Makefile index a7f053ca3..6571d000d 100644 --- a/libsrc/tgi/Makefile +++ b/libsrc/tgi/Makefile @@ -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 index 000000000..9c439953c --- /dev/null +++ b/libsrc/tgi/tgi_getaspectratio.s @@ -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 index 000000000..c46d6dede --- /dev/null +++ b/libsrc/tgi/tgi_setaspectratio.s @@ -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 + diff --git a/samples/tgidemo.c b/samples/tgidemo.c index 3a042ef6f..5502021ca 100644 --- a/samples/tgidemo.c +++ b/samples/tgidemo.c @@ -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; } -- 2.39.5