mirror of
https://github.com/simh/simh.git
synced 2026-04-30 13:31:36 +00:00
AltairZ80: Resolve warnings in Flashwriter and Disk3.
This commit is contained in:
committed by
Mark Pizzolato
parent
41665e504d
commit
6be83be27b
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user