Initial LVGL modifications
Basic LVGL wrapper with an example desktop & windowing system.
This commit is contained in:
1 parent
ceb03a9d7e
commit
989e36ffe2
17 files changed
+3378
-93
No files matched your search
@@ -11,3 +11,7 @@
|
|||||||
/*.img
|
/*.img
|
||||||
src/include/asuro.pas
|
src/include/asuro.pas
|
||||||
localenv.json
|
localenv.json
|
||||||
|
/lvgl/
|
||||||
|
dockerout.txt
|
||||||
|
AGENTS.md
|
||||||
|
*.log
|
||||||
+1
-1
@@ -5,7 +5,7 @@ VOLUME ["/code"]
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN dpkg --add-architecture i386
|
RUN dpkg --add-architecture i386
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
curl dos2unix wget git make nasm binutils:i386 xorriso grub-pc-bin && \
|
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin gcc gcc-multilib && \
|
||||||
apt-get clean my room
|
apt-get clean my room
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,7 @@ echo "Asuro Compilation"
|
|||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
#Compile Stub.asm
|
#Compile Stub.asm
|
||||||
rm lib/*
|
rm -f lib/*
|
||||||
|
|
||||||
runOrFail() {
|
runOrFail() {
|
||||||
local binary=$1
|
local binary=$1
|
||||||
@@ -23,6 +23,7 @@ runOrFail() {
|
|||||||
declare -a run_steps=(
|
declare -a run_steps=(
|
||||||
"compile_stub.sh" "Failed to compile stub!"
|
"compile_stub.sh" "Failed to compile stub!"
|
||||||
"compile_vergen.sh" "Versions failed to compile"
|
"compile_vergen.sh" "Versions failed to compile"
|
||||||
|
"compile_lvgl.sh" "Failed to compile LVGL!"
|
||||||
"compile_sources.sh" "Failed to compile FPC Sources!"
|
"compile_sources.sh" "Failed to compile FPC Sources!"
|
||||||
"compile_link.sh" "Failed linking!"
|
"compile_link.sh" "Failed linking!"
|
||||||
"compile_isogen.sh" "Failed to create ISO!"
|
"compile_isogen.sh" "Failed to create ISO!"
|
||||||
|
|||||||
+6
-1
@@ -14,4 +14,9 @@ done;
|
|||||||
objstring=lib/stub.o" "$objstring
|
objstring=lib/stub.o" "$objstring
|
||||||
echo "Object Files: "$objstring
|
echo "Object Files: "$objstring
|
||||||
echo " "
|
echo " "
|
||||||
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring
|
|
||||||
|
# Find libgcc for i386 (needed by LVGL compiled with gcc)
|
||||||
|
LIBGCC=$(gcc -m32 -print-libgcc-file-name)
|
||||||
|
echo "libgcc: ${LIBGCC}"
|
||||||
|
|
||||||
|
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring --start-group lib/liblvgl.a ${LIBGCC} --end-group
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
||||||
|
# Clone & compile in /tmp (fast container-local fs).
|
||||||
|
# Copy source + objects to /lvgl (host mount) for debugging.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
LVGL_VERSION="v9.2.2"
|
||||||
|
LVGL_REPO="https://github.com/lvgl/lvgl.git"
|
||||||
|
LVGL_DIR="/tmp/lvgl"
|
||||||
|
OBJ_DIR="/tmp/lvgl_obj"
|
||||||
|
CONF_DIR="$(pwd)"
|
||||||
|
OUT_DIR="$(pwd)/lib"
|
||||||
|
|
||||||
|
CC="gcc"
|
||||||
|
CFLAGS="-m32 -march=i686 -ffreestanding \
|
||||||
|
-fno-builtin -fno-stack-protector -fno-pic -fno-pie \
|
||||||
|
-O2 -Wall -Wno-unused-function -Wno-unused-variable \
|
||||||
|
-I${CONF_DIR} \
|
||||||
|
-I${LVGL_DIR} \
|
||||||
|
-I${LVGL_DIR}/.. \
|
||||||
|
-DLV_CONF_INCLUDE_SIMPLE"
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo "======================="
|
||||||
|
echo " "
|
||||||
|
echo "Compiling LVGL..."
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
# Clone LVGL into /tmp (container-local)
|
||||||
|
rm -rf "$LVGL_DIR"
|
||||||
|
echo "Downloading LVGL ${LVGL_VERSION}..."
|
||||||
|
git clone --depth 1 --branch "${LVGL_VERSION}" "${LVGL_REPO}" "${LVGL_DIR}" 2>&1
|
||||||
|
echo "Download complete."
|
||||||
|
|
||||||
|
# Gather all LVGL .c source files (core library only, no demos/examples)
|
||||||
|
SOURCES=$(find "${LVGL_DIR}/src" -name '*.c' -not -path '*/test/*')
|
||||||
|
TOTAL=$(echo "$SOURCES" | wc -l)
|
||||||
|
echo "Found ${TOTAL} LVGL source files."
|
||||||
|
|
||||||
|
# Compile each .c file to .o (container-local)
|
||||||
|
rm -rf "$OBJ_DIR"
|
||||||
|
mkdir -p "$OBJ_DIR"
|
||||||
|
|
||||||
|
COUNT=0
|
||||||
|
ERRORS=0
|
||||||
|
for src in $SOURCES; do
|
||||||
|
COUNT=$((COUNT + 1))
|
||||||
|
rel="${src#${LVGL_DIR}/src/}"
|
||||||
|
obj_path="${OBJ_DIR}/${rel%.c}.o"
|
||||||
|
mkdir -p "$(dirname "$obj_path")"
|
||||||
|
|
||||||
|
if ! $CC $CFLAGS -c "$src" -o "$obj_path" 2>&1; then
|
||||||
|
echo "FAILED: $rel"
|
||||||
|
ERRORS=$((ERRORS + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((COUNT % 50)) -eq 0 ]; then
|
||||||
|
echo " Compiled ${COUNT}/${TOTAL}..."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Compiled ${COUNT} files (${ERRORS} errors)."
|
||||||
|
|
||||||
|
if [ "$ERRORS" -ne 0 ]; then
|
||||||
|
echo "LVGL compilation FAILED with ${ERRORS} errors."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Archive into static library
|
||||||
|
OBJECTS=$(find "$OBJ_DIR" -name '*.o')
|
||||||
|
ar rcs "${OUT_DIR}/liblvgl.a" $OBJECTS
|
||||||
|
echo "Created ${OUT_DIR}/liblvgl.a"
|
||||||
|
|
||||||
|
# Copy source + objects to /lvgl host mount for debugging
|
||||||
|
echo "Copying LVGL source and objects to host mount..."
|
||||||
|
rm -rf /lvgl/* /lvgl/.[!.]* /lvgl/..?* 2>/dev/null || true
|
||||||
|
cp -a "$LVGL_DIR/src" /lvgl/src
|
||||||
|
cp -a "$OBJ_DIR" /lvgl/obj
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo "LVGL compilation complete."
|
||||||
|
echo " "
|
||||||
@@ -3,3 +3,4 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
|
- ./lvgl:/lvgl
|
||||||
@@ -51,6 +51,11 @@ type
|
|||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
procedure DrawCursor;
|
procedure DrawCursor;
|
||||||
|
function getMouseX: sint32;
|
||||||
|
function getMouseY: sint32;
|
||||||
|
function getMouseLMB: boolean;
|
||||||
|
function getMouseRMB: boolean;
|
||||||
|
function getMouseScroll: sint32; { returns accumulated scroll delta since last call }
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -59,7 +64,7 @@ var
|
|||||||
FirstDraw : boolean = true;
|
FirstDraw : boolean = true;
|
||||||
BackPixels : Array[0..1] of Array[0..7] of uint64;
|
BackPixels : Array[0..1] of Array[0..7] of uint64;
|
||||||
Cycle : uint32 = 0;
|
Cycle : uint32 = 0;
|
||||||
Mouse_Byte : Array[0..2] of uint8;
|
Mouse_Byte : Array[0..3] of uint8;
|
||||||
Packet : uint32;
|
Packet : uint32;
|
||||||
Registered : Boolean = false;
|
Registered : Boolean = false;
|
||||||
NeedsRedraw : Boolean = false;
|
NeedsRedraw : Boolean = false;
|
||||||
@@ -67,6 +72,35 @@ var
|
|||||||
LMouseDownPos : TMousePos;
|
LMouseDownPos : TMousePos;
|
||||||
LMouseDown : Boolean;
|
LMouseDown : Boolean;
|
||||||
RMouseDown : Boolean;
|
RMouseDown : Boolean;
|
||||||
|
HasScrollWheel : Boolean = false;
|
||||||
|
ScrollAccum : sint32 = 0;
|
||||||
|
PacketSize : uint32 = 3;
|
||||||
|
|
||||||
|
function getMouseX: sint32;
|
||||||
|
begin
|
||||||
|
getMouseX := Current.x;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getMouseY: sint32;
|
||||||
|
begin
|
||||||
|
getMouseY := Current.y;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getMouseLMB: boolean;
|
||||||
|
begin
|
||||||
|
getMouseLMB := LMouseDown;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getMouseRMB: boolean;
|
||||||
|
begin
|
||||||
|
getMouseRMB := RMouseDown;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function getMouseScroll: sint32;
|
||||||
|
begin
|
||||||
|
getMouseScroll := ScrollAccum;
|
||||||
|
ScrollAccum := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure DrawCursor;
|
procedure DrawCursor;
|
||||||
var
|
var
|
||||||
@@ -151,7 +185,7 @@ begin
|
|||||||
Mouse_Byte[Cycle]:= b;
|
Mouse_Byte[Cycle]:= b;
|
||||||
Inc(Cycle);
|
Inc(Cycle);
|
||||||
end;
|
end;
|
||||||
if Cycle = 3 then begin
|
if Cycle = PacketSize then begin
|
||||||
//Process
|
//Process
|
||||||
f:= Mouse_Byte[0];
|
f:= Mouse_Byte[0];
|
||||||
Packet.x_sign:= (f AND %00010000) = %00010000;
|
Packet.x_sign:= (f AND %00010000) = %00010000;
|
||||||
@@ -173,6 +207,10 @@ begin
|
|||||||
if Current.x > (Console.getConsoleProperties^.Width-8) then Current.x:= (Console.getConsoleProperties^.Width-8);
|
if Current.x > (Console.getConsoleProperties^.Width-8) then Current.x:= (Console.getConsoleProperties^.Width-8);
|
||||||
if Current.y > (Console.getConsoleProperties^.Height-8) then Current.y:= (Console.getConsoleProperties^.Height-8);
|
if Current.y > (Console.getConsoleProperties^.Height-8) then Current.y:= (Console.getConsoleProperties^.Height-8);
|
||||||
end;
|
end;
|
||||||
|
{ Process scroll wheel (4th byte, signed) }
|
||||||
|
if HasScrollWheel then begin
|
||||||
|
ScrollAccum := ScrollAccum + sint8(Mouse_Byte[3]);
|
||||||
|
end;
|
||||||
Cycle:= 0;
|
Cycle:= 0;
|
||||||
if Packet.LMB_Down then begin
|
if Packet.LMB_Down then begin
|
||||||
if not LMouseDown then begin
|
if not LMouseDown then begin
|
||||||
@@ -218,6 +256,7 @@ end;
|
|||||||
function load(ptr : void) : boolean;
|
function load(ptr : void) : boolean;
|
||||||
var
|
var
|
||||||
status : uint8;
|
status : uint8;
|
||||||
|
devid_byte : uint8;
|
||||||
begin
|
begin
|
||||||
push_trace('mouse.load');
|
push_trace('mouse.load');
|
||||||
mouse_wait(1);
|
mouse_wait(1);
|
||||||
@@ -232,6 +271,26 @@ begin
|
|||||||
outb($60, status);
|
outb($60, status);
|
||||||
mouse_write($F6);
|
mouse_write($F6);
|
||||||
mouse_read();
|
mouse_read();
|
||||||
|
|
||||||
|
{ Enable IntelliMouse scroll wheel: set sample rate 200, 100, 80 }
|
||||||
|
mouse_write($F3); mouse_read(); mouse_write(200); mouse_read();
|
||||||
|
mouse_write($F3); mouse_read(); mouse_write(100); mouse_read();
|
||||||
|
mouse_write($F3); mouse_read(); mouse_write(80); mouse_read();
|
||||||
|
|
||||||
|
{ Query device ID — ID 3 = IntelliMouse (scroll wheel) }
|
||||||
|
mouse_write($F2);
|
||||||
|
mouse_read(); { ACK }
|
||||||
|
devid_byte := mouse_read(); { Device ID }
|
||||||
|
if devid_byte = 3 then begin
|
||||||
|
HasScrollWheel := true;
|
||||||
|
PacketSize := 4;
|
||||||
|
console.outputln('PS/2 MOUSE', 'Scroll wheel enabled (IntelliMouse).');
|
||||||
|
end else begin
|
||||||
|
HasScrollWheel := false;
|
||||||
|
PacketSize := 3;
|
||||||
|
console.outputln('PS/2 MOUSE', 'Standard mouse (no scroll wheel).');
|
||||||
|
end;
|
||||||
|
|
||||||
mouse_write($F4);
|
mouse_write($F4);
|
||||||
mouse_read();
|
mouse_read();
|
||||||
isrmanager.registerISR(44, @Main);
|
isrmanager.registerISR(44, @Main);
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -40,6 +40,8 @@ function frontBufferBpp : uint8;
|
|||||||
function backBufferWidth : uint32;
|
function backBufferWidth : uint32;
|
||||||
function backBufferHeight : uint32;
|
function backBufferHeight : uint32;
|
||||||
function backBufferBpp : uint8;
|
function backBufferBpp : uint8;
|
||||||
|
function backBufferLocation : uint32;
|
||||||
|
function frontBufferLocation : uint32;
|
||||||
|
|
||||||
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
|
Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Texture : PTexture);
|
||||||
|
|
||||||
@@ -315,4 +317,14 @@ begin
|
|||||||
backBufferBpp:= VideoInterface.BackBuffer.BitsPerPixel;
|
backBufferBpp:= VideoInterface.BackBuffer.BitsPerPixel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function backBufferLocation : uint32;
|
||||||
|
begin
|
||||||
|
backBufferLocation:= VideoInterface.BackBuffer.Location;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function frontBufferLocation : uint32;
|
||||||
|
begin
|
||||||
|
frontBufferLocation:= VideoInterface.FrontBuffer.Location;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
File diff suppressed because it is too large.
Load diff
+26
-1
@@ -300,8 +300,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function intToString(i : uint32) : pchar;
|
function intToString(i : uint32) : pchar;
|
||||||
|
var
|
||||||
|
buf : array[0..11] of char;
|
||||||
|
len : uint32;
|
||||||
|
tmp : uint32;
|
||||||
|
result : pchar;
|
||||||
|
j : uint32;
|
||||||
begin
|
begin
|
||||||
intToString:= ' ';
|
if i = 0 then begin
|
||||||
|
result := stringNew(1);
|
||||||
|
result[0] := '0';
|
||||||
|
result[1] := #0;
|
||||||
|
intToString := result;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
len := 0;
|
||||||
|
tmp := i;
|
||||||
|
while tmp > 0 do begin
|
||||||
|
buf[len] := char(byte('0') + (tmp mod 10));
|
||||||
|
tmp := tmp div 10;
|
||||||
|
inc(len);
|
||||||
|
end;
|
||||||
|
result := stringNew(len);
|
||||||
|
for j := 0 to len - 1 do begin
|
||||||
|
result[j] := buf[len - 1 - j];
|
||||||
|
end;
|
||||||
|
result[len] := #0;
|
||||||
|
intToString := result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function boolToString(b : boolean; ext : boolean) : pchar;
|
function boolToString(b : boolean; ext : boolean) : pchar;
|
||||||
|
|||||||
@@ -266,6 +266,8 @@ procedure fpc_shortstr_assign(len: longint; sstr, dstr: Pointer); compilerproc;
|
|||||||
any int64/uint64 arithmetic occurs (e.g. sint32 * uint32 promotion).
|
any int64/uint64 arithmetic occurs (e.g. sint32 * uint32 promotion).
|
||||||
Must live in the system unit so the compiler can resolve it. }
|
Must live in the system unit so the compiler can resolve it. }
|
||||||
function fpc_mul_int64(f1, f2: int64): int64; compilerproc;
|
function fpc_mul_int64(f1, f2: int64): int64; compilerproc;
|
||||||
|
function fpc_div_int64(n, d: int64): int64; compilerproc;
|
||||||
|
function fpc_mod_int64(n, d: int64): int64; compilerproc;
|
||||||
|
|
||||||
{ Memory allocation compilerprocs – delegate to kernel heap (lmemorymanager) }
|
{ Memory allocation compilerprocs – delegate to kernel heap (lmemorymanager) }
|
||||||
function fpc_getmem(size: PtrUInt): Pointer; compilerproc;
|
function fpc_getmem(size: PtrUInt): Pointer; compilerproc;
|
||||||
@@ -454,6 +456,111 @@ begin
|
|||||||
fpc_mul_int64 := res;
|
fpc_mul_int64 := res;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ---------- 64-bit division / modulo ---------- }
|
||||||
|
|
||||||
|
{ Helper: unsigned 64÷64→64 using shift-subtract (binary long division).
|
||||||
|
Called by both signed div and mod after sign handling. }
|
||||||
|
procedure udiv64(dividendLo, dividendHi, divisorLo, divisorHi: uint32;
|
||||||
|
var quotLo, quotHi, remLo, remHi: uint32);
|
||||||
|
var
|
||||||
|
bit: longint;
|
||||||
|
begin
|
||||||
|
quotLo := 0; quotHi := 0;
|
||||||
|
remLo := 0; remHi := 0;
|
||||||
|
|
||||||
|
for bit := 63 downto 0 do begin
|
||||||
|
{ rem := rem shl 1 }
|
||||||
|
remHi := (remHi shl 1) or (remLo shr 31);
|
||||||
|
remLo := remLo shl 1;
|
||||||
|
|
||||||
|
{ bring down next bit of dividend }
|
||||||
|
if bit >= 32 then begin
|
||||||
|
remLo := remLo or ((dividendHi shr (bit - 32)) and 1);
|
||||||
|
end else begin
|
||||||
|
remLo := remLo or ((dividendLo shr bit) and 1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ if rem >= divisor then rem -= divisor; set quotient bit }
|
||||||
|
if (remHi > divisorHi) or
|
||||||
|
((remHi = divisorHi) and (remLo >= divisorLo)) then begin
|
||||||
|
{ rem -= divisor (64-bit subtract) }
|
||||||
|
if remLo < divisorLo then begin
|
||||||
|
remHi := remHi - divisorHi - 1;
|
||||||
|
remLo := remLo - divisorLo;
|
||||||
|
end else begin
|
||||||
|
remHi := remHi - divisorHi;
|
||||||
|
remLo := remLo - divisorLo;
|
||||||
|
end;
|
||||||
|
{ set quotient bit }
|
||||||
|
if bit >= 32 then
|
||||||
|
quotHi := quotHi or (uint32(1) shl (bit - 32))
|
||||||
|
else
|
||||||
|
quotLo := quotLo or (uint32(1) shl bit);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function fpc_div_int64(n, d: int64): int64; [public, alias: 'FPC_DIV_INT64']; compilerproc;
|
||||||
|
var
|
||||||
|
negate: boolean;
|
||||||
|
nLo, nHi, dLo, dHi: uint32;
|
||||||
|
qLo, qHi, rLo, rHi: uint32;
|
||||||
|
begin
|
||||||
|
if d = 0 then begin
|
||||||
|
HandleErrorInternal(200); { divide by zero }
|
||||||
|
fpc_div_int64 := 0;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
negate := false;
|
||||||
|
|
||||||
|
{ Make both operands positive, track sign }
|
||||||
|
if n < 0 then begin
|
||||||
|
n := -n;
|
||||||
|
negate := not negate;
|
||||||
|
end;
|
||||||
|
if d < 0 then begin
|
||||||
|
d := -d;
|
||||||
|
negate := not negate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
nLo := uint32(n); nHi := uint32(n shr 32);
|
||||||
|
dLo := uint32(d); dHi := uint32(d shr 32);
|
||||||
|
|
||||||
|
udiv64(nLo, nHi, dLo, dHi, qLo, qHi, rLo, rHi);
|
||||||
|
|
||||||
|
fpc_div_int64 := int64(qLo) or (int64(qHi) shl 32);
|
||||||
|
if negate then
|
||||||
|
fpc_div_int64 := -fpc_div_int64;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function fpc_mod_int64(n, d: int64): int64; [public, alias: 'FPC_MOD_INT64']; compilerproc;
|
||||||
|
var
|
||||||
|
nNeg: boolean;
|
||||||
|
nLo, nHi, dLo, dHi: uint32;
|
||||||
|
qLo, qHi, rLo, rHi: uint32;
|
||||||
|
begin
|
||||||
|
if d = 0 then begin
|
||||||
|
HandleErrorInternal(200); { divide by zero }
|
||||||
|
fpc_mod_int64 := 0;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
nNeg := n < 0;
|
||||||
|
|
||||||
|
if n < 0 then n := -n;
|
||||||
|
if d < 0 then d := -d;
|
||||||
|
|
||||||
|
nLo := uint32(n); nHi := uint32(n shr 32);
|
||||||
|
dLo := uint32(d); dHi := uint32(d shr 32);
|
||||||
|
|
||||||
|
udiv64(nLo, nHi, dLo, dHi, qLo, qHi, rLo, rHi);
|
||||||
|
|
||||||
|
fpc_mod_int64 := int64(rLo) or (int64(rHi) shl 32);
|
||||||
|
if nNeg then
|
||||||
|
fpc_mod_int64 := -fpc_mod_int64;
|
||||||
|
end;
|
||||||
|
|
||||||
{ ---------- Memory allocation compilerprocs ---------- }
|
{ ---------- Memory allocation compilerprocs ---------- }
|
||||||
|
|
||||||
function kernel_kalloc(size: uint32): Pointer; external name 'kernel_kalloc';
|
function kernel_kalloc(size: uint32): Pointer; external name 'kernel_kalloc';
|
||||||
|
|||||||
+21
-84
@@ -55,7 +55,7 @@ uses
|
|||||||
rand,
|
rand,
|
||||||
terminal,
|
terminal,
|
||||||
hashmap, vfs,
|
hashmap, vfs,
|
||||||
video, vesa, doublebuffer, color;
|
video, vesa, doublebuffer, color, lvgl, desktop, uidebug;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@@ -108,27 +108,8 @@ end;
|
|||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
||||||
var
|
var
|
||||||
c : uint8;
|
|
||||||
z : uint32;
|
|
||||||
dds : uint32;
|
dds : uint32;
|
||||||
pint : puint32;
|
|
||||||
pint2 : puint32;
|
|
||||||
keyboard_layout : array [0..1] of TKeyInfo;
|
keyboard_layout : array [0..1] of TKeyInfo;
|
||||||
i : uint32;
|
|
||||||
cEIP : uint32;
|
|
||||||
temp : uint32;
|
|
||||||
atmp : puint32;
|
|
||||||
test : puint8;
|
|
||||||
fb : puint16;
|
|
||||||
l : PLinkedListBase;
|
|
||||||
ulf : pointer;
|
|
||||||
|
|
||||||
HM : PHashMap;
|
|
||||||
|
|
||||||
colour : TRGB32;
|
|
||||||
|
|
||||||
array1 : Array[0..255] of char;
|
|
||||||
array2 : Array[0..255] of char;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ Init the base system unit }
|
{ Init the base system unit }
|
||||||
@@ -214,47 +195,6 @@ begin
|
|||||||
doublebuffer.init(@video.register);
|
doublebuffer.init(@video.register);
|
||||||
video.enable('VESA');
|
video.enable('VESA');
|
||||||
video.enable('BASIC_DOUBLE_BUFFER');
|
video.enable('BASIC_DOUBLE_BUFFER');
|
||||||
colour:= color.white;
|
|
||||||
|
|
||||||
// serial.sendHex(uint32(@array1[8]));
|
|
||||||
// serial.sendHex(uint32(@array2[8]));
|
|
||||||
// for i:=8 to 23 do begin
|
|
||||||
// array2[i]:= '?';
|
|
||||||
// end;
|
|
||||||
// array2[24]:= #0;
|
|
||||||
|
|
||||||
// array1[8]:= 'H';
|
|
||||||
// array1[9]:= 'e';
|
|
||||||
// array1[10]:= 'l';
|
|
||||||
// array1[11]:= 'l';
|
|
||||||
// array1[12]:= 'o';
|
|
||||||
// array1[13]:= 'w';
|
|
||||||
// array1[14]:= 'o';
|
|
||||||
// array1[15]:= 'r';
|
|
||||||
// array1[16]:= 'l';
|
|
||||||
// array1[17]:= 'd';
|
|
||||||
// array1[18]:= '1';
|
|
||||||
// array1[19]:= '2';
|
|
||||||
// array1[20]:= '3';
|
|
||||||
// array1[21]:= '4';
|
|
||||||
// array1[22]:= '5';
|
|
||||||
// array1[23]:= '!';
|
|
||||||
// __SSE_128_memcpy(uint32(@array1[8]), uint32(@array2[8]));
|
|
||||||
// serial.sendString(pchar(@array2[8]));
|
|
||||||
|
|
||||||
for i:=0 to video.frontBufferWidth-1 do begin
|
|
||||||
for z:=0 to video.frontBufferHeight-1 do begin
|
|
||||||
video.DrawPixel(i, z, colour);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
video.DrawLine(50,50,100,100,1,color.black);
|
|
||||||
video.DrawRect(50,150,100,200,1,color.black);
|
|
||||||
video.FillRect(50,250,100,300,1,color.black,color.red);
|
|
||||||
video.DrawLine(50,350,100,350,1,color.black);
|
|
||||||
video.Flush();
|
|
||||||
|
|
||||||
while true do begin end;
|
|
||||||
|
|
||||||
{ VFS Init }
|
{ VFS Init }
|
||||||
vfs.init();
|
vfs.init();
|
||||||
@@ -265,15 +205,15 @@ begin
|
|||||||
tracer.push_trace('kmain.STRMGMT');
|
tracer.push_trace('kmain.STRMGMT');
|
||||||
storagemanagement.init();
|
storagemanagement.init();
|
||||||
|
|
||||||
{ Hook Timer for Ticks }
|
{ Enable interrupts and hook timer BEFORE LVGL }
|
||||||
tracer.push_trace('kmain.TMR');
|
tracer.push_trace('kmain.TMR');
|
||||||
STI;
|
STI;
|
||||||
TMR_0_ISR.hook(uint32(@bios_data_area.tick_update));
|
TMR_0_ISR.hook(uint32(@bios_data_area.tick_update));
|
||||||
|
|
||||||
{ Filsystems }
|
{ Filesystems }
|
||||||
fat32.init();
|
fat32.init();
|
||||||
|
|
||||||
{ Device Drivers }
|
{ Device Drivers — must init before LVGL so mouse/keyboard are available }
|
||||||
tracer.push_trace('kmain.DEVDRV');
|
tracer.push_trace('kmain.DEVDRV');
|
||||||
console.outputln('KERNEL', 'DEVICE DRIVERS: INIT BEGIN.');
|
console.outputln('KERNEL', 'DEVICE DRIVERS: INIT BEGIN.');
|
||||||
keyboard.init(keyboard_layout);
|
keyboard.init(keyboard_layout);
|
||||||
@@ -294,33 +234,30 @@ begin
|
|||||||
tracer.push_trace('kmain.NETDRV');
|
tracer.push_trace('kmain.NETDRV');
|
||||||
net.init;
|
net.init;
|
||||||
|
|
||||||
tracer.push_trace('kmain.VMINIT');
|
|
||||||
//vm.init();
|
|
||||||
|
|
||||||
{ Init Progs }
|
{ Init Progs }
|
||||||
progmanager.init();
|
progmanager.init();
|
||||||
|
|
||||||
{ Init Splash }
|
{ Seed RNG }
|
||||||
//tracer.push_trace('kmain.SPLASHINIT');
|
|
||||||
//splash.init();
|
|
||||||
|
|
||||||
{ End of Boot }
|
|
||||||
tracer.push_trace('kmain.EOB');
|
|
||||||
|
|
||||||
console.writestringln('');
|
|
||||||
console.setdefaultattribute(console.combinecolors($17E0, $0000));
|
|
||||||
console.writestringln('Asuro Booted Correctly!');
|
|
||||||
console.setdefaultattribute(console.combinecolors($FFFF, $0000));
|
|
||||||
writestringln(' ');
|
|
||||||
|
|
||||||
tracer.push_trace('kmain.END');
|
|
||||||
rand.srand((getDateTime.Seconds SHL 24) OR (getDateTime.Minutes SHL 16) OR (getDateTime.Hours SHL 8) OR (getDateTime.Day));
|
rand.srand((getDateTime.Seconds SHL 24) OR (getDateTime.Minutes SHL 16) OR (getDateTime.Hours SHL 8) OR (getDateTime.Day));
|
||||||
|
|
||||||
tracer.push_trace('kmain.TICK');
|
{ Initialize LVGL }
|
||||||
|
console.outputln('KERNEL', 'LVGL: INIT BEGIN.');
|
||||||
|
lvgl_init(video.frontBufferWidth, video.frontBufferHeight);
|
||||||
|
console.outputln('KERNEL', 'LVGL: INIT COMPLETE.');
|
||||||
|
|
||||||
|
{ Initialize desktop environment }
|
||||||
|
console.outputln('KERNEL', 'DESKTOP: INIT BEGIN.');
|
||||||
|
desktop.init;
|
||||||
|
console.outputln('KERNEL', 'DESKTOP: INIT COMPLETE.');
|
||||||
|
|
||||||
|
{ Main render loop }
|
||||||
|
console.outputln('KERNEL', 'Entering main render loop.');
|
||||||
|
tracer.push_trace('kmain.MAINLOOP');
|
||||||
while true do begin
|
while true do begin
|
||||||
tracer.push_trace('kmain.RedrawWindows');
|
desktop.update;
|
||||||
console.redrawWindows;
|
uidebug.update;
|
||||||
|
lvgl_handler;
|
||||||
|
video.Flush();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|||||||
+6
-3
@@ -58,10 +58,13 @@ align 0x1000
|
|||||||
_PageDirectory equ BootPageDirectory
|
_PageDirectory equ BootPageDirectory
|
||||||
global _PageDirectory
|
global _PageDirectory
|
||||||
BootPageDirectory:
|
BootPageDirectory:
|
||||||
dd 0x00000083
|
dd 0x00000083 ; Identity map first 4MB (for boot transition)
|
||||||
times (KERNEL_PAGE_NUMBER - 1) dd 0
|
times (KERNEL_PAGE_NUMBER - 1) dd 0
|
||||||
dd 0x00000083
|
dd 0x00000083 ; 0xC0000000 -> phys 0x00000000 (0-4MB)
|
||||||
times (1024 - KERNEL_PAGE_NUMBER - 1) dd 0
|
dd 0x00400083 ; 0xC0400000 -> phys 0x00400000 (4-8MB)
|
||||||
|
dd 0x00800083 ; 0xC0800000 -> phys 0x00800000 (8-12MB)
|
||||||
|
dd 0x00C00083 ; 0xC0C00000 -> phys 0x00C00000 (12-16MB)
|
||||||
|
times (1024 - KERNEL_PAGE_NUMBER - 4) dd 0
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in new issue
Block a user