cpmulator icon indicating copy to clipboard operation
cpmulator copied to clipboard

HiSoft C

Open skx opened this issue 5 months ago • 1 comments

This is repeat of an old issue, #234. The HiSoft C compiiler, as contained in David's repo, fails:

  • https://github.com/davidly/cpm_compilers

I can run the v135 compiler, but not the v3.09. However I have used trial and error and I now see numerous other emulators running this:

  • David's ntvcm emulator "just works":
    • https://github.com/davidly/ntvcm
  • iz-cpm almost works
    • I had to implement BDOS call 102 - https://github.com/ivanizag/iz-cpm/pull/23
    • I also have to comment out the call to "truncate_if_needed" then it works.
      • Need to see if that is buggy.
    • https://github.com/ivanizag/iz-cpm
  • CPMEMU v5 "just works":
    • https://github.com/chenchijung/CPMEMU_V5

Once again I think that I should just write a "CPM Test Suite" where I open files, write to them, etc, etc, and test that code under N emulators. It seems like we all do things differently. Today messing around with iz-cpm and seeing the removal of the truncation code fixed iz-cpm I guess I have another area of difference to explore.

TLDR; This is the second time I've opened a bug with this same issue and I guess I need to try again now that I've identified several emulators that can run the damn thing!

skx avatar Jul 01 '25 10:07 skx

Recap of experiencing the bug:

git clone [email protected]:davidly/cpm_compilers.git
cd cpm_compilers/hisoft\ hi-tech\ c\ v3.09/
cpmulator
A>c309 E.C -O -LF -DHISOFTC
HI-TECH C COMPILER (CP/M-80) V3.09
Copyright (C) 1984-87 HI-TECH SOFTWARE
Fmt err

Using iz-cpm instead:

root@0b8543724c64:~/cpm_compilers/hisoft hi-tech c v3.09# /root/iz-cpm/target/release/iz-cpm 
iz-cpm https://github.com/ivanizag/iz-cpm
CP/M 2.2 Emulation
Press ctrl-c ctrl-c Y to return to host

A>c309 E.C -O -LF -DHISOFTC
HI-TECH C COMPILER (CP/M-80) V3.09
Copyright (C) 1984-87 HI-TECH SOFTWARE

A>E
271828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319
done

A>

Of course I had to comment out the truncation code:

root@0b8543724c64:~/iz-cpm# git diff
diff --git a/src/bdos_file.rs b/src/bdos_file.rs
index 120388a..7dd359e 100644
--- a/src/bdos_file.rs
+++ b/src/bdos_file.rs
@@ -133,16 +133,6 @@ fn truncate_if_needed(env: &mut BdosEnvironment, fcb: &Fcb, os_file_name: &OsStr
     if extent_is_full {
         return Ok(()); // No truncation needed and it could not be the last extent.
     }
-    if record_count == fcb_record_count as u32 {
-        return Ok(());
-    }
-
-    if env.call_trace {
-        println!("Truncating file from {} to {}", record_count, fcb_record_count);
-    }
-
-    let file = fs::OpenOptions::new().write(true).open(os_file_name)?;
-    file.set_len(fcb_record_count as u64 * RECORD_SIZE as u64)?;
     return Ok(());
 }
 
@@ -716,4 +706,4 @@ pub fn name_match(name: &str, pattern: &str) -> bool {
         }
     }
     true
-}
\ No newline at end of file
+}

skx avatar Jul 01 '25 11:07 skx