Mercurial > public > hwos_code
comparison src/strings.inc @ 0:11d4fc797f74
init
| author | heinrichsweikamp |
|---|---|
| date | Wed, 24 Apr 2013 19:22:45 +0200 |
| parents | |
| children | e79bc535ef9e |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:11d4fc797f74 |
|---|---|
| 1 ;============================================================================= | |
| 2 ; | |
| 3 ; File strings.asm | |
| 4 ; | |
| 5 ; Implementation code various string functions. | |
| 6 ; | |
| 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
| 8 ;============================================================================= | |
| 9 ; HISTORY | |
| 10 ; 2010-12-02 : [jDG] Creation... | |
| 11 ; | |
| 12 | |
| 13 ;============================================================================= | |
| 14 ; Copy a short embebed string at start of the string buffer (letter) | |
| 15 ; Input: (nothing) | |
| 16 ; Output: chars are copied into letter, starting at the beginning. | |
| 17 ; FSR2 point to the first unused char (the NULL termination). | |
| 18 ; | |
| 19 ; Trashed: WREG, TBLPTR, TABLAT, PRODL | |
| 20 ; Note: This are all bank-safe call. | |
| 21 ; | |
| 22 extern strcpy_block | |
| 23 STRCPY macro string | |
| 24 call strcpy_block | |
| 25 DB string, 0 | |
| 26 endm | |
| 27 | |
| 28 ;============================================================================= | |
| 29 ; A variant of STRCPY that appends chars to the current FSR2 pointer. | |
| 30 ; Input/Output/Trashed : see STRCPY. | |
| 31 extern strcat_block | |
| 32 STRCAT macro string | |
| 33 call strcat_block | |
| 34 DB string, 0 | |
| 35 endm | |
| 36 | |
| 37 ;============================================================================= | |
| 38 ; A variant of STRCAT when there is just on char to output | |
| 39 ; Input/Output/Trashed : none. | |
| 40 PUTC macro char | |
| 41 movlw char | |
| 42 movwf POSTINC2 | |
| 43 endm | |
| 44 | |
| 45 ;============================================================================= | |
| 46 ; A variant of STRCPY that send the string to the word processor afterwards. | |
| 47 ; Input/Output: see STRCPY. | |
| 48 ; Trashed: See STRCPY + word_processor. In particular, switch RAM to Bank1 | |
| 49 ; | |
| 50 extern strcpy_block_print | |
| 51 STRCPY_PRINT macro string | |
| 52 call strcpy_block_print | |
| 53 DB string, 0 | |
| 54 endm | |
| 55 | |
| 56 ; Trashed: See STRCPY + word_processor. In particular, switch RAM to Bank1 | |
| 57 extern strcat_block_print | |
| 58 STRCAT_PRINT macro string | |
| 59 call strcat_block_print | |
| 60 DB string, 0 | |
| 61 endm | |
| 62 | |
| 63 ;============================================================================= | |
| 64 ; Subroutines to operate on strings from PROM code | |
| 65 ; | |
| 66 ; Input: TBLPTR : string pointer into PROM. | |
| 67 ; Output: string in buffer, FSR2 pointer on the closing null byte. | |
| 68 | |
| 69 extern strcpy_prom, strcat_prom | |
| 70 extern strcpy_prom_print, strcat_prom_print | |
| 71 | |
| 72 ;============================================================================= | |
| 73 ; Subroutines and macros to operate on multilingual text | |
| 74 ; | |
| 75 extern strcpy_text | |
| 76 STRCPY_TEXT macro txt | |
| 77 extern txt | |
| 78 lfsr FSR1, txt | |
| 79 call strcpy_text | |
| 80 endm | |
| 81 | |
| 82 extern strcpy_text_print | |
| 83 STRCPY_TEXT_PRINT macro txt | |
| 84 extern txt | |
| 85 lfsr FSR1, txt | |
| 86 call strcpy_text_print | |
| 87 endm | |
| 88 | |
| 89 extern strcat_text | |
| 90 STRCAT_TEXT macro txt | |
| 91 extern txt | |
| 92 lfsr FSR1, txt | |
| 93 call strcat_text | |
| 94 endm | |
| 95 | |
| 96 extern strcat_text_print | |
| 97 STRCAT_TEXT_PRINT macro txt | |
| 98 extern txt | |
| 99 lfsr FSR1, txt | |
| 100 call strcat_text_print | |
| 101 endm | |
| 102 | |
| 103 ;============================================================================= | |
| 104 ; A shortcut for the macros WIN_TOP + WIN_LEFT + WIN_FONT + WIN_INVERT. | |
| 105 ; The idea is to replace a 4x6=24 bytes sequence by a more compact 6bytes one. | |
| 106 ; | |
| 107 ; Trashed: TBLPTR, TABLAT, WREG. | |
| 108 ; Note: This are all bank-safe call. | |
| 109 extern start_tiny_block | |
| 110 WIN_TINY macro x, y | |
| 111 call start_tiny_block | |
| 112 DB x, y | |
| 113 endm | |
| 114 | |
| 115 extern start_tiny_invert_block | |
| 116 WIN_TINY_INVERT macro x, y | |
| 117 call start_tiny_invert_block | |
| 118 DB x, y | |
| 119 endm | |
| 120 | |
| 121 extern start_small_block | |
| 122 WIN_SMALL macro x, y | |
| 123 call start_small_block | |
| 124 DB x, y | |
| 125 endm | |
| 126 | |
| 127 extern start_small_invert_block | |
| 128 WIN_SMALL_INVERT macro x, y | |
| 129 call start_small_invert_block | |
| 130 DB x, y | |
| 131 endm | |
| 132 | |
| 133 extern start_std_block | |
| 134 WIN_STD macro x, y | |
| 135 call start_std_block | |
| 136 DB x, y | |
| 137 endm | |
| 138 | |
| 139 extern start_std_invert_block | |
| 140 WIN_STD_INVERT macro x, y | |
| 141 call start_std_invert_block | |
| 142 DB x, y | |
| 143 endm | |
| 144 | |
| 145 extern start_medium_block | |
| 146 WIN_MEDIUM macro x, y | |
| 147 call start_medium_block | |
| 148 DB x, y | |
| 149 endm | |
| 150 | |
| 151 extern start_medium_invert_block | |
| 152 WIN_MEDIUM_INVERT macro x, y | |
| 153 call start_medium_invert_block | |
| 154 DB x, y | |
| 155 endm | |
| 156 | |
| 157 extern start_large_block | |
| 158 WIN_LARGE macro x, y | |
| 159 call start_large_block | |
| 160 DB x, y | |
| 161 endm | |
| 162 | |
| 163 extern start_large_invert_block | |
| 164 WIN_LARGE_INVERT macro x, y | |
| 165 call start_large_invert_block | |
| 166 DB x, y | |
| 167 endm | |
| 168 | |
| 169 ;============================================================================= | |
| 170 ; Shortcuts for compact display programmings. | |
| 171 TEXT_TINY macro x, y, txt | |
| 172 WIN_TINY x,y | |
| 173 STRCPY_TEXT_PRINT txt | |
| 174 endm | |
| 175 | |
| 176 TEXT_SMALL macro x, y, txt | |
| 177 WIN_SMALL x,y | |
| 178 STRCPY_TEXT_PRINT txt | |
| 179 endm | |
| 180 | |
| 181 TEXT_SMALL_INVERT macro x, y, txt | |
| 182 WIN_SMALL_INVERT x,y | |
| 183 STRCPY_TEXT_PRINT txt | |
| 184 endm | |
| 185 | |
| 186 TEXT_MEDIUM macro x, y, txt | |
| 187 WIN_MEDIUM x,y | |
| 188 STRCPY_TEXT_PRINT txt | |
| 189 endm | |
| 190 | |
| 191 TEXT_LARGE macro x, y, txt | |
| 192 WIN_LARGE x,y | |
| 193 STRCPY_TEXT_PRINT txt | |
| 194 endm | |
| 195 | |
| 196 STRING_TINY macro x, y, string | |
| 197 WIN_SMALL x,y | |
| 198 STRCPY_PRINT string | |
| 199 endm | |
| 200 | |
| 201 STRING_SMALL macro x, y, string | |
| 202 WIN_SMALL x,y | |
| 203 STRCPY_PRINT string | |
| 204 endm | |
| 205 | |
| 206 STRING_MEDIUM macro x, y, string | |
| 207 WIN_MEDIUM x,y | |
| 208 STRCPY_PRINT string | |
| 209 endm | |
| 210 | |
| 211 STRING_LARGE macro x, y, string | |
| 212 WIN_LARGE x,y | |
| 213 STRCPY_PRINT string | |
| 214 endm | |
| 215 |
