aboutsummaryrefslogtreecommitdiffhomepage
path: root/Cart_Reader/LJPRO.ino
blob: 5058409f7572041cf4f240c7c7a2a778ac9e7118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
//******************************************
// LITTLE JAMMER PRO MODULE
//******************************************
#ifdef ENABLE_LJPRO
// Little Jammer Pro
// Cartridge Pinout
// 48P 1.25mm pitch connector
// 
// FORM FACTOR IS SAME AS BANDAI WONDERSWAN/BENESSE POCKET CHALLENGE V2/LITTLE JAMMER
// WIRING IS COMPLETELY DIFFERENT!
//
// LEFT SIDE
// 1 GND
// 2 GND
// 3 S1 (GND)
// 4 S2 (GND)
// 5 U1_WP#/ACC
// 6 U1_SCLK
// 7 U1_SCLK
// 8 U1_SI
// 9 U1_SI
// 10 U1_SO/PO7
// 11 U1_SO/PO7
// 12 U1_PO6
// 13 U1_PO5
// 14 U1_PO4
// 15 U1_PO3
// 16 U1_PO2
// 17 U1_PO1
// 18 U1_PO0
// 19 U1_CS#
// 20 U1_CS#
// 21 U1_HOLD#
// 22 U1_HOLD#
// 23 VCC (+3V)
// 24 VCC (+3V)
// 25 VCC (+3V)
// 26 VCC (+3V)
// 27 U2_SCLK
// 28 U2_SCLK
// 29 U2_SI
// 30 U2_SI
// 31 U2_SO/PO7
// 32 U2_SO/PO7
// 33 U2_PO6
// 34 U2_PO5
// 35 U2_PO4
// 36 U2_PO3
// 37 U2_PO2
// 38 U2_PO1
// 39 U2_PO0
// 40 U2_CS#
// 41 U2_CS#
// 42 U2_HOLD#
// 43 U2_HOLD#
// 44 U2_WP#/ACC
// 45 S3 (GND)
// 46 S4 (GND)
// 47 GND
// 48 GND
// RIGHT SIDE

// CONTROL PINS:
// U1_HOLD#    (PH4) - SNES /IRQ
// U1_CS#      (PK0) - SNES A8
// U1_SI       (PK1) - SNES A9
// U1_WP#/ACC  (PK2) - SNES A10
//
// U2_HOLD#    (PH0) - SNES RESET
// U2_SI       (PH3) - SNES /CS
// U2_WP#/ACC  (PH5) - SNES /WR
// U2_CS#      (PH6) - SNES /RD
//
// S1          (PK4) - SNES A12
// S2          (PK5) - SNES A13
// S3          (PK6) - SNES A14
// S4          (PK7) - SNES A15

// COMBINE U1_SCLK + U2_SCLK INTO SINGLE SCLK
// SCLK(PH1)   - SNES CPUCLK

// DATA PINS:
// U1 D0-D7 (PORTF)
// U2 D0-D7 (PORTC)

// NOTES:
// HOLD# NOT USED FOR PARALLEL MODE - PULLED UP TO VCC ON CARTS
// WP#/ACC PULLED DOWN TO GND ON CARTS

//******************************************
// DEFINES
//******************************************
#define CS1_LOW   PORTK &= ~(1 << 0)
#define CS1_HIGH  PORTK |= (1 << 0)
#define CS2_LOW   PORTH &= ~(1 << 6)
#define CS2_HIGH  PORTH |= (1 << 6)

//******************************************
// VARIABLES
//******************************************
char mnfID[3];
char deviceID_str[5];
boolean ljproflash1found = false;
boolean ljproflash2found = false;
byte ljproflash1size;
byte ljproflash2size;

// EEPROM MAPPING
// 08 ROM SIZE

//******************************************
// MENU
//******************************************
// Base Menu
static const char* const menuOptionsLJPRO[] PROGMEM = { FSTRING_READ_ROM, FSTRING_RESET };

// U1_HOLD#(PH4)    - SNES /IRQ
// U1_CS#           - SNES A8
// U1_WP#/ACC       - SNES A9
// U1_SI            - SNES A10
//
// U2_HOLD#(PH0)    - SNES RESET
// U2_SI(PH3)       - SNES /CS
// U2_WP#/ACC(PH5)  - SNES /WR
// U2_CS#(PH6)      - SNES /RD

