Skip to content

Commit fd07f0b

Browse files
authored
CoCo - implement lobby mount (#1040)
* CoCo - implement lobby mount CoCo - Add lobby-enabled config to firmware CoCo/Apple/Atari - fix lobby mount so it will work more than once. * Fix Atari/Apple build * Fix Apple (again)
1 parent 182ef39 commit fd07f0b

File tree

6 files changed

+56
-12
lines changed

6 files changed

+56
-12
lines changed
0 Bytes
Binary file not shown.

lib/FileSystem/fnFsTNFS.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ bool FileSystemTNFS::start(const char *host, uint16_t port, const char * mountpa
135135
return true;
136136
}
137137

138+
bool FileSystemTNFS::is_started()
139+
{
140+
return _started;
141+
}
142+
138143
bool FileSystemTNFS::exists(const char* path)
139144
{
140145
tnfsStat tstat;

lib/FileSystem/fnFsTNFS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class FileSystemTNFS : public FileSystem
3333
FileHandler * filehandler_open(const char* path, const char* mode = FILE_READ) override;
3434
#endif
3535

36+
bool is_started();
3637
bool exists(const char* path) override;
3738

3839
bool remove(const char* path) override;

lib/device/drivewire/fuji.cpp

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "fnSystem.h"
1717
#include "fnConfig.h"
1818
#include "fsFlash.h"
19+
#include "fnFsTNFS.h"
1920
#include "fnWiFi.h"
2021

2122
#include "led.h"
@@ -1355,6 +1356,7 @@ void drivewireFuji::insert_boot_device(uint8_t d)
13551356
bIsDragon = (fnSystem.digital_read(PIN_EPROM_A14) == DIGI_HIGH && fnSystem.digital_read(PIN_EPROM_A15) == DIGI_HIGH);
13561357
#endif /* ESP_PLATFORM */
13571358

1359+
const char *boot_img = nullptr;
13581360
fnFile *fBoot = NULL;
13591361
size_t sz = 0;
13601362

@@ -1365,24 +1367,46 @@ void drivewireFuji::insert_boot_device(uint8_t d)
13651367
case 0:
13661368
if (bIsDragon)
13671369
{
1368-
fBoot = fsFlash.fnfile_open(config_atr_dragon);
1370+
boot_img = config_atr_dragon;
13691371
}
13701372
else
13711373
{
1372-
fBoot = fsFlash.fnfile_open(config_atr_coco);
1374+
boot_img = config_atr_coco;
13731375
}
1376+
fBoot = fsFlash.fnfile_open(boot_img);
13741377
break;
13751378
case 1:
1376-
fBoot = fsFlash.fnfile_open(mount_and_boot_atr);
1379+
boot_img = mount_and_boot_atr;
1380+
fBoot = fsFlash.fnfile_open(boot_img);
13771381
break;
1382+
case 2:
1383+
Debug_printf("Mounting lobby server\n");
1384+
if (!fnTNFS.is_started())
1385+
{
1386+
Debug_printf("Starting TNFS connection\n");
1387+
if (!fnTNFS.start("tnfs.fujinet.online"))
1388+
{
1389+
Debug_printf("TNFS failed to start.\n");
1390+
fBoot = NULL;
1391+
return;
1392+
}
1393+
}
1394+
1395+
Debug_printf("Opening lobby.\n");
1396+
boot_img = "/COCO/lobby.dsk";
1397+
fBoot = fnTNFS.fnfile_open(boot_img);
1398+
break;
1399+
default:
1400+
Debug_printf("Invalid boot mode: %d\n", d);
1401+
return;
13781402
}
13791403

13801404
if (fBoot)
13811405
{
13821406
fnio::fseek(fBoot, 0, SEEK_END);
13831407
sz = fnio::ftell(fBoot);
13841408
fnio::fseek(fBoot, 0, SEEK_SET);
1385-
_bootDisk.mount(fBoot, bIsDragon ? config_atr_dragon : config_atr_coco, sz);
1409+
_bootDisk.mount(fBoot, boot_img, sz);
13861410

13871411
_bootDisk.is_config_device = true;
13881412
_bootDisk.device_active = true;

lib/device/iwm/fuji.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,12 +1282,19 @@ void iwmFuji::insert_boot_device(uint8_t d)
12821282
break;
12831283
case 2:
12841284
Debug_printf("Mounting lobby server\n");
1285-
if (fnTNFS.start("tnfs.fujinet.online"))
1285+
if (!fnTNFS.is_started())
12861286
{
1287-
Debug_printf("opening lobby.\n");
1288-
boot_img = "/APPLE2/_lobby.po";
1289-
fBoot = fnTNFS.fnfile_open(boot_img);
1287+
Debug_printf("Starting TNFS connection\n");
1288+
if (!fnTNFS.start("tnfs.fujinet.online"))
1289+
{
1290+
Debug_printf("TNFS failed to start.\n");
1291+
return;
1292+
}
12901293
}
1294+
1295+
Debug_printf("opening lobby.\n");
1296+
boot_img = "/APPLE2/_lobby.po";
1297+
fBoot = fnTNFS.fnfile_open(boot_img);
12911298
break;
12921299
default:
12931300
Debug_printf("Invalid boot mode: %d\n", d);

lib/device/sio/fuji.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,12 +2051,19 @@ void sioFuji::insert_boot_device(uint8_t d)
20512051
break;
20522052
case 2:
20532053
Debug_printf("Mounting lobby server\n");
2054-
if (fnTNFS.start("tnfs.fujinet.online"))
2054+
if (!fnTNFS.is_started())
20552055
{
2056-
Debug_printf("opening lobby.\n");
2057-
fBoot = fnTNFS.fnfile_open("/ATARI/_lobby.xex");
2058-
_bootDisk.mount(fBoot, "/ATARI/_lobby.xex", 0);
2056+
Debug_printf("Starting TNFS connection\n");
2057+
if (!fnTNFS.start("tnfs.fujinet.online"))
2058+
{
2059+
Debug_printf("TNFS failed to start.\n");
2060+
return;
2061+
}
20592062
}
2063+
2064+
Debug_printf("opening lobby.\n");
2065+
fBoot = fnTNFS.fnfile_open("/ATARI/_lobby.xex");
2066+
_bootDisk.mount(fBoot, "/ATARI/_lobby.xex", 0);
20602067
break;
20612068
}
20622069
#else

0 commit comments

Comments
 (0)