mirror of
https://github.com/thamugadi/powerpc-ofw-boot.git
synced 2025-01-30 08:30:23 +00:00
VRAM modification
This commit is contained in:
parent
090102b47a
commit
a0ab1dfe98
12
Makefile
12
Makefile
@ -14,12 +14,12 @@ bootinfo.txt: load.fth
|
|||||||
echo "<chrp-boot><boot-script>" >> bootinfo.txt
|
echo "<chrp-boot><boot-script>" >> bootinfo.txt
|
||||||
cat load.fth >> bootinfo.txt
|
cat load.fth >> bootinfo.txt
|
||||||
echo "</boot-script></chrp-boot>" >> bootinfo.txt
|
echo "</boot-script></chrp-boot>" >> bootinfo.txt
|
||||||
kernel.elf: boot0.elf boot1.elf
|
kernel.elf: start.elf boot.elf
|
||||||
$(PPC)-ld -Ttext=0x200000 boot0.elf boot1.elf -o kernel.elf
|
$(PPC)-ld -Ttext=0x200000 start.elf boot.elf -o kernel.elf
|
||||||
boot1.elf: boot.c
|
boot.elf: boot.c memory.h
|
||||||
$(PPC)-gcc -c boot.c -o boot1.elf
|
$(PPC)-gcc -c boot.c -o boot.elf
|
||||||
boot0.elf: boot.S
|
start.elf: start.s
|
||||||
$(PPC)-as -c boot.S -o boot0.elf
|
$(PPC)-as -c start.s -o start.elf
|
||||||
clean:
|
clean:
|
||||||
rm DISK.APM *elf *txt
|
rm DISK.APM *elf *txt
|
||||||
run:
|
run:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# powerpc-ofw-boot
|
# powerpc-ofw-boot
|
||||||
Boots through OpenFirmware.
|
Boots through OpenFirmware.
|
||||||
Produces a HFS+ disk image formatted with Apple Partition Map partition scheme, compatible with old PowerPC-based Macs.
|
Produces a HFS+ disk image formatted with Apple Partition Map partition scheme, compatible with PowerPC-based Macs.
|
||||||
|
|
||||||
Run it with QEMU :
|
Run it with QEMU :
|
||||||
|
|
||||||
|
27
boot.c
27
boot.c
@ -1,9 +1,30 @@
|
|||||||
|
#include "memory.h"
|
||||||
|
#define beige 0xBE
|
||||||
|
#define mac99 0x5A
|
||||||
|
|
||||||
void begin(void)
|
void begin(void)
|
||||||
{
|
{
|
||||||
unsigned char type;
|
|
||||||
unsigned char *ptr_beige = 0x80000000;
|
unsigned char *ptr_beige = 0x80000000;
|
||||||
unsigned char *ptr_mac99 = 0x81000000;
|
unsigned char *ptr_mac99 = 0x81000000;
|
||||||
if (*ptr_beige == 0xBE) type = 0xBE;
|
if (*ptr_beige == beige) IO_TYPE = beige;
|
||||||
if (*ptr_mac99 == 0x5A) type = 0x5A;
|
if (*ptr_mac99 == mac99) IO_TYPE = mac99;
|
||||||
|
init_ptr();
|
||||||
|
clearscreen();
|
||||||
for(;;);
|
for(;;);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_ptr(void)
|
||||||
|
{
|
||||||
|
if (IO_TYPE == beige) vram_ptr = beige_vram;
|
||||||
|
if (IO_TYPE == mac99) vram_ptr = mac99_vram;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearscreen(void)
|
||||||
|
{
|
||||||
|
for (int i = 0; i<10000000; i++)
|
||||||
|
{
|
||||||
|
*vram_ptr = 0xFF;
|
||||||
|
i++;
|
||||||
|
vram_ptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
LOOP=$(sudo kpartx -s -a -v DISK.APM | awk -F'[ ]' '{print $3}' | tail -n1 )
|
LOOP=$(sudo kpartx -s -a -v DISK.APM | awk -F'[ ]' '{print $3}' | tail -n1 )
|
||||||
sudo mkfs.hfsplus /dev/mapper/$LOOP
|
sudo mkfs.hfsplus /dev/mapper/$LOOP
|
||||||
sudo mount -o loop /dev/mapper/$LOOP /mnt/
|
sudo mount -o loop /dev/mapper/$LOOP /mnt/
|
||||||
|
29
load.fth
29
load.fth
@ -1,14 +1,21 @@
|
|||||||
." powerpc-ofw-boot : Booting through OpenFirmware..." cr
|
." powerpc-ofw-boot : Booting through OpenFirmware..." cr
|
||||||
\ storing 0xBE for beige, 0x5A for mac99
|
\ storing 0xBE for beige, 0x5A for mac99
|
||||||
\ cannot use superior / inferior symbols (bootinfo.txt)
|
\ cannot use superior, inferior, different symbols (bootinfo.txt)
|
||||||
: superior - dup abs = ;
|
: sup - dup abs = ;
|
||||||
: inferior dup superior 1 + ;
|
: inf dup sup 1 + ;
|
||||||
frame-buffer-adr 80000000 = if
|
: diff = if 0 else -1 then ;
|
||||||
." Beige" cr
|
|
||||||
10000 0 do BE i 80000000 + c! BE 1 i + 80000000 + c! 2 +loop
|
: fba frame-buffer-adr ;
|
||||||
then
|
: beige-vram 80000000 ; : mac99-vram 81000000 ;
|
||||||
frame-buffer-adr 81000000 = if
|
|
||||||
." mac99" cr
|
variable run
|
||||||
10000 0 do 5A i 81000000 + c! 5A 1 i + 81000000 + c! 2 +loop
|
-1 run !
|
||||||
then
|
|
||||||
|
fba beige-vram = if ." Beige" cr 7000 0 do 0BE i beige-vram + c! loop then
|
||||||
|
fba mac99-vram = if ." mac99" cr 7000 0 do 05A i mac99-vram + c! loop then
|
||||||
|
fba beige-vram diff fba mac99-vram diff and if ." Hardware not supported." cr 0 run ! then
|
||||||
|
|
||||||
|
run @ 0 = if 1 0 do 0 +loop then
|
||||||
|
|
||||||
|
|
||||||
boot hd:,\boot\kernel.elf
|
boot hd:,\boot\kernel.elf
|
||||||
|
6
memory.h
Normal file
6
memory.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#define beige_vram 0x80000000
|
||||||
|
#define mac99_vram 0x81000000
|
||||||
|
|
||||||
|
unsigned char IO_TYPE;
|
||||||
|
|
||||||
|
unsigned char* vram_ptr;
|
6
memorymap.h
Normal file
6
memorymap.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#define beige_vram 0x80000000
|
||||||
|
#define mac99_vram 0x81000000
|
||||||
|
|
||||||
|
unsigned char IO_TYPE;
|
||||||
|
|
||||||
|
unsigned char* vram_ptr;
|
Loading…
x
Reference in New Issue
Block a user