LisaList2

Advanced search  

News:

2019.06.07 fixed NChat for the "Curve" theme, will eventually move it to its own page and add it to the default theme as well. Other plugins are next. see post in the Meta board for details

Pages: 1 ... 8 9 [10]   Go Down

Author Topic: LisaEm 1.2.7-RC3a support bug reports  (Read 10383 times)

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +25/-0
  • Offline Offline
  • Posts: 467
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #135 on: March 16, 2021, 02:05:08 pm »

brew install SDL2

brew install SDL2_image

brew install SDL2_ttf

I'm unsure why SDL2 would be required. wxWidgets only relies on SDL for sound, and then only on GTK systems. It might be that I installed SDL2 on the mac VM on which that specific beta release was built on, and then the wxWidgets I compiled there saw it and started using it, but it should work without SDL2 being installed on macos, assuming you compile wxWidgets yourself using the build-wx3.1.4-modern-macos.sh script inside the scripts directory, and then have added your path to it, and then built LisaEm yourself using build.sh

I would advise you to build RC3a (or unstable) yourself instead if you're going to go through that much effort. :)
Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +25/-0
  • Offline Offline
  • Posts: 467
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #136 on: March 16, 2021, 02:24:02 pm »


So it thinks this is a 4 byte opcode, but really it's a two byte opcode that's actually just a short branch to itself.

Code: [Select]
00020000  60FE                       2  START: bra.s START

So this is on purpose, for whatever reason. It could just be the idle loop of the kernel when it doesn't yet have any spawned processes to exec (i.e. init), however there is a bug in Generator - at least in the disassembly side where it doesn't properly disassemble this opcode.


Turns out this is pebkac on my part. :) Thanks to James Denton, who pointed me at http://www.bitsavers.org/pdf/unisoft/UniPlus+_System_V_Installation_Instructions.html

I needed to type in "copy" on the boot disk, and not hit enter. What's happening is that hitting enter boots the unix kernel off the disk, but this disk doesn't contain a file system, so when it tries to do fork/exece of '/etc/init' - there's no / directory, let alone a /etc directory and so exece fails with ENODIR and drops in this loop.

The loop can be found in the kernel source code in v1.5/sys/main.c. This is a tiny tiny, but valid assembly code uniplus program which just calls exece to run /etc/init. but apparently this needs to exist as a process in memory, before it can run fork/exec, (actually this is special as it's started via a different call: newproc(0) not actually fork.)

Weirdly, in UniPlus programs can start at address 0 - normally used for the trap table - but since this runs in user mode, it's fine. (This is something which the Generator disassembler doesn't like one bit! But it does emulate it properly as far as I can tell.)

This guy first sets up the stack pointer, then argc/argv, and environment variables, then calls trap #0 with 59 (exece) which tries to replace this process with init, and then fails, so it falls through and gets stuck in that "bra ." loop, but D0 is set to ENODIR - and that's what I saw happening at address 2/00000020 previously.

Fun stuff, and got a quick bit of "Ah Ha!" about how unix starts up. I had no idea it would create a fake stub program before loading init into memory, but I guess exec can't do that unless one exists as there's probably no "load this binary" function in the kernel, and so it can only use the exec class of syscalls. So it does that as a hack.

Code: [Select]
36 /*
 37  * Icode is the bootstrap program used to exec init.
 38  */
 39 short icode[] = {
 40                                 /*       .=USTART               */
 41         0x2E7C, HIGH, LOW+0x100,/*       movl   #USTART+0x100,sp*/
 42         0x227C, HIGH, LOW+0x26, /*       movl   #envp,a1        */
 43         0x223C, HIGH, LOW+0x22, /*       movl   #argp,d1        */
 44         0x207C, HIGH, LOW+0x2A, /*       movl   #name,a0        */
 45         0x42A7,                 /*       clrl   sp@-            */
 46         0x303C, 0x3B,           /*       movw   #59.,d0   exece */
 47         0x4E40,                 /*       trap   #0              */
 48         0x60FE,                 /*       bra    .               */
 49         HIGH,   LOW+0x2A,       /* argp: .long  name            */
 50         0,      0,              /* envp: .long  0               */
 51         0x2F65, 0x7463, 0x2F69, /* name: .asciz "/etc/init"     */
 52         0x6E69, 0x7400
 53 };
 54 int szicode = sizeof(icode);
 55

I'm in the process of adding patches for the profile handshaking code in v1.5/stand on the boot-a disk  (or boot blocks on ProFile/Widget media) to make the copy command work. Will report back after that.

