Skip to content

Commit c84920c

Browse files
committed
3.0.3 [apple2] fix bug in Y reg trashed by popax breaking apple2enh
1 parent bf6858b commit c84920c

File tree

7 files changed

+40
-32
lines changed

7 files changed

+40
-32
lines changed

Changelog.md

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

33
## [Unreleased]
44

5+
## [3.0.3] - 2024-04-02
6+
7+
Bugfix release:
8+
9+
- [apple2] fix network_status on apple2enh by setting y specifically
10+
- replaced BUILD_APPLE2 and BUILD_ATARI in favour of cc65 macros __APPLE2__ and __ATARI__
11+
512
## [3.0.2] - 2024-03-24
613

714
This should be considered the BASE 3 release.

apple2/src/fn_network/network_status.s

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,20 @@ have_network:
5656
jsr _sp_status
5757
pha ; save the error until we've dealt with the function args
5858

59-
ldy #$00
60-
6159
; process the device error
6260
lda _sp_payload+3
61+
ldy #$00
6362
sta (ptr4), y ; *err = sp_payload[3]
6463

6564
; process the connection status param
6665
popax ptr4
6766
lda _sp_payload+2
67+
ldy #$00 ; popax destroys y, so reset it
6868
sta (ptr4), y ; *c = sp_payload[2]
6969

7070
; process the bytes waiting (bw) param
7171
popax ptr4
72+
ldy #$00
7273
mway _sp_payload, {(ptr4), y}
7374

7475
; remove the devicespec parameter from stack, it isn't used

common/src/network_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "../../fujinet-network.h"
55

6-
#ifdef BUILD_APPLE2
6+
#ifdef __APPLE2__
77
#include "fujinet-bus-apple2.h"
88
#include "apple2/src/bus/inc/sp.h"
99
#endif
@@ -12,7 +12,7 @@ uint8_t network_init()
1212
{
1313
int8_t err = 0;
1414

15-
#ifdef BUILD_APPLE2
15+
#ifdef __APPLE2__
1616
err = sp_init();
1717
if (err == 0) {
1818
return FN_ERR_NO_DEVICE;

common/src/network_read.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
#include "fujinet-network.h"
66

7-
#ifdef BUILD_ATARI
7+
#ifdef __ATARI__
88
#include "fujinet-network-atari.h"
99
#include "fujinet-bus-atari.h"
1010
#endif
1111

12-
#ifdef BUILD_APPLE2
12+
#ifdef __APPLE2__
1313
#include "fujinet-network-apple2.h"
1414
#include "fujinet-bus-apple2.h"
1515
#include "apple2/src/bus/inc/sp.h"
@@ -27,20 +27,20 @@ int16_t network_read(char *devicespec, uint8_t *buf, uint16_t len)
2727
uint16_t fetch_size = 0;
2828
uint16_t amount_left = len;
2929
uint16_t total_read = 0;
30-
#ifdef BUILD_ATARI
30+
#ifdef __ATARI__
3131
uint8_t unit = 0;
3232
#endif
3333

3434
if (len == 0 || buf == NULL) {
35-
#ifdef BUILD_ATARI
35+
#ifdef __ATARI__
3636
return fn_error(132); // invalid command
3737
#endif
38-
#ifdef BUILD_APPLE2
38+
#ifdef __APPLE2__
3939
return fn_error(SP_ERR_BAD_CMD);
4040
#endif
4141
}
4242

43-
#ifdef BUILD_APPLE2
43+
#ifdef __APPLE2__
4444
// check we have the SP network value
4545
if (sp_network == 0) {
4646
return fn_error(SP_ERR_BAD_UNIT);
@@ -50,18 +50,18 @@ int16_t network_read(char *devicespec, uint8_t *buf, uint16_t len)
5050
fn_bytes_read = 0;
5151
fn_device_error = 0;
5252

53-
#ifdef BUILD_ATARI
53+
#ifdef __ATARI__
5454
unit = network_unit(devicespec);
5555
#endif
5656

5757
while (1) {
5858
// exit condition
5959
if (amount_left == 0) break;
6060

61-
#ifdef BUILD_ATARI
61+
#ifdef __ATARI__
6262
r = network_status_unit(unit, &fn_network_bw, &fn_network_conn, &fn_network_error);
6363
#endif
64-
#ifdef BUILD_APPLE2
64+
#ifdef __APPLE2__
6565
r = network_status_no_clr(devicespec, &fn_network_bw, &fn_network_conn, &fn_network_error);
6666
#endif
6767

@@ -79,16 +79,16 @@ int16_t network_read(char *devicespec, uint8_t *buf, uint16_t len)
7979

8080
fetch_size = MIN(amount_left, fn_network_bw);
8181

82-
#ifdef BUILD_APPLE2
82+
#ifdef __APPLE2__
8383
// need to validate this is only required for apple
8484
fetch_size = MIN(fetch_size, MAX_READ_SIZE);
8585
#endif
8686

87-
#ifdef BUILD_ATARI
87+
#ifdef __ATARI__
8888
sio_read(unit, buf, fetch_size);
8989
#endif
9090

91-
#ifdef BUILD_APPLE2
91+
#ifdef __APPLE2__
9292
sp_read(sp_network, fetch_size);
9393
memcpy(buf, sp_payload, fetch_size);
9494
#endif

common/src/network_read_nb.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
#include "fujinet-network.h"
77

8-
#ifdef BUILD_ATARI
8+
#ifdef __ATARI__
99
#include "fujinet-network-atari.h"
1010
#include "fujinet-bus-atari.h"
1111
#endif
1212

13-
#ifdef BUILD_APPLE2
13+
#ifdef __APPLE2__
1414
#include "fujinet-network-apple2.h"
1515
#include "fujinet-bus-apple2.h"
1616
#include "apple2/src/bus/inc/sp.h"
@@ -26,20 +26,20 @@ int16_t network_read_nb(char *devicespec, uint8_t *buf, uint16_t len)
2626
{
2727
uint8_t r = 0;
2828
uint16_t fetch_size = 0;
29-
#ifdef BUILD_ATARI
29+
#ifdef __ATARI__
3030
uint8_t unit = 0;
3131
#endif
3232

3333
if (len == 0 || buf == NULL) {
34-
#ifdef BUILD_ATARI
34+
#ifdef __ATARI__
3535
return -fn_error(132); // invalid command
3636
#endif
37-
#ifdef BUILD_APPLE2
37+
#ifdef __APPLE2__
3838
return -fn_error(SP_ERR_BAD_CMD);
3939
#endif
4040
}
4141

42-
#ifdef BUILD_APPLE2
42+
#ifdef __APPLE2__
4343
// check we have the SP network value
4444
if (sp_network == 0) {
4545
return -fn_error(SP_ERR_BAD_UNIT);
@@ -49,14 +49,14 @@ int16_t network_read_nb(char *devicespec, uint8_t *buf, uint16_t len)
4949
fn_bytes_read = 0;
5050
fn_device_error = 0;
5151

52-
#ifdef BUILD_ATARI
52+
#ifdef __ATARI__
5353
unit = network_unit(devicespec);
5454
#endif
5555

56-
#ifdef BUILD_ATARI
56+
#ifdef __ATARI__
5757
r = network_status_unit(unit, &fn_network_bw, &fn_network_conn, &fn_network_error);
5858
#endif
59-
#ifdef BUILD_APPLE2
59+
#ifdef __APPLE2__
6060
r = network_status_no_clr(devicespec, &fn_network_bw, &fn_network_conn, &fn_network_error);
6161
#endif
6262
// check if the status failed
@@ -72,16 +72,16 @@ int16_t network_read_nb(char *devicespec, uint8_t *buf, uint16_t len)
7272

7373
fetch_size = MIN(len, fn_network_bw);
7474

75-
#ifdef BUILD_APPLE2
75+
#ifdef __APPLE2__
7676
// need to validate this is only required for apple
7777
fetch_size = MIN(fetch_size, MAX_READ_SIZE);
7878
#endif
7979

80-
#ifdef BUILD_ATARI
80+
#ifdef __ATARI__
8181
sio_read(unit, buf, fetch_size);
8282
#endif
8383

84-
#ifdef BUILD_APPLE2
84+
#ifdef __APPLE2__
8585
sp_read(sp_network, fetch_size);
8686
memcpy(buf, sp_payload, fetch_size);
8787
#endif

fujinet-fuji.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ typedef struct {
7676

7777
// Disks have different structures / parameters
7878

79-
#ifdef BUILD_ATARI
79+
#ifdef __ATARI__
8080
typedef struct
8181
{
8282
uint16_t numSectors;
@@ -87,7 +87,7 @@ typedef struct
8787
} NewDisk;
8888
#endif
8989

90-
#ifdef BUILD_APPLE2
90+
#ifdef __APPLE2__
9191
typedef struct
9292
{
9393
uint8_t hostSlot;
@@ -328,7 +328,7 @@ bool fuji_set_device_filename(uint8_t mode, uint8_t hs, uint8_t ds, char *buffer
328328
*/
329329
bool fuji_set_directory_position(uint16_t pos);
330330

331-
#ifdef BUILD_ATARI
331+
#ifdef __ATARI__
332332
/*
333333
* Fetch the current HSIO index value.
334334
* @return success status of request

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.2
1+
3.0.3

0 commit comments

Comments
 (0)