[zvm] 1 new revision pushed by david.jc.anderson on 2009-05-28 00:58 GMT

2 views
Skip to first unread message

codesite...@google.com

unread,
May 27, 2009, 8:58:40 PM5/27/09
to zvm...@googlegroups.com
Revision: 8e062dd890
Author: David Anderson <da...@natulte.net>
Date: Wed May 27 17:57:54 2009
Log: Implement the read_char opcode.
http://code.google.com/p/zvm/source/detail?r=8e062dd890

Modified:
/zvm/trivialzui.py
/zvm/zcpu.py

=======================================
--- /zvm/trivialzui.py Mon May 12 18:48:11 2008
+++ /zvm/trivialzui.py Wed May 27 17:57:54 2009
@@ -182,7 +182,7 @@
timed_input_interval=0):
result = _read_char()
self.__screen.on_input_occurred()
- return result
+ return ord(result)

class TrivialFilesystem(zfilesystem.ZFilesystem):
def __report_io_error(self, exception):
=======================================
--- /zvm/zcpu.py Wed May 27 17:36:20 2009
+++ /zvm/zcpu.py Wed May 27 17:57:54 2009
@@ -652,9 +652,22 @@
"""TODO: Write docstring here."""
raise ZCpuNotImplemented

- def op_read_char(self, *args):
- """TODO: Write docstring here."""
- raise ZCpuNotImplemented
+ def op_read_char(self, unused, time, input_routine):
+ """Read a single character from input stream 0 (keyboard).
+
+ Optionally, call a routine periodically to decide whether or
+ not to interrupt user input.
+ """
+ # According to the spec, the first argument is always one, and
+ # exists only for Historical Reasons(tm)
+ assert unused == 1
+
+ # TODO: shiny timer stuff not implemented yet.
+ if time != 0 or input_routine != 0:
+ raise ZCpuNotImplemented
+
+ char = self._ui.keyboard_input.read_char()
+ self._write_result(char)

def op_scan_table(self, *args):
"""TODO: Write docstring here."""

Reply all
Reply to author
Forward
0 new messages