From 748d7347c8800d4328bbdbe51080574b3f56fccf Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 2 Jul 2019 13:11:37 -0400 Subject: [PATCH] shell: add "loop hook" This hook is called during every iteration, allowing regular screen refresh when video is involved. --- kernel/shell.asm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/shell.asm b/kernel/shell.asm index 123ca57..b27a83d 100644 --- a/kernel/shell.asm +++ b/kernel/shell.asm @@ -56,7 +56,9 @@ ; Pointer to a hook to call when a cmd name isn't found .equ SHELL_CMDHOOK SHELL_BUF+SHELL_BUFSIZE -.equ SHELL_RAMEND SHELL_CMDHOOK+2 +; Pointer to a routine to call at each shell loop interation +.equ SHELL_LOOPHOOK SHELL_CMDHOOK+2 +.equ SHELL_RAMEND SHELL_LOOPHOOK+2 ; *** CODE *** shellInit: @@ -66,6 +68,7 @@ shellInit: ld (SHELL_BUF), a ld hl, noop ld (SHELL_CMDHOOK), hl + ld (SHELL_LOOPHOOK), hl ; print welcome ld hl, .welcome @@ -77,7 +80,10 @@ shellInit: ; Inifite loop that processes input. Because it's infinite, you should jump ; to it rather than call it. Saves two precious bytes in the stack. shellLoop: - ; First, let's wait until something is typed. + ; First, call the loop hook + ld ix, (SHELL_LOOPHOOK) + call callIX + ; Then, let's wait until something is typed. call stdioGetC jr nz, shellLoop ; nothing typed? loop ; got it. Now, is it a CR or LF?