init.fs (1753B) - raw
1 \ Initialization for PC 2 \ This is hardcoded for QEMU with -machine pc and a floppy boot disk. 3 \ You need to adapt to your own machine. 4 : ARCH S" i386" ; 5 6 \ i386 can access unaligned memory just fine and some PC-specific drivers have 7 \ fuzzy alignment. Rather than artificially complicating them, we disable 8 \ alignment checks on i386 9 :realias align2# drop ; 10 :realias align4# drop ; 11 12 f<< /drv/pc/acpi.fs 13 \ Serial communication 14 \ f<< /drv/pc/com.fs 15 f<< /sys/grid.fs 16 f<< /drv/pc/vga.fs 17 VgaGrid :new ' grid rebind 18 grid :self to console writeio 19 20 \ Overwrite the boot drive which depends on int13h with a real drive. 21 \ Floppy boot drive 22 \ f<< /drv/pc/fdc.fs 23 \ floppy :init 24 \ floppy :self bootfs drv floppy SZ move 25 26 f<< /drv/pc/pci.fs 27 \ IDE boot drive 28 f<< /drv/pc/ata.fs 29 ATA0:0 ATADrive :reset drop 30 ATA0:0 bootfs drv ATADrive SZ move 31 32 \ AHCI boot drive 33 \ f<< /drv/pc/ahci.fs 34 \ 0 AHCIDrive :new dup bootfs drv AHCIDrive SZ move ( drv ) 35 \ AHCIDrive :enable 36 37 \ Now that int13h won't be used anymore, it's safe to configure the PIC 38 f<< /drv/pc/pic.fs 39 pic$ idt$ 40 41 f<< /fs/fat.fs 42 bootfs :patchlo 43 44 f<< /sys/kbd.fs 45 f<< /sys/mouse.fs 46 f<< /drv/pc/ps28042.fs 47 f<< /sys/ps2.fs 48 49 8042ps2$ 50 ' 8042kbd@? ' (ps2@?) realias 51 ' ps2keyset1? ' key? realias 52 53 8042mouse$ 54 PS2Mouse :new ' mouse rebind 55 640 480 4 mouse :configure 56 57 f<< /sys/loop.fs 58 f<< /drv/pc/a20.fs 59 a20$ 60 f<< /sys/scratch.fs 61 f<< /sys/screen.fs 62 f<< /drv/pc/vesa.fs 63 VESA2Screen :new ' screen rebind 64 65 ?f<< /gr/cursor.fs 66 screen :self Cursor :new structbind Cursor cursor 67 68 0 value hidemousecursor 69 : mousemove ( -- ) 70 mouseupdate screen :activated? if 71 hidemousecursor not if mouse :x mouse :y cursor :move then 72 else 73 mouse :x 16 lshift mouse :y or grid :dbgnum1! 74 mouse buttons grid :dbgnum2! then ; 75 current loopadd