From 08b5f5a9e7a73726f121b5c8819ff2e4a053c695 Mon Sep 17 00:00:00 2001 From: garritfra Date: Sat, 9 Feb 2019 14:44:18 +0100 Subject: [PATCH] Enable input --- Makefile | 3 +++ boot.asm | 23 ++++++++++++----------- boot.elf | Bin 0 -> 1120 bytes 3 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 boot.elf diff --git a/Makefile b/Makefile index d8fd161..07f2fd0 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,6 @@ image: bin: nasm -f bin -o boot.bin boot.asm + +run: prog + qemu-system-x86_64 dittoOS.img \ No newline at end of file diff --git a/boot.asm b/boot.asm index 3536a72..9d30080 100644 --- a/boot.asm +++ b/boot.asm @@ -1,5 +1,7 @@ BITS 16 +main + start: mov ax, 07C0h ; Set up 4K stack space after this bootloader add ax, 288 ; (4096 + 512) / 16 bytes per paragraph @@ -7,24 +9,23 @@ start: mov sp, 4096 mov ax, 07C0h ; Set data segment to where we're loaded + add ax, 1000 mov ds, ax - mov si, text_string ; Put string position into SI - call print_string ; Call our string-printing routine - - mov ah, 1h ; Read Char (Saved in al) - int 21h ; Execute - mov dl, al ; copy char to dl - - mov ah, 2h ; Write char - int 21h ; Execute - - jmp $ ; Jump here - infinite loop! +main_loop: + call read_char + jmp main_loop ; Jump here - infinite loop! text_string db 'Loading kernel', 0 +read_char: + mov ah, 0h + int 16h + mov ah, 0eh + int 10h + print_string: ; Routine: output string in SI to screen mov ah, 0Eh ; int 10h 'print char' function diff --git a/boot.elf b/boot.elf new file mode 100644 index 0000000000000000000000000000000000000000..fff3f8868de372c80ea7d388c727da85158be38a GIT binary patch literal 1120 zcmb<-^>JflWMqH=Mh0dE1doBi0V-hvrZpH?8JJ*7Nuoh!f-oCYmjH-^WRw6@oE=Cr zL)joo0LW29;)Aq-fFKYfX=iW%s@nh*V*z4rC=D`G5{Qw_`vBx*0L5ScW*&^c;{ZFW z0%PBWJq!XsX5Wn$f();J`{XC4WagzSWTzJ8rRFefVK^(ch3~Au7QQt$3?(dQ1zvwY z4AVbK59JUDUB#eRl3G#1pjVtxTvAk$m;_{1=0a!)pMdv}(-RBB$N$L6K{<;HSpdlA zN8^hE`LMhI$}#dlK1d7#7#XyI3>6p`C~pd6>mc!+fNVV^ei)E#j>Kn3%Fi#+ODxW1 z$W6@5V<;|3EGhvr<8$)!3m8D2j|ci3nA#bNQWI0+lQR;F7z%)VxG*wDuPC)3HL(Om MfnG{}UMk#105B3$^Z)<= literal 0 HcmV?d00001