1
0
mirror of https://github.com/mnaberez/py65.git synced 2024-06-06 20:29:34 +00:00

Fix console input when run under Python 3 on Windows. Closes #27

This commit is contained in:
Mike Naberezny 2015-02-09 14:47:55 -08:00
parent 716eeb4248
commit 915b3b6b44
2 changed files with 10 additions and 4 deletions

View File

@ -6,6 +6,8 @@
- ASCII literals are now supported by the assembler. The statement
"LDA #'A'" is equivalent to "LDA #$41".
- Fixed console input when run under Python 3 on Windows. Closes #27.
0.20 (2014-05-08)
- Page wrapping for indexed indirect (X) operations on 65C02 has been

View File

@ -8,15 +8,19 @@ if sys.platform[:3] == "win":
is available. Does not echo the character. The stdin argument is
for function signature compatibility and is ignored.
"""
return msvcrt.getch()
c = msvcrt.getch()
if isinstance(c, bytes): # Python 3
c = c.decode('latin-1')
return c
def getch_noblock(stdin):
""" Read one character from the Windows console without blocking.
Does not echo the character. If no character is available, an
emptry string is returned.
Does not echo the character. The stdin argument is for function
signature compatibility and is ignored. If no character is
available, an emptry string is returned.
"""
if msvcrt.kbhit():
return msvcrt.getch()
return getch(stdin)
return ''
else: