Skip to content

Commit 3f1ead7

Browse files
committed
Refactored Atari code to move common code into fn_fuji and reduce duplication in tests
1 parent 8d4884a commit 3f1ead7

File tree

81 files changed

+234
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+234
-267
lines changed

apple2/src/fn_network/network_http_set_channel_mode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <stdint.h>
2-
#include "../../fujinet-network.h"
2+
#include "fujinet-network.h"
33

44
uint8_t network_http_set_channel_mode(char *devicespec, uint8_t mode) {
55
return network_ioctl('M', 0, mode, devicespec, 1, 0, 2);

atari/src/fn_fuji/copy_cmd_data.s

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
.export copy_cmd_data
1+
.export copy_nw_cmd_data
2+
.export copy_io_cmd_data
23

34
.include "device.inc"
45
.include "macros.inc"
56
.include "zp.inc"
67

78
; INTERNAL COPY ROUTINE
8-
; void copy_cmd_data(void *cmd_table)
9+
; void copy_nw_cmd_data(void *cmd_table)
910
;
1011
; Sets DCB data from given table address
1112
; Trashes tmp9/10 as only ZP location
12-
.proc copy_cmd_data
13+
copy_nw_cmd_data:
1314
; the table of dcb bytes to insert
1415
axinto tmp9
1516

1617
mva #$71, IO_DCB::ddevic
18+
bne common
1719

20+
copy_io_cmd_data:
21+
; the table of dcb bytes to insert
22+
axinto tmp9
23+
24+
; first 2 bytes always $70, $01, so we can do those manually. saves table space, and loops
25+
mva #$70, IO_DCB::ddevic
26+
mva #$01, IO_DCB::dunit
27+
28+
common:
1829
; these 2 are always set by the command, no use having them in the table
1930
mva #$00, IO_DCB::dbuflo
2031
sta IO_DCB::dbufhi
@@ -31,7 +42,7 @@ l1:
3142
bpl l1
3243

3344
rts
34-
.endproc
45+
3546

3647
.rodata
3748
; which DCB entries to write to, indexed from DDEVIC

atari/src/fn_io/fn_io_appkey_open_read.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
.export _fn_io_appkey_open
22
.export _fn_io_appkey_read
33

4-
.import _fn_io_do_bus
4+
.import _bus
55
.import _fn_io_error
6-
.import fn_io_copy_cmd_data
6+
.import copy_io_cmd_data
77
.import popa, popax
88

99
.include "zp.inc"
@@ -18,11 +18,11 @@ _fn_io_appkey_open:
1818
setax #t_fn_io_open_appkey
1919

2020
ak_common:
21-
jsr fn_io_copy_cmd_data
21+
jsr copy_io_cmd_data
2222

2323
mwa tmp7, IO_DCB::dbuflo
2424

25-
jsr _fn_io_do_bus
25+
jsr _bus
2626
jmp _fn_io_error
2727

2828

atari/src/fn_io/fn_io_appkey_write.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.export _fn_io_appkey_write
22

3-
.import _fn_io_do_bus
3+
.import _bus
44
.import _fn_io_error
5-
.import fn_io_copy_cmd_data
5+
.import copy_io_cmd_data
66
.import popa, popax
77

88
.include "zp.inc"
@@ -16,14 +16,14 @@
1616
axinto tmp7 ; save buffer address
1717

1818
setax #t_fn_io_write_appkey
19-
jsr fn_io_copy_cmd_data
19+
jsr copy_io_cmd_data
2020

2121
mwa tmp7, IO_DCB::dbuflo
2222
jsr popax ; count of bytes to store in key file from buffer.
2323
sta IO_DCB::daux1
2424
stx IO_DCB::daux2
2525

26-
jsr _fn_io_do_bus
26+
jsr _bus
2727
jmp _fn_io_error
2828
.endproc
2929

atari/src/fn_io/fn_io_base64_xxcode_compute.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.export _fn_io_base64_decode_compute
22
.export _fn_io_base64_encode_compute
33

4-
.import fn_io_copy_cmd_data
5-
.import _fn_io_do_bus
4+
.import copy_io_cmd_data
5+
.import _bus
66
.import _fn_io_error
77
.import popa, popax
88

@@ -16,9 +16,9 @@ _fn_io_base64_decode_compute:
1616
setax #t_fn_io_base64_decode_compute
1717

1818
c_common:
19-
jsr fn_io_copy_cmd_data
19+
jsr copy_io_cmd_data
2020
mva #$03, IO_DCB::dtimlo
21-
jsr _fn_io_do_bus
21+
jsr _bus
2222
jmp _fn_io_error
2323

2424
; uint8_t fn_io_base64_encode_compute();

atari/src/fn_io/fn_io_base64_xxcode_io.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
.export _fn_io_base64_encode_input
44
.export _fn_io_base64_encode_output
55

6-
.import _fn_io_do_bus
7-
.import fn_io_copy_cmd_data
6+
.import _bus
7+
.import copy_io_cmd_data
88
.import io_common
99
.import popa, popax
1010

atari/src/fn_io/fn_io_base64_xxcode_length.s

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.export _fn_io_base64_decode_length
22
.export _fn_io_base64_encode_length
33

4-
.import fn_io_copy_cmd_data
5-
.import _fn_io_do_bus
4+
.import copy_io_cmd_data
5+
.import _bus
66
.import _fn_io_error
77
.import popa, popax
88

@@ -17,11 +17,11 @@ _fn_io_base64_decode_length:
1717
setax #t_fn_io_base64_decode_length
1818

1919
de_common:
20-
jsr fn_io_copy_cmd_data
20+
jsr copy_io_cmd_data
2121

2222
mwa tmp7, IO_DCB::dbuflo
2323
mva #$03, IO_DCB::dtimlo
24-
jsr _fn_io_do_bus
24+
jsr _bus
2525
jmp _fn_io_error
2626

2727
; uint8_t fn_io_base64_encode_length(unsigned long *len);

atari/src/fn_io/fn_io_bus.s

Lines changed: 0 additions & 11 deletions
This file was deleted.

atari/src/fn_io/fn_io_close_directory.s

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
.export _fn_io_close_directory
22

3+
.import _bus
4+
.import copy_io_cmd_data
5+
36
.include "macros.inc"
4-
.import _fn_io_bus
57

68
; void fn_io_close_directory(void)
79
.proc _fn_io_close_directory
810
setax #t_io_close_directory
9-
jmp _fn_io_bus
11+
jsr copy_io_cmd_data
12+
jmp _bus
1013
.endproc
1114

1215
.rodata

atari/src/fn_io/fn_io_copy_cmd_data.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
.export fn_io_copy_cmd_data
1+
.export copy_io_cmd_data
22

33
.include "zp.inc"
44
.include "macros.inc"
55
.include "device.inc"
66

77
; INTERNAL COPY ROUTINE
8-
; void fn_io_copy_cmd_data(void *cmd_table)
8+
; void copy_io_cmd_data(void *cmd_table)
99
;
1010
; Sets DCB data from given table address
1111
; Trashes tmp9/10 as only ZP location
12-
.proc fn_io_copy_cmd_data
12+
.proc copy_io_cmd_data
1313
; the table of dcb bytes to insert
1414
axinto tmp9
1515

0 commit comments

Comments
 (0)