Also, I've added HLE ProFile acceleration for the Boot ROM itself, which the boot code will use (it's now failing on attempts to write to the ProFile, so there, I need to patch the handshaking.) Hopefully this will help speed up anything that uses the Boot ROM call.

This was basically a freebie since I had code for it already in romless, but until now if you use the Boot ROM, it would do the full ProFile handshaking/byte for byte transfer under emulation. So now the entire JSR to that ROM routine happens in native code, so that should speed up almost all OS booting.
« Last Edit: March 16, 2021, 02:30:22 pm by rayarachelian »
Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +25/-0
  • Offline Offline
  • Posts: 467
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #137 on: March 18, 2021, 08:58:20 am »

Some more progress, I've added patches for the uniplus loader (aka standalone boot), so the :copy command now works, however there's some issue with the floppy after it ejects the disk, where it doesn't recognize the floppy drive anymore after the disk is ejected. This happens in both the standalone boot loader, as well as the kernel, once it comes up.

Likely this is some very tight timing CPU loop that falls out of sync. Meh. I wonder if the UniSoft driver guys though that the Lisa would never get a faster CPU, or newer versions of the ProFile which might react faster.
However, restarting and booting off boot-a-hacked, the next step :sunix worked, but then locked up at address 2/0000020 again, later after asking for which hard drive to install on and complaining about swap vs RAM. Likely this is the same NODIRENT error due to some access issue with the floppy drive.

I've found a really weird bit of behavior in the loader (the v1.5/stand pro.c file) where after it sends the 6 command bytes to the ProFile for a block write, it fails to flip the !CMD line, but goes into the prochk function which loops forever waiting for BSY to change. This caused the LisaEm profile driver to fall out of sync with the code in the loader.

I wonder if on a real ProFile, the ProFile flips BSY some time after the 6 command bytes are passed *without* first seeing !CMD flip in real life. This may be an issue for @stepleton and the Cameo/Aphid. Or not. I don't recall seeing this behavior in the /unix kernel.

Next I have to figure out the issues with the sony.c driver, and also whether /sunix is a separate kernel or a hard link to /unix on the boot disk. (Because if there's more than one and has drivers in different locations in RAM, I'll also need to patch it as well.) and obviously will need to figure out if mkfs has some disk size limit in it, and whether the install script passes a specific size to mkfs and patch that as well with the size of the profile.
Actually looking at this screenshot again, I see sunix has v1.1 on it and 1983 as the date, while before when I was booting unix, it says v1.4 and 1985. So for sure there are two different kernels at play here as well as the standalone loader.
Likely this is the reason patching the v1.4 kernel for a different sized profile did not work - because that doesn't patch the sunix v1.1 kernel.
« Last Edit: March 18, 2021, 09:05:28 am by rayarachelian »
Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'

stepleton

  • Sr. Member
  • ****
  • Karma: +46/-0
  • Offline Offline
  • Posts: 183
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #138 on: March 18, 2021, 04:12:05 pm »

FWIW: Cameo/Aphid doesn't seem to have any problems to speak of with UniPlus. Works fine for me if you use standard hard drive sizes.
Logged

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +25/-0
  • Offline Offline
  • Posts: 467
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #139 on: March 23, 2021, 10:29:30 am »

I think I found a situation where the BSY transition (BSY is tied to CA1 on the parallel port VIAs, where CA2 is used for handshaking), was not sending IRQs. Still working on this bit, however, it doesn't seem to affect LOS at all.

As an aside was looking to add HLE ProFile read/write support and seeing that LOS is doing some sort of XOR checksum on both reads and writes. Not sure if this is related to the document checksum protection/password thing, but it's interesting anyway. The strange bit is that it doesn't seem to do a whole sector in one shot, or even all the tags together in one shot, but rather in chunks. For example, for tags it does 2-3 tags at a time and I see several repeated calls to this code for a single sector.

I'm unsure about this chunking thing I'm seeing, but, it is what it is.

This read routine does 8x reads per pass (looks like manual loop unrolling) and in between it's doing an EOR to D1 (I removed the register and other outputs to clean it up a bit):
(A2) is the read from the IRA port on the VIA.

It may well be that this checksum is written to the tags. But it's different from other checksums that we see for example in the Boot ROM code, where it would also mix in some shifts to deal with single bit errors, so not as robust. Likely this code was written by someone else who wasn't aware of the code in the Boot ROM.

Code: [Select]

