MiguelVis / te

Text editor for the CP/M operating system and related computers: Amstrad PCW, CPC, Kaypro, Spectrum...
GNU General Public License v2.0
84 stars 10 forks source link

TECF: Can't read file #6

Closed Laci1953 closed 2 years ago

Laci1953 commented 3 years ago

I modified TE.CF : ... screen.columns = 120 ...

then tried to use TECF, but got the following error message :

J>tecf patch te.com te.cf TECF: Can't read file.

Why? te.com & te.cf are present:

J>sdir te.*

Directory For Drive J: User 0

Name     Bytes   Recs   Attributes      Name     Bytes   Recs   Attributes

TE BAK 2k 9 Dir RW TE CF 2k 9 Dir RW TE COM 20k 149 Dir RW

Total Bytes = 24k Total Records = 167 Files Found = 3 Total 1k Blocks = 23 Used/Max Dir Entries For Drive J: 346/1024

J>

Could this be caused by CP/M being executed in Udo Munk's Z80SIM? I do not know...

MiguelVis commented 2 years ago

Hi @Laci1953.

Yes it's strange.

That error can only occur in the read_com function when reading the COM file.

Computing its size in 128 byte records:

    // Get the file size in bytes
    if((com_size = fsize(com_fname)) == -1) {
        err_read();
    }

    com_size *= 128;

Opening the file:

    // Read the file into memory
    if(!(fp = fopen(com_fname, "rb"))) {
        err_read();
    }

Reading its contents into memory:

    if(fread(com_buf, com_size, 1, fp) != 1) {
        err_read();
    }

What TE COM adaptation are you trying to patch?

The emulator is running CP/M v2 or v3?

Do you have enough TPA?

Have you tried in another emulator?

Laci1953 commented 2 years ago

Hi,

  1. I used te_ws100.com2. 64K CP/M Vers. 2.2 (Z80 CBIOS V1.2 for Z80SIM, Copyright 1988-2007 by Udo Munk)3. TPA has 1KB more than the CP/M running on RC2014
  2. Sorry, I have only Udo Munk's Z80PACK I suggest you to test your product on Z80PACK... regards,Ladislau

    On Tuesday, September 14, 2021, 01:20:36 AM GMT+3, MiguelVis @.***> wrote:

Hi @Laci1953.

Yes it's strange.

That error can only occur in the read_com function when reading the COM file.

Computing its size in 128 byte records: // Get the file size in bytes if((com_size = fsize(com_fname)) == -1) { err_read(); }

com_size *= 128;

Opening the file: // Read the file into memory if(!(fp = fopen(com_fname, "rb"))) { err_read(); }

Reading its contents into memory: if(fread(com_buf, com_size, 1, fp) != 1) { err_read(); }

What TE COM adaptation are you trying to patch?

The emulator is running CP/M v2 or v3?

Do you have enough TPA?

Have you tried in another emulator?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

MiguelVis commented 2 years ago

Hi @Laci1953.

Fixed with commit 239754c.

There was a bug in the function fsize() from the MESCC library fileio.h due to different behaviour in CP/M v2 & v3 BDOS 35 Compute file size.

Now it solved and TECF.COM works as expected.

Thanks for opening the issue.