From b15c0020c37bd794b5725e7536373c9e14b8dd18 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 24 May 2019 11:16:59 +0200 Subject: [PATCH] Work on ATA --- kaleid/kernel/sh/shcmds.c | 11 +++++++---- kaleid/kernel/sh/shell.c | 14 ++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/kaleid/kernel/sh/shcmds.c b/kaleid/kernel/sh/shcmds.c index d3dd430..f563634 100644 --- a/kaleid/kernel/sh/shcmds.c +++ b/kaleid/kernel/sh/shcmds.c @@ -127,21 +127,24 @@ error_t CmdDie(int argc, char **argv, char *cmdline) error_t CmdDumpATASect(int argc, char **argv, char *cmdline) { - char sector[600] = {0}; + char sector[1024] = {0}; int sectNumber = ShAtoi(argv[1]); + int nb = ShAtoi(argv[2]); int x = 0; - int step = 16 ; + int step = 16; if (!sectNumber) { KernLog("Bad argument\n\n"); return EINVAL; } + if (!nb) nb = 1; + KernLog("Sector number: %d\n", sectNumber); - IoReadATA(sector, 1, sectNumber); + IoReadATA(sector, nb, sectNumber); - while(x < 512) { + while(x < 512*nb) { KernLog("%C", shcol); for (int i = 0; i < step; i++) { KernLog("%02x ", (uchar)sector[i+x]); diff --git a/kaleid/kernel/sh/shell.c b/kaleid/kernel/sh/shell.c index f7ce5de..0a5a58b 100644 --- a/kaleid/kernel/sh/shell.c +++ b/kaleid/kernel/sh/shell.c @@ -119,6 +119,11 @@ void KeStartShell(void) break; default: + + while (IoGetScroll() > 0) { + IoScrollDown(); + } + *bufptr++ = (char)ch; // End of buffer? @@ -128,16 +133,17 @@ void KeStartShell(void) KernLog("\n"); // Else, fallthrough to case '\n' - + case '\n': - *bufptr = 0; - bufptr = cmdbuf; - ExecuteCommand(cmdbuf); while (IoGetScroll() > 0) { IoScrollDown(); } + *bufptr = 0; + bufptr = cmdbuf; + ExecuteCommand(cmdbuf); + memzero(cmdbuf, CMDBUFSIZE); KernLog("%Cshell> %C", VGA_COLOR_WHITE, shcol); BFlushBuf(BStdIn);