Which Dev Library to use for Emulation?

Anything not about Mac emulation.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Which Dev Library to use for Emulation?

Post by kataetheweirdo »

I am trying to create my own emulator, but I'm not sure which library would best suit my purposes. I'm slightly tempted toward Allegro, but that doesn't fit my compiler like a glove to put it mildly. I'm using MinGW / gcc 5.1.0, if that helps any.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Which Dev Library to use for Emulation?

Post by adespoton »

I'd recommend basing on libretro. Then you get all the benefits of any future work done on that architecture.

What sort of emulation are you planning to do though? The libraries you use will mostly depend on that.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

LibRetro isn't bad, but I'm not sure if doing that before I even begin coding the emulator proper is a great idea. Especially given that what I'm doing is a computer (specifically, a PowerPC machine).
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Which Dev Library to use for Emulation?

Post by adespoton »

Basically, I think it's a good idea to figure out what you don't want/need to emulate as well as what you want to. Unlesss your question was actually simpler than that.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

So far I'm sticking with SDL2. I'm slowly trying to build up this emulator and collecting all the development materials I can. Needless to say, it's going a little rocky so far. If anyone wants to see the progress so far, there is a Discord server set up.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Which Dev Library to use for Emulation?

Post by adespoton »

Sounds good! Might want to look at what was done for MAME and LibRetro for ideas of what you want and don't want as far as structure and design.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

So, I have started on the emulator booting up the Power Mac G3 Beige ROM. But it quickly dies at 0xFFF321C after 149 opcodes, starting at 0xFFF00100.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

Well, I fixed a major code execution error, but now I'm trapped in an infinite loop after branching to a routine at 0xfff05bc4 (0x305BC4 in the ROM), which then unexpectedly goes to the loop at 0xfff05BE0 (0x305BE0 in the ROM).
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Which Dev Library to use for Emulation?

Post by adespoton »

0x305BE0 sounds really familiar, but is obscured by 20 years of neglect. Google's being no help :\
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

In the previous post, I was stuck in the routine referenced by 0xfff03024.

Some bugfixes later and now I'm almost halfway through the check-up routines in 0xfff03000. It currently malfunctions at 0xfff03044 (function address: 0xfff03778), where it calls a previous functions and gets stuck there in an infinite loop at 0xfff056a4.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

It currently stops out at 0xfff0304c. So roughly halfway through the initialization routine. But there seems to be some weird memory allocation issues I'm trying to track down in the ROM.
User avatar
adespoton
Forum All-Star
Posts: 4226
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Which Dev Library to use for Emulation?

Post by adespoton »

You've got further than I ever did now. Does the ROM chain memory allocation from the original ROM area to the larger ROM area, or just patch to the larger area right from initial allocation?

Paul Pratt might be able to help you there, as Mini vMac just patches it wholesale.
kataetheweirdo
Master Emulator
Posts: 313
Joined: Sun Feb 01, 2009 4:55 pm

Re: Which Dev Library to use for Emulation?

Post by kataetheweirdo »

Some technical notes I have gathered so far, with help from the cdg5 mailing group.

Code: Select all

VIRTUAL MEMORY MAP

5FFFEFF0 - NKSystemInfo
68000000 - Motorola 68K Emulator (0x100000 bytes)
FF800000 - Open Firmware

PHYSICAL MEMORY MAP

00000000 - 7FFFFFFF
    Mac OS Main Memory

    00400000 - OpenFirmware
    40000000 - Mirror of the ROM (NuBus Macs)
 
80000000 - FF000000
    PCI/Device Memory Area
 
81000000 - ATI MACH 64
 
F3000000 -
    Mac OS I/O Device area

F3000030 - MIO Register (0x10 bytes)

F3008000 - F3008FFF - DMA Channels

    F3008000 - SCSI DMA
    F3008100 - Floppy DMA
    F3008200 - Ethernet transmit DMA
    F3008300 - Ethernet receive DMA
    F3008400 - SCC channel A transmit DMA
    F3008500 - SCC channel A receive DMA
    F3008600 - SCC channel B transmit DMA
    F3008700 - SCC channel B receive DMA
    F3008800 - Audio out DMA
    F3008900 - Audio in DMA
    F3009000 - Reserved (0x7000 bytes)

F3010000 - SCSI device registers (0x100 bytes)
F3011000 - MACE (serial) device registers (0x100 bytes)
F3012000 - SCC compatibility port (?) (0x100 bytes)
F3013000 - SCC MacRISC port (Serial for 0x20, then Modem for 0x20, with remaining 0xC0 unknown)
F3014000 - AWAC (Audio) chip device registers
F3015000 - SWIM3 (floppy controller) device registers
F3016000 - pseudo VIA1 device registers
F3017000 - pseudo VIA2 device registers

F3020000 - Heathrow ATA

F3040000 - F037FFFF - Open PIC

F8000000 - Hammerhead memory controller registers (0x1000000 bytes)

FE010000 - 53C875 Hard Drive Controller

FE000000 - Grackle Low/Base (0x10000 bytes)
FEC00000 - Grackle Middle (0x1000 bytes)
FEE00000 - Grackle High (0x1000 bytes)

FF000000 - ?

FFC00000 - FFFFFFFF
    Mac OS ROM Area

    FFC00000 - FFEFFFFF - 68k Code Area

    (below addresses apply to Old World ROMs)
    FFF00100 - Reset Area (where the ROM begins executing)
    FFF10000 - Nanokernel Code
    FFF20000 - HW Init
Post Reply