IJFW - IchigoJamのBASICプログラムをメモリカード(MMCまたは互換カード)に保存したり読み出したりできるプログラム。メモリカードにファームウェアのファイルを置くだけで、電源ON時に自動的に書き換える機能も搭載(一応こちらがメイン)。LPC1114FN28専用。
参考URL http://www.cyberchabudai.org/index.php/entry?tag=IJFW
Diff: I2c2mem/I2c2mem.cpp
- Revision:
- 2:daf6c4719496
- Parent:
- 1:11f73f269fdc
--- a/I2c2mem/I2c2mem.cpp Wed Aug 17 07:19:20 2016 +0000 +++ b/I2c2mem/I2c2mem.cpp Sun Aug 21 07:51:01 2016 +0000 @@ -17,6 +17,7 @@ : i2cs(_i2cs), fs(_fs), ledcard(_ledcard) { buffer = new char[PROGRAM_BYTES_MAX]; address = 0; + address_old = 0; count = 0; dataBytesCount = 0; dataFileNum = 0; @@ -37,11 +38,18 @@ int length = i2cs->read(bufi2c, 36) - 1; if (length == 2 || length == 34) { + // Calculate memory address in EEPROM + address = 0x10000 * flag; // This flag expresses 64-127 block + address |= (bufi2c[0] << 8) | bufi2c[1]; + + // if command is "FILES" + if (address != address_old + 32) { + count = 0; + } + address_old = address; + + // BAS file name if (count == 0) { - // Calculate memory address in EEPROM - address = 0x10000 * flag; // This flag expresses 64-127 block - address |= (bufi2c[0] << 8) | bufi2c[1]; - // BAS file int filenum = ((address / PROGRAM_BYTES_MAX) % PROGRAM_NUM_MAX) + 100; sprintf(filename, "ij%03d.bas", filenum); } @@ -295,6 +303,7 @@ } address = 0; + address_old = 0; count = 0; dataBytesCount = 0; dataFileNum = 0;