mirror of
https://gitlab.os-k.eu/os-k-team/kvisc.git
synced 2023-08-25 14:05:46 +02:00
dev
This commit is contained in:
parent
6ae9169f6d
commit
9487374328
6
ka/inc/screen.k
Normal file
6
ka/inc/screen.k
Normal file
@ -0,0 +1,6 @@
|
||||
; The OS/K Team licenses this file to you under the MIT license.
|
||||
; See the LICENSE file in the project root for more information.
|
||||
|
||||
SCR_TEXTMODE_WIDTH := 80
|
||||
SCR_TEXTMODE_HEIGHT := 25
|
||||
|
18
ka/main.k
18
ka/main.k
@ -5,23 +5,5 @@
|
||||
; Main function
|
||||
;
|
||||
main:
|
||||
mov rdx, 25
|
||||
.1:
|
||||
mov rcx, 79
|
||||
prn.rep '+'
|
||||
prn '!'
|
||||
dec rdx
|
||||
test rdx, rdx
|
||||
j.nz .1
|
||||
|
||||
mov rcx, 80
|
||||
prn.rep '&'
|
||||
|
||||
mov rcx, 80
|
||||
prn.rep '%'
|
||||
|
||||
call showoff
|
||||
|
||||
hlt
|
||||
ret
|
||||
|
||||
|
19
ka/tests.k
19
ka/tests.k
@ -1,6 +1,25 @@
|
||||
; The OS/K Team licenses this file to you under the MIT license.
|
||||
; See the LICENSE file in the project root for more information.
|
||||
|
||||
putc_scroll_test:
|
||||
mov rdx, 25
|
||||
.1:
|
||||
mov rcx, 79
|
||||
prn.rep '+'
|
||||
prn '!'
|
||||
dec rdx
|
||||
test rdx, rdx
|
||||
j.nz .1
|
||||
|
||||
mov rcx, 80
|
||||
prn.rep '&'
|
||||
|
||||
mov rcx, 80
|
||||
prn.rep '%'
|
||||
|
||||
call showoff
|
||||
ret
|
||||
|
||||
cpudev_test:
|
||||
call RFS.GetLeastAvail
|
||||
mov rbx, rax
|
||||
|
12
vm/dv/DEVICES
Normal file
12
vm/dv/DEVICES
Normal file
@ -0,0 +1,12 @@
|
||||
# The OS/K Team licenses this file to you under the MIT license.
|
||||
# See the LICENSE file in the project root for more information.
|
||||
|
||||
The following device numbers are reserved and always correspond
|
||||
to the same device:
|
||||
|
||||
# desc
|
||||
0 CPU device
|
||||
1 memory device
|
||||
2 clock device
|
||||
3 keyboard device
|
||||
4 screen device
|
31
vm/dv/clockdev.c
Normal file
31
vm/dv/clockdev.c
Normal file
@ -0,0 +1,31 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include <pc/dev.h>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
long clockdev_poweron(ctx_t *ctx, dev_t *dev)
|
||||
{
|
||||
dev->state = DEVGOOD;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
dev_t clockdev =
|
||||
{
|
||||
.type = "clock",
|
||||
.name = "clock device",
|
||||
.modl = "",
|
||||
.vend = "The OS/K Team",
|
||||
|
||||
.major = KARCH_MAJOR,
|
||||
.minor = KARCH_MINOR,
|
||||
.revis = KARCH_REVIS,
|
||||
|
||||
.fpwon = clockdev_poweron,
|
||||
};
|
||||
|
||||
|
31
vm/dv/keybdev.c
Normal file
31
vm/dv/keybdev.c
Normal file
@ -0,0 +1,31 @@
|
||||
// The OS/K Team licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
#include <pc/dev.h>
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
long keybdev_poweron(ctx_t *ctx, dev_t *dev)
|
||||
{
|
||||
dev->state = DEVGOOD;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
dev_t keybdev =
|
||||
{
|
||||
.type = "keyboard",
|
||||
.name = "keyboard device",
|
||||
.modl = "",
|
||||
.vend = "The OS/K Team",
|
||||
|
||||
.major = KARCH_MAJOR,
|
||||
.minor = KARCH_MINOR,
|
||||
.revis = KARCH_REVIS,
|
||||
|
||||
.fpwon = keybdev_poweron,
|
||||
};
|
||||
|
||||
|
@ -32,6 +32,8 @@ void console_init(ctx_t *ctx)
|
||||
SDL_CreateWindowAndRenderer(SCREEN_WIDTH, SCREEN_HEIGHT, 0,
|
||||
&scr_win, &scr_rend);
|
||||
|
||||
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
|
||||
|
||||
if (scr_win == NULL || scr_rend == NULL)
|
||||
{
|
||||
logerr("Couldn't create SDL screen window/renderer: %s", SDL_GetError());
|
||||
@ -55,6 +57,9 @@ void console_init(ctx_t *ctx)
|
||||
memset(scr_lines[y], ' ', CONSOLE_WIDTH);
|
||||
scr_lines[y][CONSOLE_WIDTH] = 0;
|
||||
}
|
||||
|
||||
SDL_RenderClear(scr_rend);
|
||||
SDL_RenderPresent(scr_rend);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
@ -85,9 +90,6 @@ void console_render(ctx_t *ctx)
|
||||
{
|
||||
size_t y;
|
||||
|
||||
SDL_SetRenderDrawColor(scr_rend, 20, 20, 20, 0);
|
||||
//SDL_RenderSetScale(scr_rend, 0.2f, 0.2f);
|
||||
|
||||
SDL_RenderClear(scr_rend);
|
||||
|
||||
for (y = 0; y < CONSOLE_HEIGHT; y++)
|
||||
@ -118,7 +120,8 @@ void console_putat(ctx_t *ctx, char ch, int x, int y)
|
||||
|
||||
if (!surf)
|
||||
{
|
||||
logerr("console_putat: couldn't render TTF font\n");
|
||||
logerr("console_putat: couldn't render TTF font: "
|
||||
"(%d,%d) '%c'\nError: '%s'\n", x, y, ch, SDL_GetError());
|
||||
die(-1);
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,14 @@
|
||||
// Add new builtin devices here
|
||||
//
|
||||
|
||||
extern dev_t cpudev, memdev;
|
||||
extern dev_t cpudev, memdev, clockdev, keybdev, screendev;
|
||||
|
||||
static dev_t *arch_d[] =
|
||||
{
|
||||
&cpudev,
|
||||
&memdev,
|
||||
&clockdev,
|
||||
&keybdev,
|
||||
|
||||
NULL,
|
||||
};
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <pc/arch.h>
|
||||
|
||||
#define DEVLEN 32
|
||||
#define DEVSLOTS 256
|
||||
#define DEVSLOTS 4096
|
||||
|
||||
typedef long (*devfn_t)(ctx_t *, dev_t *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user