1 102470 1/00c08a88 (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb7ad +8 clks
102472 src/lisa/io_board/via6522.c:lisa_rb_Oxd800_par_via2:1806:reading from register 1 (I/ORA    )| 14:50:38.6 59684781

102476 src/lisa/io_board/via6522.c:via2_ira:572:profile.c:READ 00 from ProFile, pc24:00c08a88  tag:profile state:10| 14:50:38.6 59684781
102482 1/00c08a8a (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb7b5 +4 clks
102486 1/00c08a8c (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb7b9 +8 clks
102487 src/lisa/cpu_board/memory.c:dmem68k_store_byte:486::::::WRITE BYTE 00 ' ' to @1/00ad5700 using 17-ram| 14:50:38.6 59684793

2 102491 1/00c08a8e (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb7c1 +8 clks   2nd read
102494 src/storage/profile.c:ProfileLoop:777:ProFile access at PC:1/00c08a8e event:1 read IRA state:10 SEND_DATA_AND_TAGS_STATE idxr,idxw: 529,4 bsy:0 cmd:0 rrw:0| 14:50:38.6 59684801

102503 1/00c08a90 (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb7c9 +4 clks
102507 1/00c08a92 (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb7cd +8 clks

3 102512 1/00c08a94 (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb7d5 +8 clks
102524 1/00c08a96 (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb7dd +4 clks
102528 1/00c08a98 (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb7e1 +8 clks

4 102533 1/00c08a9a (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb7e9 +8 clks
102545 1/00c08a9c (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb7f1 +4 clks
102549 1/00c08a9e (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb7f5 +8 clks

5 102554 1/00c08aa0 (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb7fd +8 clks
102557 src/storage/profile.c:ProfileLoop:777:ProFile access at PC:1/00c08aa0 event:1 read IRA state:10 SEND_DATA_AND_TAGS_STATE idxr,idxw: 532,4 bsy:0 cmd:0 rrw:0| 14:50:38.6 59684861
102566 1/00c08aa2 (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb805 +4 clks
102570 1/00c08aa4 (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb809 +8 clks

6 102575 1/00c08aa6 (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb811 +8 clks
102587 1/00c08aa8 (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb819 +4 clks
102591 1/00c08aaa (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb81d +8 clks

7 102596 1/00c08aac (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb825 +8 clks
102599 src/storage/profile.c:ProfileLoop:777:ProFile access at PC:1/00c08aac event:1 read IRA state:10 SEND_DATA_AND_TAGS_STATE idxr,idxw: 534,4 bsy:0 cmd:0 rrw:0| 14:50:38.6 59684901

102608 1/00c08aae (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb82d +4 clks
102612 1/00c08ab0 (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb831 +8 clks

8 102617 1/00c08ab2 (0 0/0/0) : 1012                       : ..       :  239 : MOVE.B     (A2),D0  SRC:clk:00000000038eb839 +8 clks
102629 1/00c08ab4 (0 0/0/0) : b101                       : ..       : 1278 : EOR.B      D0,D1  SRC:clk:00000000038eb841 +4 clks
102633 1/00c08ab6 (0 0/0/0) : 10c0                       : ..       :  225 : MOVE.B     D0,(A0)+  SRC:clk:00000000038eb845 +8 clks

102639 1/00c08ab8 (0 0/0/0) : 51ca ffce                  : Q...     : 1031 : DBRA.W     #$c08a88,D2  SRC:clk:00000000038eb84d +10 clks


Edit: seeing the same kind of read + xor in MacWorks XL 3.0 as well. Since MacWorks is built on top of Monitor OS and Monitor OS was built before LOS, I suspect this is the original source of this behavior, and likely the XOR is used with one of the tags, perhaps as a way for the scavenger program to detect corrupted data.
« Last Edit: March 23, 2021, 08:10:35 pm by rayarachelian »
Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'

rayarachelian

  • Administrator
  • Sr. Member
  • *****
  • Karma: +25/-0
  • Offline Offline
  • Posts: 467
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: LisaEm 1.2.7-RC3a support bug reports
« Reply #140 on: April 12, 2021, 11:16:50 pm »

Eh, so 6 weeks forwards, 3 weeks back.

Had to roll back some of the profile HLE code. In my zeal to get UniPlus working, I hadn't noticed for quite a few days that I broke LOS from booting, and then had to do a lot of bisecting to figure out exactly where the bugs were, and roll them back. Pushed to unstable.

The new HLE (High Level Emulation) checkbox in preferences works for the Boot ROM phase of loading LOS (before the Welcome screen).

I'll also be adding LOS+MacWorks HLE support in the next few days/weeks. Will re start again on UniPlus, but I guess I'll have to keep testing against LOS.
Logged
Fate whispers to the warrior, 'You can not withstand the storm.'  The warrior whispers back, 'I am the storm.'
Pages: 1 ... 8 9 [10]   Go Up