robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
396 stars 48 forks source link

pcbasic_print.txt error on exit #161

Closed JDoucette closed 2 years ago

JDoucette commented 2 years ago

Bug report

Problem On exit via "SYSTEM" command, the screen disappeared and I got the following error message:

PC-BASIC error 1

Then after closing it, I saw: PC-BASIC error 2

Steps Unsure, but I was running this program repeatedly, making small changes:

10 KEY OFF:SCREEN 2:CLS
20 REM 640X200 HAS 2.4:1 SIZED PIXELS, WHICH CIRCLE() APPROX SUPPORTS
30 INPUT"BALL RADIUS(8 = REASONABLE)";XRAD:YRAD=INT(XRAD/2)
40 INPUT"GRAVITATIONAL FORCE(1 = NORMAL)";G:G=G*.001
50 INPUT"DAMPENING EFFECT(100 = 100%)";D:D=D/100
60 INPUT"HORIZONTAL SPEED(1 = NORMAL)";H:H=H*.25
70 INPUT"VERTICAL SPEED(0 = NOT FALLING)";S
80 CLS:CIRCLE(XRAD,YRAD),XRAD:PAINT(XRAD,YRAD):SX=XRAD*2:SY=YRAD*2
90 ARRAYSIZE=4+(SX+1)*(SY+1)/4:REM 4 BYTES HEADER, 4 PIXELS PER BYTE
100 DIM A(ARRAYSIZE):GET(0,0)-(SX,SY),A:CLS
110 MAXX=639-SX:MAXY=199-SY
120 R=1:C=1:LINE(0,0)-(639,199),1,B:PUT(C,R),A
130 CC=C:CR=R:C=C+H:IF C>MAXX THEN C=MAXX:H=-H*D ELSE IF C<0 THEN C=0:H=-H*D
140 S=S+G:R=R+S:IF R>MAXY THEN S=-S*D:H=H*SQR(D):R=MAXY ELSE IF R<0 THEN S=-S*D:H=H*SQR(D):R=0
150 PUT(CC,CR),A:PUT(C,R),A:GOTO 130

Program See above.

Crash log Where are the logs? I do not see any modified files in the PC-BASIC program structure. Please let me know how to view logs, and I can give better bug reports.

I see a folder location mentioned in the above image. Looking at: C:\Users\jason\AppData\Local\Temp I can see:

C:\Users\jason\AppData\Local\Temp>dir pc*
2021-11-09  10:13 PM    <DIR>          pcbasic-1.2-9brnyj
2021-11-08  11:16 PM    <DIR>          pcbasic-1.2-cm0lwq
2021-11-09  11:41 PM    <DIR>          pcbasic-1.2-jyqwzk
2021-11-10  11:37 PM    <DIR>          pcbasic-1.2-rfea7h
2021-11-11  12:16 PM    <DIR>          pcbasic-1.2-zb6vsh

They are all empty, and appear to have random names.

Notes PC-BASIC version: 1.2.14 Operating system version: Windows 10

robhagemans commented 2 years ago

Looks like you don't have any program set to handle .txt files. PC_BASIC prints by asking the operating system to print a text file, so if the OS does not have a way set to do that then that would probably cause an error. As far as I'm aware Windows normally uses notepad.exe to deal with text files, perhaps if you reset that file association it will work again?

Re the log files, there won't be one because this is not a PC-BASIC crash but a Windows error message. If PC-BASIC crashes, you'll get on-screen information including the location of the crash log file.

On another note, I see you're using an old version of PC-BASIC - please also make sure to try the latest version, 2.0.4.

JDoucette commented 2 years ago

I have .txt extension associated. By default in Windows 10 it will be notepad.exe but I have it changed to "C:\Program Files\Notepad++\notepad++.exe" which should not matter, but perhaps it does? I deal with .txt files all the time, so this has never been an issue on my PC.

robhagemans commented 2 years ago

The assumption is that the program that handles .txt responds to the printto verb - as far as I've understood this is the standard way to get Windows to print a plain text file. Perhaps it does not work if .txt has been assigned to Notepad++.