From 97dde5c46a9e059b4f54f632957a06659a6c3462 Mon Sep 17 00:00:00 2001 From: 0xMAC8205 Date: Wed, 8 Nov 2023 22:47:39 +0100 Subject: [PATCH] Added Graphics.s and Video.s Sub-Routines --- .gitignore | 1 + KernelRoutineList.txt | 36 +++++----- src/kernel/graphics.s | 150 ++++++++++++++++++++++++++++++++++++++++++ src/kernel/hardware.s | 3 +- src/kernel/video.s | 77 ++++++++++++++++++++++ 5 files changed, 247 insertions(+), 20 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..600d2d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode \ No newline at end of file diff --git a/KernelRoutineList.txt b/KernelRoutineList.txt index 1d86822..56e21a8 100644 --- a/KernelRoutineList.txt +++ b/KernelRoutineList.txt @@ -35,8 +35,8 @@ Hardware.s +- vram_dump beep - set_activity - set_user + set_activity_led + set_user_led scan_keyboard Int.s @@ -104,23 +104,21 @@ console.s graphics.s | - graphics_draw_rectangle - graphics_draw_line - graphics_draw_triangle - graphics_draw_polygon - graphics_draw_text - - graphics_fill_rectangle - graphics_fill_triangle - graphics_fill_polygon - - graphics_set_pixel + +- graphics_draw_rectangle + +- graphics_draw_line + +- graphics_draw_triangle + +- graphics_draw_polygon + +- graphics_draw_text + +- graphics_fill_rectangle + +- graphics_fill_triangle + +- graphics_fill_polygon + +- graphics_set_pixel video.s | ! Don't support 16 row mode! => Changes in future - video_clear - video_copy_memory - video_set_mode - video_get_mode - video_set_accent - video_get_accent \ No newline at end of file + +- video_clear + +- video_copy_memory + +- video_set_mode + +- video_get_mode + +- video_set_accent + +- video_get_accent \ No newline at end of file diff --git a/src/kernel/graphics.s b/src/kernel/graphics.s index e69de29..e9c8466 100644 --- a/src/kernel/graphics.s +++ b/src/kernel/graphics.s @@ -0,0 +1,150 @@ +; !!! This module only works with the Full +; Pixel Graphics mode. +; i.e. LS7 Computer Rev. 2 !!! + +graphics_draw_rectangle: + ; Graphics Draw Rectangle + ; Draws a Rectangle Outline on the Screen + + ; Input: + ; A => BorderColor + ; X => X Start Position + ; Y => Y Start Position + ; K1 => Rectangle Width + ; K2 => Rectangle Height + + ; Output: (none) + + + rts + +graphics_draw_line: + ; Graphics Draw Line + ; Draws a line on the Screen + + ; Input: + ; A => FillColor + ; X => X Start Position + ; Y => Y Start Position + ; K1 => X End Position + ; K2 => Y End Position + + ; Output: (none) + + + rts + +graphics_draw_triangle: + ; Graphics Draw Triangle + ; Draws a Triangle Outline on the Screen + + ; Input: + ; A => BorderColor + ; X => A X Position + ; Y => A Y Position + ; K1 => B X Position + ; K2 => B Y Position + ; K3 => C X Position + ; K4 => C X Position + + ; Output: (none) + + + rts + +graphics_draw_polygon: + ; Graphics Draw Polygon + ; Draws a Polygon Outline on the Screen, + ; from a Coordinate List + + ; Input: + ; A => BorderColor + ; X => LOW List Pointer + ; Y => HIGH List Pointer + + ; Output: (none) + + + rts + +graphics_draw_text: + ; Graphics Draw Text + ; Draws Text on the Screen, + ; with custom color and fond + + ; Input: + ; A => FillColor + ; X => X Position + ; Y => Y Position + ; K1 => LOW String Pointer + ; K2 => HIGH String Pointer + ; K3 => LOW Font Pointer + ; K4 => HIGH Font Pointer + + ; Output: (none) + + + rts + +graphics_fill_rectangle: + ; Graphics Fill Rectangle + ; Draws a Filled Rectangle on the Screen + + ; Input: + ; A => FillColor + ; X => X Start Position + ; Y => Y Start Position + ; K1 => Rectangle Width + ; K2 => Rectangle Height + + ; Output: (none) + + + rts + +graphics_fill_triangle: + ; Graphics Draw Triangle + ; Draws a Filled Triangle on the Screen + + ; Input: + ; A => FillColor + ; X => A X Position + ; Y => A Y Position + ; K1 => B X Position + ; K2 => B Y Position + ; K3 => C X Position + ; K4 => C X Position + + ; Output: (none) + + + rts + +graphics_fill_polygon: + ; Graphics Draw Polygon + ; Draws a Filled Polygon on the Screen, + ; from a Coordinate List + + ; Input: + ; A => FillColor + ; X => LOW List Pointer + ; Y => HIGH List Pointer + + ; Output: (none) + + + rts + +graphics_set_pixel: + ; Graphics Set Pixel + ; Sets the Pixel to a Color + + ; Input: + ; A => FillColor + ; X => X Position + ; Y => Y Position + + ; Output: (none) + + + rts diff --git a/src/kernel/hardware.s b/src/kernel/hardware.s index 07541ed..27c93d1 100644 --- a/src/kernel/hardware.s +++ b/src/kernel/hardware.s @@ -96,4 +96,5 @@ vram_dump: ; Output: (none) - rts \ No newline at end of file + rts + diff --git a/src/kernel/video.s b/src/kernel/video.s index e69de29..3135297 100644 --- a/src/kernel/video.s +++ b/src/kernel/video.s @@ -0,0 +1,77 @@ +video_clear: + ; Video Clear + ; Clears the Screen, black + + ; Input: (none) + ; Output: (none) + + + rts + +video_copy_memory: + ; Video Copy Memory + ; Sets the Pixel to a Color + + ; Input: + ; A => Horizontal Wrap + ; X => X Start Position + ; Y => Y Start Position + ; K1 => X End Position + ; K2 => Y End Position + ; K3 => LOW Memory Pointer + ; K4 => HIGH Memory Pointer + + ; Output: + ; X <= LOW Memory Pointer (end) + ; Y <= HIGH Memory Pointer (end) + + + rts + +video_set_mode: + ; Video Set Mode + ; Sets the Video Mode to + ; 0 => Text; 1 => Graphics + + ; Input: + ; A => Mode + + ; Output: (none) + + + rts + +video_get_mode: + ; Video Get Mode + ; Gets the Video mode + ; 0 => Text; 1 => Graphics + + ; Input: (none) + ; Output: + ; A <= Mode + + + rts + +video_set_accent: + ; Video Set Accent + ; Sets the Video Card's Accent + + ; Input: + ; A => Accent + + ; Output: (none) + + + rts + +video_get_accent: + ; Video Get Accent + ; Gets the Video Card's Accent + + ; Input: (none) + ; Output: + ; A <= Accent + + + rts