Compare commits

...

2 Commits

Author SHA1 Message Date
aramya acfac4f69e linker script 2023-07-04 12:45:32 +01:00
aramya cf35510749 fba 2023-07-04 12:04:46 +01:00
5 changed files with 37 additions and 13 deletions

View File

@ -2,7 +2,7 @@ MACHINE = mac99
PPC = powerpc-eabi
QEMU = qemu-system-ppc
RES = 1600x900x32
CPU = g4
SOURCES_C = $(shell find src -name "*.c")
SOURCES_S = $(shell find src -name "*.s")
OBJECTS = $(SOURCES_C:.c=.elf) $(SOURCES_S:.s=.elf)
@ -26,8 +26,8 @@ bootinfo.txt: loader/load.fth loader/def.fth
cat loader/load.fth >> bootinfo.txt
echo "</boot-script></chrp-boot>" >> bootinfo.txt
kernel.elf: $(OBJECTS)
$(PPC)-ld -Ttext=0x02000000 -Tdata=0x02100000 $^ -o $@
kernel.elf: linker.ld $(OBJECTS)
$(PPC)-ld -T $^ -o $@
%.elf: %.c
$(PPC)-gcc -I include -c $< -o $@
@ -40,7 +40,9 @@ clean:
find src -name "*.elf" -type f -delete
run:
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE)
$(QEMU) -hda *.APM -g $(RES) -machine $(MACHINE) -cpu $(CPU)
debug:
$(QEMU) -hda *.APM -d in_asm -g $(RES) -machine $(MACHINE)
$(QEMU) -hda *.APM -d in_asm -g $(RES) -machine $(MACHINE) -cpu $(CPU)
gdb:
$(QEMU) -hda *.APM -s -S -g $(RES) -machine $(MACHINE) -cpu $(CPU)

21
linker.ld Normal file
View File

@ -0,0 +1,21 @@
ENTRY(_start)
SECTIONS
{
. = 0x02000000;
.text BLOCK(4K) : ALIGN(4K)
{
*(.text)
}
. = 0x02100000;
.data BLOCK(4K) : ALIGN(4K)
{
*(.rodata)
*(.data)
}
.bss BLOCK(4K) (NOLOAD) : ALIGN(4K)
{
*(.bss)
}
}

View File

@ -3,7 +3,7 @@
: inf dup sup 1 + ;
: diff = if 0 else -1 then ;
: fba frame-buffer-adr ;
: beige-vram 80000000 ; : mac99-vram 81000000 ;
: beige-fba 80000000 ; : mac99-fba 81000000 ;
: hardware-error ." Hardware not supported." cr ;
: beige-message ." Beige hardware detected" cr ;
: mac99-message ." mac99 hardware detected" cr ;

View File

@ -1,12 +1,12 @@
initmsg
fba beige-vram = if beige-message beige-magic-number beige-vram c! then
fba mac99-vram = if mac99-message mac99-magic-number mac99-vram c! then
fba beige-vram = if screen-width 4 beige-vram + l! then
fba beige-vram = if screen-height 8 beige-vram + l! then
fba mac99-vram = if screen-width 4 mac99-vram + l! then
fba mac99-vram = if screen-height 8 mac99-vram + l! then
fba beige-fba = if beige-message beige-magic-number beige-fba c! then
fba mac99-fba = if mac99-message mac99-magic-number mac99-fba c! then
fba beige-fba = if screen-width 4 beige-fba + l! then
fba beige-fba = if screen-height 8 beige-fba + l! then
fba mac99-fba = if screen-width 4 mac99-fba + l! then
fba mac99-fba = if screen-height 8 mac99-fba + l! then
variable run
-1 run !
fba beige-vram diff fba mac99-vram diff and if hardware-error 0 run ! then
fba beige-fba diff fba mac99-fba diff and if hardware-error 0 run ! then
run @ 0 = if 1 0 do 0 +loop then
boot hd:,\boot\kernel.elf

View File

@ -13,6 +13,7 @@ void __eabi(void)
//void* ofw_interpret(char* cmd, int32_t* stack_args, int n_stack_args, int n_ret_args, int32_t* reta
void main(void)
{
ofw_interpret("show-devs", 0, 0, 0, 0);
puts("Press any key to continue", 25);
ofw_interpret("blink-screen", 0, 0, 0, 0);
ofw_interpret("key", 0, 0, 1, (int32_t*)0x03020000);