Skip to content

Commit ce0afa2

Browse files
committed
[apple2] small refactor to sp_init [4.1.3]
1 parent 68a1393 commit ce0afa2

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

Changelog.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
## [Unreleased]
44

5-
## [4.2.0] - 2024-XX-YY
6-
75
- Implement commodore fujinet-lib functions
8-
96
- Add fuji_open_directory2 prototype for applications to send path and
107
filter separately rather than in fixed 256 byte buffer with \0 delimiter. Used by CBM.
118

9+
## [4.1.3] - 2024-06-03
10+
11+
- Fix sp_init to find any SP device with network device, skipping past any higher cards if they don't have it
12+
1213
## [4.1.2] - 2024-05-20
1314

1415
Bugfix:

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# - recursive dirs for src
44
# - final files go into build/ directory instead of root folder (e.g. lbl, com file etc)
55

6-
#TARGETS := atari apple2 apple2enh c64
7-
TARGETS := c64
6+
TARGETS := atari apple2 apple2enh c64
87
PROGRAM := fujinet.lib
98
LIBS :=
109
CONFIG :=

apple2/src/bus/sp_init.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ uint8_t sp_init() {
1414
uint8_t i;
1515
bool match;
1616
uint8_t offset;
17-
uint8_t fn_device;
18-
uint16_t tmp_addr;
17+
uint16_t dispatch_address;
1918

19+
// reset any previous values, we are going to rescan.
2020
sp_network = 0;
21+
sp_is_init = 0;
2122

2223
for (base = 0xC700; base >= 0xC100; base -= 0x0100) {
2324
match = true;
@@ -31,25 +32,20 @@ uint8_t sp_init() {
3132
if (match) {
3233
// If a match is found, calculate the dispatch function address
3334
offset = read_memory(base + 0xFF);
34-
tmp_addr = base + offset + 3;
35-
sp_dispatch_fn[0] = tmp_addr & 0xFF;
36-
sp_dispatch_fn[1] = (tmp_addr >> 8) & 0xFF;
37-
38-
// now find and return the network id.
39-
sp_is_init = 1;
40-
41-
fn_device = sp_get_network_id();
42-
if (fn_device != 0) {
43-
return fn_device;
44-
}
45-
else {
46-
sp_is_init = 0;
35+
dispatch_address = base + offset + 3;
36+
sp_dispatch_fn[0] = dispatch_address & 0xFF;
37+
sp_dispatch_fn[1] = dispatch_address >> 8;
38+
39+
// now find and return the network id. it's stored in sp_network after calling sp_get_network_id
40+
sp_get_network_id();
41+
if (sp_network != 0) {
42+
sp_is_init = 1;
43+
return sp_network;
4744
}
4845
}
4946
}
5047

5148
// If no match is found, ensure dispatch function is cleared then return 0 for network not found.
52-
sp_is_init = 0;
5349
sp_dispatch_fn[0] = 0;
5450
sp_dispatch_fn[1] = 0;
5551
return 0;

commodore/src/fn_fuji/fuji_unmount_host_slot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <stdbool.h>
22
#include <stdint.h>
33
#include "fujinet-fuji.h"
4+
#include "fujinet-fuji-cbm.h"
45

56
bool fuji_unmount_host_slot(uint8_t hs)
67
{

version.txt

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

0 commit comments

Comments
 (0)