From 91bc53bb8743185a39142c1c046b49e33cd3bba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20Kj=C3=A6r-Kammersgaard?= Date: Thu, 8 Nov 2018 15:19:58 +0100 Subject: [PATCH] Cool Animation --- DEBUG_32_GRAPHICS | 0 bootloader.nasm | 2 ++ build | 25 ++++++++++--------------- build.sh | 2 +- go32bit.nasm | 33 ++++++++++++++++++++++++--------- kernel.nasm | 5 +++++ 6 files changed, 42 insertions(+), 25 deletions(-) create mode 100644 DEBUG_32_GRAPHICS diff --git a/DEBUG_32_GRAPHICS b/DEBUG_32_GRAPHICS new file mode 100644 index 0000000..e69de29 diff --git a/bootloader.nasm b/bootloader.nasm index a271230..2b1c99f 100644 --- a/bootloader.nasm +++ b/bootloader.nasm @@ -28,6 +28,7 @@ start: mov si, message ; Put address of the null-terminated string to output into 'si' call print ; Call our string-printing routine +%ifdef DEBUG_MODE mov si, enter_debug_mode call print call printCRLF @@ -43,6 +44,7 @@ start: mov ah, 0x01 ; BIOS call to wait for key int 0x16 jnz debug_mode +%endif ; entering system check: mov si, enter_system_check diff --git a/build b/build index 709bf38..d899b85 100755 --- a/build +++ b/build @@ -1,17 +1,12 @@ #!/usr/bin/bash -# if [ "$1" == "build" ] || [ "$1" == "run" ]; then -# nasm -fbin bootloader.nasm -o bootloader.bin -# nasm -fbin kernel.nasm -o kernel.bin -# cat bootloader.bin kernel.bin > SingOS.img - -# if [ $1 == "run" ]; then -# qemu-system-x86_64 -drive index=0,format=raw,file=SingOS.img -# else -# bash -c "echo;echo;echo 'Press [ENTER] to exit'; read line" -# fi -# fi - -# echo "Done" - -sh build.sh \ No newline at end of file +defines="-d DEBUG_32_GRAPHICS" +if nasm -fbin $defines bootloader.nasm -o bootloader.bin \ +&& nasm -fbin $defines kernel.nasm -o kernel.bin +then + cat bootloader.bin kernel.bin > SingOS.img + qemu-system-x86_64 -soundhw pcspk -drive index=0,format=raw,file=SingOS.img +else + echo "*** THERE WERE ERRORS ***" + read +fi \ No newline at end of file diff --git a/build.sh b/build.sh index f77a546..b75d3ac 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,7 @@ if [ "$1" != "run" ]; then fi if [ "$1" != "make" ]; then - qemu-system-x86_64 -drive index=0,format=raw,file=SingOS.img + qemu-system-x86_64 -soundhw pcspk -drive index=0,format=raw,file=SingOS.img fi echo "Done" \ No newline at end of file diff --git a/go32bit.nasm b/go32bit.nasm index fe436d5..bef63f8 100644 --- a/go32bit.nasm +++ b/go32bit.nasm @@ -1,4 +1,3 @@ - %define GDT_Paragraph 0x1000 %define GDT (GDT_Paragraph*16) %define GDT_CodeSegIndex 1 @@ -245,11 +244,13 @@ ProtectedModeBaby: ; Setup stack mov esp, 0xffffffff + + DrawStuff: - push ebp - mov ebp, esp - sub esp, 4 + ; push ebp + ; mov ebp, esp + ; sub esp, 4 mov ecx, 0 mov edx, 0 @@ -258,19 +259,22 @@ ProtectedModeBaby: LoopRows: LoopCols: mov ebx, ecx - sub ebx, 160 + sub ebx, DWORD [things] imul ebx, ebx ; shr ebx, 0 mov eax, ebx mov ebx, edx - sub ebx, 100 + sub ebx, DWORD [things] imul ebx, ebx add eax, ebx shr eax, 8 - xor eax, ecx - sub eax, edx - ror al, 7 + sub eax, ecx + add eax, edx + sub eax, 431838 + xor eax, DWORD [things] + shr ax, 3 + mov byte [edi], al ; @@ -296,6 +300,16 @@ ProtectedModeBaby: je BreakLoopRows jmp LoopRows BreakLoopRows: + + add DWORD [things], 1 + + mov al, byte [things] + test al, 1 + + + jmp DrawStuff + + %if 0 WriteProtectedModeString: lea esi, [ProtectedWelcomeStr] @@ -324,4 +338,5 @@ HALT: ;; Strings ;;;;;;;;;;;;;;;;;;;;;;;; ProtectedWelcomeStr: db " Placeholder for SingOS - 32 bit edition! ", 0 + things: dd 134558 align 512 diff --git a/kernel.nasm b/kernel.nasm index 96428d0..34b8558 100644 --- a/kernel.nasm +++ b/kernel.nasm @@ -24,6 +24,11 @@ sing_loaded: ; SingOS is ready for the user: mov bp, sp sing_ready: ; SingOS is ready for the user: + +%ifdef DEBUG_32_GRAPHICS + jmp Go32Bit +%endif + call os_clear_screen mov si, welcome ; Put address of the null-terminated string to output into 'si' call print ; Call our string-printing routine