comparison code_part1/OSTC_code_asm_part1/printf.inc @ 83:3e351e25f5d1

adding anti-aliased fonts frame and merging some patches from Jeando
author heinrichsweikamp
date Tue, 07 Dec 2010 22:36:19 +0100
parents
children
comparison
equal deleted inserted replaced
82:bc3092c41335 83:3e351e25f5d1
1 ;=============================================================================
2 ;
3 ; file printf.inc
4 ; brief Compact macro to print PROM text, with formating options.
5 ; author JD Gascuel.
6 ;
7 ; copyright (c) 2010, JD Gascuel. All rights reserved.
8 ; $Id: printf.inc 37 2010-11-22 03:22:39Z gascuel $
9 ;=============================================================================
10 ; HISTORY
11 ; 2010-11-17 : [jDG] Creation...
12 ;
13 ;=============================================================================
14 ;
15 ; Compact macro to print PROM text, with formating options.
16 ;
17 ; The aim is to allow compact formating code, with formating options, to allow
18 ; smaller footprint in the PROM.
19 ;
20 ; A print block (in PROM space) is used as paramaters. The block starts with
21 ; a set of flags, telling what options are needed.
22 ;
23 ; The block format is :
24 ; label DB flag+flag+flag+... ; A combination of various flags...
25 ; DB top, leftx2 ; Optional text position.
26 ; DB 0b1110011 ; Optional color in RRRGGGBB format.
27 ; DB .35 ; Optional CF color (CF35 = standard).
28 ; DB "The text string." ; Optional null-terminated text string
29 ; DB 0
30 ;
31 ; Two usage variantes:
32 ; + The more compact one, use just 4 bytes for the call:
33 ; code_pack ; Don't insert nulls
34 ; call printf_inline
35 ; tfAILED DB PRINTF_FONT_SMALL + PRINTF_TOPLEFT + PRINTF_COLOR8
36 ; DB 100, 100
37 ; DB color_red
38 ; DB "FAILED"
39 ; DB 0
40 ; code ; back to normal
41 ;
42 ; + A more classic one, but uses 16 bytes to load 24bits address:
43 ; WIN_PRINTF tFAILED
44 ;
45 ;=============================================================================
46 ; Flags for basic option (no argument):
47 #define PRINTF_FONT_KEEP .0 ; Keep last font size. DEFAULT.
48 #define PRINTF_FONT_SMALL .1 ; Switch to small font.
49 #define PRINTF_FONT_MEDIUM .2 ; Switch to medium font.
50 #define PRINTF_FONT_LARGE .3 ; Switch to large font.
51
52 #define PRINTF_INVERT .4 ; Draw in reverse color.
53
54 ; Flags that requires optional argument:
55 #define PRINTF_TOPLEFT .8 ; Set Top/Left text position.
56 #define PRINTF_COLOR8 .16 ; Change text color to packed RRRGGGBB format.
57 #define PRINTF_COLOR_CF .32 ; Change text color to preference CF#
58
59 ; Flags for final operation
60 #define PRINTF_COPY_PRINT .0 ; strcpy() from PROM, then print. DEFAULT.
61 #define PRINTF_COPY .64 ; just strcpy(), no final print.
62 #define PRINTF_APPEND .128 ; just strcat() (don't reset FSR2 fist), no final print.
63 #define PRINTF_PRINT .192 ; no string ops, just final call to print.
64
65 ;=============================================================================
66
67 WIN_PRINTF macro bloc
68 movlw UPPER bloc
69 movwf TBLPTRU
70 movlw HIGH bloc
71 movwf TBLPTRH
72 movlw LOW bloc
73 movwf TBLPTRL
74 call printf_subroutine
75 endm
76