Login  •  Register


The time is now: Mon May 29, 2017 5:02 pm

Emaculation wiki  •  Delete all board cookies



Post new topic  Reply to topic Page 1 of 1 [ 3 posts ]
Print view Previous topic  |  Next topic
Author Message
PostPosted: Sun Jan 08, 2017 6:30 pm 
Offline
Student Driver

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 14
Location: Russia
Hi!

I'm using System 7.5.3 w/ SheepShaver 2.3 on Windows 10 x64. Just out of my curiosity I've been playing with some old IDE, calling low-level PB... functions (PBOpen, PBControl / PBStatus, RBRead / PBWrite, PBClose) from there. As I can see, the rest of calls works OK. But something does not.

For example, I'm trying to work with Disk Driver in such way:
1. open the Driver by calling PBOpenSync with .Disk name and internal drive number (= 2) as parameters;
2. read some bytes from the disk by calling PBReadSync (bytes count = 512, position mode = 1 (fsFromStart), position offset = 0);
3. get the drive status by calling PBStatusSync w/ status code = 8 (drvStsCode);
4. close the Driver by calling PBCloseSync.

So, everything goes fine besides receiving the drive status.

Image

I'm always getting -56 error from the Driver that reads
Quote:
error -56 nsDrvErr: no such drive (tried to mount a bad drive num)
(according to Mac Error Codes list)

But why I cannot get the status when I'm able to successfully open the disk and read from it? I wonder how accurately SS emulates Drivers and Managers... Is it my own mistake or Driver functionality is implemented just partially?

I've double-checked my code and it seems to be correct. Also tried to run this test app in another emulator but have not succeed with anything (I need PowerPC processor for that, but unfortunately PearPC is unable to run Classic environment). It would be nice to have a real Mac here but I don't have one.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sun Jan 08, 2017 6:49 pm 
Offline
Forum All-Star
User avatar

Joined: Fri Nov 27, 2009 5:11 am
Posts: 1601
I haven't dug into how SheepShaver handles closing virtual hardware devices; you might want to try in qemu with Mac OS 9.0.4, as you can both run the qemu debugger and MacsBug there, which should give you more information, plus give you a comparison point.

Figuring out the problem could also result in a fix for SheepShaver, although it hasn't been actively developed now for years, so it might not.


Top
 Profile  
Reply with quote Post a reply  
PostPosted: Sat Feb 25, 2017 5:51 pm 
Offline
Student Driver

Joined: Sun Jan 08, 2017 4:31 pm
Posts: 14
Location: Russia
I checked it out and it appears that I'm getting the same error in QEMU also. Still haven't tried MacsBug or any other debugger there due to strange graphical issues... But I tried to debug this issue on SheepShaver. There's the source code for SS/BasiliskII Disk Driver. According to that I can conclude that most of the functions are implemented completely (except, maybe, Disk Status w/ codes 44, 45, 46 and 70). My app is trying to get Drive Status with code = 8, that calls this piece of code:
Code:
int16 DiskStatus(uint32 pb, uint32 dce)
{
   drive_vec::iterator info = get_drive_info(ReadMacInt16(pb + ioVRefNum));
   uint16 code = ReadMacInt16(pb + csCode);
   D(bug("DiskStatus %d\n", code));

   // I skip General codes here 'cause my code equals to 8

   // Drive valid?
   if (info == drives.end())
      return nsDrvErr;

   // Drive-specific codes
   switch (code) {
      case 8:      // Get drive status
         Mac2Mac_memcpy(pb + csParam, info->status, 22);
         return noErr;

   // Unimplemented codes are skipped also
   }
}

Using the debug mechanisme of SS I have found out that (info == drives.end()) is always true whatever input params were used for the Driver Open -> Read/Write or Control/Status -> Close session. It's kinda strange but I admit that ParamBlock might be formed incorrectly by IDE. I'm gonna check it out with some debugger later.

So, here are the questions.
- Is out there some system API logger/sniffer for SS or QEMU like Windows well-known sniffers WinAPIOverride, API Logger, API Monitor, Auto Debug Professional etc? I need to catch a few PB... functions like PBOpenSync and others.
- May I use MacsBug or QEMU debugger as step-by-step app tracer as I could do with ollydbg in Windows? I'd like to check func's parameters, asm and memory dump.
- Where's QEMU Disk Driver code? I may be inattentive, but I haven't found it here.


Top
 Profile  
Reply with quote Post a reply  
Display posts from previous:  Sort by  
Post new topic  Reply to topic Page 1 of 1 [ 3 posts ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
 

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group