Browse Source

shell: add "loop hook"

This hook is called during every iteration, allowing regular screen
refresh when video is involved.
pull/10/head
Virgil Dupras 5 years ago
parent
commit
748d7347c8
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      kernel/shell.asm

+ 8
- 2
kernel/shell.asm View File

@@ -56,7 +56,9 @@
; Pointer to a hook to call when a cmd name isn't found ; Pointer to a hook to call when a cmd name isn't found
.equ SHELL_CMDHOOK SHELL_BUF+SHELL_BUFSIZE .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 *** ; *** CODE ***
shellInit: shellInit:
@@ -66,6 +68,7 @@ shellInit:
ld (SHELL_BUF), a ld (SHELL_BUF), a
ld hl, noop ld hl, noop
ld (SHELL_CMDHOOK), hl ld (SHELL_CMDHOOK), hl
ld (SHELL_LOOPHOOK), hl


; print welcome ; print welcome
ld hl, .welcome ld hl, .welcome
@@ -77,7 +80,10 @@ shellInit:
; Inifite loop that processes input. Because it's infinite, you should jump ; 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. ; to it rather than call it. Saves two precious bytes in the stack.
shellLoop: 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 call stdioGetC
jr nz, shellLoop ; nothing typed? loop jr nz, shellLoop ; nothing typed? loop
; got it. Now, is it a CR or LF? ; got it. Now, is it a CR or LF?


Loading…
Cancel
Save