diff --git a/modules/dview.dasm16 b/modules/dview.dasm16 index bc43fcc..88a42e9 100644 --- a/modules/dview.dasm16 +++ b/modules/dview.dasm16 @@ -393,7 +393,6 @@ SET [B], 2 ;turn on the keyboard :dview.prompt.loop IFN [dview.temp.promptflag], 0 SET PC, dview.prompt.loop - SET [B], 1 ;turn off the keyboard SET A, POP ;restore memory location diff --git a/modules/keyboardDaemon.dasm16 b/modules/keyboardDaemon.dasm16 index b93e8e8..c290546 100644 --- a/modules/keyboardDaemon.dasm16 +++ b/modules/keyboardDaemon.dasm16 @@ -3,6 +3,14 @@ ;;;;;;;;;;;;;;;;;; ;:An instance of KeyboardDemon should be registered to any process that requires detection of keypresses. It requests an interrupt value from the operating system, and, when it detects that interrupt, writes the pressed key, if it is ASCII, to the location registered on its instantiation. (That location is, of course, incremented.) ;: + +:kd.daemonlist +DAT 0 ;memory location containing four words per keyboard device +DAT 0 ;debug + +:kd.length +DAT 0 ;number of literal words in the daemon list + ;:## The Handler ;:All keyboards using KeyboardDaemon are given unique interrupt messages, all of which point *kd.keystroke*. ;: @@ -135,17 +143,11 @@ SET PC, POP ;:``` ;: -:kd.daemonlist -DAT 0 ;memory location containing four words per keyboard device - -:kd.length -DAT 0 ;number of literal words in the daemon list - ;:### kd.init (slots) ;:Initializes the keyboard handler with enough room for *slots* many Generic Keyboard devices. ;: :kd.init -MUL A, 4 ;multiply by 3, because each keyboard has 3 words associated with it +MUL A, 4 ;multiply by 4, because each keyboard has 4 words associated with it SET [kd.length], A JSR heap.alloc ; SET [kd.daemonlist], A @@ -168,7 +170,7 @@ ADD C, B ;make C the ending location of the list IFE [B+1], A ;if the port exists ;TODO make this an actual search SET PC, kd.newKeyboard.found -ADD B, 2 +ADD B, 4 IFL B, C ;C will point to the very last OptLoc, so we use IFL to be safe SET PC, kd.newKeyboard.findexisting diff --git a/modules/terminal.dasm16 b/modules/terminal.dasm16 index b3d9d98..e1a664d 100644 --- a/modules/terminal.dasm16 +++ b/modules/terminal.dasm16 @@ -14,7 +14,6 @@ ;: ;TODO allow forking -;TODO make all terminal values (xpos and ypos) into VARIABLES :terminal.new SET PUSH, A @@ -49,9 +48,8 @@ SET I, A :terminal.prompt - SET A, I ;A is the screen location -SET B, terminal.stringres.prompt ;B is the text to be printed +SET B, terminal.stringres.prompt ;B is the text to be printed SET C, X ;C is the input buffer JSR dview.prompt @@ -61,6 +59,9 @@ JSR sh JSR terminal.newline +IFE [Y], 0 ;if there is nothing in the write buffer + SET PC, terminal.prompt ;then skip to prompting again on the new line + SET A, I ;make A the first word on a new line SET B, Y ;make B the output buffer location JSR dview.write ;write the output to the screen @@ -80,3 +81,6 @@ ADD I, 32 ;add 32 AND I, 0xfff0 ;make I a Y-index ADD I, A ;make I the first index on the new line +SET PC, POP + +:debug DAT 0