Changeset ee447bf in thomson for code/C/HxCHost/main.c
- Timestamp:
- Mar 10, 2012, 7:58:02 PM (12 years ago)
- Branches:
- main
- Children:
- 99bc67a
- Parents:
- 1b74fa2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/C/HxCHost/main.c
r1b74fa2 ree447bf 19 19 unsigned char* secbuf = mark+16; 20 20 21 const char* HXCSDFECFG = "HXC TEST.CFG";21 const char* HXCSDFECFG = "HXCSDFE.CFG"; 22 22 23 23 void printhex(unsigned char n) … … 114 114 inline static void config() 115 115 { 116 unsigned char* confbuf[29]; 116 117 // If it's HXCSDFE.CFG, enter config mode 117 118 // Read the config part of the file 118 119 WORD byteCount = 29; 119 FRESULT r = pf_read( secbuf, byteCount, &byteCount);120 FRESULT r = pf_read(confbuf, byteCount, &byteCount); 120 121 if (r != 0 || byteCount != 29) 121 122 { … … 132 133 mon_putc(selected == j ? 0x54: 0x50) // Blue 133 134 if(options[j].type) 134 printhex(*( secbuf+options[j].off));135 printhex(*(confbuf+options[j].off)); 135 136 else 136 my_puts(*( secbuf+options[j].off) ? "ON":"OFF");137 my_puts(*(confbuf+options[j].off) ? "ON":"OFF"); 137 138 mon_putc(0x1B); // Select back color 138 139 mon_putc(0x50); // Select back color … … 154 155 case 0x19: // SPACE 155 156 // save configuration 156 r = pf_open(HXCSDFECFG); 157 if (r) { 158 my_puts("can't open cfg"); 159 printhex(r); 160 } 157 pf_lseek(0); 161 158 byteCount = 29; 162 r = pf_write( secbuf, byteCount, &byteCount);159 r = pf_write(confbuf, byteCount, &byteCount); 163 160 if (r || byteCount != 29) { 164 161 my_puts("can't write cfg"); 165 162 printhex(r); 163 abort(); 166 164 } 167 165 r = pf_write(0, 0, &byteCount); // flush sector … … 169 167 my_puts("can't close cfg"); 170 168 printhex(r); 169 abort(); 171 170 } 172 171 // fall through 172 do { 173 asm("SWI \t \t;\n" 174 ".fcb \t0x0A\t;GETC\n"); 175 } while(KEY == 0); 173 176 case 0x10: // LEFT 174 177 // Quit (without saving) 175 178 return; 176 break;177 179 178 180 case 0x18: // DOWN … … 184 186 // decrease current option value 185 187 if(options[selected].type) 186 --*( secbuf+options[selected].off);188 --*(confbuf+options[selected].off); 187 189 else 188 *( secbuf+options[selected].off) = 0;190 *(confbuf+options[selected].off) = 0; 189 191 break; 190 192 case 0x0B: // + 191 193 if(options[selected].type) 192 ++*( secbuf+options[selected].off);194 ++*(confbuf+options[selected].off); 193 195 else 194 *( secbuf+options[selected].off) = 0xFF;196 *(confbuf+options[selected].off) = 0xFF; 195 197 break; 196 198 }
Note:
See TracChangeset
for help on using the changeset viewer.