commit ce2fe6074b26d5e2a24125d0a40bee93e6da5751 from: Benjamin Stürz date: Sat Oct 05 16:19:08 2024 UTC sys: enable A20 line commit - a64d9d6ef94a1fe121764b0d24584975f3a515cd commit + ce2fe6074b26d5e2a24125d0a40bee93e6da5751 blob - afe5bebcd75abb4844da7b0e7296229b7425e083 blob + 70caa23fd2157d7894be2132becb32f759f4640b --- sys/TODO +++ sys/TODO @@ -1,3 +1,2 @@ -- enable A20 -- fill in GDT - set_irq() +- fill in IDT blob - 3fc59d313bfdc54792f5c76e6b0537ebe2a8c3a0 blob + e184e119eff712798b5cdba15c927da1884d518d --- sys/kernel.asm +++ sys/kernel.asm @@ -25,7 +25,52 @@ _entry: mov word [highmem], ax .noxm: + ; NOTE: BIOS cannot be accessed from here cli + + ; disable keyboard + call .wait + mov al, 0xAD + out 0x64, al + + ; read from input + call .wait + mov al, 0xD0 + out 0x64, al + call .wait2 + in al, 0x60 + mov bl, al + + ; write to output + call .wait + mov al,0xD1 + out 0x64,al + call .wait + mov al, bl + or al, 2 ; enable A20 line + out 0x60, al + + ; enable keyboard + call .wait + mov al, 0xAE + out 0x64, al + call .wait + jmp .setup + +.wait: + in al,0x64 + test al, 2 + jnz .wait + ret + + +.wait2: + in al,0x64 + test al,1 + jz .wait2 + ret + +.setup: lidt [idtr] lgdt [gdtr] smsw ax