mirror of
https://github.com/mnaberez/py65.git
synced 2025-08-13 13:25:12 +00:00
Fix console input when run under Python 3 on Windows. Closes #27
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
- ASCII literals are now supported by the assembler. The statement
|
- ASCII literals are now supported by the assembler. The statement
|
||||||
"LDA #'A'" is equivalent to "LDA #$41".
|
"LDA #'A'" is equivalent to "LDA #$41".
|
||||||
|
|
||||||
|
- Fixed console input when run under Python 3 on Windows. Closes #27.
|
||||||
|
|
||||||
0.20 (2014-05-08)
|
0.20 (2014-05-08)
|
||||||
|
|
||||||
- Page wrapping for indexed indirect (X) operations on 65C02 has been
|
- Page wrapping for indexed indirect (X) operations on 65C02 has been
|
||||||
|
@@ -8,15 +8,19 @@ if sys.platform[:3] == "win":
|
|||||||
is available. Does not echo the character. The stdin argument is
|
is available. Does not echo the character. The stdin argument is
|
||||||
for function signature compatibility and is ignored.
|
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):
|
def getch_noblock(stdin):
|
||||||
""" Read one character from the Windows console without blocking.
|
""" Read one character from the Windows console without blocking.
|
||||||
Does not echo the character. If no character is available, an
|
Does not echo the character. The stdin argument is for function
|
||||||
emptry string is returned.
|
signature compatibility and is ignored. If no character is
|
||||||
|
available, an emptry string is returned.
|
||||||
"""
|
"""
|
||||||
if msvcrt.kbhit():
|
if msvcrt.kbhit():
|
||||||
return msvcrt.getch()
|
return getch(stdin)
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user