1
0
mirror of https://gitlab.os-k.eu/os-k-team/kvisc.git synced 2023-08-25 14:05:46 +02:00

scrolling

This commit is contained in:
julianb0 2019-06-20 17:44:48 +02:00
parent e9fa6438a4
commit 6ae9169f6d
No known key found for this signature in database
GPG Key ID: DDF8325C95299A62
8 changed files with 51 additions and 11 deletions

View File

@ -14,6 +14,12 @@ main:
test rdx, rdx test rdx, rdx
j.nz .1 j.nz .1
mov rcx, 80
prn.rep '&'
mov rcx, 80
prn.rep '%'
call showoff call showoff
hlt hlt

View File

@ -10,17 +10,14 @@ FLAGS=-O2 -g -Wall -fno-builtin-log -I.
dv_src = $(shell ls dv/*.c) dv_src = $(shell ls dv/*.c)
in_src = $(shell ls in/*.c) in_src = $(shell ls in/*.c)
pc_src = $(shell ls pc/*.c) pc_src = $(shell ls pc/*.c)
cn_src = $(shell ls cn/*.c)
obj = $(patsubst %.c,$(OBJDIR)/%.o,$(dv_src)) obj = $(patsubst %.c,$(OBJDIR)/%.o,$(dv_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(in_src)) obj += $(patsubst %.c,$(OBJDIR)/%.o,$(in_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(pc_src)) obj += $(patsubst %.c,$(OBJDIR)/%.o,$(pc_src))
obj += $(patsubst %.c,$(OBJDIR)/%.o,$(cn_src))
dep = $(patsubst %.c,$(OBJDIR)/%.d,$(dv_src)) dep = $(patsubst %.c,$(OBJDIR)/%.d,$(dv_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(in_src)) dep += $(patsubst %.c,$(OBJDIR)/%.d,$(in_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(pc_src)) dep += $(patsubst %.c,$(OBJDIR)/%.d,$(pc_src))
dep += $(patsubst %.c,$(OBJDIR)/%.d,$(cn_src))
# Color codes # Color codes
CL='\033[0;32m' CL='\033[0;32m'

View File

@ -4,7 +4,7 @@
#include <in/instrs.h> #include <in/instrs.h>
#include <sys/time.h> #include <sys/time.h>
#include <cn/console.h> #include <pc/console.h>
#define _NEED_ARCH_I #define _NEED_ARCH_I
#include <in/arch_i.h> #include <in/arch_i.h>

View File

@ -3,7 +3,7 @@
#include <unistd.h> #include <unistd.h>
#include <in/instrs.h> #include <in/instrs.h>
#include <cn/console.h> #include <pc/console.h>
IMPL_START_0(hlt) IMPL_START_0(hlt)
{ {

View File

@ -1,7 +1,7 @@
// The OS/K Team licenses this file to you under the MIT license. // The OS/K Team licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include <cn/console.h> #include <pc/console.h>
#define CONSOLE_WIDTH 80 #define CONSOLE_WIDTH 80
#define CONSOLE_HEIGHT 25 #define CONSOLE_HEIGHT 25
@ -91,7 +91,7 @@ void console_render(ctx_t *ctx)
SDL_RenderClear(scr_rend); SDL_RenderClear(scr_rend);
for (y = 0; y < CONSOLE_HEIGHT; y++) for (y = 0; y < CONSOLE_HEIGHT; y++)
if (scr_texts[y] != NULL) if (scr_texts[y] != NULL && scr_rects[y] != NULL)
SDL_RenderCopy(scr_rend, scr_texts[y], SDL_RenderCopy(scr_rend, scr_texts[y],
NULL, scr_rects[y]); NULL, scr_rects[y]);
@ -104,7 +104,7 @@ void console_putat(ctx_t *ctx, char ch, int x, int y)
{ {
SDL_Surface *surf; SDL_Surface *surf;
trace("putat: %c %d %d\n", ch, x, y); //trace("putat: %c %d %d\n", ch, x, y);
if (y >= CONSOLE_HEIGHT || x >= CONSOLE_WIDTH) if (y >= CONSOLE_HEIGHT || x >= CONSOLE_WIDTH)
{ {
@ -167,6 +167,8 @@ int csn_y = 0;
void console_putc(ctx_t *ctx, char ch) void console_putc(ctx_t *ctx, char ch)
{ {
size_t y;
if (ch < ' ' && ch != '\n') if (ch < ' ' && ch != '\n')
ch = 127; ch = 127;
@ -186,7 +188,42 @@ void console_putc(ctx_t *ctx, char ch)
} }
if (csn_y == CONSOLE_HEIGHT) if (csn_y == CONSOLE_HEIGHT)
csn_y = 0; {
csn_y--;
memmove(scr_lines, &scr_lines[1],
(CONSOLE_HEIGHT - 1) * CONSOLE_WIDTH);
memset(&scr_lines[CONSOLE_HEIGHT-1], ' ', CONSOLE_WIDTH);
scr_lines[CONSOLE_HEIGHT-1][CONSOLE_WIDTH] = 0;
if (scr_texts[0] != NULL)
{
SDL_DestroyTexture(scr_texts[0]);
scr_texts[0] = NULL;
}
memmove(scr_texts, &scr_texts[1],
(CONSOLE_HEIGHT - 1) * sizeof(SDL_Texture *));
scr_texts[CONSOLE_HEIGHT-1] = NULL;
if (scr_rects[0] != NULL)
{
free(scr_rects[0]);
scr_rects[0] = NULL;
}
memmove(scr_rects, &scr_rects[1],
(CONSOLE_HEIGHT - 1) * sizeof(SDL_Rect *));
scr_rects[CONSOLE_HEIGHT-1] = NULL;
for (y = 0; y < CONSOLE_HEIGHT-1; y++)
if (scr_rects[y] != NULL)
{
scr_rects[y]->y -= 16; // surf->h
}
}
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//

View File

@ -2,7 +2,7 @@
// See the LICENSE file in the project root for more information. // See the LICENSE file in the project root for more information.
#include <pc/dev.h> #include <pc/dev.h>
#include <cn/console.h> #include <pc/console.h>
void die(int code) void die(int code)
{ {

View File

@ -5,7 +5,7 @@
#include <signal.h> #include <signal.h>
#include <pc/dev.h> #include <pc/dev.h>
#include <cn/console.h> #include <pc/console.h>
#define FWPROGSIZE (1024 * 1024 * 1024) #define FWPROGSIZE (1024 * 1024 * 1024)
static ssize_t fwsize; static ssize_t fwsize;