Code: Select all
00000931306p[CLVGA] >>PANIC<< mem_write: graphics: mapping = 0
может знает кто, что такое mapping?
Code: Select all
00000931306p[CLVGA] >>PANIC<< mem_write: graphics: mapping = 0
Code: Select all
Unit Unit1;
(* -------------------------------------------------------- *)
Interface
(* -------------------------------------------------------- *)
Type
Dword = Cardinal;
Size = Record
Height: Word;
Width : Word;
End;
Var
hConsole: Pointer;
ConsoleInit: Procedure(WndWidth, WndHeight, ScrWidth, ScrHeight: Dword; Caption: PChar); StdCall;
ConsoleExit: Procedure(bCloseWindow: Cardinal); StdCall;
printf: Function(Const Format: PChar): Integer; CDecl VarArgs;
(* -------------------------------------------------------- *)
Procedure Main; Forward;
Procedure ThreadTerminate; Forward;
Function LoadLibrary(Path: PChar): Pointer; StdCall; Forward;
Function GetProcAddress(hLib: Pointer; ProcName: PChar): Pointer; StdCall; Forward;
Function GetScreenSize: Size; Forward;
Function GetScreenBitsPerPixel: Cardinal; Forward;
Function GetScreenBytesPerScanLine: Cardinal; Forward;
(* -------------------------------------------------------- *)
Implementation
(* -------------------------------------------------------- *)
Procedure Main();
Var
Screen: Size;
Begin
hConsole := LoadLibrary('/sys/lib/console.obj');
ConsoleInit := GetProcAddress(hConsole, 'con_init');
ConsoleExit := GetProcAddress(hConsole, 'con_exit');
printf := GetProcAddress(hConsole, 'con_printf');
ConsoleInit($FFFFFFFF, $FFFFFFFF, $FFFFFFFF, $FFFFFFFF, 'Test');
Screen := GetScreenSize();
printf('Screen = %dx%d'#10, Screen.Width, Screen.Height);
printf('ScreenBitsPerPixel = %d'#10, GetScreenBitsPerPixel);
printf('ScreenBytesPerScanLine = %d'#10, GetScreenBytesPerScanLine);
ConsoleExit(0);
ThreadTerminate;
End;
(* -------------------------------------------------------- *)
Function GetScreenSize: Size;
Asm
push ebx
mov eax, 61
mov ebx, 1
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
Function GetScreenBitsPerPixel: Cardinal;
Asm
push ebx
mov eax, 61
mov ebx, 2
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
Function GetScreenBytesPerScanLine: Cardinal;
Asm
push ebx
mov eax, 61
mov ebx, 3
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
Procedure ThreadTerminate();
Asm
mov eax, $FFFFFFFF
int 64
End;
(* -------------------------------------------------------- *)
Function GetProcAddress(hLib: Pointer; ProcName: PChar): Pointer;
Asm
push esi
push edi
push ebx
mov edx, hLib
xor eax, eax
test edx, edx
jz @end
mov edi, ProcName
mov ecx, $FFFFFFFF
repne scasb
mov ebx, ecx
not ebx
@next:
mov esi, [edx]
test esi, esi
jz @end
mov ecx, ebx
mov edi, ProcName
add edx, 8
repe cmpsb
jne @next
mov eax, [edx - 4]
@end:
pop ebx
pop edi
pop esi
End;
(* -------------------------------------------------------- *)
Function LoadLibrary(Path: PChar): Pointer;
Asm
push ebx
mov eax, 68
mov ebx, 19
mov ecx, Path
int 64
pop ebx
End;
(* -------------------------------------------------------- *)
End.
Users browsing this forum: No registered users and 0 guests