mirror of
https://github.com/mnaberez/py65.git
synced 2025-01-16 18:33:00 +00:00
Fix console input when run under Python 3 on Windows. Closes #27
This commit is contained in:
parent
716eeb4248
commit
915b3b6b44
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user