Skip to content

Commit

Permalink
worked on #104, resulting in narrowing the issue down to keyboard
Browse files Browse the repository at this point in the history
daemon data being mangled
  • Loading branch information
alexander-bauer committed Sep 19, 2012
1 parent d1c5086 commit 657172b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
1 change: 0 additions & 1 deletion modules/dview.dasm16
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions modules/keyboardDaemon.dasm16
Original file line number Diff line number Diff line change
Expand Up @@ -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*.
;:
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
10 changes: 7 additions & 3 deletions modules/terminal.dasm16
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
;:

;TODO allow forking
;TODO make all terminal values (xpos and ypos) into VARIABLES

:terminal.new
SET PUSH, A
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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

0 comments on commit 657172b

Please sign in to comment.