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; }