AltairZ80: Resolve warnings in Flashwriter and Disk3.
This commit is contained in:
parent
94d0e78a2e
commit
0521722525
2 changed files with 21 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2007-2022 Howard M. Harte. *
|
* Copyright (c) 2007-2023 Howard M. Harte. *
|
||||||
* https://github.com/hharte *
|
* https://github.com/hharte *
|
||||||
* *
|
* *
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining *
|
* Permission is hereby granted, free of charge, to any person obtaining *
|
||||||
|
@ -138,6 +138,11 @@ static t_stat fw2_attach(UNIT *uptr, CONST char *cptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
fw2_info[i] = (FW2_INFO *)calloc(1, sizeof(FW2_INFO));
|
fw2_info[i] = (FW2_INFO *)calloc(1, sizeof(FW2_INFO));
|
||||||
|
|
||||||
|
if (fw2_info[i] == NULL) {
|
||||||
|
return SCPE_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
fw2_info[i]->uptr = uptr;
|
fw2_info[i]->uptr = uptr;
|
||||||
fw2_info[i]->uptr->u3 = baseaddr;
|
fw2_info[i]->uptr->u3 = baseaddr;
|
||||||
|
|
||||||
|
@ -200,7 +205,9 @@ static t_stat fw2_detach(UNIT *uptr)
|
||||||
static t_stat get_base_address(const char *cptr, uint32 *baseaddr)
|
static t_stat get_base_address(const char *cptr, uint32 *baseaddr)
|
||||||
{
|
{
|
||||||
uint32 b;
|
uint32 b;
|
||||||
sscanf(cptr, "%x", &b);
|
|
||||||
|
if (sscanf(cptr, "%x", &b) != 1) return SCPE_ARG;
|
||||||
|
|
||||||
if(b & (FW2_CAPACITY-1)) {
|
if(b & (FW2_CAPACITY-1)) {
|
||||||
sim_printf("FWII must be on a %d-byte boundary.\n", FW2_CAPACITY);
|
sim_printf("FWII must be on a %d-byte boundary.\n", FW2_CAPACITY);
|
||||||
return SCPE_ARG;
|
return SCPE_ARG;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* *
|
* *
|
||||||
* Copyright (c) 2007-2022 Howard M. Harte. *
|
* Copyright (c) 2007-2023 Howard M. Harte. *
|
||||||
* https://github.com/hharte *
|
* https://github.com/hharte *
|
||||||
* *
|
* *
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining *
|
* Permission is hereby granted, free of charge, to any person obtaining *
|
||||||
|
@ -537,6 +537,11 @@ static uint8 DISK3_Write(const uint32 Addr, uint8 cData)
|
||||||
|
|
||||||
dataBuffer = (uint8 *)malloc(xfr_len);
|
dataBuffer = (uint8 *)malloc(xfr_len);
|
||||||
|
|
||||||
|
if (dataBuffer == NULL) {
|
||||||
|
sim_printf("%s: memory allocation failure.\n", sim_uname(pDrive->uptr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
||||||
|
|
||||||
if(disk3_info->iopb[DISK3_IOPB_ARG1] == 1) { /* Read */
|
if(disk3_info->iopb[DISK3_IOPB_ARG1] == 1) { /* Read */
|
||||||
|
@ -615,6 +620,12 @@ static uint8 DISK3_Write(const uint32 Addr, uint8 cData)
|
||||||
file_offset += (disk3_info->iopb[DISK3_IOPB_ARG3] * data_len);
|
file_offset += (disk3_info->iopb[DISK3_IOPB_ARG3] * data_len);
|
||||||
|
|
||||||
fmtBuffer = (uint8 *)malloc(data_len);
|
fmtBuffer = (uint8 *)malloc(data_len);
|
||||||
|
|
||||||
|
if (fmtBuffer == NULL) {
|
||||||
|
sim_printf("%s: memory allocation failure.\n", sim_uname(pDrive->uptr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
memset(fmtBuffer, disk3_info->iopb[DISK3_IOPB_ARG2], data_len);
|
memset(fmtBuffer, disk3_info->iopb[DISK3_IOPB_ARG2], data_len);
|
||||||
|
|
||||||
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
if(sim_fseek((pDrive->uptr)->fileref, file_offset, SEEK_SET) == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue