apple1-videocard-lib/demos/sdcard/cmd_type.h
nino-porcino 06ed8bfc4d fix bugs
2022-02-10 17:06:16 +01:00

36 lines
711 B
C

void comando_type() {
// 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;
}
// get file length in tmpword
receive_word_from_mcu();
if(TIMEOUT) return;
// get file bytes
for(word t=0;t!=tmpword;t++) {
byte data = receive_byte_from_MCU();
if(TIMEOUT) return;
woz_putc(data);
if(apple1_readkey()) {
woz_puts("*BRK*\r");
break;
}
}
}