Skip to content

Commit 3b96057

Browse files
authored
Coco lobby (#151)
* CoCo: Fixed pause to be (properly) ticks instead of seconds * CoCo: Implement lobby command
1 parent c534206 commit 3b96057

File tree

4 files changed

+69
-15
lines changed

4 files changed

+69
-15
lines changed

src/coco/input.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ HDSubState input_hosts_and_devices_hosts(void)
284284
bar_jump(selected_host_slot);
285285
k = 0;
286286
return HD_HOSTS;
287+
case 'l':
288+
case 'L':
289+
mount_and_boot_lobby();
290+
return HD_HOSTS;
287291
case '1':
288292
case '2':
289293
case '3':
@@ -316,6 +320,10 @@ HDSubState input_hosts_and_devices_devices(void)
316320
case 'e':
317321
hosts_and_devices_eject((byte)bar_get());
318322
break;
323+
case 'L':
324+
case 'l':
325+
mount_and_boot_lobby();
326+
return HD_DEVICES;
319327
case 'R':
320328
case 'r':
321329
selected_device_slot = (byte)bar_get();

src/coco/mount_and_boot.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
#ifdef _CMOC_VERSION_
22

33
#include "mount_and_boot.h"
4+
#include "../screen.h"
45
#include "../typedefs.h"
6+
#include "../globals.h"
57

68
void mount_and_boot_lobby(void)
79
{
10+
if (screen_mount_and_boot_lobby())
11+
{
12+
fuji_set_boot_mode(2);
13+
system_boot();
14+
}
15+
else
16+
{
17+
if (hd_subState == HD_HOSTS)
18+
{
19+
screen_hosts_and_devices_hosts();
20+
}
21+
else if (hd_subState == HD_DEVICES)
22+
{
23+
screen_hosts_and_devices_devices();
24+
}
25+
}
826
}
927

1028
void mount_and_boot(void)

src/coco/pause.c

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,28 @@
99

1010
void pause(unsigned char delay)
1111
{
12-
#ifdef DRAGON
13-
asm
14-
{
15-
// We come here from a JMP $C000 in Color Basic (normally at
16-
// $A10A in v1.2). At this point, the 60 Hz interrupt has
17-
// not been enabled yet, so enable it.
18-
lda $FF03 // get control register of PIA0, port B
12+
#ifdef DRAGON
13+
asm
14+
{
15+
// We come here from a JMP $C000 in Color Basic (normally at
16+
// $A10A in v1.2). At this point, the 60 Hz interrupt has
17+
// not been enabled yet, so enable it.
18+
lda $FF03 // get control register of PIA0, port B
1919
ora #1
20-
sta $FF03 // enable 60 Hz interrupt
20+
sta $FF03 // enable 60 Hz interrupt
2121

22-
// Unmask interrupts to allow the timer IRQ to be processed.
22+
// Unmask interrupts to allow the timer IRQ to be processed.
2323
andcc #$AF
24-
}
24+
}
2525
#endif
26-
sleep(delay/20);
26+
27+
if (!delay)
28+
{
29+
return;
30+
}
31+
32+
setTimer(0);
33+
while (getTimer() < delay);
2734
}
2835

2936
#endif /* _CMOC_VERSION */

src/coco/screen.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,35 @@ void screen_connect_wifi(NetConfig *nc)
571571
screen_add_shadow(9,BLUE); // change to CYAN
572572
}
573573

574+
bool screen_mount_and_boot_lobby(void)
575+
{
576+
unsigned char k;
577+
578+
// Confirm we want to go to there
579+
locate(0, 15);
580+
printf(" BOOT TO LOBBY? y/n");
581+
582+
k = waitkey(true);
583+
584+
switch (k)
585+
{
586+
case 'Y':
587+
case 'y':
588+
return true;
589+
default:
590+
return false;
591+
}
592+
}
593+
574594
void screen_end(void)
575595
{
576-
// Restore the original casing flag.
577-
asm {
596+
// Restore the original casing flag.
597+
asm
598+
{
578599
lda orig_casflag
579600
sta $011A
580-
}
581-
return;
601+
}
602+
return;
582603
}
583604

584605
#endif

0 commit comments

Comments
 (0)