New TGI routines tgi_getaspectratio/tgi_setaspectratio.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5009 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-05-01 18:40:38 +00:00
parent c142061ca5
commit a507605a89
6 changed files with 55 additions and 3 deletions

View 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

View 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. */

View 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 \

View File

@ -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

View File

@ -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

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