From 639e4d8b93304325f700b75bafcd725d28160be2 Mon Sep 17 00:00:00 2001 From: Maxim Logaev Date: Wed, 14 Sep 2022 08:57:27 +0300 Subject: [PATCH] Check for maximum disp resolution supported by KOS and set debug level. --- vbox.asm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vbox.asm b/vbox.asm index af5fdd5..c3eab9d 100644 --- a/vbox.asm +++ b/vbox.asm @@ -27,6 +27,9 @@ include 'bga.inc' KOS_DISP_W_MIN = 640 KOS_DISP_H_MIN = 480 +KOS_DISP_W_MAX = 3840 +KOS_DISP_H_MAX = 2160 + section '.flat' readable writable executable proc START c, state, cmdline : dword @@ -34,7 +37,7 @@ proc START c, state, cmdline : dword cmp [state], DRV_ENTRY jne .fail - DEBUGF 1,"[vbox]: Start driver\n" + DEBUGF 2,"[vbox]: Start driver\n" invoke GetPCIList mov ebx, eax @@ -48,7 +51,7 @@ proc START c, state, cmdline : dword jmp .find_dev .dev_found: - DEBUGF 1,"[vbox]: Device found!\n" + DEBUGF 2,"[vbox]: Device found!\n" ; Get address of "display" structure in kernel. invoke GetDisplay @@ -110,7 +113,7 @@ proc START c, state, cmdline : dword ret .dev_not_found: - DEBUGF 1,"[vbox]: Device not found!\n" + DEBUGF 2,"[vbox]: Device not found!\n" .fail: pop edi esi ebx xor eax, eax @@ -153,9 +156,13 @@ proc set_display_res ; Skip if mode is less than minimum. cmp edi, KOS_DISP_W_MIN - jl .skip + jb .skip cmp esi, KOS_DISP_H_MIN - jl .skip + jb .skip + cmp edi, KOS_DISP_W_MAX + ja .skip + cmp esi, KOS_DISP_W_MAX + ja .skip cmp ecx, VBE_DISPI_BPP_32 jnz .skip