OPEN+KEYBOARD=CRASH

DOS specific questions.
Post Reply
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

OPEN+KEYBOARD=CRASH

Post by VANYA »

Hi all!

I must say right away: I use freedos on a flash drive! That is, DOS is installed on a USB flash drive.

I don't know why CRASH happens, but when using the keyboard and file functions, the program CRASHED.

Other programs save files without problems, but for some reason FB OPEN does not have this.

Here is an example:

Code: Select all

Function SaveFile(sFile As String) As Long

	Dim As Integer f = Freefile
	
	Open sFile For Binary As #f

	If Err>0 Then
		? "Error"
		end
	Else
		Close #f
		Return 1
	Endif

End Function

print "start"

do

	print "save"
	if savefile("12345678.txt") then
		print "kill"
		kill("12345678.txt")
	endif
	print "ESC to exit or any key to continue"

loop until getkey = 27
After the first save and pressing any key (for the next save) except ESC, the CRASH program.

P.S. if you remove the GETKEY function from the program, you can save as many times as you like.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: OPEN+KEYBOARD=CRASH

Post by dodicat »

It works OK in dos 7 (via win 98).
I can go through the loop many times, save kill, save kill, . . . until I press escape.
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: OPEN+KEYBOARD=CRASH

Post by Dinosaur »

Hi All

I am using a USB to sata adapter, with a 256Gb SSD, FBC 1.08.1
and it never fails.

Have you tried doing it slowly with 2 or 3 sec pause in between ?

Regards

EDIT: Just checked with el-cheapo slow usb stick, still no problem.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: OPEN+KEYBOARD=CRASH

Post by VANYA »

Thanks for testing!

I tried to stick a flash drive into an old laptop and everything is fine there (no errors). And in the main computer, the error is in 100% of cases (AM4 Ryzen board, 16GB). I tried to stick a flash drive into all available USB connectors - the error is everywhere (Page Fault in RMCB). It is strange that other programs save files without problems.

This is the error that occurs:

Image

If the image is not showing then here is another link:

https://disk.yandex.ru/i/83E1cuArA8wcXw
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: OPEN+KEYBOARD=CRASH

Post by coderJeff »

I don't quite understand how the GPF in RMCB is developing but fbc installs it's own keyboard handler and does some data locking / unlocking while checking for key presses.

Recently in fbc 1.10.0 I added a change that worked for me to help prevent some crashes in msdos 6 under vmware and dosbox. In my case it was some keyboard+graphics.

This will prevent any internal fb_Delay() call (aka SLEEP) from calling __dpmi_yeild().

Code: Select all

extern "c"
	extern as unsigned long __fb_dos_no_dpmi_yield
end extern

__fb_dos_no_dpmi_yield = 1
But I think maybe in this case with GETKEY it's because the keyboard interrupt service routine isn't installed until the first call to GETKEY.

At the beggining of the program, try putting:

Code: Select all

var dummy = multikey(1)
sleep 1000, 1
Which will ensure that the keyboard handler is installed before the rest of the program runs. I know is not a solution, but it might help us figure out what is happening.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: OPEN+KEYBOARD=CRASH

Post by VANYA »

Hi Jeff!
At the beggining of the program, try putting:

Code: Select all

var dummy = multikey(1)
sleep 1000, 1
It does not help. The program still crashes with an error.

In my actual program, I had to throw out the file handling, delay, and key functions. I replaced them with C language functions.

---------------

There are libraries with long names in the compiler libraries folder. Because of this, the compiler does not see them and the threading functions do not work.
Post Reply