Skip to content

Commit cdd7287

Browse files
committed
[4.1.4] Another sp_init patch after I bodged the last one.
1 parent ce0afa2 commit cdd7287

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
- Add fuji_open_directory2 prototype for applications to send path and
77
filter separately rather than in fixed 256 byte buffer with \0 delimiter. Used by CBM.
88

9+
## [4.1.4] - 2024-06-05
10+
11+
- Fix sp_init again! Thanks again to @shunkita for noticing I'd broken their update.
12+
913
## [4.1.3] - 2024-06-03
1014

1115
- Fix sp_init to find any SP device with network device, skipping past any higher cards if they don't have it

apple2/src/bus/sp_init.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ uint8_t sp_init() {
1616
uint8_t offset;
1717
uint16_t dispatch_address;
1818

19-
// reset any previous values, we are going to rescan.
19+
// reset network id and is_init flag, we are going to rescan.
2020
sp_network = 0;
2121
sp_is_init = 0;
2222

@@ -36,16 +36,19 @@ uint8_t sp_init() {
3636
sp_dispatch_fn[0] = dispatch_address & 0xFF;
3737
sp_dispatch_fn[1] = dispatch_address >> 8;
3838

39-
// now find and return the network id. it's stored in sp_network after calling sp_get_network_id
39+
// now find and return the network id. it's stored in sp_network after calling sp_get_network_id.
40+
// we need to set sp_is_init to 1 to stop sp_get_network_id from calling init again and recursing.
41+
sp_is_init = 1;
4042
sp_get_network_id();
4143
if (sp_network != 0) {
42-
sp_is_init = 1;
4344
return sp_network;
4445
}
46+
// it failed to find a network on this SP device, so reset sp_is_init and reloop/exit
47+
sp_is_init = 0;
4548
}
4649
}
4750

48-
// If no match is found, ensure dispatch function is cleared then return 0 for network not found.
51+
// If no match is found, ensure dispatch function is cleared, sp_is_init is already 0, then return 0 for network not found.
4952
sp_dispatch_fn[0] = 0;
5053
sp_dispatch_fn[1] = 0;
5154
return 0;

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.1.3
1+
4.1.4

0 commit comments

Comments
 (0)