Directory Driver problem
-
- Aurora
- Posts: 965
- Joined: Tue Dec 17, 2013 1:17 pm
Directory Driver problem
Hi, I was wondering if any SMSQ experts could help me with a problem I am having writing a Directory Device Driver.
I am writing a driver to emulate the Microdrives on QPC2.
My driver is (mostly) working, but I have a problem with Executable programs. When I EXEC them I get a 'Invalid Name' error.
I can Load and Save normal files, I can Copy files to and from my emulated Microdrive without problems. But I cannot EXEC programs.
The executable file stored in my Microdrive image must be OK, as I can copy it to a RAM drive, and execute it from there OK.
I can also OPEN the executable file in my Microdrive image without error.
I don't have much in the way of documentation for SMSQ, So I am using QDOS documentation to work from.
Does anyone know if there anything special about the way the EXEC command opens and reads the file compared to QDOS.
For reference
My driver code is based on the MDV driver from Minerva.
I am using SMSQ Version 3.09
I am writing a driver to emulate the Microdrives on QPC2.
My driver is (mostly) working, but I have a problem with Executable programs. When I EXEC them I get a 'Invalid Name' error.
I can Load and Save normal files, I can Copy files to and from my emulated Microdrive without problems. But I cannot EXEC programs.
The executable file stored in my Microdrive image must be OK, as I can copy it to a RAM drive, and execute it from there OK.
I can also OPEN the executable file in my Microdrive image without error.
I don't have much in the way of documentation for SMSQ, So I am using QDOS documentation to work from.
Does anyone know if there anything special about the way the EXEC command opens and reads the file compared to QDOS.
For reference
My driver code is based on the MDV driver from Minerva.
I am using SMSQ Version 3.09
Re: Directory Driver problem
Martin,
if everything else seems to work properly and EXECed files don't, I guess you have a problem with the file header. The ERR.INAM you get seems to rather mean "invalid file" instead of "invalid name" in your case. EXECutable files are about the only file type that really need the correct file header for the EXECutable flag and the amount of data space to reserve.
You might want to check whether the file header survives being written and read from your device.
As a side note, there shouldn't be much difference between a device driver on native QDOS and SMSQ/E. And a (joint QDOS and) SMSQ/E manual can be found here:
http://kilgus.net/smsqe/QDOS%20SMS%20Re ... Manual.pdf
Regards,
Tobias
if everything else seems to work properly and EXECed files don't, I guess you have a problem with the file header. The ERR.INAM you get seems to rather mean "invalid file" instead of "invalid name" in your case. EXECutable files are about the only file type that really need the correct file header for the EXECutable flag and the amount of data space to reserve.
You might want to check whether the file header survives being written and read from your device.
As a side note, there shouldn't be much difference between a device driver on native QDOS and SMSQ/E. And a (joint QDOS and) SMSQ/E manual can be found here:
http://kilgus.net/smsqe/QDOS%20SMS%20Re ... Manual.pdf
Regards,
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
-
- RWAP Master
- Posts: 2892
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: Directory Driver problem
Martin - you could always post the code on here for people to look at, or send it to me by pm and I will see if I can help...
As you can copy the file from the microdrive to the ram disk and execute it from there, the file header seems to be ok, so this does seem odd....
As you can copy the file from the microdrive to the ram disk and execute it from there, the file header seems to be ok, so this does seem odd....
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
-
- Aurora
- Posts: 965
- Joined: Tue Dec 17, 2013 1:17 pm
Re: Directory Driver problem
I will have a look through that.As a side note, there shouldn't be much difference between a device driver on native QDOS and SMSQ/E. And a (joint QDOS and) SMSQ/E manual can be found here:
http://kilgus.net/smsqe/QDOS%20SMS%20Re ... Manual.pdf
Regards,
Tobias
If I can't sus it out, I will see if I can zip up the code and sources and do an attachment.RWAP wrote:Martin - you could always post the code on here for people to look at, or send it to me by pm and I will see if I can help...
As you can copy the file from the microdrive to the ram disk and execute it from there, the file header seems to be ok, so this does seem odd....
As I am new here, The User Control Panel says I can't sens PM's.
I keep thinking it must be to do with reading the file header. But I have also noticed that if I LBYTES an executable file. I get the Invalid Name error, But if I LBYTES a data file, it works OK.
However I have not tried LBYTEing an executable file from RAM or FLP to see if LBYTES tries to EXEC it. Although I would not expect it to.
- vanpeebles
- Commissario Pebbli
- Posts: 2850
- Joined: Sat Nov 20, 2010 7:13 pm
- Location: North East UK
Re: Directory Driver problem
Martin,
what you observe might actually be a completely different problem - SMSQ/E seems to be having an mdv_ emulation already (didn't know that before I actually had a browse through the sources - But I have found a number of hints on mdv emulation through RAM disk.). (The whole mechanism seems to be the same thing as supported on some Miracle hardware: you do a
"FORMAT ramx_mdvy_"
and the QL will do a sector copy of the mdv to ram disk and operate from there.)
It might well be your implementation causes one or the other clash with that implementation.
You would want to have a look into the sources at the files around 'smsq_dd_rd_emul_*'. The default implementation (i.e NOT QL), however, looks to me as it should give an ERR_INAM on every access to mdvx_, not only for EXECutable files.
Regards,
Tobias
what you observe might actually be a completely different problem - SMSQ/E seems to be having an mdv_ emulation already (didn't know that before I actually had a browse through the sources - But I have found a number of hints on mdv emulation through RAM disk.). (The whole mechanism seems to be the same thing as supported on some Miracle hardware: you do a
"FORMAT ramx_mdvy_"
and the QL will do a sector copy of the mdv to ram disk and operate from there.)
It might well be your implementation causes one or the other clash with that implementation.
You would want to have a look into the sources at the files around 'smsq_dd_rd_emul_*'. The default implementation (i.e NOT QL), however, looks to me as it should give an ERR_INAM on every access to mdvx_, not only for EXECutable files.
Regards,
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
-
- Aurora
- Posts: 965
- Joined: Tue Dec 17, 2013 1:17 pm
Re: Directory Driver problem
Nice idea, But my device name is not mdv, its mdi. So I don't see that there should be a clashtofro wrote:Martin,
what you observe might actually be a completely different problem - SMSQ/E seems to be having an mdv_ emulation already (didn't know that before I actually had a browse through the sources - But I have found a number of hints on mdv emulation through RAM disk.). (The whole mechanism seems to be the same thing as supported on some Miracle hardware: you do a
"FORMAT ramx_mdvy_"
and the QL will do a sector copy of the mdv to ram disk and operate from there.)
It might well be your implementation causes one or the other clash with that implementation.
Tobias
-
- Aurora
- Posts: 965
- Joined: Tue Dec 17, 2013 1:17 pm
Re: Directory Driver problem
I was going to PM this to you, but I could not see how to add an attachment to the PM.RWAP wrote:Martin - you could always post the code on here for people to look at, or send it to me by pm and I will see if I can help...
The Forum did not like the _zip extension, so you will need to rename it first.
- Attachments
-
- MDIdriver.zip
- (106.76 KiB) Downloaded 272 times
Re: Directory Driver problem
Martin,
if you have a look in the manual I have linked above (page 184), you might see that the file system definition block for SMSQ/E looks a bit different than your (QDOS-based) assumption.
Not sure if this causes the problems you see, but you never know. Especially the bytes you consider "spare" are actually in use.
Tobias
if you have a look in the manual I have linked above (page 184), you might see that the file system definition block for SMSQ/E looks a bit different than your (QDOS-based) assumption.
Not sure if this causes the problems you see, but you never know. Especially the bytes you consider "spare" are actually in use.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
-
- Aurora
- Posts: 965
- Joined: Tue Dec 17, 2013 1:17 pm
Re: Directory Driver problem
I think I may have got it.
The problem is not with the file being an executable as such, but with it size.
I spent the afternoon looking at that QDOS/SMSQ manual. Then finding the code for LBYTES in the ROM. And then trying to trace the code through the ROM.
I found the "Invalid Name" error occurred when the LBYTES command tried to actually Load the code.
Then I traced the code for FS_LOAD in my driver, Which handles loading two ways depending on whether the file more or less than about 4K bytes.
My test executable file trips the more than 4K method, which calls FS_FLUSH before loading the file.
FS_FLUSH did not return, and processing fell into the Rename code, which set D0 to "Invalid Name".
Altered my source code, Assembled, Tested it. EXECuted my test file, No error message, But no executed program either!
Tried LBYTEing the program, look at what was loaded. And thought, That's not the program.
This was 7PM. I thought, No stop, Walk away and leave it.
Just after I shut the computer down, I realized, I think what was downloaded was the Directory, which coincided with something I saw earlier that the File number in the Channel Definition block, is not being set, or is being trashed, So FS_LOAD had loaded the directory instead of the file.
Sorry if I've just gone on a bit. But thanks to both of you for your help.
The problem is not with the file being an executable as such, but with it size.
I spent the afternoon looking at that QDOS/SMSQ manual. Then finding the code for LBYTES in the ROM. And then trying to trace the code through the ROM.
I found the "Invalid Name" error occurred when the LBYTES command tried to actually Load the code.
Then I traced the code for FS_LOAD in my driver, Which handles loading two ways depending on whether the file more or less than about 4K bytes.
My test executable file trips the more than 4K method, which calls FS_FLUSH before loading the file.
FS_FLUSH did not return, and processing fell into the Rename code, which set D0 to "Invalid Name".
Altered my source code, Assembled, Tested it. EXECuted my test file, No error message, But no executed program either!
Tried LBYTEing the program, look at what was loaded. And thought, That's not the program.
This was 7PM. I thought, No stop, Walk away and leave it.
Just after I shut the computer down, I realized, I think what was downloaded was the Directory, which coincided with something I saw earlier that the File number in the Channel Definition block, is not being set, or is being trashed, So FS_LOAD had loaded the directory instead of the file.
Sorry if I've just gone on a bit. But thanks to both of you for your help.