From 8077d4de387c13ac5359383aef184d3738284fb6 Mon Sep 17 00:00:00 2001 From: Peter Schorn Date: Sun, 17 Jun 2018 08:37:08 +0200 Subject: [PATCH] AltairZ80: Clean up of source code formatting --- AltairZ80/altairz80_dsk.c | 6 +++--- AltairZ80/altairz80_hdsk.c | 4 ++-- AltairZ80/disasm.c | 12 +++++++---- AltairZ80/m68ksim.c | 24 +++++++++++----------- AltairZ80/m68ksim.h | 12 +++++------ AltairZ80/s100_fif.c | 12 +++++------ AltairZ80/s100_hdc1001.c | 42 +++++++++++++++++++------------------- AltairZ80/s100_mdsa.c | 4 ++-- AltairZ80/vfdhd.c | 2 +- 9 files changed, 61 insertions(+), 57 deletions(-) diff --git a/AltairZ80/altairz80_dsk.c b/AltairZ80/altairz80_dsk.c index 2045718d..2d9bda16 100644 --- a/AltairZ80/altairz80_dsk.c +++ b/AltairZ80/altairz80_dsk.c @@ -405,14 +405,14 @@ static t_stat dsk_attach(UNIT *uptr, CONST char *cptr) { const t_stat r = attach_unit(uptr, cptr); /* attach unit */ if (r != SCPE_OK) /* error? */ return r; - + assert(uptr != NULL); thisUnitIndex = find_unit_index(uptr); assert((0 <= thisUnitIndex) && (thisUnitIndex < NUM_OF_DSK)); - + /* If the file size is close to the mini-disk image size, set the number of tracks to 16, otherwise, 32 sectors per track. */ - + imageSize = sim_fsize(uptr -> fileref); sectors_per_track[thisUnitIndex] = (((MINI_DISK_SIZE - MINI_DISK_DELTA < imageSize) && (imageSize < MINI_DISK_SIZE + MINI_DISK_DELTA)) ? diff --git a/AltairZ80/altairz80_hdsk.c b/AltairZ80/altairz80_hdsk.c index f5681c92..1cce9c8a 100644 --- a/AltairZ80/altairz80_hdsk.c +++ b/AltairZ80/altairz80_hdsk.c @@ -194,7 +194,7 @@ static DPB dpb[] = { { "CPM68K", (1 << 24), (1<<17),0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, /* CP/M-68K HDSK */ - + { "EZ80FL", 131072, 32, 0x03, 0x07, 0x00, 127, 0x003E, 0xC0, 0x00, 0x0000, 0x0000, 0x02, 0x03, 0, 0, NULL }, /* 128K FLASH */ @@ -846,7 +846,7 @@ int32 hdsk_read(void) { hdskStatus = CPM_ERROR; return hdskStatus; } - + if (sim_fread(hdskbuf, 1, uptr -> HDSK_SECTOR_SIZE, uptr -> fileref) != (size_t)(uptr -> HDSK_SECTOR_SIZE)) { for (i = 0; i < uptr -> HDSK_SECTOR_SIZE; i++) hdskbuf[i] = CPM_EMPTY; diff --git a/AltairZ80/disasm.c b/AltairZ80/disasm.c index 47357624..261f21ea 100644 --- a/AltairZ80/disasm.c +++ b/AltairZ80/disasm.c @@ -1205,10 +1205,14 @@ long disasm (unsigned char *data, char *output, int segsize, long offset) case 0x64: segover = "fs"; break; case 0x65: segover = "gs"; break; } - } else if (*data == 0x66) - osize = 48 - segsize, data++; - else if (*data == 0x67) - asize = 48 - segsize, data++; + } else if (*data == 0x66) { + osize = 48 - segsize; + data++; + } + else if (*data == 0x67) { + asize = 48 - segsize; + data++; + } else break; } diff --git a/AltairZ80/m68ksim.c b/AltairZ80/m68ksim.c index 18e146da..88ff6f39 100644 --- a/AltairZ80/m68ksim.c +++ b/AltairZ80/m68ksim.c @@ -1,31 +1,31 @@ /* m68kcpmsim.c: CP/M for Motorola 68000 definitions - + Copyright (c) 2014, Peter Schorn - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL PETER SCHORN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + Except as contained in this notice, the name of Peter Schorn shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Peter Schorn. - + Based on work by David W. Schultz http://home.earthlink.net/~david.schultz (c) 2014 - + MC68000 simulation tailored to support CP/M-68K. It includes: 16MB of memory. (Flat, function codes and address space types ignored.) @@ -170,21 +170,21 @@ t_stat m68k_hdsk_boot(const int32 unitno, DEVICE *dptr, const uint32 verboseMessage, const int32 hdskNumber) { UNIT *uptr; size_t i; - + if ((unitno < 0) || (unitno >= hdskNumber)) return SCPE_ARG; - + uptr = (dptr -> units) + unitno; if (((uptr -> flags) & UNIT_ATT) == 0) { sim_debug(verboseMessage, dptr, "HDSK%d: Boot drive is not attached.\n", unitno); return SCPE_ARG; } - + if (sim_fseek(uptr -> fileref, 0, SEEK_SET) != 0) { sim_debug(verboseMessage, dptr, "HDSK%d: Boot error seeking start.\n", unitno); return SCPE_ARG; } - + i = sim_fread(&m68k_ram[M68K_BOOT_PC], 1, M68K_BOOT_LENGTH, uptr -> fileref); if (i != M68K_BOOT_LENGTH) { sim_debug(verboseMessage, dptr, @@ -192,7 +192,7 @@ t_stat m68k_hdsk_boot(const int32 unitno, DEVICE *dptr, unitno, M68K_BOOT_LENGTH); return SCPE_ARG; } - + // Now put in values for the stack and PC vectors WRITE_LONG(m68k_ram, 0, M68K_BOOT_SP); // SP WRITE_LONG(m68k_ram, 4, M68K_BOOT_PC); // PC diff --git a/AltairZ80/m68ksim.h b/AltairZ80/m68ksim.h index 63d2dc0a..060810b5 100644 --- a/AltairZ80/m68ksim.h +++ b/AltairZ80/m68ksim.h @@ -1,28 +1,28 @@ /* m68kcpmsim.h: CP/M for Motorola 68000 definitions - + Copyright (c) 2014, Peter Schorn - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL PETER SCHORN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + Except as contained in this notice, the name of Peter Schorn shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from Peter Schorn. - + Based on work by David W. Schultz http://home.earthlink.net/~david.schultz (c) 2014 */ diff --git a/AltairZ80/s100_fif.c b/AltairZ80/s100_fif.c index 8299ff66..b9c87614 100644 --- a/AltairZ80/s100_fif.c +++ b/AltairZ80/s100_fif.c @@ -262,7 +262,7 @@ static int DoDiskOperation(desc_t *dsc, uint8 val) case READ_SEC: addr = (dsc->track * SPT) + dsc->sector - 1; if (sim_fseek(cpx, addr * SEC_SZ, SEEK_SET) == 0) { - rtn = sim_fread(blanksec, 1, SEC_SZ, cpx); + rtn = sim_fread(blanksec, 1, SEC_SZ, cpx); if ((rtn != SEC_SZ) && (current_disk_flags & UNIT_DSK_VERBOSE) && (warnAttached[current_disk] < warnLevelDSK)) { warnAttached[current_disk]++; @@ -284,11 +284,11 @@ static int DoDiskOperation(desc_t *dsc, uint8 val) case WRITE_SEC: addr = (dsc->track * SPT) + dsc->sector - 1; if (sim_fseek(cpx, addr * SEC_SZ, SEEK_SET) == 0) { - addr = dsc->addr_l + (dsc->addr_h << 8); /* no assumption on endianness */ - for (kt = 0; kt < SEC_SZ; kt++) { - blanksec[kt] = GetBYTEWrapper(addr++); - } - sim_fwrite(blanksec, 1, SEC_SZ, cpx); + addr = dsc->addr_l + (dsc->addr_h << 8); /* no assumption on endianness */ + for (kt = 0; kt < SEC_SZ; kt++) { + blanksec[kt] = GetBYTEWrapper(addr++); + } + sim_fwrite(blanksec, 1, SEC_SZ, cpx); } else { if ((current_disk_flags & UNIT_DSK_VERBOSE) && (warnAttached[current_disk] < warnLevelDSK)) { diff --git a/AltairZ80/s100_hdc1001.c b/AltairZ80/s100_hdc1001.c index d9432df5..37bc5a62 100644 --- a/AltairZ80/s100_hdc1001.c +++ b/AltairZ80/s100_hdc1001.c @@ -306,41 +306,41 @@ static int32 hdc1001dev(const int32 port, const int32 io, const int32 data) #define HDC1001_OP_HEAD 0x02 #define HDC1001_OP_SECTOR 0x03 -#define HDC1001_CMD_NULL 0x00 -#define HDC1001_CMD_READ_DATA 0x01 -#define HDC1001_CMD_WRITE_DATA 0x02 -#define HDC1001_CMD_WRITE_HEADER 0x03 -#define HDC1001_CMD_READ_HEADER 0x04 +#define HDC1001_CMD_NULL 0x00 +#define HDC1001_CMD_READ_DATA 0x01 +#define HDC1001_CMD_WRITE_DATA 0x02 +#define HDC1001_CMD_WRITE_HEADER 0x03 +#define HDC1001_CMD_READ_HEADER 0x04 -#define HDC1001_STATUS_BUSY 0 +#define HDC1001_STATUS_BUSY 0 #define HDC1001_STATUS_RANGE 1 #define HDC1001_STATUS_NOT_READY 2 -#define HDC1001_STATUS_TIMEOUT 3 -#define HDC1001_STATUS_DAT_CRC 4 -#define HDC1001_STATUS_WR_FAULT 5 -#define HDC1001_STATUS_OVERRUN 6 -#define HDC1001_STATUS_HDR_CRC 7 -#define HDC1001_STATUS_MAP_FULL 8 -#define HDC1001_STATUS_COMPLETE 0xFF /* Complete with No Error */ +#define HDC1001_STATUS_TIMEOUT 3 +#define HDC1001_STATUS_DAT_CRC 4 +#define HDC1001_STATUS_WR_FAULT 5 +#define HDC1001_STATUS_OVERRUN 6 +#define HDC1001_STATUS_HDR_CRC 7 +#define HDC1001_STATUS_MAP_FULL 8 +#define HDC1001_STATUS_COMPLETE 0xFF /* Complete with No Error */ #define HDC1001_CODE_NOOP 0x00 #define HDC1001_CODE_VERSION 0x01 -#define HDC1001_CODE_GLOBAL 0x02 +#define HDC1001_CODE_GLOBAL 0x02 #define HDC1001_CODE_SPECIFY 0x03 #define HDC1001_CODE_SET_MAP 0x04 #define HDC1001_CODE_HOME 0x05 #define HDC1001_CODE_SEEK 0x06 #define HDC1001_CODE_READ_HDR 0x07 -#define HDC1001_CODE_READWRITE 0x08 +#define HDC1001_CODE_READWRITE 0x08 #define HDC1001_CODE_RELOCATE 0x09 -#define HDC1001_CODE_FORMAT 0x0A -#define HDC1001_CODE_FORMAT_BAD 0x0B -#define HDC1001_CODE_STATUS 0x0C -#define HDC1001_CODE_SELECT 0x0D +#define HDC1001_CODE_FORMAT 0x0A +#define HDC1001_CODE_FORMAT_BAD 0x0B +#define HDC1001_CODE_STATUS 0x0C +#define HDC1001_CODE_SELECT 0x0D #define HDC1001_CODE_EXAMINE 0x0E -#define HDC1001_CODE_MODIFY 0x0F +#define HDC1001_CODE_MODIFY 0x0F -#define HDC1001_IOPB_LEN 16 +#define HDC1001_IOPB_LEN 16 #define TF_DATA 0 #define TF_ERROR 1 diff --git a/AltairZ80/s100_mdsa.c b/AltairZ80/s100_mdsa.c index d2898dc1..39a54a04 100644 --- a/AltairZ80/s100_mdsa.c +++ b/AltairZ80/s100_mdsa.c @@ -111,7 +111,7 @@ static uint32 stepCleared = TRUE; /* true when step bit has returned to zero * /* MDS-AD Controller Subcases */ #define MDSA_READ_ROM0 0 -#define MDSA_READ_ROM1 1 +#define MDSA_READ_ROM1 1 #define MDSA_WRITE_DATA 2 #define MDSA_CTLR_COMMAND 3 @@ -372,7 +372,7 @@ static uint8 MDSA_Read(const uint32 Addr) uint8 driveNum; MDSA_DRIVE_INFO *pDrive; int32 rtn; - + cData = 0; pDrive = &mdsa_info->drive[mdsa_info->currentDrive]; switch( (Addr & 0x300) >> 8 ) { diff --git a/AltairZ80/vfdhd.c b/AltairZ80/vfdhd.c index ec6d799d..08d42c63 100644 --- a/AltairZ80/vfdhd.c +++ b/AltairZ80/vfdhd.c @@ -232,7 +232,7 @@ static t_stat vfdhd_attach(UNIT *uptr, CONST char *cptr) t_stat r; unsigned int i = 0; - r = attach_unit(uptr, cptr); /* attach unit */ + r = attach_unit(uptr, cptr); /* attach unit */ if(r != SCPE_OK) /* error? */ return r;