From 2c2c386e053639739496a70f7439437406d23de8 Mon Sep 17 00:00:00 2001 From: CrazyEttin <> Date: Fri, 19 Aug 2022 00:50:09 +0300 Subject: [PATCH] Fix a bug with the file handling for the tape punch --- emulator.pas | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/emulator.pas b/emulator.pas index 702cbaa..34b983d 100644 --- a/emulator.pas +++ b/emulator.pas @@ -267,7 +267,16 @@ begin //Punch if Punch.Path <> '' then begin assign (TapeOut, Punch.Path); - if Punch.Reset then begin + if FileExists (Punch.Path) = false then begin + try + rewrite (TapeOut); + write (TapeOut, R [X]); + close (TapeOut); + Punch.Reset := false; + except + end; + end + else if Punch.Reset then begin try rewrite (TapeOut); write (TapeOut, R [X]);