void ljproMenu()
{
  convertPgm(menuOptionsLJPRO, 2);
  uint8_t mainMenu = question_box(F("LITTLE JAMMER PRO"), menuOptions, 2, 0);

  switch (mainMenu)
  {
    case 0:
      // Read ROM
      sd.chdir("/");
      readROM_LJPRO();
      sd.chdir("/");
      break;

    case 1:
      // reset
      resetArduino();
      break;
  }
}

//******************************************
// SETUP
//******************************************

void setup_LJPRO()
{
  // Request 3.3V
  setVoltage(VOLTS_SET_3V3);

  // LITTLE JAMMER PRO uses Serial Flash
  // Set Data Pins to Input
  DDRF = 0x00; // U1 Data
  DDRC = 0x00; // U2 Data
  // Set Unused Address Pins to Output
  DDRL = 0xFF;

  // Set Control Pins to Output
  //     U2_HLD(PH0) SCLK(PH1)  U2_SI(PH3) U1_HLD(PH4) U2_WP(PH5) U2_CS(PH6)
  DDRH |=  (1 << 0) | (1 << 1) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
  //      U1_CS(PK0) U1_SI(PK1) U1_WP(PK2) --------
  DDRK |=  (1 << 0) | (1 << 1) | (1 <<2) | (1 << 3);

  // FLASH Configuration Pins to Input
  //         S1(PK4)    S2(PK5)    S3(PK6)    S4(PK7)
  DDRK &= ~((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7));

  // Set TIME(PJ0) to Output (UNUSED)
  DDRJ |=  (1 << 0);

  // Setting Control Pins to HIGH
  //     U2_HLD(PH0) SCLK(PH1)  U2_SI(PH3) U1_HLD(PH4) U2_WP(PH5) U2_CS(PH6)
  PORTH |= (1 << 0) | (1 << 1) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6);
  //      U1_CS(PK0)  U1_SI(PK1) U1_WP(PK2)  --------    S1(PK4)    S2(PK5)    S3(PK6)    S4(PK7)
  PORTK |=  (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7);

  // Set Unused Data Pins (PA0-PA7) to Output
  DDRA = 0xFF;

  // Set Unused Pins HIGH
  PORTA = 0xFF;
  PORTJ |= (1 << 0); // TIME(PJ0)

  strcpy(romName, "LJPRO");

  mode = CORE_LJPRO;
}

//******************************************
// SERIAL MODE
//******************************************
// 25L4005/25L1605/25L3205/25L6405
// Default Serial Mode

void sendSerial_U1(uint8_t data)
{
  for (int i = 0; i < 8; i++) {
    PORTH &= ~(1 << 1); // SCLK LOW
    if ((data >> 7) & 0x1) { // Bit is HIGH
      PORTK |= (1 << 1); // U1_SI HIGH;
    }
    else {
      PORTK &= ~(1 << 1); // U1_SI LOW;
    }
    PORTH |= (1 << 1); // SCLK HIGH
    // rotate to the next bit
    data <<= 1;
  }
}

void sendSerial_U2(uint8_t data)
{
  for (int i = 0; i < 8; i++) {
    PORTH &= ~(1 << 1); // SCLK LOW
    if ((data >> 7) & 0x1) { // Bit is HIGH
      PORTH |= (1 << 3); // U2_SI HIGH;
    }
    else {
      PORTH &= ~(1 << 3); // U2_SI LOW;
    }
    PORTH |= (1 << 1); // SCLK HIGH
    // rotate to the next bit
    data <<= 1;
  }
}

uint8_t readSerial_U1()
{
  bool serBits[9];
  for (byte i = 0; i < 8; i++) {
    pulseClock_LJPRO(1);
    serBits[i] = (PINF >> 7) & 0x1;
  }
  byte tempdata = serBits[0] << 7 | serBits[1] << 6 | serBits[2] << 5 | serBits[3] << 4 | serBits[4] << 3 | serBits[5] << 2 | serBits[6] << 1 | serBits[7];

  return tempdata;
}

