apple1-videocard-lib/demos/sdcard/cmd_type.h

37 lines
753 B
C
Raw Permalink Normal View History

2022-02-10 16:06:16 +00:00
void comando_type() {
2022-02-07 07:50:35 +00:00
// send command byte
send_byte_to_MCU(CMD_READ);
if(TIMEOUT) return;
// send filename
send_string_to_MCU(filename);
if(TIMEOUT) return;
// response
byte response = receive_byte_from_MCU();
if(TIMEOUT) return;
if(response == ERR_RESPONSE) {
// error with file, print message
print_string_response();
return;
}
2022-02-10 16:06:16 +00:00
// get file length in tmpword
receive_word_from_mcu();
2022-02-07 07:50:35 +00:00
if(TIMEOUT) return;
2022-02-16 07:58:59 +00:00
// get file bytes
byte print_on = 1;
2022-02-10 16:06:16 +00:00
for(word t=0;t!=tmpword;t++) {
2022-02-07 07:50:35 +00:00
byte data = receive_byte_from_MCU();
if(TIMEOUT) return;
2022-02-16 07:58:59 +00:00
if(print_on) woz_putc(data);
2022-02-07 07:50:35 +00:00
if(apple1_readkey()) {
woz_puts("*BRK*\r");
2022-02-16 07:58:59 +00:00
print_on = 0;
2022-02-07 07:50:35 +00:00
}
}
}