Mac OS 7.1 - MacsBug 6.2

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Installed MacsBug, set up 'FKEY' in the System as resource ID of 5. The version 6.2 is matching the OS 7.1, I should think.
But after pressing Command-Shift-5, instead of dropping into the debugger I am getting Illegal instruction in BII.

Anything I may be doing wrong?
Many thanks.

Tom
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

A new observation. With `MacsBug' installed [resides in System folder / Mac greets on boot, and says Debugger installed underneath].

Generating exception in a programme.

Code: Select all

zero := zero DIV 0;
Should drop into the debugger, but drops out of BII and says

Code: Select all

Illegal instruction: 4e7a at 007e789c
Caught SIGSEGV at address 0x75958000 [IP=0x7bba8]
Not sure what happens, is there a way to tell BII, not catch exceptions when MacsBug is installed?

Many thanks.
Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Changing Processor ID to 4, which does not match LCIII machine and ROM, I use normally CPU 3 and FPU.
I can drop into MacsBug, see the screen, cursor flashing, but cannot type any chars.

Tomas
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Mac OS 7.1 - MacsBug 6.2

Post by adespoton »

tcat wrote: Fri Sep 11, 2020 8:40 am Hi,

Changing Processor ID to 4, which does not match LCIII machine and ROM, I use normally CPU 3 and FPU.
I can drop into MacsBug, see the screen, cursor flashing, but cannot type any chars.

Tomas
See https://docs.google.com/spreadsheets/d/ ... Dk7QDyKPY/ - you may want to ensure FPU is enabled, whether using CPU 3 or 4. Your ROM is probably the best one to use for 7.1, but you may need to change the machine ID. Remember that BII machine ID does not line up with the gestalt ID, but is off by 6 IIRC due to it not supporting the first 6 gestalt IDs used in Macs.

Also, BII has its own built-in debugging, so you'll be fighting against that when attempting to trigger MACSBug.
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Code: Select all

gestaltMacLCIII  =  27
27 - 6 = 21 that is for model-ID
But reports bad start-up disk.

No luck. Out of many model ID combinations for 7.1,
I can boot model-ID 18, which is gestalt 24 => PowerBook100,
and gestaltMacClassic = 17.

MacsBug, always needs processor ID = 4.

But still cannot type any keys in MacsBug.

BII is probably taking over control of the machine, therefore nothing can be typed.

Not sure there is a solution path possible.
Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

27 - 6 = 21 that is for model-ID
But reports bad start-up disk.
Enabler 003 added for LCIII, then does not report bad start up disk,
all lined up to my best knowledge.
But getting exception in BII during boot.

Same goes for LC/Peforma 630
gestalt = 98 - 6 => Model id 92
enabler 405
fpu true
630.rom
hd installed with LC630-CD.toast

Exception during boot.

Interesting some exceptions are caught in BII and MacsBug at the same time.
The above combinations are caught in BII only.

Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Cannot type any chars in MacsBug.
cpu=4, LCIII.rom, OS-7.1, modelid=5

These seem combinations that brings MacsBug screen on user break, cursor flashing, but does not accept any input from the keyboard. Tried aligning various model ids' with roms, but till now did not find a working combination.

Please see picture here,
https://github.com/tcat-qldom/MacOS-7/b ... ??raw=true
https://github.com/tcat-qldom/MacOS-7

The beauty about this low level debugger [lean & mean tool], it can catch most if not all exceptions, allows user debug output messages, debug low mem conditions, help finding dangling pointers, sensible app segment strategy, and much more.

It is the official debug tool that was always present, each Mac equipped with 'Programmers' key', that could invoke debugger, reset app, reset machine, etc.

It seems latest BII does not support MacsBug, which is a pity. Looking around the BII code, with `ZERO' understanding.

Code: Select all

        // Fake CPU speed test (SetupTimeK)
        // *** increased jl : MacsBug uses TimeDBRA for kbd repeat timing
        wp = (uint16 *)(ROMBaseHost + 0x800);
        *wp++ = htons(0x31fc);                  // move.w       #xxx,TimeDBRA
        *wp++ = htons(10000);
        *wp++ = htons(0x0d00);
Historically there was support for it, as it seems.

Any ideas?
Many thanks.

Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

BII has its own built-in debugging, so you'll be fighting against that when attempting to trigger MACSBug.
Just to be sure, JIT-Debugger is disabled on Linux (RPI), as this platform does not support it.

Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Tried many combinations, modelid, enablers, and ROMs, some bootable.
Tried to disable cxmon and debugger in the source, making a new build.
Tried many versions of MacsBug.
Still MacsBug wont accept keyboard input.

Not sure, would this be a candidate for an issue to file at git?
Or is it just me not seeing the solution?

Many thanks
Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

I have tried many builds of BII with a lot of debug output, still did not figure out why MacsBug does not read the keyboard. I have tested that keycodes are passed to ADB, when MacsBug screen shows up, but no chars appear on the command line. As keyboard and mouse are physically connected to ADB, do not get why it does not work.