uint8_t readSerial_U2()
{
  bool serBits[9];
  for (byte i = 0; i < 8; i++) {
    pulseClock_LJPRO(1);
    serBits[i] = (PINC >> 7) & 0x1;
  }
  byte tempdata = serBits[0] << 7 | serBits[1] << 6 | serBits[2] << 5 | serBits[3] << 4 | serBits[4] << 3 | serBits[5] << 2 | serBits[6] << 1 | serBits[7];

  return tempdata;
}

// RDID
// Manufacturer 0xC2
// Memory Density 0x20
// Device ID 0x13 [25L4005]/0x15 [25L1605]/0x16 [25L3205]/0x17 [25L6405]

void readSerialID_U1()
{
  CS1_LOW;
  DDRF = 0x00; // U1 Data Input
  sendSerial_U1(0x9F); // 0x9F = 10011111
  // Manufacturer Code
  byte id0 = readSerial_U1();
  // Device Code
  byte id1 = readSerial_U1();
  byte id2 = readSerial_U1();
  CS1_HIGH;
  // Flash ID
  sprintf(mnfID, "%02X", id0);
  sprintf(deviceID_str, "%02X%02X", id1, id2);
  if(strcmp(deviceID_str, "2013") == 0) { // MX25L4005
    ljproflash1found = 1;
    ljproflash1size = 1;
    println_Msg(F("U1 MX25L4005 FOUND"));
    display_Update();
  }
  else if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
    ljproflash1found = 1;
    ljproflash1size = 2;
    println_Msg(F("U1 MX25L1605 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
    ljproflash1found = 1;
    ljproflash1size = 4;
    println_Msg(F("U1 MX25L3205 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2017") == 0) { // MX25L6405
    ljproflash1found = 1;
    ljproflash1size = 8;
    println_Msg(F("U1 MX25L6405 FOUND"));
    display_Update();
  }
}

void readSerialID_U2()
{
  CS2_LOW;
  DDRC = 0x00; // U2 Data Input
  sendSerial_U2(0x9F); // 0x9F = 10011111
  // Manufacturer Code
  byte id0 = readSerial_U2();
  // Device Code
  byte id1 = readSerial_U2();
  byte id2 = readSerial_U2();
  CS2_HIGH;
  // Flash ID
  sprintf(mnfID, "%02X", id0);
  sprintf(deviceID_str, "%02X%02X", id1, id2);
  if(strcmp(deviceID_str, "2013") == 0) { // MX25L4005
    ljproflash2found = 1;
    ljproflash2size = 1;
    println_Msg(F("U2 MX25L4005 FOUND"));
    display_Update();
  }
  else if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
    ljproflash2found = 1;
    ljproflash2size = 2;
    println_Msg(F("U2 MX25L1605 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
    ljproflash2found = 1;
    ljproflash2size = 4;
    println_Msg(F("U2 MX25L3205 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2017") == 0) { // MX25L6405
    ljproflash2found = 1;
    ljproflash2size = 8;
    println_Msg(F("U2 MX25L6405 FOUND"));
    display_Update();
  }
}

void readSerialData_U1(uint32_t startaddr, uint32_t endaddr)
{
  for (uint32_t addr = startaddr; addr < endaddr; addr += 512) {
    for (int x = 0; x < 512; x++) {
      sdBuffer[x] = readSerial_U1();
    }
    myFile.write(sdBuffer, 512);
  }
}

void readSerialData_U2(uint32_t startaddr, uint32_t endaddr)
{
  for (uint32_t addr = startaddr; addr < endaddr; addr += 512) {
    for (int x = 0; x < 512; x++) {
      sdBuffer[x] = readSerial_U2();
    }
    myFile.write(sdBuffer, 512);
  }
}

//******************************************
// PARALLEL MODE
//******************************************
// 25L1605/25L3205/25L6405
// Parallel Mode - Command 0x55
// SCLK Frequency 1.2MHz (Cycle 833.33ns)
// READ 0x03
// WRITE 0x02

void pulseClock_LJPRO(unsigned int times)
{
  for (unsigned int i = 0; i < (times * 2); i++) {
    // Switch the clock pin to 0 if it's 1 and 0 if it's 1
    PORTH ^= (1 << 1);
    // without the delay the clock pulse would be 1.5us and 666kHz
    //__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t"));
  }
}

// Send one byte of data to Serial FLASH [Parallel Mode]
void sendData_U1(byte data)
{
  DDRF = 0xFF; // U1 Data Output
  PORTF = data;
  pulseClock_LJPRO(8);
  DDRF = 0x00; // U1 Data Input
}

void sendData_U2(byte data)
{
  DDRC = 0xFF; // U2 Data Output
  PORTC = data;
  pulseClock_LJPRO(8);
  DDRC = 0x00; // U2 Data Input
}

void readData_U1(uint32_t startaddr, uint32_t endaddr)
{
  for (uint32_t addr = startaddr; addr < endaddr; addr += 512) {
    for (int x = 0; x < 512; x++) {
      pulseClock_LJPRO(1);
      sdBuffer[x] = PINF;
    }
    myFile.write(sdBuffer, 512);
  }
}

void readData_U2(uint32_t startaddr, uint32_t endaddr)
{
  for (uint32_t addr = startaddr; addr < endaddr; addr += 512) {
    for (int x = 0; x < 512; x++) {
      pulseClock_LJPRO(1);
      sdBuffer[x] = PINC;
    }
    myFile.write(sdBuffer, 512);
  }
}

// RDID
// Manufacturer 0xC2
// Memory Density 0x20
// Device ID 0x15 [25L1605]/0x16 [25L3205]/0x17 [25L6405]

void readID_U1() // Parallel Mode
{
  CS1_LOW; // U1 LOW
  sendSerial_U1(0x9F); // RDID Command
  pulseClock_LJPRO(1);
  byte id0 = PINF; // 0xC2
  pulseClock_LJPRO(1);
  byte id1 = PINF; // 0x20
  pulseClock_LJPRO(1);
  byte id2 = PINF; // 0x15 [MX25L1605]/0x16 [MX25L3205]/0x17 [MX25L6405]
  CS1_HIGH; // U1 HIGH
  // Flash ID
  sprintf(mnfID, "%02X", id0);
  sprintf(deviceID_str, "%02X%02X", id1, id2);
  if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
    ljproflash1found = 1;
    ljproflash1size = 2;
    display_Clear();
    println_Msg(F("U1 MX25L1605 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
    ljproflash1found = 1;
    ljproflash1size = 4;
    display_Clear();
    println_Msg(F("U1 MX25L3205 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2017") == 0) { // MX25L6405
    ljproflash1found = 1;
    ljproflash1size = 8;
    display_Clear();
    println_Msg(F("U1 MX25L6405 FOUND"));
    display_Update();
  }
}

void readID_U2() // Parallel Mode
{
  CS2_LOW; // U2 LOW
  sendSerial_U2(0x9F); // RDID Command
  pulseClock_LJPRO(1);
  byte id0 = PINC; // 0xC2
  pulseClock_LJPRO(1);
  byte id1 = PINC; // 0x20
  pulseClock_LJPRO(1);
  byte id2 = PINC; // 0x15 [MX25L1605]/0x16 [MX25L3205]/0x17 [MX25L6405]
  pulseClock_LJPRO(1);
  CS2_HIGH; // U2 HIGH
  // Flash ID
  sprintf(mnfID, "%02X", id0);
  sprintf(deviceID_str, "%02X%02X", id1, id2);
  if(strcmp(deviceID_str, "2015") == 0) { // MX25L1605
    ljproflash2found = 1;
    ljproflash2size = 2;
    println_Msg(F("U2 MX25L1605 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2016") == 0) { // MX25L3205
    ljproflash2found = 1;
    ljproflash2size = 4;
    println_Msg(F("U2 MX25L3205 FOUND"));
    display_Update();
  }
  else if (strcmp(deviceID_str, "2017") == 0) { // MX25L6405
    ljproflash2found = 1;
    ljproflash2size = 8;
    println_Msg(F("U2 MX25L6405 FOUND"));
    display_Update();
  }
}

//******************************************
// READ ROM
//******************************************

void readROM_LJPRO() 
{
  createFolderAndOpenFile("LJPRO", "ROM", romName, "bin");

  // Little Jammer Pro PCB B1043-02A
  // Footprints for two 25L1605/25L3205 chips
  // Test carts only have one 25L1605 (2MB) installed
  // PCB could possibly install two 25L3205 chips (2x4MB = 8MB)

  // Little Jammer Pro PCB B1043-03B
  // Footprints for 25L4005 + 25L6405 chips
  // U1 = 25L4005 (512KB), U2 = 25L6405 (8MB)

  // Reset Flash Settings
  ljproflash1found = 0;
  ljproflash2found = 0;
  ljproflash1size = 0;
  ljproflash2size = 0;

  display_Clear();
  readSerialID_U1();
  if (!ljproflash1found) {
    // Set U1 FLASH to Parallel Mode
    CS1_LOW; // U1 LOW
    sendSerial_U1(0x55); // Parallel Mode
    CS1_HIGH; // U1 HIGH
    readID_U1(); // Read ID using Parallel Mode
  }
  readSerialID_U2();
  if (!ljproflash2found) {
    // Set U2 FLASH to Parallel Mode
    CS2_LOW; // U2 LOW
    sendSerial_U2(0x55); // Parallel Mode
    CS2_HIGH; // U2 HIGH
    readID_U2(); // Read ID using Parallel Mode
  }
  // NOTE:  Setting Flash to Parallel Mode stays in effect until Power Cycle

  // Read U1
  println_Msg(F("Reading U1..."));
  display_Update();
  if (ljproflash1size == 1) { // 25L4005 - Serial Mode
    CS1_LOW; // U1 LOW
    DDRF = 0x00; // U1 Data Input
    sendSerial_U1(0x03); // Read Array
    sendSerial_U1(0x00); // Address A23-A16
    sendSerial_U1(0x00); // Address A15-A8
    sendSerial_U1(0x00); // Address A7-A0
    readSerialData_U1(0x00000,0x80000); // 512KB
    CS1_HIGH; // U1 HIGH
  }
  else { // 25L1605/25L3205/25L6405 - Parallel Mode
    // Set U1 FLASH to Parallel Mode
    CS1_LOW; // U1 LOW
    sendSerial_U1(0x55); // Parallel Mode
    CS1_HIGH; // U1 HIGH
    CS1_LOW; // U1 LOW
    DDRF = 0x00; // U1 Data Input
    sendSerial_U1(0x03); // Read Array
    sendSerial_U1(0x00); // Address A23-A16
    sendSerial_U1(0x00); // Address A15-A8
    sendSerial_U1(0x00); // Address A7-A0
    readData_U1(0x000000, 0x200000); // 2MB
    if (ljproflash1size > 2) {
      readData_U1(0x200000, 0x400000); // +2MB = 4MB
      if (ljproflash1size > 4) {
        readData_U1(0x400000, 0x800000); // +4MB = 8MB
      }
    }
    CS1_HIGH; // U1 HIGH
  }
  if (ljproflash2found) {
    // Read U2
    println_Msg(F("Reading U2..."));
    display_Update();
    if (ljproflash2size == 1) { // 25L4005 - Serial Mode
      CS2_LOW; // U2 LOW
      DDRC = 0x00; // U2 Data Input
      sendSerial_U2(0x03); // Read Array
      sendSerial_U2(0x00); // Address A23-A16
      sendSerial_U2(0x00); // Address A15-A8
      sendSerial_U2(0x00); // Address A7-A0
      readSerialData_U2(0x00000,0x80000); // 512KB
      CS2_HIGH; // U2 HIGH
    }
    else { // 25L1605/25L3205/25L6405 - Parallel Mode
      // Set U2 FLASH to Parallel Mode
      CS2_LOW; // U2 LOW
      sendSerial_U2(0x55); // Parallel Mode
      CS2_HIGH; // U2 HIGH
      CS2_LOW; // U2 LOW
      DDRC = 0x00; // U2 Data Input
      sendSerial_U2(0x03); // Read Array
      sendSerial_U2(0x00); // Address A23-A16
      sendSerial_U2(0x00); // Address A15-A8
      sendSerial_U2(0x00); // Address A7-A0
      readData_U2(0x000000, 0x200000); // 2MB
      if (ljproflash2size > 2) {
        readData_U2(0x200000, 0x400000); // +2MB = 4MB
        if (ljproflash2size > 4) {
          readData_U2(0x400000, 0x800000); // +4MB = 8MB
        }
      }
      CS2_HIGH; // U2 HIGH
    }
  }
  myFile.close();

  printCRC(fileName, NULL, 0);

  println_Msg(FS(FSTRING_EMPTY));
  print_STR(press_button_STR, 1);
  display_Update();
  wait(); 
}
#endif