diff --git a/Makefile b/Makefile index cdd9f8d..ff2e14d 100644 --- a/Makefile +++ b/Makefile @@ -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 "" >> bootinfo.txt - cat load.fs >> bootinfo.txt + cat load.fth >> bootinfo.txt echo "" >> 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: diff --git a/boot.S b/boot.S index d469a33..449991d 100644 --- a/boot.S +++ b/boot.S @@ -1,4 +1,3 @@ .globl _start -_start: -addi 1,1,1 +_start: b begin diff --git a/boot.c b/boot.c index fcd173b..5d186da 100644 --- a/boot.c +++ b/boot.c @@ -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(;;); } diff --git a/load.fth b/load.fth new file mode 100644 index 0000000..97efc0f --- /dev/null +++ b/load.fth @@ -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