Skip to content

Commit b26ac14

Browse files
committed
[apple2] fujiCommandID_t with do_inquiry
1 parent 9ec9ec7 commit b26ac14

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

lib/device/iwm/iwmFuji.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ void iwmFuji::iwm_stat_read_device_slots()
11011101
int returnsize;
11021102

11031103
// Load the data from our current device array
1104-
for (int i = 0; i < MAX_DISK_DEVICES; i++)
1104+
for (int i = 0; i < MAX_A2DISK_DEVICES; i++)
11051105
{
11061106
diskSlots[i].mode = _fnDisks[i].access_mode;
11071107
diskSlots[i].hostSlot = _fnDisks[i].host_slot;
@@ -1199,7 +1199,7 @@ void iwmFuji::_populate_config_from_slots()
11991199
}
12001200
}
12011201

1202-
for (int i = 0; i < MAX_DISK_DEVICES; i++)
1202+
for (int i = 0; i < MAX_A2DISK_DEVICES; i++)
12031203
{
12041204
if (_fnDisks[i].host_slot >= MAX_HOSTS || _fnDisks[i].filename[0] == '\0')
12051205
Config.clear_mount(i);

lib/device/iwm/network.cpp

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void iwmNetwork::iwmnet_special_inquiry()
359359
{
360360
}
361361

362-
void iwmNetwork::do_inquiry(unsigned char inq_cmd)
362+
void iwmNetwork::do_inquiry(fujiCommandID_t inq_cmd)
363363
{
364364
auto& current_network_data = network_data_map[current_network_unit];
365365
// Reset inq_dstats
@@ -770,7 +770,7 @@ void iwmNetwork::iwm_ctrl(iwm_decoded_cmd_t cmd)
770770
{
771771
uint8_t err_result = SP_ERR_NOERROR;
772772

773-
uint8_t control_code = get_status_code(cmd);
773+
fujiCommandID_t control_code = (fujiCommandID_t) get_status_code(cmd);
774774

775775
// fujinet-lib (with unit-id support) sends the count of bytes for a control as 4 to cater for the network unit.
776776
// Older code sends 3 as the count, so we can detect if the network unit byte is there or not.
@@ -792,43 +792,43 @@ void iwmNetwork::iwm_ctrl(iwm_decoded_cmd_t cmd)
792792

793793
// Debug_printv("cmd (looking for network_unit in byte 6, i.e. hex[5]):\r\n%s\r\n", mstr::toHex(cmd.decoded, 9).c_str());
794794

795-
if (control_code != 'O' && current_network_data.json == nullptr) {
795+
if (control_code != FUJICMD_OPEN && current_network_data.json == nullptr) {
796796
Debug_printv("control should not be called on a non-open channel - FN was probably reset");
797797
}
798798

799799
switch (control_code)
800800
{
801-
case ' ':
801+
case FUJICMD_RENAME:
802802
rename();
803803
break;
804-
case '!':
804+
case FUJICMD_DELETE:
805805
del();
806806
break;
807-
case '*':
807+
case FUJICMD_MKDIR:
808808
mkdir();
809809
break;
810-
case ',':
810+
case FUJICMD_CHDIR:
811811
set_prefix();
812812
break;
813-
case '0':
813+
case FUJICMD_GETCWD:
814814
get_prefix();
815815
break;
816-
case 'O':
816+
case FUJICMD_OPEN:
817817
open();
818818
break;
819-
case 'C':
819+
case FUJICMD_CLOSE:
820820
close();
821821
break;
822-
case 'W':
822+
case FUJICMD_WRITE:
823823
net_write();
824824
break;
825-
case 0xFC:
825+
case FUJICMD_JSON:
826826
channel_mode();
827827
break;
828-
case 0xFD: // login
828+
case FUJICMD_USERNAME: // login
829829
set_login();
830830
break;
831-
case 0xFE: // password
831+
case FUJICMD_PASSWORD: // password
832832
set_password();
833833
break;
834834
default:
@@ -856,12 +856,14 @@ void iwmNetwork::iwm_ctrl(iwm_decoded_cmd_t cmd)
856856
} else {
857857
switch (control_code)
858858
{
859-
case 'P':
859+
case FUJICMD_PARSE:
860860
json_parse();
861861
break;
862-
case 'Q':
862+
case FUJICMD_QUERY:
863863
json_query(cmd);
864864
break;
865+
default:
866+
break;
865867
}
866868
}
867869
break;

lib/device/iwm/network.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class iwmNetwork : public iwmDevice
392392
* @brief Perform the inquiry, handle both local and protocol commands.
393393
* @param inq_cmd the command to check against.
394394
*/
395-
void do_inquiry(unsigned char inq_cmd);
395+
void do_inquiry(fujiCommandID_t inq_cmd);
396396

397397
/**
398398
* @brief set translation specified by aux1 to aux2_translation mode.

lib/runcpm/abstraction_fujinet_apple2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ uint8_t bdos_readDeviceSlots(uint16_t addr)
624624
disk_slot diskSlots[MAX_DISK_DEVICES];
625625

626626
// Load the data from our current device array
627-
for (int i = 0; i < MAX_DISK_DEVICES; i++)
627+
for (int i = 0; i < MAX_A2DISK_DEVICES; i++)
628628
{
629629
diskSlots[i].mode = theFuji->get_disk(i)->access_mode;
630630
diskSlots[i].hostSlot = theFuji->get_disk(i)->host_slot;

0 commit comments

Comments
 (0)