Have two basic BII builds (https://github.com/cebix/macemu), SDL and X11, with direct or mem slot addressing, I suspect X11 sources are outdated around keycodes. Mac Classic rom version $276 requires mem slot.

Code: Select all

# video_x.cpp - Video/graphics emulation, X11 specific stuff
> 	if (strstr(vendor, line) == vendor) # does not seem to work
---
< 	if (strcmp(strstr(line, vendor), vendor) == 0)  # recoded to this

It looks for vendor string occurrence in keycodes file below

# /usr/share/BasiliskII/keycodes
# ../BasiliskII/src/Unix/keycodes
#The XFree86 Project, Inc
      The X.Org Foundation   <== vendor string changed
9       53      # Esc
67      122     # F1
68      120     # F2
69      99      # F3
70      118     # F4
71      96      # F5
...
Filed an issue at git repo for unssuporting MacsBug.

For X11 build I disabled DebugUtil(), so it can catch in MacsBug instead, ^C in pty then brings up monitor (built --with-mon=yes), h for help, x for quit - nice :-)

Code: Select all

#  ../BasiliskII/src/rom_patches.cpp - ROM patches
//	r.a[0] = ROMBaseMac + debugutil_offset;
//	r.d[0] = 0xa08d;
//	Execute68kTrap(0xa247, &r);		// SetOSTrapAddress()
Meanwhile using mini vMac, where MacsBug works, but only in System 7.5.3 with system update 7.5.
System 7.1 does not boot in vMac.

So I run two emulators BII with 7.1 and 7.5 mounted - w/o MacsBug, and vMac 7.5. - w/ MacsBug.
vMac can reuse the same HD image, but requires that 7.5 image is cleanly unmounted in BII first, otherwise will not boot in vMac.

Tomas
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Interesting observation with BII for X with mem banks.

Code: Select all

$ ./configure --disable-vosf --disable-jit-compiler --with-x --with-gtk=no --enable-addressing=banks
MacsBug installed as 'FKEY'(5) in System suitcase.
Cmd-Shift-5 drops into MacsBug.

Keyboard is read this time, raising exceptions with each keypress,

Code: Select all

Illegal instruction: d9fe at 0000002e
Illegal instruction: d9fe at 0000002e
Illegal instruction: d9fe at 0000002e
Illegal instruction: d9fe at 0000002e
...
Technote (https://basilisk.cebix.net/TECH) says BII does not emulate applications accessing h/w directly.
However this seems the MacsBug case, as it does not call ToolBox routines, but reads keyboard directly over ADB(Apple Desktop Bus).

This part is patched in ROM when BII starts. So perhaps we need to adjust ADB handling somehow, or patch MacsBug to call WaitNextEvent()?

Any ideas?
Many thanks
Tomas
Adam P
Tinkerer
Posts: 67
Joined: Wed Mar 31, 2010 11:55 pm
Location: Maine, U.S.
Contact:

Re: Mac OS 7.1 - MacsBug 6.2

Post by Adam P »

As far as I know, the only version of Basilisk II that works with MacsBug is Windows build 142. And even then, it only works under the right set-up, and you'll still get error messages on each time you enter or step. I think it was due to a missing implementation for a MOVE to/from SR instruction.
tcat
Inquisitive Elf
Posts: 37
Joined: Tue Aug 04, 2020 4:04 pm

Re: Mac OS 7.1 - MacsBug 6.2

Post by tcat »

Hi,

Interesting,
MOVE to/from SR
, not emulated then.
I wonder what it takes to implement it.

Looking inside uae_cpu/ directory.

Code: Select all

basilisk_glue.cpp  cpuopti.c  memory.cpp  noflags.h    table68k
build68k.c         fpu        memory.h    readcpu.cpp
compiler           gencpu.c   newcpu.cpp  readcpu.h
cpu_emulation.h    m68k.h     newcpu.h    spcflags.h
In gencpu.c, I can see,

Code: Select all

static void gen_opcode (unsigned long int opcode)
{
...
    case i_MVSR2:
        genamode (curi->smode, "srcreg", sz_word, "src", 2, 0);
        printf ("\tMakeSR();\n");
        if (curi->size == sz_byte)
            genastore ("regs.sr & 0xff", curi->smode, "srcreg", sz_word, "src");
        else
            genastore ("regs.sr", curi->smode, "srcreg", sz_word, "src");
        break;
     case i_MV2SR:
        genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
        if (curi->size == sz_byte)
            printf ("\tMakeSR();\n\tregs.sr &= 0xFF00;\n\tregs.sr |= src & 0xFF;\n");
        else {
            printf ("\tregs.sr = src;\n");
        }
        printf ("\tMakeFromSR();\n");
        break;
...
}
Many thanks
Tomas
Post Reply