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