24-bit VGA
This commit is contained in:
parent
f32a405e0f
commit
efd9d6946c
5
Makefile
5
Makefile
|
@ -1,3 +1,4 @@
|
|||
MACHINE=mac99
|
||||
PPC=powerpc-linux-gnu
|
||||
QEMU=qemu-system-ppc
|
||||
DISK.APM: kernel.elf bootinfo.txt scripts/kpartx.sh
|
||||
|
@ -24,8 +25,8 @@ start.elf: entry/start.s
|
|||
clean:
|
||||
rm *.APM *elf *txt
|
||||
run:
|
||||
$(QEMU) *.APM -g 1024x768x32
|
||||
$(QEMU) *.APM -g 1280x768x32 -machine $(MACHINE)
|
||||
debug:
|
||||
$(QEMU) *.APM -d in_asm -g 1024x768x32
|
||||
$(QEMU) *.APM -d in_asm -g 1280x768x32 -machine $(MACHINE)
|
||||
all:
|
||||
make clean && make && make run
|
||||
|
|
48
entry/boot.c
48
entry/boot.c
|
@ -1,16 +1,18 @@
|
|||
#define beige 0xBE
|
||||
#define mac99 0x5A
|
||||
#define __VRAM__BEIGE 0x80000000
|
||||
#define __VRAM__MAC99 0x81000000
|
||||
#define __BIOS__BEIGE 0xFFC00000
|
||||
#define __BIOS__MAC99 0xFFF00000
|
||||
#define beige 0xBE
|
||||
#define mac99 0x5A
|
||||
|
||||
#define __VRAM__BEIGE 0x80000000
|
||||
#define __BIOS__BEIGE 0xFFC00000
|
||||
|
||||
unsigned char IO_TYPE;
|
||||
#define __VRAM__MAC99 0x81000000
|
||||
#define __BIOS__MAC99 0XFFF00000
|
||||
#define __USB_KEYBOARD__MAC99 0x80080038
|
||||
#define __USB_MOUSE__MAC99 0x8008003C
|
||||
|
||||
unsigned char IO_TYPE;
|
||||
unsigned char* p_vram;
|
||||
unsigned char* p_bios;
|
||||
|
||||
|
||||
void get_io_type(void)
|
||||
{
|
||||
if (*(unsigned char*)__VRAM__BEIGE == beige) IO_TYPE = beige;
|
||||
|
@ -21,9 +23,7 @@ void init(void)
|
|||
{
|
||||
if (IO_TYPE == beige)
|
||||
{
|
||||
p_vram = __VRAM__BEIGE;
|
||||
p_bios = __BIOS__BEIGE;
|
||||
|
||||
for(;;); // unsupported yet.
|
||||
}
|
||||
else if (IO_TYPE == mac99)
|
||||
{
|
||||
|
@ -36,29 +36,23 @@ void main(void)
|
|||
{
|
||||
get_io_type();
|
||||
init();
|
||||
clearscreen(0xAA,0xBB);
|
||||
clearscreen(100,85,100, 0x100000);
|
||||
for(;;);
|
||||
}
|
||||
|
||||
void clearscreen(unsigned char a, unsigned char b)
|
||||
void clearscreen(unsigned char a, unsigned char b, unsigned char c, int n)
|
||||
{
|
||||
init();
|
||||
for (unsigned int i = 0; i<0x100000; i++)
|
||||
for (unsigned int i = 0; i<n; i++)
|
||||
{
|
||||
*p_vram = a;
|
||||
//24-bit VGA
|
||||
*p_vram = 0;
|
||||
p_vram++;
|
||||
*p_vram = b;
|
||||
*p_vram = a;
|
||||
p_vram++;
|
||||
*p_vram = b;
|
||||
p_vram++;
|
||||
*p_vram = c;
|
||||
p_vram++;
|
||||
}
|
||||
}
|
||||
|
||||
void noisescreen(void)
|
||||
{
|
||||
init();
|
||||
for (unsigned int i = 0; i<0x200000; i++)
|
||||
{
|
||||
*p_vram = *(p_bios+0x2F0000+i);
|
||||
p_vram++;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
.globl _start
|
||||
_start:
|
||||
li 1, 0xac
|
||||
b main
|
||||
|
|
|
@ -8,14 +8,15 @@
|
|||
: fba frame-buffer-adr ;
|
||||
: beige-vram 80000000 ; : mac99-vram 81000000 ;
|
||||
|
||||
: beige-error ." G3 Beige machine isn't supported yet. Please run it with a post-1999 PowerPC Mac." ;
|
||||
|
||||
variable run
|
||||
-1 run !
|
||||
|
||||
fba beige-vram = if ." Beige" cr 100 0 do 0BE i beige-vram + c! loop then
|
||||
fba mac99-vram = if ." mac99" cr 100 0 do 05A i mac99-vram + c! loop then
|
||||
fba beige-vram = if beige-error cr 100 0 do 0BE i beige-vram + c! loop then
|
||||
fba mac99-vram = if ." mac99" cr 100 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
|
||||
|
||||
fba 100 dump
|
||||
|
||||
run @ 0 = if 1 0 do 0 +loop then
|
||||
|
||||
boot hd:,\boot\kernel.elf
|
||||
|
|
Loading…
Reference in New Issue