Skip to content

Commit

Permalink
cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
thamugadi committed Jan 1, 2022
1 parent ceb68a6 commit 3f271fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
8 changes: 0 additions & 8 deletions entry/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,3 @@ void memcpy(unsigned char* dest, unsigned char* src, int n)
}
}

unsigned char u8_extract_bit(unsigned char n, unsigned char bit)
{
return (n & (0b10000000 >> bit)) >> (7 - bit);
}
unsigned char u32_extract_bit(unsigned int n, unsigned char bit)
{
return (n & (0x80000000 >> bit)) >> (31 - bit);
}
2 changes: 1 addition & 1 deletion entry/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define __VRAM__BEIGE 0x80000000
#define __BIOS__BEIGE 0xFFC00000
#define __TIMR__BEIGE 0x81080038
#define __TIMR__BEIGE 0 //
#define __VRAM__MAC99 0x81000000
#define __BIOS__MAC99 0xFFF00000
#define __TIMR__MAC99 0x80080038
Expand Down
2 changes: 2 additions & 0 deletions entry/start.s
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.globl _start
_start:
stwu 1, -0x7fff(1)

b main
23 changes: 16 additions & 7 deletions loader/load.fth
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
." powerpc-ofw-boot : Booting through OpenFirmware..." cr

\ storing 0xBE for beige, 0x5A for mac99
\ cannot use superior, inferior, different symbols (bootinfo.txt)
: sup - dup abs = ;
: inf dup sup 1 + ;
: diff = if 0 else -1 then ;
: fba frame-buffer-adr ;
: beige-vram 80000000 ; : mac99-vram 81000000 ;
: hardware-error ." Hardware not supported." ;

fba beige-vram = if ." Beige hardware detected" cr 0BE beige-vram c! then
fba mac99-vram = if ." mac99 hardware detected" cr 05A mac99-vram c! then


: hardware-error ." Hardware not supported." cr ;
: beige-message ." Beige hardware detected" cr ;
: mac99-message ." mac99 hardware detected" cr ;
: beige-magic-number 0BE ;
: mac99-magic-number 05A ;
: magic-number-offset 0 ;
: width-offset 4 ;
: height-offset 8 ;

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

." informations stored :" cr
fba a dump

variable run
-1 run !
fba beige-vram diff fba mac99-vram diff and if hardware-error cr 0 run ! then
fba beige-vram diff fba mac99-vram diff and if hardware-error 0 run ! then
run @ 0 = if 1 0 do 0 +loop then
." Running Game of Life: " cr
boot hd:,\boot\kernel.elf
Expand Down

0 comments on commit 3f271fc

Please sign in to comment.