mirror of
https://github.com/KrisKennaway/ii-vision.git
synced 2024-12-22 12:29:31 +00:00
Add a HEADER opcode that emits the 7-byte video header, used to
select the playback mode (HGR/DHGR).
This commit is contained in:
parent
6bde085d5e
commit
2a76e3d48f
@ -11,6 +11,7 @@ def _op_cmds():
|
|||||||
"""Construct names of player opcodes."""
|
"""Construct names of player opcodes."""
|
||||||
|
|
||||||
op_cmds = [
|
op_cmds = [
|
||||||
|
"HEADER",
|
||||||
"TERMINATE",
|
"TERMINATE",
|
||||||
"NOP",
|
"NOP",
|
||||||
"ACK",
|
"ACK",
|
||||||
@ -45,7 +46,7 @@ class Opcode:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def emit_command(opcode: "Opcode") -> Iterator[int]:
|
def emit_command(opcode: "Opcode") -> Iterator[int]:
|
||||||
# Emit address of next opcode
|
# Emit address of opcode
|
||||||
yield opcode._START >> 8
|
yield opcode._START >> 8
|
||||||
yield opcode._START & 0xff
|
yield opcode._START & 0xff
|
||||||
|
|
||||||
@ -56,6 +57,35 @@ class Opcode:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Header(Opcode):
|
||||||
|
"""Video header opcode."""
|
||||||
|
COMMAND = OpcodeCommand.HEADER
|
||||||
|
|
||||||
|
def __init__(self, mode: "video.Mode"):
|
||||||
|
self.video_mode = mode
|
||||||
|
|
||||||
|
def __data_eq__(self, other):
|
||||||
|
return self.video_mode == other.video_mode
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def emit_command(opcode: "Opcode") -> Iterator[int]:
|
||||||
|
# This is special in that it does not explicitly vector to the next
|
||||||
|
# opcode
|
||||||
|
return
|
||||||
|
|
||||||
|
def emit_data(self) -> Iterator[int]:
|
||||||
|
# Pad bytes to same size as Tick opcode, to make it easier to schedule
|
||||||
|
# ACK opcodes.
|
||||||
|
yield 0xff
|
||||||
|
yield 0xff
|
||||||
|
yield 0xff
|
||||||
|
yield 0xff
|
||||||
|
yield 0xff
|
||||||
|
yield 0xff
|
||||||
|
|
||||||
|
yield self.video_mode.value
|
||||||
|
|
||||||
|
|
||||||
class Nop(Opcode):
|
class Nop(Opcode):
|
||||||
"""NOP pad opcode that does nothing except vector to the next one."""
|
"""NOP pad opcode that does nothing except vector to the next one."""
|
||||||
COMMAND = OpcodeCommand.NOP
|
COMMAND = OpcodeCommand.NOP
|
||||||
@ -158,6 +188,7 @@ def _fill_opcode_addresses():
|
|||||||
|
|
||||||
_OPCODE_ADDRS = _parse_symbol_table()
|
_OPCODE_ADDRS = _parse_symbol_table()
|
||||||
_OPCODE_CLASSES = {
|
_OPCODE_CLASSES = {
|
||||||
|
OpcodeCommand.HEADER: Header,
|
||||||
OpcodeCommand.TERMINATE: Terminate,
|
OpcodeCommand.TERMINATE: Terminate,
|
||||||
OpcodeCommand.NOP: Nop,
|
OpcodeCommand.NOP: Nop,
|
||||||
OpcodeCommand.ACK: Ack,
|
OpcodeCommand.ACK: Ack,
|
||||||
|
Loading…
Reference in New Issue
Block a user