2019-03-21 16:48:02 +00:00
|
|
|
"""Representation of Apple II + player virtual machine state."""
|
|
|
|
|
|
|
|
from typing import Iterator
|
|
|
|
|
|
|
|
|
|
|
|
class Machine:
|
2019-03-21 22:42:09 +00:00
|
|
|
"""Represents Apple II and player virtual machine state."""
|
2019-03-21 16:48:02 +00:00
|
|
|
|
2019-06-21 21:08:22 +00:00
|
|
|
def __init__(self):
|
2019-03-21 22:42:09 +00:00
|
|
|
self.page = 0x20 # type: int
|
2019-03-21 16:48:02 +00:00
|
|
|
|
|
|
|
def emit(self, opcode: "Opcode") -> Iterator[int]:
|
2019-03-21 22:42:09 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
:param opcode:
|
|
|
|
:return:
|
|
|
|
"""
|
2019-03-21 16:48:02 +00:00
|
|
|
cmd = opcode.emit_command(opcode)
|
|
|
|
if cmd:
|
|
|
|
yield from cmd
|
|
|
|
data = opcode.emit_data()
|
|
|
|
if data:
|
|
|
|
yield from data
|
|
|
|
|
|
|
|
# Update changes in memory map, if any
|
2019-06-13 22:40:55 +00:00
|
|
|
opcode.apply(self)
|