Skip to content

Commit 1d730cc

Browse files
committed
[apple2] 3.0.1 release - Support for CONFIG fuji functions
1 parent 7c34b3b commit 1d730cc

12 files changed

+56
-30
lines changed

Changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
## [Unreleased]
44

5+
## [3.0.1] - 2024-03-19
6+
7+
Complete Apple2 fuji device support for CONFIG.
8+
9+
- [apple2] fixes for mount_host_slot and mount_disk_image
10+
- [apple2] don't call FN for get_device_enabled_status, as it's broken
11+
- [apple2] add fuji_disable_device and fuji_enable_device implementations
12+
- [apple2] fix control commands that were not setting the payload parameters
13+
- [apple2] fix fuji_set_device_filename payload length
14+
515
## [3.0.0] - 2024-03-18
616

717
- The great rename fn_io_ to fuji_ to reflect device in FN being used, version bump to 3.0.0 to reflect huge name changes

apple2/src/fn_fuji/fuji_close_directory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ bool fuji_close_directory(void)
99
return false;
1010
}
1111

12+
sp_payload[0] = 0x00;
13+
sp_payload[1] = 0x00;
14+
1215
sp_error = sp_control(sp_fuji_id, 0xF5);
1316
return sp_error == 0;
1417
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#include <stdint.h>
22
#include "fujinet-fuji.h"
3+
#include "fujinet-bus-apple2.h"
34

45
bool fuji_disable_device(uint8_t d)
56
{
6-
// not supported on apple2
7-
return false;
7+
sp_error = sp_get_fuji_id();
8+
if (sp_error <= 0) {
9+
return false;
10+
}
11+
12+
sp_payload[0] = 1;
13+
sp_payload[1] = 0;
14+
sp_payload[2] = d;
15+
16+
sp_error = sp_control(sp_fuji_id, 0xD4);
17+
return sp_error == 0;
818
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#include <stdint.h>
22
#include "fujinet-fuji.h"
3+
#include "fujinet-bus-apple2.h"
34

45
bool fuji_enable_device(uint8_t d)
56
{
6-
// not supported on apple2
7-
return false;
7+
sp_error = sp_get_fuji_id();
8+
if (sp_error <= 0) {
9+
return false;
10+
}
11+
12+
sp_payload[0] = 1;
13+
sp_payload[1] = 0;
14+
sp_payload[2] = d;
15+
16+
sp_error = sp_control(sp_fuji_id, 0xD5);
17+
return sp_error == 0;
818
}

apple2/src/fn_fuji/fuji_get_device_enabled_status.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,9 @@
22
#include "fujinet-fuji.h"
33
#include "fujinet-bus-apple2.h"
44

5-
// Stupidly complex, the FN ALWAYS returns "1" for IWM, and ignores the device id.
6-
// However, if it is implemented on FN, this will not need changing.
5+
// TODO: sort this out! To get status, we need a code for
6+
// every different device as there's no payload to specify which device.
77
bool fuji_get_device_enabled_status(uint8_t d)
88
{
9-
int8_t err = 0;
10-
err = sp_get_fuji_id();
11-
if (err <= 0) {
12-
return false;
13-
}
14-
15-
// Number of bytes in payload
16-
sp_payload[0] = 1;
17-
sp_payload[1] = 0;
18-
19-
// Actual payload
20-
sp_payload[2] = d;
21-
22-
// Call FN
23-
sp_error = sp_control(sp_fuji_id, 0xD1);
24-
if (sp_error == 0) {
25-
return sp_payload[0] != 0;
26-
}
27-
return false;
9+
return true;
2810
}

apple2/src/fn_fuji/fuji_mount_all.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ bool fuji_mount_all(void)
99
return false;
1010
}
1111

12+
sp_payload[0] = 0x00;
13+
sp_payload[1] = 0x00;
14+
1215
sp_error = sp_control(sp_fuji_id, 0xD7);
1316
return sp_error == 0;
1417
}

apple2/src/fn_fuji/fuji_mount_disk_image.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ bool fuji_mount_disk_image(uint8_t ds, uint8_t mode)
99
return false;
1010
}
1111

12+
sp_payload[0] = 2;
13+
sp_payload[1] = 0;
14+
sp_payload[2] = ds;
15+
sp_payload[3] = mode;
16+
1217
sp_error = sp_control(sp_fuji_id, 0xF8);
1318
return sp_error == 0;
1419
}

apple2/src/fn_fuji/fuji_mount_host_slot.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ bool fuji_mount_host_slot(uint8_t hs)
99
return false;
1010
}
1111

12+
sp_payload[0] = 1;
13+
sp_payload[1] = 0;
14+
sp_payload[2] = hs;
15+
1216
sp_error = sp_control(sp_fuji_id, 0xF9);
1317
return sp_error == 0;
1418
}

apple2/src/fn_fuji/fuji_open_directory.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ bool fuji_open_directory(uint8_t hs, char *path_filter)
1010
return false;
1111
}
1212

13-
// Number of bytes in payload
1413
// we don't care about the length of the path/filter, it's max is 255 (256 - 1 for hs)
1514
// The FN will split the string on null bytes anyway, so no need to worry about
1615
// it on the host side too much.
1716
sp_payload[0] = 0;
1817
sp_payload[1] = 1;
19-
// Actual payload
18+
2019
sp_payload[2] = hs;
2120
memcpy(&sp_payload[3], path_filter, 255);
2221

apple2/src/fn_fuji/fuji_read_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ bool fuji_read_directory(uint8_t maxlen, uint8_t aux2, char *buffer)
2222

2323
sp_error = sp_status(sp_fuji_id, 0xF6);
2424
if (sp_error == 0) {
25-
strcpy(buffer, sp_payload);
25+
memcpy(buffer, &sp_payload[0], maxlen);
2626
}
2727
return sp_error == 0;
2828

0 commit comments

Comments
 (0)