From: uz Date: Fri, 6 Nov 2009 16:18:13 +0000 (+0000) Subject: tgi_vectorchar takes now a char argument. Added tgi_install_vectorfont. X-Git-Tag: V2.13.1~75 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1154a116490926d35eca8a84ea2dee7ba5a4dddc;p=cc65 tgi_vectorchar takes now a char argument. Added tgi_install_vectorfont. git-svn-id: svn://svn.cc65.org/cc65/trunk@4454 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc index 1d5f93db9..7522106c7 100644 --- a/asminc/tgi-kernel.inc +++ b/asminc/tgi-kernel.inc @@ -100,6 +100,7 @@ TGI_TEXT_VERTICAL = 1 .global _tgi_color ; Current drawing color .global _tgi_font ; Which font to use .global _tgi_textdir ; Current text direction + .global _tgi_vectorfont ; Pointer to vector font .global _tgi_textscalew ; Text magnification for the width .global _tgi_textscaleh ; Text magnification for the height .global _tgi_charwidth ; Width of scaled system font char @@ -184,6 +185,7 @@ TGI_TEXT_VERTICAL = 1 .global _tgi_imulround .global _tgi_init .global _tgi_install + .global _tgi_install_vectorfont .global _tgi_ioctl .global _tgi_line .global _tgi_lineto diff --git a/include/tgi/tgi-vectorfont.h b/include/tgi/tgi-vectorfont.h index 6801b7b34..bf36f8b0b 100644 --- a/include/tgi/tgi-vectorfont.h +++ b/include/tgi/tgi-vectorfont.h @@ -76,7 +76,7 @@ struct tgi_vectorfont { -void __fastcall__ tgi_vectorchar (const unsigned char* Ops); +void __fastcall__ tgi_vectorchar (char C); /* Draw one character of the vector font at the current graphics cursor * position using the current font magnification. */ diff --git a/libsrc/tgi/Makefile b/libsrc/tgi/Makefile index 1e0dc2bf9..e594b39fc 100644 --- a/libsrc/tgi/Makefile +++ b/libsrc/tgi/Makefile @@ -61,6 +61,7 @@ S_OBJS = tgi-kernel.o \ tgi_gotoxy.o \ tgi_imulround.o \ tgi_init.o \ + tgi_install_vectorfont.o\ tgi_ioctl.o \ tgi_line.o \ tgi_linepop.o \ diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s index 90af17a1a..a4316f8f1 100644 --- a/libsrc/tgi/tgi-kernel.s +++ b/libsrc/tgi/tgi-kernel.s @@ -26,6 +26,7 @@ _tgi_cury: .res 2 ; Current drawing cursor Y _tgi_color: .res 1 ; Current drawing color _tgi_font: .res 1 ; Which font to use _tgi_textdir: .res 1 ; Current text direction +_tgi_vectorfont: .res 2 ; Pointer to vector font ; The following two store an 8.8 fixed point value in the first two bytes, ; and a rounded integer value in the third byte. The latter is passed to the ; driver to scale the bitmap font. The variables are expected to be in diff --git a/libsrc/tgi/tgi_install_vectorfont.s b/libsrc/tgi/tgi_install_vectorfont.s new file mode 100644 index 000000000..ff174896e --- /dev/null +++ b/libsrc/tgi/tgi_install_vectorfont.s @@ -0,0 +1,24 @@ +; +; Ullrich von Bassewitz, 2009-11-06 +; + + .include "tgi-kernel.inc" + + +;----------------------------------------------------------------------------- +; void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font); +; /* Install a vector font for use. More than one vector font can be loaded, +; * but only one can be active. This function is used to tell which one. Call +; * with a NULL pointer to uninstall the currently installed font. +; */ +; + +.code +.proc _tgi_install_vectorfont + + sta _tgi_vectorfont + stx _tgi_vectorfont+1 + rts + +.endproc + diff --git a/libsrc/tgi/tgi_vectorchar.s b/libsrc/tgi/tgi_vectorchar.s index 3c171e9d7..b48378669 100644 --- a/libsrc/tgi/tgi_vectorchar.s +++ b/libsrc/tgi/tgi_vectorchar.s @@ -7,13 +7,13 @@ ; */ ; - .export _tgi_vectorchar - - .import imul16x16r32, umul16x16r32, negax, negeax + .import _toascii, imul16x16r32, umul16x16r32, negax, negeax .include "tgi-kernel.inc" + .include "tgi-vectorfont.inc" .include "zeropage.inc" - + + .macpack longbranch ;---------------------------------------------------------------------------- ; Data @@ -28,17 +28,21 @@ X2: .res 2 Y2: .res 2 - ;---------------------------------------------------------------------------- ; .code .proc _tgi_vectorchar +; Convert the character to ASCII, multiplicate by two and save into Y + + jsr _toascii + asl a + tay + ; Since we will call tgi_lineto, which uses the zero page, and we do also ; need the zero page, make room in the register bank. - tay lda Ops pha lda Ops+1 @@ -46,9 +50,26 @@ Y2: .res 2 lda Flag pha -; Save the pointer +; Calculate a pointer to the vector ops for the given char (now in Y). - sty Ops + lda _tgi_vectorfont+1 + tax + ora _tgi_vectorfont + jeq Done ; Bail out if no font installed + lda _tgi_vectorfont + clc + adc #<(TGI_VECTORFONT::CHARS - 2*TGI_VF_FIRSTCHAR) + sta Ops + lda _tgi_vectorfont+1 + adc #>(TGI_VECTORFONT::CHARS - 2*TGI_VF_FIRSTCHAR) + sta Ops+1 + + iny + lda (Ops),y + tax + dey + lda (Ops),y + sta Ops stx Ops+1 ; Main loop executing vector operations @@ -112,7 +133,7 @@ Loop: lda _tgi_textscalew+0 ; Done. Restore zp and return. -@Done: pla +Done: pla sta Flag pla sta Ops+1