refactor: port to python3
This commit is contained in:
parent
04a34eaf44
commit
2ec18cc353
4 changed files with 9 additions and 4 deletions
2
orao.py
2
orao.py
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf8 -*-
|
# -*- coding: utf8 -*-
|
||||||
|
|
||||||
import pygame, numpy, sys, datetime
|
import pygame, numpy, sys, datetime
|
||||||
|
|
|
@ -136,7 +136,9 @@ class CPU(object):
|
||||||
self.sp = (self.sp + 1) & 0xFF
|
self.sp = (self.sp + 1) & 0xFF
|
||||||
return self.get_byte(256 + self.sp)
|
return self.get_byte(256 + self.sp)
|
||||||
|
|
||||||
def stack_push_word(self, val): map(self.stack_push, [(val >> 8) & 0xFF, val & 0xFF])
|
def stack_push_word(self, val):
|
||||||
|
self.stack_push((val >> 8) & 0xFF)
|
||||||
|
self.stack_push(val & 0xFF)
|
||||||
|
|
||||||
def stack_pop_word(self): return self.stack_pop() + (self.stack_pop() << 8)
|
def stack_pop_word(self): return self.stack_pop() + (self.stack_pop() << 8)
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
|
@ -20,7 +20,7 @@ _kbd = {
|
||||||
|
|
||||||
def listener(event, cpu):
|
def listener(event, cpu):
|
||||||
if event.type in [pygame.KEYDOWN, pygame.KEYUP]:
|
if event.type in [pygame.KEYDOWN, pygame.KEYUP]:
|
||||||
for address, keycodes in _kbd.iteritems():
|
for address, keycodes in _kbd.items():
|
||||||
keys = map(pygame.key.get_pressed().__getitem__, keycodes)
|
keys = list(map(pygame.key.get_pressed().__getitem__, keycodes))
|
||||||
cpu.memory[address] = ~numpy.dot(keys, [16, 32, 64, 128][:len(keys)]) & 0xFF
|
cpu.memory[address] = ~numpy.dot(keys, [16, 32, 64, 128][:len(keys)]) & 0xFF
|
||||||
|
|
||||||
|
|
3
requirements.txt
Normal file
3
requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
numpy==1.26.1
|
||||||
|
pygame==2.5.2
|
||||||
|
Wave==0.0.2
|
Loading…
Reference in a new issue