casing
This commit is contained in:
parent
90af933fb7
commit
7cc3dab687
3 changed files with 11 additions and 11 deletions
16
loaders.cpp
16
loaders.cpp
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
2
main.cpp
2
main.cpp
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue