Compare commits

...
Author SHA1 Message Date
t3hn3rd 188b1aebb0 feature: Pipeline - LVGL Build Caching
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Add LVGL build caching: store liblvgl.a on host mount to skip
  full recompilation on subsequent builds
2026-03-03 23:22:09 +00:00
t3hn3rd 452203b7b4 Merge pull request 'bug: vtop incorrect bitmask' (#36) from feature/vtop-fix into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #36
Reviewed-by: Aaron Hance <[email protected]>
2026-03-03 20:03:47 +00:00
t3hn3rd 76c419336e bug: vtop incorrect bitmask
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Fix for issue #32 in which the incorrect bitmask ($FFFFFF) is used where
  $3FFFFF should be used instead. (24 vs 22 bits).
2026-03-03 19:10:08 +00:00
admin 2ad0ae8420 Merge pull request 'feature/gitattributes' (#30) from feature/gitattributes into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #30
2026-03-02 21:56:56 +00:00
t3hn3rd c0c199bfe6 .gitattributes update
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Updated .gitattributes linguist excludes for compile-time directories.
2026-03-02 21:48:10 +00:00
t3hn3rd 7ec3bcb9b9 .gitattributes & doc directory
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Added gitattributes for linguist exclusions
- Created empty doc folder for local working docs
2026-03-02 21:41:14 +00:00
admin 4bd0a2dfbf Merge pull request 'Merge feature/graphics-interrupts into develop' (#14) from feature/graphics-interrupts into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #14
2026-03-02 19:19:46 +00:00
admin 431e5bc8f4 Merge pull request 'Merge feature/USB into develop' (#13) from feature/USB into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #13
2026-03-02 19:14:05 +00:00
t3hn3rd 8169d93a9c refactor: move render loop & USB hotplug to timer-driven units
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Replace the blocking main render loop in kernel.pas with two new
timer-hooked units that are driven by the 1024Hz PIT interrupt:

- graphicsrefresh: calls desktop.update, uidebug.update, lvgl_handler
  and video.Flush every 4 ticks (~256 FPS target).
- usbhotplug: calls usbcore.usb_check_hotplug every 1024 ticks (~1Hz).

The kernel main procedure now registers both timer hooks and enters an
idle STI/HLT loop (kernel.yield), allowing the CPU to sleep between
interrupts instead of busy-spinning.

Also removes the unused myUserLandFunction and reorders early syslog
init calls for clarity.
2026-03-02 19:04:42 +00:00
t3hn3rd 547251dbd0 update: Kernel.pas changes to align with USB implementation
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Kernel.pas updated to init USB devices & check for hotplug.
- USB Poll removed given USB stack is now interrupt driven.
2026-03-02 15:53:40 +00:00
t3hn3rd 7bbcc44c5e Feature: USB - Hotplug, mass storage, disconnect callbacks, dynamic device lists
- Add disconnect callback (fnDisconnect) to TUSBDevice for safe unplug handling
- Add HotplugArmed/PortChangePending flags to TUSBHCDriver for deferred
  hotplug processing from ISR context (OHCI RHSC, EHCI PCD, xHCI PSC)
- Implement usb_rescan_port() and usb_check_hotplug() in usbcore
- Add usb_bulk_transfer_wait() with timer-based timeout (bios_data_area)
- Add timer-based timeout to usb_control_msg polling loop
- Replace static device arrays with dynamic linked lists in class drivers:
  usb_keyboard (KeyboardList), usb_mouse (MouseList), usb_storage (StorageList)
- Add 3-strike fail-count self-deactivation in keyboard/mouse poll loops
- Add unload() disconnect handlers for keyboard, mouse, and storage drivers
- Implement USB Mass Storage BOT driver (usb_storage.pas):
  CBW/CSW transport, SCSI INQUIRY/READ_CAPACITY/READ10/WRITE10,
  storagemanagement integration with read/write callbacks
- xHCI: acknowledge port status change W1C bits in event handler
- Integrate usb_check_hotplug + poll_keyboards/poll_mice into kernel main loop
2026-03-02 15:52:49 +00:00
t3hn3rd 25475a88a7 featur: USB - Add device tracking, stall recovery, removal, and terminal command
- Track enumerated devices per-HC via linked list (hc^.Devices)
- Add usb_clear_halt() for endpoint stall recovery (CLEAR_FEATURE)
- Add usb_remove_device() to clean up and free device records
- Add get_hc() for indexed host controller access
- Implement 'USB' terminal command showing HC info, connected devices,
  speeds, class descriptors, and endpoint details
2026-03-02 15:50:55 +00:00
t3hn3rd db49c29627 fix: lowercase names for units
- PCI.pas -> pci.pas
2026-03-02 13:38:10 +00:00
t3hn3rd c237553508 fix: ps2_keyboard report key-up events for break codes
The PS/2 keyboard callback hardcoded is_down_code := true for every
scancode, so key releases were never reported. This caused keys to
repeat endlessly until the next key was pressed.

In PS/2 scancode set 1, bit 7 indicates a break (release) code.
The callback now:
- Detects break codes via (scancode AND $80)
- Masks to base code (scancode AND $7F) for key matrix lookup
- Sets is_down_code := false for break codes
- Updates modifier state (shift/ctrl/alt) before building the
  key event, so modifier releases take effect immediately

Files changed:
- ps2_keyboard.pas: rewrite callback to handle make/break codes
2026-03-02 13:37:29 +00:00
t3hn3rd 0c96d32754 feature: move all USB HC drivers from polling to interrupt-driven completion
Replace main-loop polling (poll_all, poll_keyboards, poll_mice) with
hardware interrupt handlers for all four USB host controller drivers.

Each HC driver (XHCI, EHCI, OHCI, UHCI) now:
- Registers an ISR on its PCI interrupt line via isrmanager
- Enables hardware interrupts after HC initialization
- Acknowledges interrupt status in the ISR before calling poll,
  preventing interrupt storms on level-triggered PCI lines
- Uses a PollBusy re-entrancy guard to prevent ISR/inline poll races

usbcore gains a completion hook system (register_completion_hook /
fire_completion_hooks) so HID drivers (keyboard, mouse) are notified
directly from the ISR after transfer completion.

Files changed:
- usbcore.pas: completion hook infrastructure
- XHCI.pas: ISR, enable_interrupts, submit ordering fix
- EHCI.pas: ISR, enable_interrupts, status ack in ISR
- OHCI.pas: ISR, enable_interrupts, status ack in ISR
- UHCI.pas: ISR, enable_interrupts, status ack in ISR
- usb_keyboard.pas: register completion hook
- usb_mouse.pas: register completion hook
2026-03-02 13:36:40 +00:00
t3hn3rd 3f83f279d7 XHCI driver implementation
- Beginnings of a functional XHCI driver implemented.
2026-03-02 12:24:02 +00:00
t3hn3rd 82fe9fa6df EHCI Implementation
- Beginnings of a functional EHCI driver implemented.
2026-03-02 12:23:35 +00:00
admin 983d9a428d Merge pull request 'feature: Tracer O(1) ring buffer refactor' (#12) from feature/tracer-optimizations into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #12
2026-03-01 22:29:53 +00:00
t3hn3rd 2fa77d8295 Merge branch 'feature/tracer-optimizations' into feature/USB 2026-03-01 21:26:56 +00:00
t3hn3rd f53afc1d2d feature: Tracer O(1) ring buffer refactor
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
- Replaced O(n) shift loop + StringCopy/kalloc/kfree with O(1) ring
  buffer storing PChar pointers directly (zero allocation).
- Eliminated mod operator (causes int64 promotion + broken RTL helpers
  on i386 bare-metal); uses pure uint32 branch arithmetic.
- Removed dead code: PTracerEntry/TTracerEntry linked list types,
  head/tail PTracerEntry vars, c_lock boolean
- Dropped lmemorymanager and serial from uses clause
- pop_trace remains as no-op stub for ABI compat
- get_trace_N uses underflow-safe index: if head >= idx then
  head - idx else MAX_TRACE - (idx - head)
- Added print_traces debug helper
2026-03-01 21:26:35 +00:00
t3hn3rd cb7144f282 USB Stack & HID Refactor
- New units: usbtypes, usbcore, usbhub, UHCI, OHCI, usb_keyboard,
  usb_mouse
- usbtypes: shared USB descriptors, constants, HC abstraction,
  aligned alloc, unit tests
- usb_keyboard: USB HID boot keyboard driver with HID-to-ASCII
  translation, polling, unit tests
- usb_mouse: USB HID boot mouse driver with delta/scroll/button
  processing, polling, unit tests

HID Layer Restructure:
- keyboard.pas: stripped to abstract API (hook + reportKeyEvent),
  no PS/2 dependency
- mouse.pas: absorbed mousestate.pas, now owns
  position/buttons/scroll/hooks directly
- mousestate.pas: deleted (merged into mouse.pas)
- New ps2_keyboard.pas: PS/2 scan code translation,
  calls keyboard.reportKeyEvent
- New ps2_mouse.pas: PS/2 packet handling, calls
  mouse.setMousePos/fireMouseEvent

LVGL Integration:
- lvgl.pas: updated to use mouse.pas directly (was mousestate),
  improved keyboard input handling with proper key held/release tracking
- vterminal.pas: removed serial debug logging, dropped serial dependency

Kernel:
- kernel.pas: added USB units, USB polling in main loop, unit test
  calls, ps2_keyboard/ps2_mouse init
2026-03-01 21:23:33 +00:00
admin afdc83eaf6 Merge pull request 'Merge feature/hardening into develop' (#11) from feature/hardening into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #11
2026-03-01 02:57:23 +00:00
t3hn3rd 2239d9c848 Rebase: Fixed console -> syslog interface
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2026-03-01 02:46:13 +00:00
t3hn3rd beb4b253ab fix: guard against uint32 underflow in memset/memcpy and strings unit
When size=0 was passed to memset() or memcpy(), the loop bound
`0 to size-1` underflowed to $FFFFFFFF, iterating ~4 billion times
and causing an immediate page fault.

Added `if size = 0 then exit` guards to both memset() and memcpy()
in util.pas.

Also guarded all `for i:=0 to X-1` loops in strings.pas where X
could be 0 on empty string inputs:
- stringToUpper: wrap loop in `if stringSize > 0`
- stringToLower: wrap loop in `if stringSize > 0`
- stringEquals: early exit when both sizes are 0
- stringToInt: early exit when string is empty

Additionally fixed all previously identified bugs in strings.pas:
- hexStringToInt: guard against empty string underflow
- stringConcat: cache stringSize calls to avoid redundant O(n) scans
- stringTrim: clamp length to source string size
- stringSub: bounds check start/size against source length
- stringReplace: complete rewrite - was using stringEquals() for
  substring matching (only matched at string end), dropped prefix
  chars, had dangling assignment overwriting valid result with
  uninitialized pointer, and had unused variable
- stringIndexOf: rewritten to use new stringMatchAt() helper for
  correct substring matching
- stringContains: simplified to delegate to fixed stringIndexOf(),
  also fixing uint32 underflow when sub was empty
- stringToInt: removed always-true `v >= 0` check on uint32
- intToString: implemented (was a stub returning ' ')
- Added stringMatchAt() helper for prefix comparison
- Added comprehensive UnitTest procedure with 77 assertions
  including adversarial empty/nil/boundary inputs
2026-03-01 02:33:28 +00:00
admin 084130da80 Merge pull request 'feat: VESA rendering implementation & LVGL for graphics drawing' (#10) from feature/lvgl into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #10
2026-03-01 02:25:47 +00:00
t3hn3rd f752be48ce refactor/feature/fix: Major refactor of codebase
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
refactor(stdio): replace console/terminal command system with buffer-based stdio
- Introduced stdio.pas as the unified command I/O layer.
- All 31 command procedures across 15 files now receive stdin_buf,
  stdout_buf, and stderr_buf (POutBuf) instead of a single outbuf.
- vterminal.pas creates all three buffers per command invocation and
  displays both stdout and stderr.
- Deleted console.pas, terminal.pas, and 9 obsolete windowing programs
  (shell, splash, edit, memview, themer, netlog, vmlog, vmstate, udpcat).
- Migrated all registerCommand calls to stdio, rewrote vterminal
  processCommand to use stdio.findCommand, and added proper error
  routing to stderr for invalid params, bad paths, and system errors.

refactor(syslog): replace console logging with serial-backed syslog
- Introduced syslog.pas for kernel-level logging over serial/dev.
- Migrated all boot logging in kernel.pas from console.outputln/
  writestringln to syslog.logln/writestringln.
- Converted 19 fault handlers, hashmap, lists, scheduler, tracer, net,
  udp, and all driver init paths to use syslog.
- Rewrote BSOD in util.pas (50+ calls) from console to syslog.
- Removed CONSOLE_SLOW_REDRAW, TRGB565, TRGB565Pair, and HWND
  from system.pas.

fix(keyboard): add ring buffer and proper press/release cycling for LVGL input
- Replaced the single last_key/key_pressed slot in lvgl.pas with a
  16-entry ring buffer (kb_buf, kb_head, kb_tail) to prevent ISR
  overwrites when typing fast.
- Added a kb_pending_release flag so each keystroke gets a
  full PRESSED->RELEASED cycle before the next key is consumed —
  LVGL requires this pairing and was silently dropping intermediate
  keys when receiving consecutive PRESSED events without
  intervening releases.

feat(vterminal): use Hack monospace font for terminal output
- Added Hack Regular 14px (hack_14.c) as a custom LVGL font.
- Removed the .static_bitmap field from the generated font file
  (not present in LVGL 9.2 lv_font_t struct).
- Declared the hack_14 external symbol in lvgl.pas and switched
  vterminal's text label from lv_font_montserrat_14 to hack_14
  for proper monospace terminal rendering.
2026-03-01 02:06:31 +00:00
t3hn3rd dbe6e958e2 fix: More changes for Hyper-V PS/2 mouse compatability
continuous-integration/drone/push Build is passing
2026-02-28 22:54:19 +00:00
t3hn3rd 201cda4c29 fix: Pipeline fixes for temporary lvgl directory
continuous-integration/drone/push Build is passing
- Fixed missing lvgl artefacts for build pipeline causing drone failures.
2026-02-28 16:48:41 +00:00
t3hn3rd e54b34aa93 fix: gate AVX enable on XSAVE support and set CR4.OSXSAVE first
continuous-integration/drone/push Build is failing
XGETBV/XSETBV require CR4 bit 18 (OSXSAVE) to be set before execution,
otherwise the CPU raises #UD (invalid opcode). Hyper-V enforces this
strictly; VirtualBox was silently tolerating it.

- Check both AVX and XSAVE CPUID flags before attempting AVX enable
- Set CR4.OSXSAVE (bit 18) before issuing XGETBV/XSETBV
- If XSAVE is not exposed by the hypervisor, AVX enable is skipped
  gracefully instead of faulting
2026-02-28 16:31:57 +00:00
t3hn3rd fcfe7c3204 fix: Mouse driver Hyper-V compatibility + resolution-independent bounds clamping
- Add mouse_wait_long() with 100,000 iteration timeout for init-time
  i8042 controller commands (mouse_write/mouse_read/load). The original
  mouse_wait() stays at 100 iterations for ISR-safe use in main().

- In load(): use mouse_wait_long() for all direct port I/O ($64/$60)
  and clear CCB bit 5 (AND NOT $20) to ensure the mouse clock is not
  disabled — required for Hyper-V which enforces this strictly.

- Replace Console.getConsoleProperties^.Width/Height with
  video.frontBufferWidth/Height for mouse bounds clamping. The old
  console properties are zero when console.init() is not called,
  which locked the cursor to (0,0). Add 'video' to uses clause.
2026-02-28 16:31:26 +00:00
t3hn3rd be4b482bde fix: LVGL rendering for 16bpp framebuffers (HyperV compatibility)
continuous-integration/drone/push Build is failing
The LVGL flush callback assumed 32bpp (4-byte stride, direct pixel
copy), causing corrupted output on hypervisors that fall back to
16bpp modes (e.g. HyperV at 1600x1200x16).

- lvgl.pas: Make lvgl_flush_cb BPP-aware; add ARGB8888->RGB565
  conversion path for 16bpp, keep direct copy for 32bpp. Replace
  static lv_buf1 array (hardcoded 1600px wide) with kalloc'd buffer
  sized to actual screen width.
- doublebuffer.pas: Fix allocateBackBuffer size from (W*H*BPP) to
  (W*H*BPP) div 8 to get correct byte count.
- vesa.pas: Account for BPP in allocateVESAFrameBuffer page range
  calculation to avoid under-mapping at higher BPP/resolutions.
- Removed the initialization of console in kernel.pas as this will
  cause issues on some systems that don't expect to need to allocate the
  textmode buffer.
2026-02-28 15:38:11 +00:00
t3hn3rd 6f50b053b7 Full LVGL binding & Cursor fix
- Full(ish) LVGL bindings implemented.
- Cursor replaced with an actual cursor.
2026-02-28 00:06:10 +00:00
t3hn3rd ece376660c Removed old lv_conf
continuous-integration/drone/push Build is failing
2026-02-27 22:43:53 +00:00
t3hn3rd 98a14bc7dc More work towards LVGL implementation
continuous-integration/drone/push Build is failing
2026-02-27 22:43:02 +00:00
t3hn3rd 989e36ffe2 Initial LVGL modifications
Basic LVGL wrapper with an example desktop & windowing system.
2026-02-27 16:30:31 +00:00
t3hn3rd ceb03a9d7e Merge branch 'feature/fpc-3.2.2' into feature/lvgl
# Conflicts:
#	.drone.yml
#	virtualbox-wrapper.ps1
2026-02-26 15:51:37 +00:00
admin 924305a1ab Merge pull request 'Migration from FPC 2.6.4 to FPC 3.2.2' (#9) from feature/fpc-3.2.2 into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #9
2026-02-26 12:51:09 +00:00
t3hn3rd 8be364c990 Merge pull request 'feature/ci-cd-drone-migration' (#3) from feature/ci-cd-drone-migration into develop
continuous-integration/drone/push Build is passing
Reviewed-on: #3
2025-03-10 20:08:38 +00:00
t3hn3rd 0e2c6b2936 Final commit to merge through develop & master
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is failing
- CI/CD Pipeline now working & tested.
- Commits to all branches will trigger the pipeline in DroneCI.
- Commits to master will trigger the resulting ISO artefact to be uploaded to Gitea as a Package.

# Conflicts:
#	.drone.yml
2025-03-10 12:48:21 +00:00
t3hn3rd 632c3fa66b DevOps Workflow Improvements
- `VirtualBox-Wrapper.ps1` now takes 'up' or 'down' as opposed to a machine name. This allows start/stop of a virtualmachine.
- `VirtualBox-Wrapper.ps1` now relies on a gitignored `localenv.json` to work.
- `VirtualBox-Wrapper.ps1` can also optionally monitor the log file generated from the serial adapter in VirtualBox.
- `readme.md` updated to provide instructions on how to populate the `localenv.json` file.
- `tasks.json` updated to have a "Clean" task to --remove-orphans, the Build task depends on this.
- `tasks.json` updated to have a "Close VirtualBox" task, this runs the `virtualbox-wrapper.ps1` in 'down' mode. The Build task depends on this.
- `launch.json` updated to run the `VirtualBox-Wrapper.ps1` with the "-Command up" argument, instead of machine name.
- .gitignore updated to ignore any instances of `localenv.json`.
2025-03-09 13:05:39 +00:00
t3hn3rd 875e3e4765 VirtualBox 7 Compatability Changes
- Created a PowerShell script `virtualbox-wrapper.ps1` to wrap calls to vboxmanage and only exit once the virtual machine has been terminated.
- Updated launch.json to use the PowerShell launch type to launch `virtualbox-wrapper.ps1` with the machine name supplied as an argument.
- Updated `readme.md` to reflect these changes.
2025-03-08 19:29:46 +00:00
t3hn3rd e28d68128d Merge branch 'feature/video-refactor' of https://gitlab.spexeah.com/spexeah/asuro into feature/video-refactor 2022-02-07 19:48:15 +00:00
t3hn3rd a9969d58f8 Draw texture function added to Video driver. 2022-02-07 19:48:01 +00:00
t3hn3rd d7a54d858d TARGA & Texture Units
Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
2022-02-07 19:48:00 +00:00
t3hn3rd 4e991c3e6f Double Buffer with SSE 128 copy working 2022-02-07 19:48:00 +00:00
t3hn3rd a3217de71a SSE MOVUPS/128bit Memcpy + Fixed Doublebuffer 2022-02-07 19:48:00 +00:00
t3hn3rd 19b433a19f Vesa32 additions + util functions to support 2022-02-07 19:48:00 +00:00
t3hn3rd 69d1d22a18 Fixed files being weird with case/unit searches 2022-02-07 19:48:00 +00:00
t3hn3rd 5c15343ed0 Delete files to recommit with lowercase names. 2022-02-07 19:48:00 +00:00
t3hn3rd 3ae349fbc8 New modular driver set for video
Started outlining how the modular driver set will look for video drawing routines. Currently supports Drawing pixels to the screen & Flushing backbuffer -> frontbuffer.
Still very much test code, tracer is used everywhere for debugging, NOT DEVELOP READY.
Many more draw routines need implementing - such as, but not limited to; drawRect, drawBitmap, drawLine, drawCurve, drawCircle.

TODO: Implement the aforementioned routines in all VESA modes + WindowManager.
2022-02-07 19:48:00 +00:00
t3hn3rd 78c060c114 Abstracted video driver somewhat
Split out video driver into abstract/standard/implementation.
2022-02-07 19:48:00 +00:00
t3hn3rd cd925e96c2 Enabled AVX + Changed flush to flush 2 pixels per iteration. 2022-02-07 19:48:00 +00:00
t3hn3rd 142dd486dd Double buffering implemented
Double buffering is now enabled with the use of the new large alloc (klalloc).
2022-02-07 19:48:00 +00:00
t3hn3rd beeeabd441 Expaneded Video.pas and addec color.pas
Backbuffer will need modification to lmemorymanager to remove the limits to allocation size.
2022-02-07 19:48:00 +00:00
t3hn3rd b73c66f6d6 Started work on refactored video. 2022-02-07 19:48:00 +00:00
t3hn3rd a7111d3cac Draw texture function added to Video driver. 2022-02-06 13:26:12 +00:00
t3hn3rd d182fd7f46 TARGA & Texture Units
Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
2022-02-06 13:25:04 +00:00
t3hn3rd b5582b1284 Double Buffer with SSE 128 copy working 2022-01-30 00:17:50 +00:00
t3hn3rd 161cea4920 SSE MOVUPS/128bit Memcpy + Fixed Doublebuffer 2022-01-29 01:39:45 +00:00
t3hn3rd 6b81c4ece0 Vesa32 additions + util functions to support 2022-01-23 16:58:46 +00:00
t3hn3rd ee17f69115 Fixed files being weird with case/unit searches 2021-07-07 17:49:04 +01:00
t3hn3rd 81c19bff16 Delete files to recommit with lowercase names. 2021-07-07 17:49:04 +01:00
t3hn3rd e7cda58113 New modular driver set for video
Started outlining how the modular driver set will look for video drawing routines. Currently supports Drawing pixels to the screen & Flushing backbuffer -> frontbuffer.
Still very much test code, tracer is used everywhere for debugging, NOT DEVELOP READY.
Many more draw routines need implementing - such as, but not limited to; drawRect, drawBitmap, drawLine, drawCurve, drawCircle.

TODO: Implement the aforementioned routines in all VESA modes + WindowManager.
2021-07-07 17:49:04 +01:00
t3hn3rd 44f18554e1 Abstracted video driver somewhat
Split out video driver into abstract/standard/implementation.
2021-07-07 17:49:04 +01:00
t3hn3rd 52b42ec975 Enabled AVX + Changed flush to flush 2 pixels per iteration. 2021-07-07 17:49:04 +01:00
t3hn3rd 2815dd9e4d Double buffering implemented
Double buffering is now enabled with the use of the new large alloc (klalloc).
2021-07-07 17:49:04 +01:00
t3hn3rd d057bfc3ff Expaneded Video.pas and addec color.pas
Backbuffer will need modification to lmemorymanager to remove the limits to allocation size.
2021-07-07 17:49:04 +01:00
t3hn3rd e4621c8aaa Started work on refactored video. 2021-07-07 17:49:04 +01:00
128 changed files with 69432 additions and 6560 deletions
+8 -1
View File
@@ -1 +1,8 @@
* text=auto eol=lf
* text=auto eol=lf
lvglh/** linguist-vendored
lvgl/** linguist-vendored
.vscode/* linguist-vendored
lib/* linguist-generated
release/* linguist-generated
iso/* linguist-generated
*.asm linguist-detectable
+5
View File
@@ -11,3 +11,8 @@
/*.img
src/include/asuro.pas
localenv.json
/lvgl/
dockerout.txt
AGENTS.md
*.log
/doc/*.md
+1 -1
View File
@@ -5,7 +5,7 @@ VOLUME ["/code"]
ENV DEBIAN_FRONTEND=noninteractive
RUN dpkg --add-architecture i386
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
SHELL ["/bin/bash", "-c"]
+2 -1
View File
@@ -7,7 +7,7 @@ echo "Asuro Compilation"
echo " "
#Compile Stub.asm
rm lib/*
rm -f lib/*
runOrFail() {
local binary=$1
@@ -23,6 +23,7 @@ runOrFail() {
declare -a run_steps=(
"compile_stub.sh" "Failed to compile stub!"
"compile_vergen.sh" "Versions failed to compile"
"compile_lvgl.sh" "Failed to compile LVGL!"
"compile_sources.sh" "Failed to compile FPC Sources!"
"compile_link.sh" "Failed linking!"
"compile_isogen.sh" "Failed to create ISO!"
+6 -1
View File
@@ -14,4 +14,9 @@ done;
objstring=lib/stub.o" "$objstring
echo "Object Files: "$objstring
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
+132
View File
@@ -0,0 +1,132 @@
#!/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).
# Cache liblvgl.a on host mount (/code/lvgl/) to skip rebuild.
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)/lvglh"
OUT_DIR="$(pwd)/lib"
CACHE_DIR="/code/lvgl"
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 " "
# If cached liblvgl.a exists on host mount, just copy it and skip everything
if [ -f "${CACHE_DIR}/liblvgl.a" ]; then
echo "Found cached liblvgl.a in ${CACHE_DIR}, copying to ${OUT_DIR}..."
cp "${CACHE_DIR}/liblvgl.a" "${OUT_DIR}/liblvgl.a"
echo "(Delete lvgl/liblvgl.a to force a full rebuild.)"
echo " "
echo "LVGL compilation complete (cached)."
echo " "
exit 0
fi
# 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"
# Compile custom LVGL extension files from lvglh/
LVGLH_SOURCES=$(find "${CONF_DIR}" -name '*.c' 2>/dev/null || true)
if [ -n "$LVGLH_SOURCES" ]; then
echo " "
echo "Compiling custom LVGL files from lvglh/..."
LVGLH_OBJ_DIR="/tmp/lvglh_obj"
rm -rf "$LVGLH_OBJ_DIR"
mkdir -p "$LVGLH_OBJ_DIR"
HCOUNT=0
HERRORS=0
for src in $LVGLH_SOURCES; do
HCOUNT=$((HCOUNT + 1))
rel="${src#${CONF_DIR}/}"
obj_path="${LVGLH_OBJ_DIR}/${rel%.c}.o"
mkdir -p "$(dirname "$obj_path")"
echo " [lvglh] $rel"
if ! $CC $CFLAGS -c "$src" -o "$obj_path" 2>&1; then
echo " FAILED: $rel"
HERRORS=$((HERRORS + 1))
fi
done
echo "Compiled ${HCOUNT} custom files (${HERRORS} errors)."
if [ "$HERRORS" -ne 0 ]; then
echo "Custom LVGL compilation FAILED."
exit 1
fi
# Append custom objects into the existing archive
HOBJECTS=$(find "$LVGLH_OBJ_DIR" -name '*.o')
ar rcs "${OUT_DIR}/liblvgl.a" $HOBJECTS
echo "Updated ${OUT_DIR}/liblvgl.a with custom objects."
else
echo "No custom LVGL files in lvglh/."
fi
# Cache liblvgl.a and source to host mount for next build
echo "Caching LVGL to host mount..."
mkdir -p "$CACHE_DIR"
rm -rf ${CACHE_DIR}/* ${CACHE_DIR}/.[!.]* ${CACHE_DIR}/..?* 2>/dev/null || true
cp "${OUT_DIR}/liblvgl.a" "${CACHE_DIR}/liblvgl.a"
cp -a "$LVGL_DIR/src" "${CACHE_DIR}/src"
cp -a "$LVGL_DIR"/*.h "${CACHE_DIR}/" 2>/dev/null || true
cp -a "$OBJ_DIR" "${CACHE_DIR}/obj"
echo "Done."
echo " "
echo "LVGL compilation complete."
echo " "
+1 -1
View File
@@ -4,4 +4,4 @@ echo "======================="
echo " "
echo "Compiling FPC Sources..."
echo " "
fpc -Aelf -gw -g -gl -n -vlewn -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* -Fusrc/driver/bus/* -Fusrc/driver/bus/usb/* -Fusrc/driver/hid/* src/kernel.pas
View File
+12886
View File
File diff suppressed because it is too large Load Diff
+374
View File
File diff suppressed because it is too large Load Diff
+35812
View File
File diff suppressed because it is too large Load Diff
-2709
View File
File diff suppressed because it is too large Load Diff
+102 -69
View File
File diff suppressed because it is too large Load Diff
-65
View File
@@ -1,65 +0,0 @@
// Copyright 2021 Kieron Morris
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Driver->Bus->EHCI - Enhanced Host Controller Interface Driver.
@author(Kieron Morris <[email protected]>)
}
unit EHCI;
interface
uses
tracer,
Console,
PCI,
drivertypes,
pmemorymanager,
vmemorymanager,
util,
drivermanagement;
function load : boolean;
implementation
function load : boolean;
var
devices : TDeviceArray;
count : uint32;
i : uint32;
begin
tracer.push_trace('EHCI.load');
devices:= PCI.getDeviceInfo($0C, $03, $20, count);
console.output('USB-EHCI Driver', 'Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.output('USB-EHCI Driver', 'Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
end;
end;
load:= true;
end;
end.
-96
View File
@@ -1,96 +0,0 @@
// Copyright 2021 Kieron Morris
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Driver->Bus->OHCI - Open Host Controller Interface Driver.
@author(Kieron Morris <[email protected]>)
}
unit OHCI;
interface
uses
tracer,
Console,
PCI,
drivertypes,
pmemorymanager,
vmemorymanager,
util,
drivermanagement;
type
POHCI_MMR = ^TOHCI_MMR;
TOHCI_MMR = packed record
HcRevision : uint32;
HcControl : uint32;
HcCommandStatus : uint32;
HcIntStatus : uint32;
HcIntEnable : uint32;
HcIntDisable : uint32;
HcHCCA : uint32;
HcPeriodCurrentED : uint32;
HcControlHeadED : uint32;
HcControlCurrentED : uint32;
HcBulkHeadED : uint32;
HcBulkCurrentED : uint32;
HcDoneHead : uint32;
HcFmRemaining : uint32;
HcFmNumber : uint32;
HcPeriodicStart : uint32;
HcLSThreshold : uint32;
HcRhDescriptorA : uint32;
HcRhDescriptorB : uint32;
HcRhStatus : uint32;
end;
function load : boolean;
implementation
function load : boolean;
var
devices : TDeviceArray;
count : uint32;
i : uint32;
block : uint32;
MMR : POHCI_MMR;
begin
tracer.push_trace('OHCI.load');
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
console.output('USB-OHCI Driver', 'Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.output('USB-OHCI Driver', 'Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
block:= devices[i].address0 SHR 22;
force_alloc_block(block, 0);
map_page(block, block);
MMR:= POHCI_MMR(devices[i].address0);
end;
end;
load:= true;
end;
end.
+17 -17
View File
@@ -18,14 +18,14 @@
@author(Aaron Hance <[email protected]>)
@author(Kieron Morris <[email protected]>)
}
unit PCI;
unit pci;
interface
uses
tracer,
util,
console,
syslog,
drivertypes,
lmemorymanager,
vmemorymanager,
@@ -100,14 +100,14 @@ var
begin
push_trace('PCI.load');
console.outputln('PCI', 'Scanning Bus: 0');
syslog.logln('PCI', 'Scanning Bus: 0');
scanBus(0);
//while unscanned busses scan busses
current_bus := 1;
while true do begin
if current_bus < bus_count then begin
console.output('PCI', 'Scanning Bus: ');
console.writeintln(bus_count);
syslog.log('PCI', 'Scanning Bus: ');
syslog.writeintln(bus_count);
scanBus(current_bus);
current_bus := current_bus + 1;
end else break;
@@ -122,7 +122,7 @@ var
begin
push_trace('PCI.init');
console.outputln('PCI','INIT BEGIN.');
syslog.logln('PCI','INIT BEGIN.');
DevID.Bus:= biUnknown;
DevID.id0:= 0;
DevID.id1:= 0;
@@ -130,7 +130,7 @@ begin
DevID.id3:= 0;
DevID.ex:= nil;
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
console.outputln('PCI', 'INIT END.');
syslog.logln('PCI', 'INIT END.');
pop_trace;
end;
@@ -388,16 +388,16 @@ begin
DevID^.id4:= device.vendor_id;
DevID^.ex:= nil;
console.output('PCI', 'Found Device: ');
console.writehex(device.header_type);
console.writestring(' ');
console.writehex(device.device_id);
console.writestring(' ');
console.writehex(device.class_code);
console.writestring(' ');
console.writehex(device.subclass_class);
console.writestring(' ');
console.writehexln(device.prog_if);
syslog.log('PCI', 'Found Device: ');
syslog.writehex(device.header_type);
syslog.writestring(' ');
syslog.writehex(device.device_id);
syslog.writestring(' ');
syslog.writehex(device.class_code);
syslog.writestring(' ');
syslog.writehex(device.subclass_class);
syslog.writestring(' ');
syslog.writehexln(device.prog_if);
devices[device_count] := device;
device_count := device_count + 1;
-65
View File
@@ -1,65 +0,0 @@
// Copyright 2021 Kieron Morris
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Driver->Bus->UHCI - Universal Host Controller Interface Driver.
@author(Kieron Morris <[email protected]>)
}
unit UHCI;
interface
uses
tracer,
Console,
PCI,
drivertypes,
pmemorymanager,
vmemorymanager,
util,
drivermanagement;
function load : boolean;
implementation
function load : boolean;
var
devices : TDeviceArray;
count : uint32;
i : uint32;
begin
tracer.push_trace('UHCI.load');
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
console.output('USB-UHCI Driver','Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.output('USB-UHCI Driver','Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
end;
end;
load:= true;
end;
end.
-65
View File
@@ -1,65 +0,0 @@
// Copyright 2021 Kieron Morris
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Driver->Bus->XHCI - eXtensible Host Controller Interface Driver.
@author(Kieron Morris <[email protected]>)
}
unit XHCI;
interface
uses
tracer,
Console,
PCI,
drivertypes,
pmemorymanager,
vmemorymanager,
util,
drivermanagement;
function load : boolean;
implementation
function load : boolean;
var
devices : TDeviceArray;
count : uint32;
i : uint32;
begin
tracer.push_trace('XHCI.load');
devices:= PCI.getDeviceInfo($0C, $03, $30, count);
console.output('USB-XHCI Driver', 'Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.output('USB-XHCI Driver', 'Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
end;
end;
load:= true;
end;
end.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More