added mac99 support

This commit is contained in:
aramya 2021-09-30 03:19:50 +01:00
parent e4e6a6ba81
commit fc6d7ad104
4 changed files with 28 additions and 34 deletions

View File

@ -10,20 +10,20 @@ DISK.APM: kernel.elf bootinfo.txt kpartx.sh
sudo cp kernel.elf /mnt/boot
sudo umount /mnt/
sudo kpartx -d DISK.APM
bootinfo.txt: load.fs
bootinfo.txt: load.fth
echo "<chrp-boot><boot-script>" >> bootinfo.txt
cat load.fs >> bootinfo.txt
cat load.fth >> bootinfo.txt
echo "</boot-script></chrp-boot>" >> bootinfo.txt
kernel.elf: boot.elf boot1.elf
$(PPC)-ld -Ttext=0x200000 boot.elf boot1.elf -o kernel.elf
kernel.elf: boot0.elf boot1.elf
$(PPC)-ld -Ttext=0x200000 boot0.elf boot1.elf -o kernel.elf
boot1.elf: boot.c
$(PPC)-gcc -c boot.c -o boot1.elf
boot.elf: boot.S
$(PPC)-as -c boot.S -o boot.elf
boot0.elf: boot.S
$(PPC)-as -c boot.S -o boot0.elf
clean:
rm DISK.APM *elf *txt
run:
qemu-system-ppc DISK.APM
qemu-system-ppc -M mac99 DISK.APM
debug:
qemu-system-ppc DISK.APM -d in_asm
all:

3
boot.S
View File

@ -1,4 +1,3 @@
.globl _start
_start:
addi 1,1,1
_start:
b begin

31
boot.c
View File

@ -1,28 +1,9 @@
#define DEVICE16 0x81080000
#define DEVICE16END 0x810FFFFF
#define VRAM 0x80000000
#define VRAMEND 0x80FFFFFF
#define BIOS 0xFFC00000
#define BIOSEND 0xFFFFFFFF
void begin(void)
{
unsigned char* addr = VRAM;
unsigned char* noise = BIOS+0x2E0000;
while (addr < VRAMEND)
{
*addr = *noise;
addr++;
noise++;
}
begin();
}
void clearscreen(void)
{
unsigned char* addr = 0x80000000;
while (addr < 0x80FFFFFF)
{
*addr = 0;
addr++;
}
unsigned char type;
unsigned char *ptr_beige = 0x80000000;
unsigned char *ptr_mac99 = 0x81000000;
if (*ptr_beige == 0xBE) type = 0xBE;
if (*ptr_mac99 == 0x5A) type = 0x5A;
for(;;);
}

14
load.fth Normal file
View File

@ -0,0 +1,14 @@
." powerpc-ofw-boot : Booting through OpenFirmware..." cr
\ storing 0xBE for beige, 0x5A for mac99
\ cannot use superior / inferior symbols (bootinfo.txt)
: superior - dup abs = ;
: inferior dup superior 1 + ;
frame-buffer-adr 80000000 = if
." Beige" cr
10000 0 do BE i 80000000 + c! BE 1 i + 80000000 + c! 2 +loop
then
frame-buffer-adr 81000000 = if
." mac99" cr
10000 0 do 5A i 81000000 + c! 5A 1 i + 81000000 + c! 2 +loop
then
boot hd:,\boot\kernel.elf