Changeset bf89cfb in buchla-68k for vlib/glcinit.c
- Timestamp:
- 07/15/2017 11:15:58 AM (7 years ago)
- Branches:
- master
- Children:
- c80943f
- Parents:
- 09d1345
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlib/glcinit.c
r09d1345 rbf89cfb 9 9 Initializes the GLC. 10 10 11 unsigned12 11 GLCcrc(row, col) 13 unsigned row, col;14 12 15 13 Positions the GLC cursor at ('row', 'col') preparatory 16 14 to writing text. Returns the calculated cursor address. 17 15 18 unsigned19 16 GLCcxy(x, y) 20 unsigned x, y;21 17 22 18 Positions the GLC cursor at ('x', 'y') preparatory to … … 26 22 27 23 GLCwrts(s) 28 char *s;29 24 30 25 Writes the character string pointed to by 's' at the … … 34 29 35 30 GLCtext(row, col, s) 36 unsigned row, col;37 char *s;38 31 39 32 Sets the GLC cursor to ('row', 'col'), then writes the … … 43 36 44 37 GLCdisp(dsp, crs, blk1, blk2, blk3) 45 short dsp, crs, blk1, blk2, blk3;46 38 47 39 Sets the overall display, cursor and block status values. 48 40 49 41 GLCcurs(crs) 50 short crs;51 42 52 43 Turns the cursor on or off. … … 56 47 #include "ram.h" 57 48 58 uint16_tlcdbase; /* LCD graphics base address */59 uint16_tlcdbit; /* LCD graphics pixel bit mask */60 uint16_tlcdcol; /* LCD text column */61 uint16_tlcdctl1; /* LCD display control -- command */62 uint16_tlcdctl2; /* LCD display control -- data */63 uint16_tlcdcurs; /* LCD graphics pixel byte address */64 uint16_tlcdrow; /* LCD text row */65 uint16_tlcdx; /* LCD graphics x */66 uint16_tlcdy; /* LCD graphics y */49 int32_t lcdbase; /* LCD graphics base address */ 50 int16_t lcdbit; /* LCD graphics pixel bit mask */ 51 int16_t lcdcol; /* LCD text column */ 52 int16_t lcdctl1; /* LCD display control -- command */ 53 int16_t lcdctl2; /* LCD display control -- data */ 54 int32_t lcdcurs; /* LCD graphics pixel byte address */ 55 int16_t lcdrow; /* LCD text row */ 56 int16_t lcdx; /* LCD graphics x */ 57 int16_t lcdy; /* LCD graphics y */ 67 58 68 59 /* GLC initialization values */ 69 60 70 int8_t glc_is1[] = { 0x12, 0x05, 0x07, 0x54, 0x58, 0x3F, 0x55, 0x00 };71 int8_t glc_is2[] = { 0x00, 0x00, 0x3F, 0x00, 0x20, 0x3F, 0x00, 0x00 };61 uint8_t glc_is1[] = { 0x12, 0x05, 0x07, 0x54, 0x58, 0x3F, 0x55, 0x00 }; 62 uint8_t glc_is2[] = { 0x00, 0x00, 0x3F, 0x00, 0x20, 0x3F, 0x00, 0x00 }; 72 63 73 64 /* … … 88 79 lcdctl2 = val; 89 80 90 LCD_WC = lcdctl1;91 LCD_WD = lcdctl2;81 LCD_WC = (uint8_t)lcdctl1; 82 LCD_WD = (uint8_t)lcdctl2; 92 83 93 84 } … … 103 94 lcdctl2 = (crs & 3) | (lcdctl2 & ~3); 104 95 105 LCD_WC = lcdctl1;106 LCD_WD = lcdctl2;96 LCD_WC = (uint8_t)lcdctl1; 97 LCD_WD = (uint8_t)lcdctl2; 107 98 } 108 99 … … 118 109 register int16_t i; 119 110 register int32_t ic; 120 register int8_t *gp;111 register uint8_t *gp; 121 112 122 113 lcdbase = G_PLANE2; /* set defaults for graphics variables */ … … 135 126 136 127 for (i = 0; i < 8; i++) 137 LCD_WD = *gp++;128 LCD_WD = *gp++; 138 129 139 130 LCD_WC = G_SETSAD; /* setup scroll registers */ … … 184 175 */ 185 176 186 uint16_t GLCcrc(uint16_t row, uint16_t col)187 { 188 uint16_t curad;177 int16_t GLCcrc(int16_t row, int16_t col) 178 { 179 int16_t curad; 189 180 190 181 curad = col + (row * 85); /* calculate cursor location */ 191 182 192 183 LCD_WC = G_CRSWR; /* send cursor address to GLC */ 193 LCD_WD = curad & 0xFF;194 LCD_WD = ( curad >> 8) & 0xFF;184 LCD_WD = (uint8_t)(curad & 0xFF); 185 LCD_WD = (uint8_t)((curad >> 8) & 0xFF); 195 186 196 187 lcdrow = row; /* set text cursor variables */ … … 210 201 */ 211 202 212 uint16_t GLCcxy(uint16_t x, uint16_t y)213 { 214 register uint16_t curad, xby6;203 int16_t GLCcxy(int16_t x, int16_t y) 204 { 205 register int32_t curad, xby6; 215 206 216 207 /* calculate cursor address */ … … 223 214 224 215 LCD_WC = G_CRSWR; 225 LCD_WD = curad & 0xFF;226 LCD_WD = ( curad >> 8) & 0xFF;216 LCD_WD = (uint8_t)(curad & 0xFF); 217 LCD_WD = (uint8_t)((curad >> 8) & 0xFF); 227 218 228 219 /* set graphics variables */ … … 256 247 while (*s) { /* write string to GLC */ 257 248 258 LCD_WD = *s++;249 LCD_WD = (uint8_t)*s++; 259 250 lcdcol++; /* keep column variable up to date */ 260 251 } … … 271 262 */ 272 263 273 void GLCtext( uint16_t row, uint16_t col, int8_t *s)274 { 275 register uint16_t curad;264 void GLCtext(int16_t row, int16_t col, int8_t *s) 265 { 266 register int16_t curad; 276 267 277 268 curad = col + (row * 85); /* calculate cursor address */ 278 269 279 270 LCD_WC = G_CRSWR; /* send cursor address to GLC */ 280 LCD_WD = curad & 0xFF;281 LCD_WD = ( curad >> 8) & 0xFF;271 LCD_WD = (uint8_t)(curad & 0xFF); 272 LCD_WD = (uint8_t)((curad >> 8) & 0xFF); 282 273 283 274 lcdrow = row; /* set GLC text cursor variables */ … … 290 281 while (*s) { /* write string to GLC */ 291 282 292 LCD_WD = *s++;283 LCD_WD = (uint8_t)*s++; 293 284 lcdcol++; /* keep cursor column up to date */ 294 285 }
Note:
See TracChangeset
for help on using the changeset viewer.