Author Topic: Mac OS Rom Hacking  (Read 23498 times)

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Mac OS Rom Hacking
« Reply #40 on: May 23, 2017, 06:20:22 AM »
Wow. That is way farther along than I had thought we were :)

Yeah.  Slow but moving. Not really much to say here  as that moves, unless people really want to hear method counts, method addresses and how many lines of code I have reviewed. If people want that, then cool I'll share it. Just would be a lot of info that may be useless because I would have no confidence in it until I get further. At that point I will share.

Sorry folks if you want more. Just ask. I will share all the mundane details.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Mac OS Rom Hacking
« Reply #41 on: May 30, 2017, 01:58:31 PM »
I was reading the revised edition of "Designing PCI Cards and Drivers" when I discovered this little snippet. It is part of a list describing how New World Macs are initialized. It is on page 92 (amazingly, page 92 of the pdf corresponds with the page numbered 92. This usually does not happen).
Quote
6. The Trampoline code decompresses the Mac OS ROM image, gathers information about the system from Open Firmware, creates data structures based on this information, terminates Open Firmware, and rearranges the contents of memory to an interim location in physical memory space.
7. The Trampoline code transfers control to the HardwareInit routine in the Mac OS ROM bootinfo file.
8. The HardwareInit routine copies data structures to their correct places in memory, and then calls the NanoKernel.
9. The NanoKernel fills in its data structures and then calls the 68K emulator.
So, have you found this HardwareInit routine yet? It looks interesting...

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: Mac OS Rom Hacking
« Reply #42 on: May 30, 2017, 02:26:47 PM »
daniel: what will happen if you boot another, non-prepared system folder with this rom file - or the other way round?
insert arbitrary signature here

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Mac OS Rom Hacking
« Reply #43 on: May 30, 2017, 02:47:55 PM »
It depends. If you stick the custom rom file in a system folder by itself, it will just not work. The file I made stores the required data in the bootfiles folder. It would not even begin to boot up normally. If you somehow boot up a system folder that has the custom rom file and bootfiles folder with another rom file (maybe by having that rom file on a partition without a system file and finder), it will behave just as a normal system folder. There is nothing in the normal startup code that looks in the bootfiles folder, so it is just ignored. The rom file would normally be consulted for a few things, but it has no resource fork so those consultations fail. Mac OS 9 seems to be ok with that. You could have a system that absolutely has to have some of the resources (or datafork pefs) stored in a regular rom file, but I have not come across one of those systems yet and have no idea which ones they would be, if any. I hope that this answered your question.

Offline ELN

  • Gold Member
  • *****
  • Posts: 295
  • new to the forums
Re: Mac OS Rom Hacking
« Reply #44 on: May 31, 2017, 01:25:26 AM »
So, have you found this HardwareInit routine yet? It looks interesting...

Unfortunately not. The HardwareInit routine was originally at ROM+340000 but was removed in v2 of the NewWorld ROM (the first version to use parcels, also called NewNewWorld). The later Trampoline versions jump straight to the NanoKernel, at ROM+310000.

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Mac OS Rom Hacking
« Reply #45 on: May 31, 2017, 03:46:25 AM »
Fascinating. I thought it would be something like that. The book had no mention of Mac OS 9 in it. Still, they probably share a lot of the same code. It would be interesting to find a sequence of opcodes in one and search for it in the other. That might tell us where the pagemap stuff in the Trampoline is.

Offline nanopico

  • Moderator
  • Platinum Member
  • *****
  • Posts: 767
Re: Mac OS Rom Hacking
« Reply #46 on: May 31, 2017, 06:02:35 AM »
Fascinating. I thought it would be something like that. The book had no mention of Mac OS 9 in it. Still, they probably share a lot of the same code. It would be interesting to find a sequence of opcodes in one and search for it in the other. That might tell us where the pagemap stuff in the Trampoline is.

I may have a few points wrong here but it is pretty close.

A lot of the documentation in Inside Macintosh and some of the extension like you are reading stopped being updates during OS 8 and 7.
By 9 they had no interest because they knew OS X was coming. Most of the documentation for 9 that was different from Inside Macintosh was done through Tech Notes if that.
Finding some of that data can be sort of hard.
The last thing I found in regards to the new world rom's and open firmware was from the first version and quit a bit changed since then.
If it ain't broke, don't fix it, or break it so you can fix it!

Offline nightstalkerpoet

  • Valued Member
  • **
  • Posts: 16
  • New Member
Re: Mac OS Rom Hacking
« Reply #47 on: January 06, 2018, 08:51:17 AM »
« Last Edit: January 06, 2018, 01:57:49 PM by nightstalkerpoet »

Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
insert arbitrary signature here

Offline zefrenchtoon

  • Veteran Member
  • ****
  • Posts: 119

Offline Daniel

  • Gold Member
  • *****
  • Posts: 300
  • Programmer, Hacker, Thinker
Re: Mac OS Rom Hacking
« Reply #50 on: July 18, 2022, 01:30:44 PM »
The system 7 source code link is here:
https://web.archive.org/web/20200224195214/http://www.toddp.com/classic/Software%20Install/Apple%20Source%20Code/System%207.1%20Source/Tools/

Very interesting but unfortunately, some files seems to be missing on the archive :(

Elliot (ELN on this site) has the sources, and has made various attempts to update them to Mac OS 9 over the years. Here is the latest attempt https://github.com/elliotnunn/supermario.


Offline IIO

  • Platinum Member
  • *****
  • Posts: 4440
  • just a number
Re: Mac OS Rom Hacking
« Reply #51 on: July 18, 2022, 04:33:04 PM »
oh, didnt check if it is complete. just noticed that the original is gone and thought i´d update the thread.

missing download links on archived sites is a pestilence.

can we post it here? i think it was on apple ftp for some years, too.
insert arbitrary signature here