Skip to content

Commit 6701068

Browse files
authored
Add dragon support (#128)
Add dragon support to config. Add makefile, change call vector to dragon drivewire call. Support VDK file mounting. Add reminder message for drive mounting.
1 parent c7bdd38 commit 6701068

File tree

5 files changed

+175
-13
lines changed

5 files changed

+175
-13
lines changed

Makefile.dragon

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Makefile for Building CoCo Config with CMOC
2+
3+
CC=cmoc
4+
AS=lwasm
5+
CP=cp
6+
MV=mv
7+
CFLAGS=-c --dragon -DDRAGON -O2 --no-relocate
8+
ECHO=echo
9+
FIRMWARE_DIR="../fujinet-firmware"
10+
11+
all: configd.bin configx.bin
12+
13+
CONFIGOBJS = check_wifi.o connect_wifi.o destination_host_slot.o hosts_and_devices.o main.o perform_copy.o select_file.o select_slot.o set_wifi.o show_info.o bar.o die.o input.o io.o mount_and_boot.o screen.o strrchr.o pause.o
14+
15+
16+
#HIRESLIB = src/coco/hirestxt-0.5.0/libhirestxt_dgn.a
17+
18+
configd.bin: $(CONFIGOBJS)
19+
$(CC) --dragon --org=2601 --limit=7800 -O2 --no-relocate -o configd.bin $(CONFIGOBJS)
20+
#$(CC) --dragon --raw -o configd.bin $(HIRESLIB) $(CONFIGOBJS)
21+
$(ECHO) Now, Do a Upload Filesystem task.
22+
rm -f autorund.vdk
23+
dragondos new autorund.vdk 360
24+
dragondos list autorund.vdk
25+
#for i in $^; do dragondos insertbinary ./autorund.vdk $$i 0x2601 0x2601; done
26+
dragondos insertbinary ./autorund.vdk ./configd.bin 0x2601 0x2601
27+
dragondos list autorund.vdk
28+
$(CP) autorund.vdk ~/tnfs/
29+
$(CP) autorund.vdk ../fujinet-firmware/data/webui/device_specific/BUILD_COCO/
30+
$(CP) autorund.vdk ../fujinet-firmware/data/BUILD_COCO/
31+
$(CP) configd.bin AUTOLOAD.DWL
32+
$(CP) AUTOLOAD.DWL ../fujinet-firmware/data/BUILD_COCO/
33+
$(CP) AUTOLOAD.DWL ../fujinet-firmware/data/webui/device_specific/BUILD_COCO/
34+
35+
$(ECHO) Now, Do a Upload Filesystem task.
36+
37+
# One option for autoload is to just create the config file as a dragon binary and load this with the DW4 named object mechanism
38+
#
39+
configx.bin: check_wifi.o connect_wifi.o destination_host_slot.o hosts_and_devices.o main.o perform_copy.o select_file.o select_slot.o set_wifi.o show_info.o bar.o die.o input.o io.o mount_and_boot.o screen.o strrchr.o pause.o
40+
$(CC) --verbose -O2 --dragon -o configx.bin $(HIRESLIB) check_wifi.o connect_wifi.o destination_host_slot.o hosts_and_devices.o main.o perform_copy.o select_file.o select_slot.o set_wifi.o show_info.o bar.o die.o input.o io.o mount_and_boot.o screen.o strrchr.o pause.o
41+
# --org=2601 --limit=7800
42+
# $(CP) configx.bin AUTOLOAD.DWL
43+
# $(CP) AUTOLOAD.DWL ../original/data/BUILD_COCO/AUTOLOAD.DWL
44+
# $(CP) AUTOLOAD.DWL ../original/data/webui/device_specific/BUILD_COCO/AUTOLOAD.DWL
45+
46+
pause.o: src/coco/pause.c
47+
$(CC) $(CFLAGS) src/coco/pause.c
48+
49+
strrchr.o: src/coco/strrchr.c
50+
$(CC) $(CFLAGS) src/coco/strrchr.c
51+
52+
check_wifi.o: src/check_wifi.c
53+
$(CC) $(CFLAGS) src/check_wifi.c
54+
55+
connect_wifi.o: src/connect_wifi.c
56+
$(CC) $(CFLAGS) src/connect_wifi.c
57+
58+
destination_host_slot.o: src/destination_host_slot.c
59+
$(CC) $(CFLAGS) src/destination_host_slot.c
60+
61+
hosts_and_devices.o: src/hosts_and_devices.c
62+
$(CC) $(CFLAGS) src/hosts_and_devices.c
63+
64+
main.o: src/main.c
65+
$(CC) $(CFLAGS) src/main.c
66+
67+
perform_copy.o: src/perform_copy.c
68+
$(CC) $(CFLAGS) src/perform_copy.c
69+
70+
select_file.o: src/select_file.c
71+
$(CC) $(CFLAGS) src/select_file.c
72+
73+
select_slot.o: src/select_slot.c
74+
$(CC) $(CFLAGS) src/select_slot.c
75+
76+
set_wifi.o: src/set_wifi.c
77+
$(CC) $(CFLAGS) src/set_wifi.c
78+
79+
show_info.o: src/show_info.c
80+
$(CC) $(CFLAGS) src/show_info.c
81+
82+
bar.o: src/coco/bar.c
83+
$(CC) $(CFLAGS) src/coco/bar.c
84+
85+
die.o: src/coco/die.c
86+
$(CC) $(CFLAGS) src/coco/die.c
87+
88+
input.o: src/coco/input.c
89+
$(CC) $(CFLAGS) src/coco/input.c
90+
91+
io.o: src/coco/io.c
92+
$(CC) $(CFLAGS) src/coco/io.c
93+
94+
mount_and_boot.o: src/coco/mount_and_boot.c
95+
$(CC) $(CFLAGS) src/coco/mount_and_boot.c
96+
97+
screen.o: src/coco/screen.c
98+
$(CC) $(CFLAGS) src/coco/screen.c
99+
100+
clean:
101+
$(RM) *.o
102+
$(RM) coco/*.o
103+
$(RM) config.bin
104+
$(RM) autorund.vdk
105+
$(RM) AUTOLOAD.DWL
106+
107+

src/coco/io.c

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ byte response[256];
2323
int _dirpos=0;
2424
byte orig_casflag;
2525

26+
#ifndef DRAGON
27+
#define DWWRT_VEC 0xD941
28+
#define DWREAD_VEC 0xD93F
29+
#else
30+
#define DWWRT_VEC 0xFA00
31+
#define DWREAD_VEC 0xF9FE
32+
#endif
33+
34+
2635
/**
2736
* @brief Read string to s from DriveWire with expected length l
2837
* @param s pointer to string buffer
@@ -33,10 +42,11 @@ byte dwread(byte *s, int l)
3342
{
3443
asm
3544
{
45+
orcc #$50
3646
pshs x,y
3747
ldx :s
3848
ldy :l
39-
jsr [0xD93F]
49+
jsr [DWREAD_VEC]
4050
puls y,x
4151
tfr cc,b
4252
lsrb
@@ -55,12 +65,13 @@ int dwwrite(byte *s, int l)
5565
{
5666
asm
5767
{
68+
orcc #$50
5869
pshs x,y
5970
ldx :s
60-
ldy :l
61-
jsr [0xD941]
62-
tfr cc,d
63-
puls y,x
71+
ldy :l
72+
jsr [DWWRT_VEC]
73+
tfr cc,d
74+
puls y,x
6475
}
6576
}
6677

@@ -174,7 +185,7 @@ unsigned char io_get_wifi_status(void)
174185

175186
io_ready();
176187
io_get_response(&r, 1);
177-
188+
178189
return r;
179190
}
180191

@@ -458,6 +469,10 @@ void io_mount_disk_image(unsigned char ds, unsigned char mode)
458469
dwwrite((byte *)"\xE2\xF8",2);
459470
dwwrite((byte *)&ds,1);
460471
dwwrite((byte *)&mode,1);
472+
473+
#ifdef DRAGON
474+
475+
#endif
461476
}
462477

463478
void io_umount_disk_image(unsigned char ds)

src/coco/pause.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@
99

1010
void pause(unsigned char delay)
1111
{
12-
sleep(delay/60);
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
19+
ora #1
20+
sta $FF03 // enable 60 Hz interrupt
21+
22+
// Unmask interrupts to allow the timer IRQ to be processed.
23+
andcc #$AF
24+
}
25+
#endif
26+
sleep(delay/20);
1327
}
1428

1529
#endif /* _CMOC_VERSION */

src/connect_wifi.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ extern bool screen_should_be_cleared;
7979

8080
void connect_wifi(void)
8181
{
82+
#ifndef _CMOC_VERSION_
8283
unsigned char retries = 20;
84+
#else
85+
unsigned char retries = 2;
86+
#endif
8387
NetConfig nc;
8488
unsigned char s, key;
8589

@@ -95,14 +99,24 @@ void connect_wifi(void)
9599
#ifndef _CMOC_VERSION_
96100
// check for esc key and abort
97101
if (input() == KEY_ABORT)
102+
#else
103+
unsigned char c = inkey();
104+
if (c!=0)
105+
{
106+
char szMsg[32];
107+
sprintf(szMsg, "c = %02x\n", c);
108+
screen_error(szMsg);
109+
pause(150);
110+
}
111+
if (c==' ' || c==0x3)
112+
#endif /* _CMOC_VERSION_ */
98113
{
99114
screen_error("CONNECTION ABORTED");
100115
pause(150);
101-
state=SET_WIFI;
116+
state=HOSTS_AND_DEVICES;
102117
return;
103118
}
104-
#endif /* _CMOC_VERSION_ */
105-
119+
106120
s = io_get_wifi_status();
107121

108122
switch (s)
@@ -120,13 +134,23 @@ void connect_wifi(void)
120134
pause(60);
121135
return;
122136
case 4:
123-
screen_error("CONNECT FAILED");
124-
pause(150);
137+
screen_error("CONNECT FAILED1");
138+
//pause(150);
139+
// ws_subState = WS_SCAN;
140+
state = HOSTS_AND_DEVICES;
125141
return;
126142
case 5:
127143
screen_error("CONNECTION LOST");
128144
pause(150);
129145
return;
146+
#ifdef _CMOC_VERSION_
147+
case 6:
148+
//screen_error("CONNECT FAILED");
149+
screen_error("BAD PSK");
150+
pause(150);
151+
state = HOSTS_AND_DEVICES;
152+
return;
153+
#endif
130154
default:
131155
screen_error("PLEASE WAIT...");
132156
pause(150);

src/hosts_and_devices.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,9 @@ void hosts_and_devices_done(void)
359359
io_mount_disk_image(i, deviceSlots[i].mode);
360360
}
361361
}
362-
362+
#ifdef DRAGON
363+
printf("DON'T FORGET TO MAP DISKS\n I.E. \"LINK 1,5\"");
364+
#endif
363365
state = DONE;
364366
}
365367

0 commit comments

Comments
 (0)