This commit is contained in:
folkert van heusden 2024-04-26 16:01:31 +02:00
parent 90af933fb7
commit 7cc3dab687
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 11 additions and 11 deletions

View file

@ -23,14 +23,14 @@ void loadbin(bus *const b, uint16_t base, const char *const file)
FILE *fh = fopen(file, "rb"); FILE *fh = fopen(file, "rb");
while(!feof(fh)) while(!feof(fh))
b -> writeByte(base++, fgetc(fh)); b->writeByte(base++, fgetc(fh));
fclose(fh); fclose(fh);
} }
void set_boot_loader(bus *const b, const bootloader_t which) void set_boot_loader(bus *const b, const bootloader_t which)
{ {
cpu *const c = b -> getCpu(); cpu *const c = b->getCpu();
uint16_t offset = 0; uint16_t offset = 0;
uint16_t start = 0; uint16_t start = 0;
@ -139,12 +139,12 @@ void set_boot_loader(bus *const b, const bootloader_t which)
} }
for(int i=0; i<size; i++) for(int i=0; i<size; i++)
b -> writeWord(offset + i * 2, bl[i]); b->writeWord(offset + i * 2, bl[i]);
c -> setRegister(7, start); c->setRegister(7, start);
} }
std::optional<uint16_t> loadTape(bus *const b, const std::string & file) std::optional<uint16_t> load_tape(bus *const b, const std::string & file)
{ {
#if defined(ESP32) #if defined(ESP32)
File32 fh; File32 fh;
@ -211,7 +211,7 @@ std::optional<uint16_t> loadTape(bus *const b, const std::string & file)
#endif #endif
csum += c; csum += c;
b -> writeByte(p++, c); b->writeByte(p++, c);
} }
#if defined(ESP32) #if defined(ESP32)
@ -271,6 +271,6 @@ void load_p11_x11(bus *const b, const std::string & file)
fclose(fh); fclose(fh);
cpu *const c = b -> getCpu(); cpu *const c = b->getCpu();
c -> setRegister(7, 0); c->setRegister(7, 0);
} }

View file

@ -1,4 +1,4 @@
// (C) 2018-2023 by Folkert van Heusden // (C) 2018-2024 by Folkert van Heusden
// Released under MIT license // Released under MIT license
#include <optional> #include <optional>
@ -12,5 +12,5 @@ typedef enum { BL_NONE, BL_RK05, BL_RL02 } bootloader_t;
void loadbin(bus *const b, uint16_t base, const char *const file); void loadbin(bus *const b, uint16_t base, const char *const file);
void set_boot_loader(bus *const b, const bootloader_t which); void set_boot_loader(bus *const b, const bootloader_t which);
std::optional<uint16_t> loadTape(bus *const b, const std::string & file); std::optional<uint16_t> load_tape(bus *const b, const std::string & file);
void load_p11_x11(bus *const b, const std::string & file); void load_p11_x11(bus *const b, const std::string & file);

View file

@ -574,7 +574,7 @@ int main(int argc, char *argv[])
std::optional<uint16_t> bic_start; std::optional<uint16_t> bic_start;
if (tape.empty() == false) { if (tape.empty() == false) {
bic_start = loadTape(b, tape); bic_start = load_tape(b, tape);
if (bic_start.has_value() == false) if (bic_start.has_value() == false)
return 1; // fail return 1; // fail