Addes Video Sub-Routines
Cleaned Up Updared README
This commit is contained in:
parent
834b07fbfa
commit
bf2ac59896
13
README.md
13
README.md
@ -1,2 +1,15 @@
|
|||||||
# LS7-Kernel
|
# LS7-Kernel
|
||||||
Kernel for the LS/7 Computer
|
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
|
13
lib/kernel.s
13
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
|
||||||
|
|
||||||
|
|
2
lib/src/irq.s
Normal file
2
lib/src/irq.s
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
irq
|
||||||
|
rti
|
203
lib/src/video.s
Normal file
203
lib/src/video.s
Normal file
@ -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
|
45
lib/variables.s
Normal file
45
lib/variables.s
Normal file
@ -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
|
65
main.s
65
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
|
||||||
|
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
|
|
||||||
|
|
||||||
.include "lib/kernel.s"
|
|
||||||
|
|
||||||
reset
|
|
||||||
|
|
||||||
|
|
||||||
|
loop jmp loop
|
||||||
|
|
||||||
.org $fffa
|
irq_jump jmp (irq_vector)
|
||||||
.addr $0f00
|
|
||||||
.addr reset
|
|
||||||
.addr irq_jump
|
.org $fffa
|
||||||
|
.addr $0f00
|
||||||
|
.addr reset
|
||||||
|
.addr irq_jump
|
||||||
|
|
||||||
; hardware registers
|
; hardware registers
|
||||||
vidx = $be00
|
vidx = $be00
|
||||||
@ -34,4 +72,5 @@ ier = $bf8e
|
|||||||
|
|
||||||
keyboard_port = $bd00
|
keyboard_port = $bd00
|
||||||
system_register = $bc00
|
system_register = $bc00
|
||||||
.end
|
|
||||||
|
.end
|
Loading…
Reference in New Issue
Block a user