| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,99 @@ |
| 1 |
+; Author: Pawel Jablonski |
|
| 2 |
+; E-mail: pj@xirx.net |
|
| 3 |
+; WWW: xirx.net |
|
| 4 |
+; GIT: git.xirx.net |
|
| 5 |
+; |
|
| 6 |
+; License: You can use this code however you like |
|
| 7 |
+; but leave information about the original author. |
|
| 8 |
+; Code is free for non-commercial and commercial use. |
|
| 9 |
+ |
|
| 10 |
+map ../../../bin/rom/rom.map |
|
| 11 |
+ |
|
| 12 |
+; 4 full rectangles to see color |
|
| 13 |
+const colorBar 0xDB, 0xDB, 0xDB, 0xDB, ' ', 0x00 |
|
| 14 |
+ |
|
| 15 |
+; Color names |
|
| 16 |
+const color_0 "black " |
|
| 17 |
+const color_1 "dark blue " |
|
| 18 |
+const color_2 "green " |
|
| 19 |
+const color_3 "persian green " |
|
| 20 |
+const color_4 "bright red " |
|
| 21 |
+const color_5 "flirt " |
|
| 22 |
+const color_6 "buddha gold " |
|
| 23 |
+const color_7 "eagle " |
|
| 24 |
+const color_8 "abbey " |
|
| 25 |
+const color_9 "dodger blue " |
|
| 26 |
+const color_a "screaming green" |
|
| 27 |
+const color_b "aquamarine " |
|
| 28 |
+const color_c "sunset orange " |
|
| 29 |
+const color_d "pink flamingo " |
|
| 30 |
+const color_e "gorse " |
|
| 31 |
+const color_f "white " |
|
| 32 |
+ |
|
| 33 |
+; First label is the entry point |
|
| 34 |
+.entry: |
|
| 35 |
+ call .main |
|
| 36 |
+ ret |
|
| 37 |
+ |
|
| 38 |
+; No arguments |
|
| 39 |
+; No return |
|
| 40 |
+.main: |
|
| 41 |
+ push A |
|
| 42 |
+ ; Clear loop counter |
|
| 43 |
+ clr A |
|
| 44 |
+.main_loop: |
|
| 45 |
+ ; Show dark color on left |
|
| 46 |
+ call .printColor |
|
| 47 |
+ ; Show light color on right |
|
| 48 |
+ xor 0b1000, A |
|
| 49 |
+ call .printColor |
|
| 50 |
+ xor 0b1000, A |
|
| 51 |
+ ; After last color do not print new line |
|
| 52 |
+ cmp 0xf, A |
|
| 53 |
+ je .main_loop_no_newline |
|
| 54 |
+ call .xStringNewLine |
|
| 55 |
+.main_loop_no_newline: |
|
| 56 |
+ loope 7, A, .main_loop |
|
| 57 |
+ ; Refresh the screen |
|
| 58 |
+ call .xLcdRefresh |
|
| 59 |
+ pop A |
|
| 60 |
+ ret |
|
| 61 |
+ |
|
| 62 |
+; Arguments: |
|
| 63 |
+; A - color (4 bit) |
|
| 64 |
+; No return |
|
| 65 |
+.printColor: |
|
| 66 |
+ push A |
|
| 67 |
+ push X |
|
| 68 |
+ push Y |
|
| 69 |
+ ; Color should be 4 bit |
|
| 70 |
+ cmp 0xf, A |
|
| 71 |
+ ; 0xf < A |
|
| 72 |
+ jl .printColor_end |
|
| 73 |
+ ; Set foreground to color from reg A |
|
| 74 |
+ call .xLcdSetForeground |
|
| 75 |
+ ; Load address to color bar |
|
| 76 |
+ mov low(*colorBar), X |
|
| 77 |
+ mov high(*colorBar), Y |
|
| 78 |
+ ; Print color bar with a sample of color |
|
| 79 |
+ call .xStringPrint |
|
| 80 |
+ push A |
|
| 81 |
+ ; Set foreground color to default |
|
| 82 |
+ mov 0xf, A |
|
| 83 |
+ call .xLcdSetForeground |
|
| 84 |
+ pop A |
|
| 85 |
+ ; Load address to color name |
|
| 86 |
+ mov low(*color_0), X |
|
| 87 |
+ mov high(*color_0), Y |
|
| 88 |
+ ; Every color name takes 16 bytes of memory |
|
| 89 |
+ swap A |
|
| 90 |
+ ; Move address to current color name |
|
| 91 |
+ add A, X |
|
| 92 |
+ incc Y |
|
| 93 |
+ ; Print color name |
|
| 94 |
+ call .xStringPrint |
|
| 95 |
+.printColor_end: |
|
| 96 |
+ pop Y |
|
| 97 |
+ pop X |
|
| 98 |
+ pop A |
|
| 99 |
+ ret |