Fork of Dimiter program. "Wait" commands adjusted and added Arial 10 font.

Fork of KS0108 by Dimiter K

Committer:
DimiterK
Date:
Thu Feb 10 03:06:19 2011 +0000
Revision:
4:bdc04bb2ffc1
Parent:
3:366a6b7d6259
Child:
5:e4b50f4c13a8
Added two helper functions. Ver1.11

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DimiterK 1:a368f2688222 1 /*************************************************************************
DimiterK 1:a368f2688222 2 Copyright (c) 2010 Dimiter Kentri
DimiterK 1:a368f2688222 3
DimiterK 1:a368f2688222 4 Permission is hereby granted, free of charge, to any person obtaining a copy
DimiterK 1:a368f2688222 5 of this software and associated documentation files (the "Software"), to deal
DimiterK 1:a368f2688222 6 in the Software without restriction, including without limitation the rights
DimiterK 1:a368f2688222 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
DimiterK 1:a368f2688222 8 copies of the Software, and to permit persons to whom the Software is
DimiterK 1:a368f2688222 9 furnished to do so, subject to the following conditions:
DimiterK 1:a368f2688222 10
DimiterK 1:a368f2688222 11 The above copyright notice and this permission notice shall be included in
DimiterK 1:a368f2688222 12 all copies or substantial portions of the Software.
DimiterK 0:135b9a0a816e 13
DimiterK 1:a368f2688222 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
DimiterK 1:a368f2688222 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
DimiterK 1:a368f2688222 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
DimiterK 1:a368f2688222 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
DimiterK 1:a368f2688222 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
DimiterK 1:a368f2688222 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
DimiterK 1:a368f2688222 20 THE SOFTWARE.
DimiterK 1:a368f2688222 21 *******************************************************************************/
DimiterK 1:a368f2688222 22
DimiterK 4:bdc04bb2ffc1 23 /*
DimiterK 4:bdc04bb2ffc1 24 *@Includes
DimiterK 4:bdc04bb2ffc1 25 */
DimiterK 1:a368f2688222 26 #include "KS0108.h"
DimiterK 1:a368f2688222 27
DimiterK 1:a368f2688222 28
DimiterK 0:135b9a0a816e 29 KS0108::KS0108 (PinName _RST,PinName _DI, PinName _RW, PinName _E, PinName _CS2, PinName _CS1, PinName DB0, PinName DB1, PinName DB2, PinName DB3, PinName DB4, PinName DB5, PinName DB6, PinName DB7)
DimiterK 0:135b9a0a816e 30 : DB(DB0,DB1,DB2,DB3,DB4,DB5,DB6,DB7),RST (_RST),DI(_DI), RW(_RW), E(_E), CS2(_CS2), CS1(_CS1) {
DimiterK 0:135b9a0a816e 31
DimiterK 0:135b9a0a816e 32 DB.output();
DimiterK 0:135b9a0a816e 33 CS1.output(); CS2.output();
DimiterK 0:135b9a0a816e 34 RST.write(0);
DimiterK 0:135b9a0a816e 35 wait_us(10);
DimiterK 0:135b9a0a816e 36 RST.write(1); //reset screen
DimiterK 0:135b9a0a816e 37 E.write(0);
DimiterK 0:135b9a0a816e 38 ClearScreen(); //clear display
DimiterK 0:135b9a0a816e 39 WriteInstruction(LCD_ON, BOTH); //turn on lcd
DimiterK 0:135b9a0a816e 40 }
DimiterK 0:135b9a0a816e 41
DimiterK 0:135b9a0a816e 42
DimiterK 1:a368f2688222 43
DimiterK 0:135b9a0a816e 44 void KS0108::WriteInstruction(unsigned int Command,unsigned int side){
DimiterK 0:135b9a0a816e 45 E.write(0);
DimiterK 0:135b9a0a816e 46 DI.write(0);
DimiterK 0:135b9a0a816e 47 RW.write(0);
DimiterK 0:135b9a0a816e 48
DimiterK 2:03d27b3fce6e 49 SelectSide(side); //select controller
DimiterK 0:135b9a0a816e 50
DimiterK 0:135b9a0a816e 51 wait(0.0000003); // 300ns
DimiterK 0:135b9a0a816e 52 E.write(1);
DimiterK 0:135b9a0a816e 53 DB.output();
DimiterK 0:135b9a0a816e 54 DB.write(Command);
DimiterK 0:135b9a0a816e 55 wait(0.0000001);
DimiterK 0:135b9a0a816e 56 E.write(0);
DimiterK 0:135b9a0a816e 57 }
DimiterK 0:135b9a0a816e 58
DimiterK 1:a368f2688222 59
DimiterK 0:135b9a0a816e 60 void KS0108::WriteData(unsigned int data,unsigned char side){
DimiterK 2:03d27b3fce6e 61 E.write(0);
DimiterK 0:135b9a0a816e 62 DI.write(1);
DimiterK 0:135b9a0a816e 63 RW.write(0);
DimiterK 0:135b9a0a816e 64
DimiterK 0:135b9a0a816e 65 SelectSide(side);
DimiterK 0:135b9a0a816e 66
DimiterK 0:135b9a0a816e 67 wait(0.0000003); // 300ns
DimiterK 0:135b9a0a816e 68 E = 1;
DimiterK 0:135b9a0a816e 69 DB.output();
DimiterK 0:135b9a0a816e 70 DB.write(data);
DimiterK 0:135b9a0a816e 71 wait(0.0000001);
DimiterK 0:135b9a0a816e 72 E = 0;
DimiterK 0:135b9a0a816e 73 }
DimiterK 0:135b9a0a816e 74
DimiterK 1:a368f2688222 75
DimiterK 0:135b9a0a816e 76 void KS0108::WriteDataColPag(unsigned int page, unsigned int col, unsigned int data){
DimiterK 0:135b9a0a816e 77
DimiterK 0:135b9a0a816e 78 SelectSide(NONE);
DimiterK 0:135b9a0a816e 79 col = col%SCREEN_WIDTH;
DimiterK 0:135b9a0a816e 80 page = page%8;
DimiterK 0:135b9a0a816e 81
DimiterK 0:135b9a0a816e 82 if(col<(SCREEN_WIDTH/2)){
DimiterK 0:135b9a0a816e 83 SelectSide(LEFT);
DimiterK 0:135b9a0a816e 84 WriteInstruction(LCD_SET_PAGE|page,LEFT);
DimiterK 0:135b9a0a816e 85 WriteInstruction(LCD_SET_ADD|col,LEFT); //set page and column position
DimiterK 0:135b9a0a816e 86 WriteData(data,LEFT); //output data to D0-D7
DimiterK 0:135b9a0a816e 87 }else{
DimiterK 0:135b9a0a816e 88
DimiterK 0:135b9a0a816e 89 SelectSide(RIGHT);
DimiterK 0:135b9a0a816e 90 col -= (SCREEN_WIDTH/2);
DimiterK 0:135b9a0a816e 91 WriteInstruction(LCD_SET_PAGE|page,RIGHT);
DimiterK 0:135b9a0a816e 92 WriteInstruction(LCD_SET_ADD|col,RIGHT); //set page and column position
DimiterK 0:135b9a0a816e 93 WriteData(data,RIGHT); //output data to D0-D7
DimiterK 0:135b9a0a816e 94 }
DimiterK 0:135b9a0a816e 95
DimiterK 0:135b9a0a816e 96 SelectSide(NONE);
DimiterK 0:135b9a0a816e 97 }
DimiterK 0:135b9a0a816e 98
DimiterK 1:a368f2688222 99
DimiterK 0:135b9a0a816e 100 unsigned int KS0108::ReadData(){
DimiterK 0:135b9a0a816e 101 unsigned int data;
DimiterK 0:135b9a0a816e 102 DB.input();
DimiterK 0:135b9a0a816e 103 DI.write(1);
DimiterK 0:135b9a0a816e 104
DimiterK 0:135b9a0a816e 105 RW.write(1);
DimiterK 0:135b9a0a816e 106 E.write(1);
DimiterK 0:135b9a0a816e 107 wait(0.00000045);
DimiterK 0:135b9a0a816e 108
DimiterK 0:135b9a0a816e 109 data = DB.read();
DimiterK 0:135b9a0a816e 110 wait(0.0000001);
DimiterK 0:135b9a0a816e 111 E.write(0);
DimiterK 0:135b9a0a816e 112 DB.output();
DimiterK 0:135b9a0a816e 113
DimiterK 0:135b9a0a816e 114 return data;
DimiterK 0:135b9a0a816e 115 }
DimiterK 0:135b9a0a816e 116
DimiterK 1:a368f2688222 117
DimiterK 0:135b9a0a816e 118 unsigned int KS0108::ReadStatus(){
DimiterK 0:135b9a0a816e 119 unsigned int status;
DimiterK 0:135b9a0a816e 120 DB.input();
DimiterK 0:135b9a0a816e 121
DimiterK 0:135b9a0a816e 122 DI.write(0);
DimiterK 0:135b9a0a816e 123
DimiterK 0:135b9a0a816e 124 RW.write(1);
DimiterK 0:135b9a0a816e 125 E.write(1);
DimiterK 0:135b9a0a816e 126 wait(0.00000045);
DimiterK 0:135b9a0a816e 127
DimiterK 0:135b9a0a816e 128 status = DB.read();
DimiterK 0:135b9a0a816e 129 E.write(0);
DimiterK 0:135b9a0a816e 130 wait(0.0000001);
DimiterK 0:135b9a0a816e 131 DB.output();
DimiterK 0:135b9a0a816e 132
DimiterK 0:135b9a0a816e 133 return status;
DimiterK 0:135b9a0a816e 134 }
DimiterK 0:135b9a0a816e 135
DimiterK 1:a368f2688222 136
DimiterK 0:135b9a0a816e 137 void KS0108::SelectSide(unsigned char side){
DimiterK 0:135b9a0a816e 138 if(side==LEFT)
DimiterK 0:135b9a0a816e 139 {CS1.write(1);CS2.write(0);}
DimiterK 0:135b9a0a816e 140 else if(side==RIGHT)
DimiterK 0:135b9a0a816e 141 {CS1.write(0);CS2.write(1);}
DimiterK 0:135b9a0a816e 142 else if (side==BOTH)
DimiterK 0:135b9a0a816e 143 {CS1.write(1);CS2.write(1);}
DimiterK 0:135b9a0a816e 144 else if (side==NONE)
DimiterK 0:135b9a0a816e 145 {CS1.write(0);CS2.write(0);}
DimiterK 0:135b9a0a816e 146 }
DimiterK 0:135b9a0a816e 147
DimiterK 1:a368f2688222 148
DimiterK 0:135b9a0a816e 149 void KS0108::ClearScreen(){
DimiterK 0:135b9a0a816e 150 for (int col=0;col<128;col++) {
DimiterK 0:135b9a0a816e 151 for (int page=0;page<8;page++)
DimiterK 0:135b9a0a816e 152 {
DimiterK 0:135b9a0a816e 153 WriteDataColPag(page,col,WHITE);
DimiterK 0:135b9a0a816e 154 }
DimiterK 0:135b9a0a816e 155 }
DimiterK 0:135b9a0a816e 156 }
DimiterK 0:135b9a0a816e 157
DimiterK 0:135b9a0a816e 158
DimiterK 4:bdc04bb2ffc1 159 void KS0108::TurnOn(){
DimiterK 4:bdc04bb2ffc1 160 WriteInstruction(LCD_ON,BOTH);
DimiterK 4:bdc04bb2ffc1 161 }
DimiterK 4:bdc04bb2ffc1 162
DimiterK 4:bdc04bb2ffc1 163
DimiterK 4:bdc04bb2ffc1 164 void KS0108::TurnOff(){
DimiterK 4:bdc04bb2ffc1 165 WriteInstruction(LCD_OFF,BOTH);
DimiterK 4:bdc04bb2ffc1 166 }
DimiterK 4:bdc04bb2ffc1 167
DimiterK 0:135b9a0a816e 168 /*******************************************************************************************/
DimiterK 0:135b9a0a816e 169
DimiterK 1:a368f2688222 170
DimiterK 0:135b9a0a816e 171 void KS0108::SetPixel(unsigned int x, unsigned int y, unsigned int color){
DimiterK 0:135b9a0a816e 172
DimiterK 0:135b9a0a816e 173 unsigned int position;
DimiterK 0:135b9a0a816e 174
DimiterK 0:135b9a0a816e 175 SelectSide(NONE);
DimiterK 0:135b9a0a816e 176 WriteInstruction(LCD_SET_ADD,NONE);
DimiterK 0:135b9a0a816e 177
DimiterK 0:135b9a0a816e 178 if(x>=64){
DimiterK 0:135b9a0a816e 179 WriteInstruction(LCD_SET_PAGE|(y/8),RIGHT);
DimiterK 0:135b9a0a816e 180 WriteInstruction(LCD_SET_ADD|x,RIGHT);
DimiterK 0:135b9a0a816e 181 position = ReadData(); //dummy read
DimiterK 0:135b9a0a816e 182 position = ReadData(); //actual read
DimiterK 0:135b9a0a816e 183 WriteInstruction(LCD_SET_ADD|x,RIGHT);
DimiterK 0:135b9a0a816e 184 if(color==WHITE)
DimiterK 0:135b9a0a816e 185 WriteData(position&(~(1<<(y%8))),RIGHT); // draw a white pixel
DimiterK 0:135b9a0a816e 186 else
DimiterK 0:135b9a0a816e 187 WriteData(position|(1<<(y%8)),RIGHT);
DimiterK 0:135b9a0a816e 188 wait_us(450);
DimiterK 0:135b9a0a816e 189 }else{
DimiterK 0:135b9a0a816e 190 WriteInstruction(LCD_SET_PAGE|(y/8),LEFT);
DimiterK 0:135b9a0a816e 191 WriteInstruction(LCD_SET_ADD|x,LEFT);
DimiterK 0:135b9a0a816e 192 position = ReadData(); //dummy read
DimiterK 0:135b9a0a816e 193 position = ReadData(); //actual read
DimiterK 0:135b9a0a816e 194 WriteInstruction(LCD_SET_ADD|x,LEFT);
DimiterK 0:135b9a0a816e 195 if(color==WHITE)
DimiterK 0:135b9a0a816e 196 WriteData(position&(~(1<<(y%8))),LEFT);
DimiterK 0:135b9a0a816e 197 else
DimiterK 0:135b9a0a816e 198 WriteData(position|(1<<(y%8)),LEFT);
DimiterK 0:135b9a0a816e 199
DimiterK 0:135b9a0a816e 200 wait_us(450);
DimiterK 0:135b9a0a816e 201
DimiterK 0:135b9a0a816e 202 }
DimiterK 0:135b9a0a816e 203
DimiterK 0:135b9a0a816e 204 }
DimiterK 0:135b9a0a816e 205
DimiterK 0:135b9a0a816e 206
DimiterK 1:a368f2688222 207
DimiterK 0:135b9a0a816e 208 void KS0108::FullRectangle(unsigned int Xaxis1, unsigned int Yaxis1, unsigned int Xaxis2 ,unsigned int Yaxis2,unsigned int color){
DimiterK 0:135b9a0a816e 209
DimiterK 0:135b9a0a816e 210 for(unsigned int i=Xaxis1;i<=Xaxis2;i++){
DimiterK 0:135b9a0a816e 211 for(unsigned int j=Yaxis1;j<=Yaxis2;j++){
DimiterK 0:135b9a0a816e 212 SetPixel(i,j,color);
DimiterK 0:135b9a0a816e 213 }
DimiterK 0:135b9a0a816e 214 }
DimiterK 0:135b9a0a816e 215 }
DimiterK 0:135b9a0a816e 216
DimiterK 1:a368f2688222 217
DimiterK 0:135b9a0a816e 218 void KS0108::EmptyRectangle(unsigned int Xaxis1,unsigned int Yaxis1, unsigned int Xaxis2,unsigned int Yaxis2,unsigned int color){
DimiterK 0:135b9a0a816e 219 unsigned int CurrentValue;
DimiterK 0:135b9a0a816e 220
DimiterK 0:135b9a0a816e 221 /* Draw the two horizontal lines */
DimiterK 0:135b9a0a816e 222 for (CurrentValue = 0; CurrentValue < Xaxis2 - Xaxis1+ 1; CurrentValue++)
DimiterK 0:135b9a0a816e 223 {
DimiterK 0:135b9a0a816e 224 SetPixel(Xaxis1 + CurrentValue, Yaxis1,color);
DimiterK 0:135b9a0a816e 225 SetPixel(Xaxis1 + CurrentValue, Yaxis2,color);
DimiterK 0:135b9a0a816e 226 }
DimiterK 0:135b9a0a816e 227
DimiterK 0:135b9a0a816e 228 /* draw the two vertical lines */
DimiterK 0:135b9a0a816e 229 for (CurrentValue = 0; CurrentValue < Yaxis2 - Yaxis1 + 1; CurrentValue++)
DimiterK 0:135b9a0a816e 230 {
DimiterK 0:135b9a0a816e 231 SetPixel(Xaxis1, Yaxis1 + CurrentValue,color);
DimiterK 0:135b9a0a816e 232 SetPixel(Xaxis2, Yaxis1 + CurrentValue,color);
DimiterK 0:135b9a0a816e 233 }
DimiterK 0:135b9a0a816e 234 }
DimiterK 0:135b9a0a816e 235
DimiterK 1:a368f2688222 236
DimiterK 0:135b9a0a816e 237 void KS0108::RoundRectangle(unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned int radius, unsigned int color) {
DimiterK 0:135b9a0a816e 238 int tSwitch, x1 = 0, y1 = radius;
DimiterK 0:135b9a0a816e 239 tSwitch = 3 - 2 * radius;
DimiterK 0:135b9a0a816e 240
DimiterK 0:135b9a0a816e 241 while (x1 <= y1) {
DimiterK 0:135b9a0a816e 242 SetPixel(x+radius - x1, y+radius - y1, color);
DimiterK 0:135b9a0a816e 243 SetPixel(x+radius - y1, y+radius - x1, color);
DimiterK 0:135b9a0a816e 244
DimiterK 0:135b9a0a816e 245 SetPixel(x+width-radius + x1, y+radius - y1, color);
DimiterK 0:135b9a0a816e 246 SetPixel(x+width-radius + y1, y+radius - x1, color);
DimiterK 0:135b9a0a816e 247
DimiterK 0:135b9a0a816e 248 SetPixel(x+width-radius + x1, y+height-radius + y1, color);
DimiterK 0:135b9a0a816e 249 SetPixel(x+width-radius + y1, y+height-radius + x1, color);
DimiterK 0:135b9a0a816e 250
DimiterK 0:135b9a0a816e 251 SetPixel(x+radius - x1, y+height-radius + y1, color);
DimiterK 0:135b9a0a816e 252 SetPixel(x+radius - y1, y+height-radius + x1, color);
DimiterK 0:135b9a0a816e 253
DimiterK 0:135b9a0a816e 254 if (tSwitch < 0) {
DimiterK 0:135b9a0a816e 255 tSwitch += (4 * x1 + 6);
DimiterK 0:135b9a0a816e 256 } else {
DimiterK 0:135b9a0a816e 257 tSwitch += (4 * (x1 - y1) + 10);
DimiterK 0:135b9a0a816e 258 y1--;
DimiterK 0:135b9a0a816e 259 }
DimiterK 0:135b9a0a816e 260 x1++;
DimiterK 0:135b9a0a816e 261 }
DimiterK 0:135b9a0a816e 262
DimiterK 0:135b9a0a816e 263 HLineShort(x+radius,y, width-(2*radius), color); // top
DimiterK 0:135b9a0a816e 264 HLineShort(x+radius,y+height, width-(2*radius), color); // bottom
DimiterK 0:135b9a0a816e 265 VLineShort(x,y+radius,height-(2*radius), color); // left
DimiterK 0:135b9a0a816e 266 VLineShort(x+width, y+radius,height-(2*radius), color); // right
DimiterK 0:135b9a0a816e 267 }
DimiterK 0:135b9a0a816e 268
DimiterK 1:a368f2688222 269
DimiterK 0:135b9a0a816e 270 void KS0108::HLine(unsigned int Xaxis1, unsigned int Xaxis2 ,unsigned int Yaxis,unsigned int color){
DimiterK 0:135b9a0a816e 271 FullRectangle(Xaxis1,Yaxis,Xaxis2,Yaxis,color);
DimiterK 0:135b9a0a816e 272
DimiterK 0:135b9a0a816e 273 }
DimiterK 0:135b9a0a816e 274
DimiterK 1:a368f2688222 275
DimiterK 0:135b9a0a816e 276 void KS0108::HLineShort(unsigned int Xaxis, unsigned int Yaxis,unsigned int width ,unsigned int color){
DimiterK 0:135b9a0a816e 277 FullRectangle(Xaxis,Yaxis,Xaxis+width,Yaxis,color);
DimiterK 0:135b9a0a816e 278
DimiterK 0:135b9a0a816e 279 }
DimiterK 0:135b9a0a816e 280
DimiterK 1:a368f2688222 281
DimiterK 0:135b9a0a816e 282 void KS0108::VLine(unsigned int Xaxis, unsigned int Yaxis1 ,unsigned int Yaxis2,unsigned int color){
DimiterK 0:135b9a0a816e 283 FullRectangle(Xaxis,Yaxis1,Xaxis,Yaxis2,color);
DimiterK 0:135b9a0a816e 284 }
DimiterK 0:135b9a0a816e 285
DimiterK 1:a368f2688222 286
DimiterK 0:135b9a0a816e 287 void KS0108::VLineShort(unsigned int Xaxis,unsigned int Yaxis, unsigned int height ,unsigned int color){
DimiterK 0:135b9a0a816e 288 FullRectangle(Xaxis,Yaxis,Xaxis,Yaxis+height,color);
DimiterK 0:135b9a0a816e 289
DimiterK 0:135b9a0a816e 290 }
DimiterK 0:135b9a0a816e 291
DimiterK 1:a368f2688222 292
DimiterK 0:135b9a0a816e 293 void KS0108::DegreeLine(unsigned int x, int y,unsigned int degree,unsigned int inner_radius,unsigned int outer_radius, unsigned int color){
DimiterK 0:135b9a0a816e 294 int fx,fy,tx,ty;
DimiterK 0:135b9a0a816e 295 fx = x + dfloor(inner_radius * sin(degree * 3.14 / 180));
DimiterK 0:135b9a0a816e 296 fy = y - dfloor(inner_radius * cos(degree * 3.14 / 180));
DimiterK 0:135b9a0a816e 297 tx = x + dfloor(outer_radius * sin(degree * 3.14 / 180));
DimiterK 0:135b9a0a816e 298 ty = y - dfloor(outer_radius * cos(degree * 3.14 / 180));
DimiterK 0:135b9a0a816e 299 SlantyLine(fx,fy,tx,ty,color);
DimiterK 0:135b9a0a816e 300 }
DimiterK 0:135b9a0a816e 301
DimiterK 1:a368f2688222 302
DimiterK 0:135b9a0a816e 303 double KS0108::dfloor( double value ) {
DimiterK 0:135b9a0a816e 304
DimiterK 0:135b9a0a816e 305 if (value < 0.0)
DimiterK 0:135b9a0a816e 306 return ceil( value );
DimiterK 0:135b9a0a816e 307 else
DimiterK 0:135b9a0a816e 308 return floor( value );
DimiterK 0:135b9a0a816e 309
DimiterK 0:135b9a0a816e 310 }
DimiterK 0:135b9a0a816e 311
DimiterK 1:a368f2688222 312
DimiterK 0:135b9a0a816e 313 void KS0108::SlantyLine(unsigned int lX1, unsigned int lY1, unsigned int lX2,unsigned int lY2,unsigned int color){
DimiterK 0:135b9a0a816e 314 long lError, lDeltaX, lDeltaY, lYStep, bSteep;
DimiterK 0:135b9a0a816e 315
DimiterK 0:135b9a0a816e 316 // A steep line has a bigger ordinate.
DimiterK 0:135b9a0a816e 317
DimiterK 0:135b9a0a816e 318 if(((lY2 > lY1) ? (lY2 - lY1) : (lY1 - lY2)) > ((lX2 > lX1) ? (lX2 - lX1) : (lX1 - lX2))){
DimiterK 0:135b9a0a816e 319 bSteep = 1;
DimiterK 0:135b9a0a816e 320 }else {
DimiterK 0:135b9a0a816e 321 bSteep = 0;
DimiterK 0:135b9a0a816e 322 }
DimiterK 0:135b9a0a816e 323
DimiterK 0:135b9a0a816e 324 // If line is steep, swap the X and Y coordinates.
DimiterK 0:135b9a0a816e 325 if(bSteep){
DimiterK 0:135b9a0a816e 326 lError = lX1;
DimiterK 0:135b9a0a816e 327 lX1 = lY1;
DimiterK 0:135b9a0a816e 328 lY1 = lError;
DimiterK 0:135b9a0a816e 329 lError = lX2;
DimiterK 0:135b9a0a816e 330 lX2 = lY2;
DimiterK 0:135b9a0a816e 331 lY2 = lError;
DimiterK 0:135b9a0a816e 332 }
DimiterK 0:135b9a0a816e 333
DimiterK 0:135b9a0a816e 334
DimiterK 0:135b9a0a816e 335 // If the starting X coordinate is larger than the ending X coordinate,
DimiterK 2:03d27b3fce6e 336 // swap the start and end coordinates.
DimiterK 0:135b9a0a816e 337 if(lX1 > lX2){
DimiterK 0:135b9a0a816e 338 lError = lX1;
DimiterK 0:135b9a0a816e 339 lX1 = lX2;
DimiterK 0:135b9a0a816e 340 lX2 = lError;
DimiterK 0:135b9a0a816e 341 lError = lY1;
DimiterK 0:135b9a0a816e 342 lY1 = lY2;
DimiterK 0:135b9a0a816e 343 lY2 = lError;
DimiterK 0:135b9a0a816e 344 }
DimiterK 0:135b9a0a816e 345
DimiterK 2:03d27b3fce6e 346 // Compute the difference between the start and end coordinates.
DimiterK 0:135b9a0a816e 347 lDeltaX = lX2 - lX1;
DimiterK 0:135b9a0a816e 348 lDeltaY = (lY2 > lY1) ? (lY2 - lY1) : (lY1 - lY2);
DimiterK 0:135b9a0a816e 349
DimiterK 0:135b9a0a816e 350 lError = -lDeltaX / 2; // Initialize the error term to negative half the X delta.
DimiterK 0:135b9a0a816e 351
DimiterK 0:135b9a0a816e 352 if(lY1 < lY2){ // Determine the direction to step in the Y axis when required.
DimiterK 0:135b9a0a816e 353 lYStep = 1;
DimiterK 0:135b9a0a816e 354 }else{
DimiterK 0:135b9a0a816e 355 lYStep = -1;
DimiterK 0:135b9a0a816e 356 }
DimiterK 0:135b9a0a816e 357
DimiterK 0:135b9a0a816e 358 for(; lX1 <= lX2; lX1++){ // Loop through all the points along the X axis of the line.
DimiterK 0:135b9a0a816e 359
DimiterK 0:135b9a0a816e 360 // See if this is a steep line.
DimiterK 0:135b9a0a816e 361
DimiterK 0:135b9a0a816e 362 if(bSteep){
DimiterK 0:135b9a0a816e 363
DimiterK 0:135b9a0a816e 364 // Plot this point of the line, swapping the X and Y coordinates.
DimiterK 0:135b9a0a816e 365
DimiterK 0:135b9a0a816e 366 SetPixel(lY1, lX1,color);
DimiterK 0:135b9a0a816e 367 }
DimiterK 0:135b9a0a816e 368 else { // Plot this point of the line, using the coordinates as is.
DimiterK 0:135b9a0a816e 369 SetPixel(lX1, lY1,color);
DimiterK 0:135b9a0a816e 370 }
DimiterK 0:135b9a0a816e 371
DimiterK 0:135b9a0a816e 372 // Increment the error term by the Y delta.
DimiterK 0:135b9a0a816e 373
DimiterK 0:135b9a0a816e 374 lError += lDeltaY;
DimiterK 0:135b9a0a816e 375
DimiterK 0:135b9a0a816e 376 if(lError > 0){ // See if the error term is now greater than zero.
DimiterK 0:135b9a0a816e 377
DimiterK 0:135b9a0a816e 378 lY1 += lYStep; // Take a step in the Y axis.
DimiterK 0:135b9a0a816e 379
DimiterK 0:135b9a0a816e 380 lError -= lDeltaX; // Decrement the error term by the X delta.
DimiterK 0:135b9a0a816e 381 }
DimiterK 0:135b9a0a816e 382 }
DimiterK 0:135b9a0a816e 383 }
DimiterK 0:135b9a0a816e 384
DimiterK 0:135b9a0a816e 385
DimiterK 1:a368f2688222 386
DimiterK 0:135b9a0a816e 387 void KS0108::Line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color){
DimiterK 0:135b9a0a816e 388 unsigned int deltax, deltay, x,y, steep;
DimiterK 0:135b9a0a816e 389 int lerror, ystep;
DimiterK 0:135b9a0a816e 390
DimiterK 0:135b9a0a816e 391 steep = absDiff(y1,y2) > absDiff(x1,x2); //check slope
DimiterK 0:135b9a0a816e 392
DimiterK 0:135b9a0a816e 393 if ( steep ){
DimiterK 0:135b9a0a816e 394 swap(x1, y1);
DimiterK 0:135b9a0a816e 395 swap(x2, y2);
DimiterK 0:135b9a0a816e 396 }
DimiterK 0:135b9a0a816e 397
DimiterK 0:135b9a0a816e 398 if (x1 > x2){
DimiterK 0:135b9a0a816e 399 swap(x1, x2);
DimiterK 0:135b9a0a816e 400 swap(y1, y2);
DimiterK 0:135b9a0a816e 401 }
DimiterK 0:135b9a0a816e 402
DimiterK 0:135b9a0a816e 403 deltax = x2 - x1;
DimiterK 0:135b9a0a816e 404 deltay = absDiff(y2,y1);
DimiterK 0:135b9a0a816e 405 lerror = deltax / 2;
DimiterK 0:135b9a0a816e 406 y = y1;
DimiterK 0:135b9a0a816e 407 if(y1 < y2) ystep = 1; else ystep = -1;
DimiterK 0:135b9a0a816e 408
DimiterK 0:135b9a0a816e 409 for(x = x1; x <= x2; x++){
DimiterK 0:135b9a0a816e 410 if (steep) SetPixel(y,x, color); else SetPixel(x,y, color);
DimiterK 0:135b9a0a816e 411 lerror -= deltay;
DimiterK 0:135b9a0a816e 412 if (lerror < 0){
DimiterK 0:135b9a0a816e 413 y = y + ystep;
DimiterK 0:135b9a0a816e 414 lerror += deltax;
DimiterK 0:135b9a0a816e 415 }
DimiterK 0:135b9a0a816e 416 }
DimiterK 0:135b9a0a816e 417 }
DimiterK 0:135b9a0a816e 418
DimiterK 1:a368f2688222 419
DimiterK 0:135b9a0a816e 420 void KS0108::EmptyCircle(unsigned int CenterX, unsigned int CenterY, unsigned int Radius,unsigned int color){
DimiterK 0:135b9a0a816e 421 unsigned int y=0, x=0, d = 0;
DimiterK 0:135b9a0a816e 422 int part;
DimiterK 0:135b9a0a816e 423 d = CenterY - CenterX;
DimiterK 0:135b9a0a816e 424 y = Radius;
DimiterK 0:135b9a0a816e 425 part = 3 - 2 * Radius;
DimiterK 0:135b9a0a816e 426
DimiterK 0:135b9a0a816e 427 while (x <= y) {
DimiterK 0:135b9a0a816e 428 SetPixel(CenterX + x, CenterY + y,color);
DimiterK 0:135b9a0a816e 429 SetPixel(CenterX + x, CenterY - y,color);
DimiterK 0:135b9a0a816e 430 SetPixel(CenterX - x, CenterY + y,color);
DimiterK 0:135b9a0a816e 431 SetPixel(CenterX - x, CenterY - y,color);
DimiterK 0:135b9a0a816e 432 SetPixel(CenterY + y - d, CenterY + x,color);
DimiterK 0:135b9a0a816e 433 SetPixel(CenterY + y - d, CenterY - x,color);
DimiterK 0:135b9a0a816e 434 SetPixel(CenterY - y - d, CenterY + x,color);
DimiterK 0:135b9a0a816e 435 SetPixel(CenterY - y - d, CenterY - x,color);
DimiterK 0:135b9a0a816e 436
DimiterK 0:135b9a0a816e 437 if (part < 0) part += (4 * x + 6);
DimiterK 0:135b9a0a816e 438 else {
DimiterK 0:135b9a0a816e 439 part += (4 * (x - y) + 10);
DimiterK 0:135b9a0a816e 440 y--;
DimiterK 0:135b9a0a816e 441 }
DimiterK 0:135b9a0a816e 442 x++;
DimiterK 0:135b9a0a816e 443 }
DimiterK 0:135b9a0a816e 444
DimiterK 0:135b9a0a816e 445 }
DimiterK 0:135b9a0a816e 446
DimiterK 1:a368f2688222 447
DimiterK 0:135b9a0a816e 448 void KS0108::FullCircle(unsigned int CenterX, unsigned int CenterY, unsigned int Radius,unsigned int color){
DimiterK 0:135b9a0a816e 449
DimiterK 0:135b9a0a816e 450 int f = 1 - Radius;
DimiterK 0:135b9a0a816e 451 int ddF_x = 1;
DimiterK 0:135b9a0a816e 452 int ddF_y = 2 * Radius; //changed sign of -2
DimiterK 0:135b9a0a816e 453 unsigned int x = 0;
DimiterK 0:135b9a0a816e 454 unsigned int y = Radius;
DimiterK 0:135b9a0a816e 455
DimiterK 0:135b9a0a816e 456 //Fill in the center between the two halves
DimiterK 0:135b9a0a816e 457
DimiterK 0:135b9a0a816e 458 Line(CenterX, CenterY-Radius, CenterX, CenterY+Radius, color);
DimiterK 0:135b9a0a816e 459
DimiterK 0:135b9a0a816e 460 while(x < y){
DimiterK 0:135b9a0a816e 461 if(f >= 0)
DimiterK 0:135b9a0a816e 462 {
DimiterK 0:135b9a0a816e 463 y--;
DimiterK 0:135b9a0a816e 464 ddF_y += 2;
DimiterK 0:135b9a0a816e 465 f += ddF_y;
DimiterK 0:135b9a0a816e 466 }
DimiterK 0:135b9a0a816e 467 x++;
DimiterK 0:135b9a0a816e 468 ddF_x += 2;
DimiterK 0:135b9a0a816e 469 f += ddF_x;
DimiterK 0:135b9a0a816e 470
DimiterK 0:135b9a0a816e 471 /*
DimiterK 0:135b9a0a816e 472 * Now draw vertical lines between the points on the circle rather than
DimiterK 0:135b9a0a816e 473 * draw the points of the circle. This draws lines between the
DimiterK 0:135b9a0a816e 474 * perimeter points on the upper and lower quadrants of the 2 halves of the circle.
DimiterK 0:135b9a0a816e 475 */
DimiterK 0:135b9a0a816e 476
DimiterK 0:135b9a0a816e 477 Line(CenterX+x, CenterY+y, CenterX+x, CenterY-y, color);
DimiterK 0:135b9a0a816e 478 Line(CenterX-x, CenterY+y, CenterX-x, CenterY-y, color);
DimiterK 0:135b9a0a816e 479 Line(CenterX+y, CenterY+x, y+CenterX, CenterY-x, color);
DimiterK 0:135b9a0a816e 480 Line(CenterX-y, CenterY+x, CenterX-y, CenterY-x, color);
DimiterK 0:135b9a0a816e 481 }
DimiterK 0:135b9a0a816e 482 }
DimiterK 0:135b9a0a816e 483
DimiterK 0:135b9a0a816e 484
DimiterK 1:a368f2688222 485
DimiterK 0:135b9a0a816e 486 void KS0108::PlotEllipse(long CX, long CY, long XRadius,long YRadius, int color) {
DimiterK 0:135b9a0a816e 487
DimiterK 0:135b9a0a816e 488
DimiterK 0:135b9a0a816e 489 long X, Y;
DimiterK 0:135b9a0a816e 490 long XChange, YChange;
DimiterK 0:135b9a0a816e 491 long EllipseError;
DimiterK 0:135b9a0a816e 492 long TwoASquare,TwoBSquare;
DimiterK 0:135b9a0a816e 493 long StoppingX, StoppingY;
DimiterK 0:135b9a0a816e 494 TwoASquare = 2*XRadius*XRadius;
DimiterK 0:135b9a0a816e 495 TwoBSquare = 2*YRadius*YRadius;
DimiterK 0:135b9a0a816e 496 X = XRadius;
DimiterK 0:135b9a0a816e 497 Y = 0;
DimiterK 0:135b9a0a816e 498 XChange = YRadius*YRadius*(1-2*XRadius);
DimiterK 0:135b9a0a816e 499 YChange = XRadius*XRadius;
DimiterK 0:135b9a0a816e 500 EllipseError = 0;
DimiterK 0:135b9a0a816e 501 StoppingX = TwoBSquare*XRadius;
DimiterK 0:135b9a0a816e 502 StoppingY = 0;
DimiterK 0:135b9a0a816e 503
DimiterK 0:135b9a0a816e 504 while ( StoppingX >=StoppingY ) //first set of points,y'>-1
DimiterK 0:135b9a0a816e 505 {
DimiterK 0:135b9a0a816e 506 Plot4EllipsePoints(CX,CY,X,Y,color);
DimiterK 0:135b9a0a816e 507 Y++;
DimiterK 0:135b9a0a816e 508 StoppingY=StoppingY+ TwoASquare;
DimiterK 0:135b9a0a816e 509 EllipseError = EllipseError+ YChange;
DimiterK 0:135b9a0a816e 510 YChange=YChange+TwoASquare;
DimiterK 0:135b9a0a816e 511 if ((2*EllipseError + XChange) > 0 ) {
DimiterK 0:135b9a0a816e 512 X--;
DimiterK 0:135b9a0a816e 513 StoppingX=StoppingX- TwoBSquare;
DimiterK 0:135b9a0a816e 514 EllipseError=EllipseError+ XChange;
DimiterK 0:135b9a0a816e 515 XChange=XChange+TwoBSquare;
DimiterK 0:135b9a0a816e 516 }
DimiterK 0:135b9a0a816e 517 }
DimiterK 0:135b9a0a816e 518
DimiterK 0:135b9a0a816e 519 Y = YRadius;
DimiterK 0:135b9a0a816e 520 X = 0;
DimiterK 0:135b9a0a816e 521 YChange = XRadius*XRadius*(1-2*YRadius);
DimiterK 0:135b9a0a816e 522 XChange = YRadius*YRadius;
DimiterK 0:135b9a0a816e 523 EllipseError = 0;
DimiterK 0:135b9a0a816e 524 StoppingY = TwoASquare*YRadius;
DimiterK 0:135b9a0a816e 525 StoppingX = 0;
DimiterK 0:135b9a0a816e 526
DimiterK 0:135b9a0a816e 527 while ( StoppingY >=StoppingX ) //{2nd set of points, y'< -1}
DimiterK 0:135b9a0a816e 528 {
DimiterK 0:135b9a0a816e 529 Plot4EllipsePoints(CX,CY,X,Y,color);
DimiterK 0:135b9a0a816e 530 X++;
DimiterK 0:135b9a0a816e 531 StoppingX=StoppingX + TwoBSquare;
DimiterK 0:135b9a0a816e 532 EllipseError=EllipseError+ XChange;
DimiterK 0:135b9a0a816e 533 XChange=XChange+TwoBSquare;
DimiterK 0:135b9a0a816e 534 if ((2*EllipseError + YChange) > 0 ) {
DimiterK 0:135b9a0a816e 535 Y--;
DimiterK 0:135b9a0a816e 536 StoppingY=StoppingY- TwoASquare;
DimiterK 0:135b9a0a816e 537 EllipseError=EllipseError+ YChange;
DimiterK 0:135b9a0a816e 538 YChange=YChange+TwoASquare;
DimiterK 0:135b9a0a816e 539 }
DimiterK 0:135b9a0a816e 540 }
DimiterK 0:135b9a0a816e 541 }
DimiterK 0:135b9a0a816e 542
DimiterK 0:135b9a0a816e 543
DimiterK 1:a368f2688222 544
DimiterK 0:135b9a0a816e 545 void KS0108::Plot4EllipsePoints(long CX,long CY, long X, long Y, int color){
DimiterK 0:135b9a0a816e 546 SetPixel(CX+X, CY+Y, color); //{point in quadrant 1}
DimiterK 0:135b9a0a816e 547 SetPixel(CX-X, CY+Y, color); //{point in quadrant 2}
DimiterK 0:135b9a0a816e 548 SetPixel(CX-X, CY-Y, color); //{point in quadrant 3}
DimiterK 0:135b9a0a816e 549 SetPixel(CX+X, CY-Y, color); //{point in quadrant 4}
DimiterK 0:135b9a0a816e 550 }
DimiterK 0:135b9a0a816e 551
DimiterK 0:135b9a0a816e 552 /***********************************************************************************/
DimiterK 0:135b9a0a816e 553
DimiterK 1:a368f2688222 554
DimiterK 0:135b9a0a816e 555 void KS0108::FullScreenBMP (unsigned char *PictureData){
DimiterK 0:135b9a0a816e 556 unsigned int Page=0;
DimiterK 0:135b9a0a816e 557 unsigned int Column=0;
DimiterK 0:135b9a0a816e 558
DimiterK 0:135b9a0a816e 559 // Draw left side of the picture
DimiterK 0:135b9a0a816e 560 SelectSide(LEFT);
DimiterK 0:135b9a0a816e 561 for (Page = 0; Page < 8; Page++){ /* loop on the 8 pages */
DimiterK 0:135b9a0a816e 562 WriteInstruction(LCD_SET_PAGE | Page,LEFT); /* Set the page */
DimiterK 0:135b9a0a816e 563 for (Column = 0; Column < 64; Column++)
DimiterK 0:135b9a0a816e 564 WriteData(PictureData[(128*Page)+Column],LEFT);
DimiterK 0:135b9a0a816e 565 }
DimiterK 0:135b9a0a816e 566
DimiterK 0:135b9a0a816e 567 // Draw right side of the picture
DimiterK 0:135b9a0a816e 568 SelectSide(RIGHT);
DimiterK 0:135b9a0a816e 569 for (Page = 0; Page < 8; Page++){ /* loop on the 8 pages */
DimiterK 0:135b9a0a816e 570
DimiterK 0:135b9a0a816e 571 WriteInstruction(LCD_SET_PAGE| Page,RIGHT); /* Set the page */
DimiterK 0:135b9a0a816e 572 for (Column = 64; Column < 128; Column++)
DimiterK 0:135b9a0a816e 573 WriteData(PictureData[(128*Page)+Column],RIGHT);
DimiterK 0:135b9a0a816e 574 }
DimiterK 0:135b9a0a816e 575 }
DimiterK 0:135b9a0a816e 576
DimiterK 2:03d27b3fce6e 577 void KS0108::CustomImage(Image* image,unsigned int x, unsigned int y, unsigned int color){
DimiterK 2:03d27b3fce6e 578 unsigned int i, j, bit_idx, pixelByte, imgHeight, imgSize;
DimiterK 2:03d27b3fce6e 579
DimiterK 2:03d27b3fce6e 580 imgHeight = image->imgHeight; //get height of the image array
DimiterK 2:03d27b3fce6e 581 imgSize = (image->imgWidth)>>3; //number of bytes = width of icon/8
DimiterK 2:03d27b3fce6e 582
DimiterK 2:03d27b3fce6e 583 for(i=0;i<imgHeight;i++){
DimiterK 2:03d27b3fce6e 584 for(j=0;j<imgSize;j++){
DimiterK 2:03d27b3fce6e 585 pixelByte = image->imgarray[i*imgSize+j];
DimiterK 2:03d27b3fce6e 586 for(bit_idx=0;bit_idx<8;bit_idx++){
DimiterK 2:03d27b3fce6e 587 if(pixelByte&(0x80>>bit_idx))
DimiterK 3:366a6b7d6259 588 SetPixel(x+bit_idx+8*j, y+i, color);
DimiterK 2:03d27b3fce6e 589 else
DimiterK 2:03d27b3fce6e 590 SetPixel(x+bit_idx+8*j, y+i, !color);
DimiterK 2:03d27b3fce6e 591 }
DimiterK 2:03d27b3fce6e 592 }
DimiterK 2:03d27b3fce6e 593 }
DimiterK 2:03d27b3fce6e 594 }
DimiterK 0:135b9a0a816e 595 /******************************************************************************************/
DimiterK 0:135b9a0a816e 596
DimiterK 1:a368f2688222 597
DimiterK 0:135b9a0a816e 598 void KS0108::CursorXY(unsigned int x, unsigned int y){
DimiterK 0:135b9a0a816e 599 if( (x > SCREEN_WIDTH-1) || (y > SCREEN_HEIGHT-1) ) // exit if coordinates are not legal
DimiterK 0:135b9a0a816e 600 return;
DimiterK 0:135b9a0a816e 601
DimiterK 0:135b9a0a816e 602 if(y<(SCREEN_WIDTH/2)){
DimiterK 0:135b9a0a816e 603 SelectSide(LEFT);
DimiterK 0:135b9a0a816e 604 WriteInstruction(LCD_SET_PAGE|(y/8),RIGHT);
DimiterK 0:135b9a0a816e 605 WriteInstruction(LCD_SET_ADD|x,RIGHT);
DimiterK 0:135b9a0a816e 606 }else{
DimiterK 0:135b9a0a816e 607 SelectSide(RIGHT);
DimiterK 0:135b9a0a816e 608 WriteInstruction(LCD_SET_PAGE|(y/8),RIGHT);
DimiterK 0:135b9a0a816e 609 WriteInstruction(LCD_SET_ADD|x,RIGHT);
DimiterK 0:135b9a0a816e 610 }
DimiterK 0:135b9a0a816e 611 }
DimiterK 0:135b9a0a816e 612
DimiterK 1:a368f2688222 613
DimiterK 0:135b9a0a816e 614 void KS0108::Putc (int page, int col,unsigned char c) {
DimiterK 0:135b9a0a816e 615 if (c>31 && c<127){
DimiterK 0:135b9a0a816e 616 for(int i=0;i<5;i++){
DimiterK 0:135b9a0a816e 617 WriteDataColPag(page,col+i,System5x7[((c-32)*5+i)+6]);
DimiterK 0:135b9a0a816e 618 }
DimiterK 0:135b9a0a816e 619 }
DimiterK 0:135b9a0a816e 620 }
DimiterK 0:135b9a0a816e 621
DimiterK 0:135b9a0a816e 622
DimiterK 1:a368f2688222 623
DimiterK 0:135b9a0a816e 624 void KS0108::PutString(unsigned int x, unsigned int y,char* str){
DimiterK 0:135b9a0a816e 625
DimiterK 0:135b9a0a816e 626 while(*str != 0){
DimiterK 0:135b9a0a816e 627 Putc(x,y,*str);
DimiterK 0:135b9a0a816e 628 str++;
DimiterK 0:135b9a0a816e 629 y+=System5x7[2];
DimiterK 0:135b9a0a816e 630 }
DimiterK 0:135b9a0a816e 631
DimiterK 0:135b9a0a816e 632 }
DimiterK 0:135b9a0a816e 633
DimiterK 0:135b9a0a816e 634
DimiterK 0:135b9a0a816e 635
DimiterK 0:135b9a0a816e 636 void KS0108::PrintFloat(float val, unsigned int x,unsigned int y){
DimiterK 0:135b9a0a816e 637 char buf[20] = {}; // prints up to 20 digits
DimiterK 0:135b9a0a816e 638 sprintf(buf,"%f",val);
DimiterK 0:135b9a0a816e 639 PutString(x,y,buf);
DimiterK 0:135b9a0a816e 640
DimiterK 0:135b9a0a816e 641 }
DimiterK 0:135b9a0a816e 642
DimiterK 1:a368f2688222 643
DimiterK 0:135b9a0a816e 644 void KS0108::PrintInteger(int val,unsigned int x,unsigned int y){
DimiterK 0:135b9a0a816e 645 char buf[20] = {}; // prints up to 20 digits
DimiterK 0:135b9a0a816e 646 sprintf(buf,"%d",val);
DimiterK 0:135b9a0a816e 647 PutString(x,y,buf);
DimiterK 0:135b9a0a816e 648 }