From bf2ac598968a7202dda856800c242b20db3ebf91 Mon Sep 17 00:00:00 2001 From: 0xMAC8205 Date: Sat, 28 Oct 2023 20:47:43 +0200 Subject: [PATCH] Addes Video Sub-Routines Cleaned Up Updared README --- README.md | 13 ++ a.out | Bin 0 -> 16384 bytes lib/kernel.s | 13 ++ lib/{kernel/console.s => src/char.s} | 0 lib/{kernel/int.s => src/event_handler.s} | 0 lib/{kernel/irq.s => src/int.s} | 0 lib/src/irq.s | 2 + lib/{kernel => src}/keyboard.s | 0 lib/{kernel => src}/memory_manager.s | 0 lib/{kernel => src}/string.s | 0 lib/src/video.s | 203 ++++++++++++++++++++++ lib/variables.s | 45 +++++ main.s | 61 +++++-- 13 files changed, 326 insertions(+), 11 deletions(-) create mode 100644 a.out rename lib/{kernel/console.s => src/char.s} (100%) rename lib/{kernel/int.s => src/event_handler.s} (100%) rename lib/{kernel/irq.s => src/int.s} (100%) create mode 100644 lib/src/irq.s rename lib/{kernel => src}/keyboard.s (100%) rename lib/{kernel => src}/memory_manager.s (100%) rename lib/{kernel => src}/string.s (100%) create mode 100644 lib/src/video.s create mode 100644 lib/variables.s diff --git a/README.md b/README.md index 831b44a..72f89fd 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,15 @@ # LS7-Kernel Kernel for the LS/7 Computer + +!! Still in Development !! + +# Building & Compiling +Although, there already is a pre-compiled Binary "a.out", +if you want to make and apply changes you have to compile the program +yourself. + +The Compile and Upload scripts are contained in the Makefile + +* Dependencies: +* Compiler: vasm6502 (may switch to cc65) +* Uploader: minipro \ No newline at end of file diff --git a/a.out b/a.out new file mode 100644 index 0000000000000000000000000000000000000000..e8d9b3b13ef7b649d93f1d4cafdc3b440dbabcd0 GIT binary patch literal 16384 zcmeIuOHG4O6b8UQUkN)PEpG}*r62$iO-NWFfF%ZwgJa-&Amqwmi4w}5AYn$rJnsK` z`x;BFGG-lRd{;ilzV0%P>o#LoKN;_JopGp()Ma{;K2KkzZ_?ZJefp3-NuQ>dkABE* zJ)fTE>naNd3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b* k1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKz&`_LoB1+-0rSEpH~;_u literal 0 HcmV?d00001 diff --git a/lib/kernel.s b/lib/kernel.s index e69de29..8957e4e 100644 --- a/lib/kernel.s +++ b/lib/kernel.s @@ -0,0 +1,13 @@ + .include "lib/src/irq.s" + .include "lib/src/keyboard.s" + .include "lib/src/video.s" + .include "lib/src/string.s" + .include "lib/src/int.s" + + + + +kernel_init + rts + + \ No newline at end of file diff --git a/lib/kernel/console.s b/lib/src/char.s similarity index 100% rename from lib/kernel/console.s rename to lib/src/char.s diff --git a/lib/kernel/int.s b/lib/src/event_handler.s similarity index 100% rename from lib/kernel/int.s rename to lib/src/event_handler.s diff --git a/lib/kernel/irq.s b/lib/src/int.s similarity index 100% rename from lib/kernel/irq.s rename to lib/src/int.s diff --git a/lib/src/irq.s b/lib/src/irq.s new file mode 100644 index 0000000..2557905 --- /dev/null +++ b/lib/src/irq.s @@ -0,0 +1,2 @@ +irq + rti \ No newline at end of file diff --git a/lib/kernel/keyboard.s b/lib/src/keyboard.s similarity index 100% rename from lib/kernel/keyboard.s rename to lib/src/keyboard.s diff --git a/lib/kernel/memory_manager.s b/lib/src/memory_manager.s similarity index 100% rename from lib/kernel/memory_manager.s rename to lib/src/memory_manager.s diff --git a/lib/kernel/string.s b/lib/src/string.s similarity index 100% rename from lib/kernel/string.s rename to lib/src/string.s diff --git a/lib/src/video.s b/lib/src/video.s new file mode 100644 index 0000000..e5fefde --- /dev/null +++ b/lib/src/video.s @@ -0,0 +1,203 @@ +video_write + ; Video Write (string) + ; String will be written from a Pointer, + ; without a new line at the end + + ; Input: + ; X => LOW Memory Pointer + ; Y => HIGH Memory Pointer + + ; Output: (none) + + + rts + +video_write_static + ; Video Write Static (string) + ; String will be written wich follows after + ; the JSR call without a new line at the end + + ; Input: (none) + ; Output: (none) + + + rts + +video_writeline + ; Video Writeline (string) + ; Same as "video_write", except at + ; the end, a new line begins + + ; Input: + ; X => LOW Memory Pointer + ; Y => HIGH Memory Pointer + + ; Output: (none) + + + rts + +video_writeline_static + ; Video Writeline Static (string) + ; Same as "video_write_static", except at + ; the end, a new line begins + + ; Input: (none) + ; Output: (none) + + + rts + +video_set_color + ; Video Set Color + ; Sets the color, of the content + ; that will be written, following + + ; Input: + ; A => Color + + ; Output: (none) + + + rts + +video_set_foreground + ; Video Set Foreground + ; Sets the Foreground color + + ; Input: + ; A => Color + + ; Output: (none) + + + rts + +video_set_background + ; Video Set Background + ; Sets the Background color + + ; Input: + ; A => Color + + ; Output: (none) + + + rts + +video_read_line + ; Video Read Line + ; Loops, till the Return key is pressed + ; Output is stored in $300 => "Typebuffer" + + ; Input: (none) + ; Output: (none) + + + rts + +video_read_char + ; Video Read Char + ; Loops, till a Key is pressed + + ; Input: (none) + + ; Output: + ; A => Pressed Key as Char + + + rts + +video_set_cursor + ; Video Set Cursor + ; Sets the Cursor Location + + ; Input: + ; X => X Coordinate + ; Y => Y Coordinate + + ; Output: (none) + + + rts + +video_get_cursor + ; Video Get Cursor + ; Gets the Cursor Location + + ; Input: (none) + + ; Output: + ; X => X Coordinate + ; Y => Y Coordinate + + + rts + +video_return + ; Video Return + ; Sets the Cursor to it's line starting Position + ; and if nessesary, scrolls it up and prints the Start Text + + ; Input: (none) + ; Output: (none) + + + rts + +video_scroll + ; Video Scroll + ; Scrolls the screen in the given direction + + ; Input: + ; A => Scroll Mode + + ; Output: (none) + + ; Syntax: + ; (MSB) 0bxxxx0000 (LSB) + ; |||| + ; |||+- 0 = Scroll LEFT 1 = Scroll RIGHT + ; ||| + ; ||+-- 0 = Scroll UP 1 = Scroll DOWN + ; || + ; |+--- 0 = Dispose content & replace gap with Empty cells + ; | 1 = Wrap around + ; | + ; +---- 0 = Scroll Text Video Buffer (Y 0 - 31) (4k) + ; 1 = Scroll Entire Video Buffer (Y 0 - 255) (32k) + + + ; I.E => 0x03 => Scrolls RIGHT & Up and Disposes "scrolled away" content. Fills gaps with empty cells + + + rts + +video_clear + ; Video Clear + ; Clears the Screen, to + + + rts + +video_reset_color + ; Video Reset Color + ; Resets the Color to it's initial state + + ; Input: (none) + ; Output: (none) + + + rts + +video_reset + ; Video Reset + ; Resets the Video Display + ; to it's initial state, i.e + ; clears the screen, resets the Cursor etc... + + ; Input: (none) + ; Output: (none) + + + rts diff --git a/lib/variables.s b/lib/variables.s new file mode 100644 index 0000000..703f941 --- /dev/null +++ b/lib/variables.s @@ -0,0 +1,45 @@ +; Static System Variables + +; Name Address Size Status Comment + +z0 = $0 ; 8 bit +z1 = $1 ; 8 bit + +irq_a = $200 ; 8 bit (internal) +irq_x = $201 ; 8 bit (internal) +irq_y = $202 ; 8 bit (internal) +irq_vector = $203 ; 16 bit + +k0 = $205 ; 8 bit +k1 = $206 ; 8 bit +k2 = $207 ; 8 bit +k3 = $208 ; 8 bit +k4 = $209 ; 8 bit +k5 = $20a ; 8 bit +k6 = $20b ; 8 bit +k7 = $20c ; 8 bit + +keyboard_current = $20d ; 8 bit +keyboard_previous = $20e ; 8 bit +keyboard_format = $20f ; 8 bit +keyboard_arrow = $210 ; 8 bit +keyboard_modifier = $211 ; 8 bit + +cursor_x = $212 ; 8 bit +cursor_y = $213 ; 8 bit +cursor_x_previous = $214 ; 8 bit (internal) +cursor_y_previous = $215 ; 8 bit (internal) +cursor_value = $216 ; 8 bit +cursor_speed = $217 ; 8 bit +cursor_speed_count = $218 ; 8 bit (internal) +cursor_delay_interval = $219 ; 8 bit +cursor_delay = $21a ; 8 bit +cursor_delay_count = $21b ; 8 bit (internal) +cursor_delay_switch = $21c ; 8 bit (internal) + +soft_system_register = $21d ; 8 bit (internal) + +color = $2fe ; 8 bit + +typelength = $2ff ; 8 bit +typebuffer = $300 ; 256 bit \ No newline at end of file diff --git a/main.s b/main.s index 28f4475..9c92b11 100644 --- a/main.s +++ b/main.s @@ -1,20 +1,58 @@ + .include "lib/variables.s" + + .org $c000 ; $c000 for 16k ROM + + ; libraries + .include "lib/kernel.s" + +reset sei + cld + + lda #irq + sta irq_vector+1 + + lda #$E0 + sta vidm + + lda #$60 + sta cursor_delay + lda #$06 + sta cursor_delay_interval + lda #$20 + sta color + lda #$80 + sta cursor_speed + lda #$ff + sta cursor_x_previous + sta cursor_y_previous + + stz cursor_x + stz cursor_y + stz cursor_value + stz cursor_speed_count + stz cursor_delay_count + stz cursor_delay_switch + stz typelength + stz keyboard_current + stz keyboard_previous + stz system_register + stz soft_system_register + jsr kernel_init - .org $c000 - ; libraries +loop jmp loop - .include "lib/kernel.s" +irq_jump jmp (irq_vector) -reset - - - .org $fffa - .addr $0f00 - .addr reset - .addr irq_jump + .org $fffa + .addr $0f00 + .addr reset + .addr irq_jump ; hardware registers vidx = $be00 @@ -34,4 +72,5 @@ ier = $bf8e keyboard_port = $bd00 system_register = $bc00 - .end \ No newline at end of file + + .end \ No newline at end of file