Skip to content

Commit

Permalink
Revert to original ZXCC exact size model.
Browse files Browse the repository at this point in the history
Fixed error introduced in previous update
  • Loading branch information
ogdenpm committed Mar 15, 2022
1 parent 8f3eab8 commit e74e3ab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions bin/z80.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "zxcc.h" // put first before calling windows include files
#include<stdio.h>
#include "zxcc.h"


#define parity(a) (partable[a])

Expand Down
11 changes: 4 additions & 7 deletions cpmredir/lib/cpmredir.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ cpm_word fcb_open(cpm_byte* fcb, cpm_byte* dma)
*/

/* Get the file length */
redir_wr32(fcb + LENGTH_OFFSET, zxlseek(handle, 0, SEEK_CUR));
redir_wr32(fcb + LENGTH_OFFSET, zxlseek(handle, 0, SEEK_END));
zxlseek(handle, 0, SEEK_SET);

/* Set the last record byte count */
Expand All @@ -170,7 +170,7 @@ cpm_word fcb_close(cpm_byte* fcb)
SHOWNAME("fcb_close")

if ((handle = redir_verify_fcb(fcb)) < 0) return -1;
redir_Msg(" (at %lx)\n", zxlseek(handle, 0, SEEK_END));
redir_Msg(" (at %lx)\n", zxlseek(handle, 0, SEEK_CUR));

if (fcb[0] & 0x80) /* Close directory */
{
Expand Down Expand Up @@ -489,10 +489,8 @@ cpm_word fcb_randwr(cpm_byte* fcb, cpm_byte* dma)
/* Update the file length */
len = redir_rd32(fcb + LENGTH_OFFSET);
/* PMO: Bug fix, account for the data just written */
if (len < offs + rv) {
if (len < offs + rv)
redir_wr32(fcb + LENGTH_OFFSET, offs + rv);
fcb[0x20] = (offs + rv) % 256;
}

if (rv < redir_rec_len) return 1; /* disk full */
return 0;
Expand Down Expand Up @@ -768,8 +766,7 @@ cpm_word fcb_chmod(cpm_byte* fcb, cpm_byte* dma)
newoffs = offs = ((st.st_size + 127) / 128) * 128;
if (fcb[0x20] & 0x7F)
{
newoffs -= fcb[0x20] & 0x7f;
//newoffs -= (0x80 - (fcb[0x20] & 0x7F));
newoffs -= (0x80 - (fcb[0x20] & 0x7F));
}
if (newoffs == st.st_size)
{
Expand Down
2 changes: 1 addition & 1 deletion winbuild/zxcc/zxcc.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ call "$(SolutionDir)Scripts\install.cmd" "$(SolutionDir)external\$(PlatformTarge
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);USE_CPMIO;DEBUG;_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions);USE_CPMIO;DEBUG</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>..\include;..\..\cpmio\include;..\..\cpmredir\include</AdditionalIncludeDirectories>
Expand Down

0 comments on commit e74e3ab

Please sign in to comment.