mirror of
https://github.com/michaelcmartin/Ophis.git
synced 2024-12-21 12:29:46 +00:00
Second attempt at implementation of the BBXn instructions for Rockwell 65c02 chips.
Reliable technical documentation for how these instructions are decoded is a little thin on the ground online, so some of this implementation is still speculative.
This commit is contained in:
parent
1c7174e696
commit
e5ac21f0f9
@ -314,6 +314,7 @@ def parse_line(ppt, lexemelist):
|
||||
Err.log("Unknown pragma " + pragma)
|
||||
else: # Instruction
|
||||
opcode = line.expect("OPCODE").value
|
||||
arg2 = None
|
||||
if line.lookahead(0).type == "#":
|
||||
mode = "Immediate"
|
||||
line.expect("#")
|
||||
@ -344,15 +345,21 @@ def parse_line(ppt, lexemelist):
|
||||
arg = parse_expr(line)
|
||||
tok = line.expect("EOL", ",").type
|
||||
if tok == ",":
|
||||
tok = line.expect("X", "Y").type
|
||||
if tok == "X":
|
||||
mode = "MemoryX"
|
||||
# Parser has to special-case the BBXn instructions,
|
||||
# Which uniquely take two addresses
|
||||
if opcode[:3] in ["bbs", "bbr"]:
|
||||
arg2 = parse_expr(line)
|
||||
mode = "Memory2"
|
||||
else:
|
||||
mode = "MemoryY"
|
||||
tok = line.expect("X", "Y").type
|
||||
if tok == "X":
|
||||
mode = "MemoryX"
|
||||
else:
|
||||
mode = "MemoryY"
|
||||
line.expect("EOL")
|
||||
else:
|
||||
mode = "Memory"
|
||||
result.append(IR.Node(ppt, mode, opcode, arg))
|
||||
result.append(IR.Node(ppt, mode, opcode, arg, arg2))
|
||||
|
||||
aux()
|
||||
result = [node for node in result if node is not IR.NullNode]
|
||||
|
@ -12,339 +12,340 @@
|
||||
# the tables in tools/opcodes. Edit those tables, not these.
|
||||
|
||||
# Names of addressing modes
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative"] # 14
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative", # 14
|
||||
"Zero Page, Relative"] # 15
|
||||
|
||||
|
||||
# Lengths of the argument
|
||||
lengths = [0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1]
|
||||
lengths = [0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2]
|
||||
|
||||
opcodes = {
|
||||
'adc': [None, 0x69, 0x65, 0x75, None, 0x6D, 0x7D, 0x79,
|
||||
None, None, None, None, 0x61, 0x71, None],
|
||||
None, None, None, None, 0x61, 0x71, None, None],
|
||||
'adc.w': [None, None, None, None, None, 0x6D, 0x7D, 0x79,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'and': [None, 0x29, 0x25, 0x35, None, 0x2D, 0x3D, 0x39,
|
||||
None, None, None, None, 0x21, 0x31, None],
|
||||
None, None, None, None, 0x21, 0x31, None, None],
|
||||
'and.w': [None, None, None, None, None, 0x2D, 0x3D, 0x39,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'asl': [0x0A, None, 0x06, 0x16, None, 0x0E, 0x1E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'asl.w': [None, None, None, None, None, 0x0E, 0x1E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'bcc': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x90],
|
||||
None, None, None, None, None, None, 0x90, None],
|
||||
'bcs': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xB0],
|
||||
None, None, None, None, None, None, 0xB0, None],
|
||||
'beq': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xF0],
|
||||
None, None, None, None, None, None, 0xF0, None],
|
||||
'bit': [None, None, 0x24, None, None, 0x2C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'bit.w': [None, None, None, None, None, 0x2C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'bmi': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x30],
|
||||
None, None, None, None, None, None, 0x30, None],
|
||||
'bne': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xD0],
|
||||
None, None, None, None, None, None, 0xD0, None],
|
||||
'bpl': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x10],
|
||||
None, None, None, None, None, None, 0x10, None],
|
||||
'brk': [0x00, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'bvc': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x50],
|
||||
None, None, None, None, None, None, 0x50, None],
|
||||
'bvs': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x70],
|
||||
None, None, None, None, None, None, 0x70, None],
|
||||
'clc': [0x18, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cld': [0xD8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cli': [0x58, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'clv': [0xB8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cmp': [None, 0xC9, 0xC5, 0xD5, None, 0xCD, 0xDD, 0xD9,
|
||||
None, None, None, None, 0xC1, 0xD1, None],
|
||||
None, None, None, None, 0xC1, 0xD1, None, None],
|
||||
'cmp.w': [None, None, None, None, None, 0xCD, 0xDD, 0xD9,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cpx': [None, 0xE0, 0xE4, None, None, 0xEC, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cpx.w': [None, None, None, None, None, 0xEC, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cpy': [None, 0xC0, 0xC4, None, None, 0xCC, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'cpy.w': [None, None, None, None, None, 0xCC, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dec': [None, None, 0xC6, 0xD6, None, 0xCE, 0xDE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dec.w': [None, None, None, None, None, 0xCE, 0xDE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dex': [0xCA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dey': [0x88, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'eor': [None, 0x49, 0x45, 0x55, None, 0x4D, 0x5D, 0x59,
|
||||
None, None, None, None, 0x41, 0x51, None],
|
||||
None, None, None, None, 0x41, 0x51, None, None],
|
||||
'eor.w': [None, None, None, None, None, 0x4D, 0x5D, 0x59,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'inc': [None, None, 0xE6, 0xF6, None, 0xEE, 0xFE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'inc.w': [None, None, None, None, None, 0xEE, 0xFE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'inx': [0xE8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'iny': [0xC8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'jmp': [None, None, None, None, None, 0x4C, None, None,
|
||||
0x6C, None, None, None, None, None, None],
|
||||
0x6C, None, None, None, None, None, None, None],
|
||||
'jsr': [None, None, None, None, None, 0x20, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'lda': [None, 0xA9, 0xA5, 0xB5, None, 0xAD, 0xBD, 0xB9,
|
||||
None, None, None, None, 0xA1, 0xB1, None],
|
||||
None, None, None, None, 0xA1, 0xB1, None, None],
|
||||
'lda.w': [None, None, None, None, None, 0xAD, 0xBD, 0xB9,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ldx': [None, 0xA2, 0xA6, None, 0xB6, 0xAE, None, 0xBE,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ldx.w': [None, None, None, None, None, 0xAE, None, 0xBE,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ldy': [None, 0xA0, 0xA4, 0xB4, None, 0xAC, 0xBC, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ldy.w': [None, None, None, None, None, 0xAC, 0xBC, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'lsr': [0x4A, None, 0x46, 0x56, None, 0x4E, 0x5E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'lsr.w': [None, None, None, None, None, 0x4E, 0x5E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'nop': [0xEA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ora': [None, 0x09, 0x05, 0x15, None, 0x0D, 0x1D, 0x19,
|
||||
None, None, None, None, 0x01, 0x11, None],
|
||||
None, None, None, None, 0x01, 0x11, None, None],
|
||||
'ora.w': [None, None, None, None, None, 0x0D, 0x1D, 0x19,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'pha': [0x48, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'php': [0x08, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'pla': [0x68, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'plp': [0x28, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rol': [0x2A, None, 0x26, 0x36, None, 0x2E, 0x3E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rol.w': [None, None, None, None, None, 0x2E, 0x3E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ror': [0x6A, None, 0x66, 0x76, None, 0x6E, 0x7E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ror.w': [None, None, None, None, None, 0x6E, 0x7E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rti': [0x40, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rts': [0x60, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sbc': [None, 0xE9, 0xE5, 0xF5, None, 0xED, 0xFD, 0xF9,
|
||||
None, None, None, None, 0xE1, 0xF1, None],
|
||||
None, None, None, None, 0xE1, 0xF1, None, None],
|
||||
'sbc.w': [None, None, None, None, None, 0xED, 0xFD, 0xF9,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sec': [0x38, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sed': [0xF8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sei': [0x78, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sta': [None, None, 0x85, 0x95, None, 0x8D, 0x9D, 0x99,
|
||||
None, None, None, None, 0x81, 0x91, None],
|
||||
None, None, None, None, 0x81, 0x91, None, None],
|
||||
'sta.w': [None, None, None, None, None, 0x8D, 0x9D, 0x99,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'stx': [None, None, 0x86, None, 0x96, 0x8E, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'stx.w': [None, None, None, None, None, 0x8E, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sty': [None, None, 0x84, 0x94, None, 0x8C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sty.w': [None, None, None, None, None, 0x8C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tax': [0xAA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tay': [0xA8, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tsx': [0xBA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'txa': [0x8A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'txs': [0x9A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tya': [0x98, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
}
|
||||
undocops = {
|
||||
'anc': [None, 0x0B, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ane': [None, 0x8B, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'arr': [None, 0x6B, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'asr': [None, 0x4B, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dcp': [None, None, 0xC7, 0xD7, None, 0xCF, 0xDF, 0xDB,
|
||||
None, None, None, None, 0xC3, 0xD3, None],
|
||||
None, None, None, None, 0xC3, 0xD3, None, None],
|
||||
'isb': [None, None, 0xE7, 0xF7, None, 0xEF, 0xFF, 0xFB,
|
||||
None, None, None, None, 0xE3, 0xF3, None],
|
||||
None, None, None, None, 0xE3, 0xF3, None, None],
|
||||
'las': [None, None, None, None, None, None, None, 0xBB,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'lax': [None, None, 0xA7, None, 0xB7, 0xAF, None, 0xBF,
|
||||
None, None, None, None, 0xA3, 0xB3, None],
|
||||
None, None, None, None, 0xA3, 0xB3, None, None],
|
||||
'lxa': [None, 0xAB, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'nop': [0xEA, None, 0x04, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rla': [None, None, 0x27, 0x37, None, 0x2F, 0x3F, 0x3B,
|
||||
None, None, None, None, 0x23, 0x33, None],
|
||||
None, None, None, None, 0x23, 0x33, None, None],
|
||||
'rra': [None, None, 0x67, 0x77, None, 0x6F, 0x7F, 0x7B,
|
||||
None, None, None, None, 0x63, 0x73, None],
|
||||
None, None, None, None, 0x63, 0x73, None, None],
|
||||
'sax': [None, None, 0x87, None, 0x97, 0x8F, None, None,
|
||||
None, None, None, None, 0x83, None, None],
|
||||
None, None, None, None, 0x83, None, None, None],
|
||||
'sbx': [None, 0xCB, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sha': [None, None, None, None, None, None, None, 0x9F,
|
||||
None, None, None, None, None, 0x93, None],
|
||||
None, None, None, None, None, 0x93, None, None],
|
||||
'shs': [None, None, None, None, None, None, None, 0x9B,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'shx': [None, None, None, None, None, None, None, 0x9E,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'slo': [None, None, 0x07, 0x17, None, 0x0F, 0x1F, 0x1B,
|
||||
None, None, None, None, 0x03, 0x13, None],
|
||||
None, None, None, None, 0x03, 0x13, None, None],
|
||||
'sre': [None, None, 0x47, 0x57, None, 0x4F, 0x5F, 0x5B,
|
||||
None, None, None, None, 0x43, 0x53, None],
|
||||
None, None, None, None, 0x43, 0x53, None, None],
|
||||
}
|
||||
c02extensions = {
|
||||
'adc': [None, 0x69, 0x65, 0x75, None, 0x6D, 0x7D, 0x79,
|
||||
None, None, None, 0x72, 0x61, 0x71, None],
|
||||
None, None, None, 0x72, 0x61, 0x71, None, None],
|
||||
'and': [None, 0x29, 0x25, 0x35, None, 0x2D, 0x3D, 0x39,
|
||||
None, None, None, 0x32, 0x21, 0x31, None],
|
||||
None, None, None, 0x32, 0x21, 0x31, None, None],
|
||||
'bbr0': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x0F],
|
||||
None, None, None, None, None, None, None, 0x0F],
|
||||
'bbr1': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x1F],
|
||||
None, None, None, None, None, None, None, 0x1F],
|
||||
'bbr2': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x2F],
|
||||
None, None, None, None, None, None, None, 0x2F],
|
||||
'bbr3': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x3F],
|
||||
None, None, None, None, None, None, None, 0x3F],
|
||||
'bbr4': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x4F],
|
||||
None, None, None, None, None, None, None, 0x4F],
|
||||
'bbr5': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x5F],
|
||||
None, None, None, None, None, None, None, 0x5F],
|
||||
'bbr6': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x6F],
|
||||
None, None, None, None, None, None, None, 0x6F],
|
||||
'bbr7': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x7F],
|
||||
None, None, None, None, None, None, None, 0x7F],
|
||||
'bbs0': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x8F],
|
||||
None, None, None, None, None, None, None, 0x8F],
|
||||
'bbs1': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x9F],
|
||||
None, None, None, None, None, None, None, 0x9F],
|
||||
'bbs2': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xAF],
|
||||
None, None, None, None, None, None, None, 0xAF],
|
||||
'bbs3': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xBF],
|
||||
None, None, None, None, None, None, None, 0xBF],
|
||||
'bbs4': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xCF],
|
||||
None, None, None, None, None, None, None, 0xCF],
|
||||
'bbs5': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xDF],
|
||||
None, None, None, None, None, None, None, 0xDF],
|
||||
'bbs6': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xEF],
|
||||
None, None, None, None, None, None, None, 0xEF],
|
||||
'bbs7': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0xFF],
|
||||
None, None, None, None, None, None, None, 0xFF],
|
||||
'bit': [None, 0x89, 0x24, 0x34, None, 0x2C, 0x3C, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'bra': [None, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, 0x80],
|
||||
None, None, None, None, None, None, 0x80, None],
|
||||
'cmp': [None, 0xC9, 0xC5, 0xD5, None, 0xCD, 0xDD, 0xD9,
|
||||
None, None, None, 0xD2, 0xC1, 0xD1, None],
|
||||
None, None, None, 0xD2, 0xC1, 0xD1, None, None],
|
||||
'dea': [0x3A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'dec': [0x3A, None, 0xC6, 0xD6, None, 0xCE, 0xDE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'eor': [None, 0x49, 0x45, 0x55, None, 0x4D, 0x5D, 0x59,
|
||||
None, None, None, 0x52, 0x41, 0x51, None],
|
||||
None, None, None, 0x52, 0x41, 0x51, None, None],
|
||||
'ina': [0x1A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'inc': [0x1A, None, 0xE6, 0xF6, None, 0xEE, 0xFE, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'jmp': [None, None, None, None, None, 0x4C, None, None,
|
||||
0x6C, 0x7C, None, None, None, None, None],
|
||||
0x6C, 0x7C, None, None, None, None, None, None],
|
||||
'lda': [None, 0xA9, 0xA5, 0xB5, None, 0xAD, 0xBD, 0xB9,
|
||||
None, None, None, 0xB2, 0xA1, 0xB1, None],
|
||||
None, None, None, 0xB2, 0xA1, 0xB1, None, None],
|
||||
'ora': [None, 0x09, 0x05, 0x15, None, 0x0D, 0x1D, 0x19,
|
||||
None, None, None, 0x12, 0x01, 0x11, None],
|
||||
None, None, None, 0x12, 0x01, 0x11, None, None],
|
||||
'phx': [0xDA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'phy': [0x5A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'plx': [0xFA, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'ply': [0x7A, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb0': [None, None, 0x07, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb1': [None, None, 0x17, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb2': [None, None, 0x27, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb3': [None, None, 0x37, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb4': [None, None, 0x47, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb5': [None, None, 0x57, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb6': [None, None, 0x67, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'rmb7': [None, None, 0x77, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sbc': [None, 0xE9, 0xE5, 0xF5, None, 0xED, 0xFD, 0xF9,
|
||||
None, None, None, 0xF2, 0xE1, 0xF1, None],
|
||||
None, None, None, 0xF2, 0xE1, 0xF1, None, None],
|
||||
'smb0': [None, None, 0x87, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb1': [None, None, 0x97, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb2': [None, None, 0xA7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb3': [None, None, 0xB7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb4': [None, None, 0xC7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb5': [None, None, 0xD7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb6': [None, None, 0xE7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'smb7': [None, None, 0xF7, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'sta': [None, None, 0x85, 0x95, None, 0x8D, 0x9D, 0x99,
|
||||
None, None, None, 0x92, 0x81, 0x91, None],
|
||||
None, None, None, 0x92, 0x81, 0x91, None, None],
|
||||
'stp': [0xDB, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'stz': [None, None, 0x64, 0x74, None, 0x9C, 0x9E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'stz.w': [None, None, None, None, None, 0x9C, 0x9E, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'trb': [None, None, 0x14, None, None, 0x1C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'trb.w': [None, None, None, None, None, 0x1C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tsb': [None, None, 0x04, None, None, 0x0C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'tsb.w': [None, None, None, None, None, 0x0C, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
'wai': [0xCB, None, None, None, None, None, None, None,
|
||||
None, None, None, None, None, None, None],
|
||||
None, None, None, None, None, None, None, None],
|
||||
}
|
||||
|
@ -273,6 +273,9 @@ class EasyModes(Pass):
|
||||
if not collapse_y(node, env):
|
||||
node.nodetype = "AbsoluteY"
|
||||
|
||||
def visitMemory2(self, node, env):
|
||||
node.nodetype = "ZPRelative"
|
||||
|
||||
def visitPointer(self, node, env):
|
||||
if node.data[1].hardcoded:
|
||||
if not collapse_no_index_ind(node, env):
|
||||
@ -329,6 +332,9 @@ class PCTracker(Pass):
|
||||
def visitRelative(self, node, env):
|
||||
env.incPC(2)
|
||||
|
||||
def visitZPRelative(self, node, env):
|
||||
env.incPC(3)
|
||||
|
||||
def visitIndirect(self, node, env):
|
||||
env.incPC(3)
|
||||
|
||||
@ -564,13 +570,13 @@ class ExtendBranches(PCTracker):
|
||||
self.changed = False
|
||||
|
||||
def visitRelative(self, node, env):
|
||||
(opcode, expr) = node.data
|
||||
(opcode, expr) = node.data[:2]
|
||||
arg = expr.value(env)
|
||||
arg = arg - (env.getPC() + 2)
|
||||
if arg < -128 or arg > 127:
|
||||
if opcode == 'bra':
|
||||
# If BRA - BRanch Always - is out of range, it's a JMP.
|
||||
node.data = ('jmp', expr)
|
||||
node.data = ('jmp', expr, None)
|
||||
node.nodetype = "Absolute"
|
||||
if Cmd.warn_on_branch_extend:
|
||||
print>>sys.stderr, str(node.ppt) + ": WARNING: " \
|
||||
@ -584,8 +590,9 @@ class ExtendBranches(PCTracker):
|
||||
expansion = [IR.Node(node.ppt, "Relative",
|
||||
ExtendBranches.reversed[opcode],
|
||||
IR.SequenceExpr([IR.PCExpr(), "+",
|
||||
IR.ConstantExpr(5)])),
|
||||
IR.Node(node.ppt, "Absolute", 'jmp', expr)]
|
||||
IR.ConstantExpr(5)]),
|
||||
None),
|
||||
IR.Node(node.ppt, "Absolute", 'jmp', expr, None)]
|
||||
node.nodetype = 'SEQUENCE'
|
||||
node.data = expansion
|
||||
if Cmd.warn_on_branch_extend:
|
||||
@ -597,7 +604,36 @@ class ExtendBranches(PCTracker):
|
||||
self.changed = True
|
||||
node.accept(self, env)
|
||||
else:
|
||||
env.incPC(2)
|
||||
PCTracker.visitRelative(self, node, env)
|
||||
|
||||
def visitZPRelative(self, node, env):
|
||||
(opcode, tested, expr) = node.data
|
||||
arg = expr.value(env)
|
||||
arg = arg - (env.getPC() + 3)
|
||||
if arg < -128 or arg > 127:
|
||||
# Otherwise, we replace it with a 'macro' of sorts by hand:
|
||||
# $branch LOC -> $reversed_branch ^+6; JMP LOC
|
||||
# We don't use temp labels here because labels need to have
|
||||
# been fixed in place by this point, and JMP is always 3
|
||||
# bytes long.
|
||||
expansion = [IR.Node(node.ppt, "ZPRelative",
|
||||
ExtendBranches.reversed[opcode],
|
||||
tested,
|
||||
IR.SequenceExpr([IR.PCExpr(), "+",
|
||||
IR.ConstantExpr(6)])),
|
||||
IR.Node(node.ppt, "Absolute", 'jmp', expr, None)]
|
||||
node.nodetype = 'SEQUENCE'
|
||||
node.data = expansion
|
||||
if Cmd.warn_on_branch_extend:
|
||||
print>>sys.stderr, str(node.ppt) + ": WARNING: " + \
|
||||
opcode + " out of range, " \
|
||||
"replacing with " + \
|
||||
ExtendBranches.reversed[opcode] + \
|
||||
"/jmp combo"
|
||||
self.changed = True
|
||||
node.accept(self, env)
|
||||
else:
|
||||
PCTracker.visitZPRelative(self, node, env)
|
||||
|
||||
|
||||
class NormalizeModes(Pass):
|
||||
@ -710,9 +746,20 @@ class Assembler(Pass):
|
||||
else:
|
||||
Err.log("Attempt to write to data segment")
|
||||
|
||||
def relativize(self, expr, env, arglen):
|
||||
"Convert an expression into one for use in relative addressing"
|
||||
arg = expr.value(env)
|
||||
arg = arg - (env.getPC() + arglen + 1)
|
||||
if arg < -128 or arg > 127:
|
||||
Err.log("Branch target out of bounds")
|
||||
arg = 0
|
||||
if arg < 0:
|
||||
arg += 256
|
||||
return IR.ConstantExpr(arg)
|
||||
|
||||
def assemble(self, node, mode, env):
|
||||
"A generic instruction called by the visitor methods themselves"
|
||||
(opcode, expr) = node.data
|
||||
(opcode, expr, expr2) = node.data
|
||||
bin_op = Ops.opcodes[opcode][mode]
|
||||
if bin_op is None:
|
||||
Err.log('%s does not have mode "%s"' % (opcode.upper(),
|
||||
@ -720,19 +767,17 @@ class Assembler(Pass):
|
||||
return
|
||||
self.outputbyte(IR.ConstantExpr(bin_op), env)
|
||||
arglen = Ops.lengths[mode]
|
||||
if mode == 14: # Special handling for relative mode
|
||||
arg = expr.value(env)
|
||||
arg = arg - (env.getPC() + 2)
|
||||
if arg < -128 or arg > 127:
|
||||
Err.log("Branch target out of bounds")
|
||||
arg = 0
|
||||
if arg < 0:
|
||||
arg += 256
|
||||
expr = IR.ConstantExpr(arg)
|
||||
if arglen == 1:
|
||||
if mode == 15: # ZP Relative mode is wildly nonstandard
|
||||
expr2 = self.relativize(expr2, env, arglen)
|
||||
self.outputbyte(expr, env)
|
||||
if arglen == 2:
|
||||
self.outputword(expr, env)
|
||||
self.outputbyte(expr2, env)
|
||||
else:
|
||||
if mode == 14:
|
||||
expr = self.relativize(expr, env, arglen)
|
||||
if arglen == 1:
|
||||
self.outputbyte(expr, env)
|
||||
elif arglen == 2:
|
||||
self.outputword(expr, env)
|
||||
env.incPC(1 + arglen)
|
||||
self.code += 1 + arglen
|
||||
|
||||
@ -781,6 +826,9 @@ class Assembler(Pass):
|
||||
def visitRelative(self, node, env):
|
||||
self.assemble(node, 14, env)
|
||||
|
||||
def visitZPRelative(self, node, env):
|
||||
self.assemble(node, 15, env)
|
||||
|
||||
def visitLabel(self, node, env):
|
||||
pass
|
||||
|
||||
|
@ -17,43 +17,45 @@ prologue = '"""' + """Opcodes file.
|
||||
# the tables in tools/opcodes. Edit those tables, not these.
|
||||
|
||||
# Names of addressing modes
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative"] # 14
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative", # 14
|
||||
"Zero Page, Relative"] # 15
|
||||
|
||||
|
||||
# Lengths of the argument
|
||||
lengths = [0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1]
|
||||
lengths = [0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2]
|
||||
"""
|
||||
|
||||
# These values should match the ones in the prologue string.
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative"] # 14
|
||||
modes = ["Implied", # 0
|
||||
"Immediate", # 1
|
||||
"Zero Page", # 2
|
||||
"Zero Page, X", # 3
|
||||
"Zero Page, Y", # 4
|
||||
"Absolute", # 5
|
||||
"Absolute, X", # 6
|
||||
"Absolute, Y", # 7
|
||||
"(Absolute)", # 8
|
||||
"(Absolute, X)", # 9
|
||||
"(Absolute), Y", # 10
|
||||
"(Zero Page)", # 11
|
||||
"(Zero Page, X)", # 12
|
||||
"(Zero Page), Y", # 13
|
||||
"Relative", # 14
|
||||
"Zero Page, Relative"] # 15
|
||||
|
||||
flatmodes = [x.lower() for x in modes]
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
0C: TSB - Absolute; TSB.W - Absolute
|
||||
0D: ORA - Absolute
|
||||
0E: ASL - Absolute
|
||||
0F: BBR0 - Relative
|
||||
0F: BBR0 - Zero Page, Relative
|
||||
10: BPL - Relative
|
||||
11: ORA - (Zero Page), Y
|
||||
12: ORA - (Zero Page)
|
||||
@ -29,7 +29,7 @@
|
||||
1C: TRB - Absolute; TRB.W - Absolute
|
||||
1D: ORA - Absolute, X
|
||||
1E: ASL - Absolute, X
|
||||
1F: BBR1 - Relative
|
||||
1F: BBR1 - Zero Page, Relative
|
||||
20: JSR - Absolute
|
||||
21: AND - (Zero Page, X)
|
||||
22:
|
||||
@ -45,7 +45,7 @@
|
||||
2C: BIT - Absolute
|
||||
2D: AND - Absolute
|
||||
2E: ROL - Absolute
|
||||
2F: BBR2 - Relative
|
||||
2F: BBR2 - Zero Page, Relative
|
||||
30: BMI - Relative
|
||||
31: AND - (Zero Page), Y
|
||||
32: AND - (Zero Page)
|
||||
@ -61,7 +61,7 @@
|
||||
3C: BIT - Absolute, X
|
||||
3D: AND - Absolute, X
|
||||
3E: ROL - Absolute, X
|
||||
3F: BBR3 - Relative
|
||||
3F: BBR3 - Zero Page, Relative
|
||||
40: RTI - Implied
|
||||
41: EOR - (Zero Page, X)
|
||||
42:
|
||||
@ -77,7 +77,7 @@
|
||||
4C: JMP - Absolute
|
||||
4D: EOR - Absolute
|
||||
4E: LSR - Absolute
|
||||
4F: BBR4 - Relative
|
||||
4F: BBR4 - Zero Page, Relative
|
||||
50: BVC - Relative
|
||||
51: EOR - (Zero Page), Y
|
||||
52: EOR - (Zero Page)
|
||||
@ -93,7 +93,7 @@
|
||||
5C:
|
||||
5D: EOR - Absolute, X
|
||||
5E: LSR - Absolute, X
|
||||
5F: BBR5 - Relative
|
||||
5F: BBR5 - Zero Page, Relative
|
||||
60: RTS - Implied
|
||||
61: ADC - (Zero Page, X)
|
||||
62:
|
||||
@ -109,7 +109,7 @@
|
||||
6C: JMP - (Absolute)
|
||||
6D: ADC - Absolute
|
||||
6E: ROR - Absolute
|
||||
6F: BBR6 - Relative
|
||||
6F: BBR6 - Zero Page, Relative
|
||||
70: BVS - Relative
|
||||
71: ADC - (Zero Page), Y
|
||||
72: ADC - (Zero Page)
|
||||
@ -125,7 +125,7 @@
|
||||
7C: JMP - (Absolute, X)
|
||||
7D: ADC - Absolute, X
|
||||
7E: ROR - Absolute, X
|
||||
7F: BBR7 - Relative
|
||||
7F: BBR7 - Zero Page, Relative
|
||||
80: BRA - Relative
|
||||
81: STA - (Zero Page, X)
|
||||
82:
|
||||
@ -141,7 +141,7 @@
|
||||
8C: STY - Absolute
|
||||
8D: STA - Absolute
|
||||
8E: STX - Absolute
|
||||
8F: BBS0 - Relative
|
||||
8F: BBS0 - Zero Page, Relative
|
||||
90: BCC - Relative
|
||||
91: STA - (Zero Page), Y
|
||||
92: STA - (Zero Page)
|
||||
@ -157,7 +157,7 @@
|
||||
9C: STZ - Absolute; STZ.W - Absolute
|
||||
9D: STA - Absolute, X
|
||||
9E: STZ - Absolute, X; STZ.W - Absolute, X
|
||||
9F: BBS1 - Relative
|
||||
9F: BBS1 - Zero Page, Relative
|
||||
A0: LDY - Immediate
|
||||
A1: LDA - (Zero Page, X)
|
||||
A2: LDX - Immediate
|
||||
@ -173,7 +173,7 @@
|
||||
AC: LDY - Absolute
|
||||
AD: LDA - Absolute
|
||||
AE: LDX - Absolute
|
||||
AF: BBS2 - Relative
|
||||
AF: BBS2 - Zero Page, Relative
|
||||
B0: BCS - Relative
|
||||
B1: LDA - (Zero Page), Y
|
||||
B2: LDA - (Zero Page)
|
||||
@ -189,7 +189,7 @@
|
||||
BC: LDY - Absolute, X
|
||||
BD: LDA - Absolute, X
|
||||
BE: LDX - Absolute, Y
|
||||
BF: BBS3 - Relative
|
||||
BF: BBS3 - Zero Page, Relative
|
||||
C0: CPY - Immediate
|
||||
C1: CMP - (Zero Page, X)
|
||||
C2:
|
||||
@ -205,7 +205,7 @@
|
||||
CC: CPY - Absolute
|
||||
CD: CMP - Absolute
|
||||
CE: DEC - Absolute
|
||||
CF: BBS4 - Relative
|
||||
CF: BBS4 - Zero Page, Relative
|
||||
D0: BNE - Relative
|
||||
D1: CMP - (Zero Page), Y
|
||||
D2: CMP - (Zero Page)
|
||||
@ -221,7 +221,7 @@
|
||||
DC:
|
||||
DD: CMP - Absolute, X
|
||||
DE: DEC - Absolute, X
|
||||
DF: BBS5 - Relative
|
||||
DF: BBS5 - Zero Page, Relative
|
||||
E0: CPX - Immediate
|
||||
E1: SBC - (Zero Page, X)
|
||||
E2:
|
||||
@ -237,7 +237,7 @@
|
||||
EC: CPX - Absolute
|
||||
ED: SBC - Absolute
|
||||
EE: INC - Absolute
|
||||
EF: BBS6 - Relative
|
||||
EF: BBS6 - Zero Page, Relative
|
||||
F0: BEQ - Relative
|
||||
F1: SBC - (Zero Page), Y
|
||||
F2: SBC - (Zero Page)
|
||||
@ -253,4 +253,4 @@
|
||||
FC:
|
||||
FD: SBC - Absolute, X
|
||||
FE: INC - Absolute, X
|
||||
FF: BBS7 - Relative
|
||||
FF: BBS7 - Zero Page, Relative
|
||||
|
Binary file not shown.
@ -1,74 +1,74 @@
|
||||
.text
|
||||
.org $0800
|
||||
early:
|
||||
bbr0 late
|
||||
bbr1 late
|
||||
bbr2 late
|
||||
bbr3 late
|
||||
bbr4 late
|
||||
bbr5 late
|
||||
bbr6 late
|
||||
bbr7 late
|
||||
bbr0 $42, late
|
||||
bbr1 $42, late
|
||||
bbr2 $42, late
|
||||
bbr3 $42, late
|
||||
bbr4 $42, late
|
||||
bbr5 $42, late
|
||||
bbr6 $42, late
|
||||
bbr7 $42, late
|
||||
bra late
|
||||
bbs0 late
|
||||
bbs1 late
|
||||
bbs2 late
|
||||
bbs3 late
|
||||
bbs4 late
|
||||
bbs5 late
|
||||
bbs6 late
|
||||
bbs7 late
|
||||
bbr0 early
|
||||
bbr1 early
|
||||
bbr2 early
|
||||
bbr3 early
|
||||
bbr4 early
|
||||
bbr5 early
|
||||
bbr6 early
|
||||
bbr7 early
|
||||
bbs0 $42, late
|
||||
bbs1 $42, late
|
||||
bbs2 $42, late
|
||||
bbs3 $42, late
|
||||
bbs4 $42, late
|
||||
bbs5 $42, late
|
||||
bbs6 $42, late
|
||||
bbs7 $42, late
|
||||
bbr0 $42, early
|
||||
bbr1 $42, early
|
||||
bbr2 $42, early
|
||||
bbr3 $42, early
|
||||
bbr4 $42, early
|
||||
bbr5 $42, early
|
||||
bbr6 $42, early
|
||||
bbr7 $42, early
|
||||
bra early
|
||||
bbs0 early
|
||||
bbs1 early
|
||||
bbs2 early
|
||||
bbs3 early
|
||||
bbs4 early
|
||||
bbs5 early
|
||||
bbs6 early
|
||||
bbs7 early
|
||||
early2:
|
||||
bbs0 $42, early2
|
||||
bbs1 $42, early2
|
||||
bbs2 $42, early2
|
||||
bbs3 $42, early2
|
||||
bbs4 $42, early2
|
||||
bbs5 $42, early2
|
||||
bbs6 $42, early2
|
||||
bbs7 $42, early2
|
||||
.advance ^+256
|
||||
late:
|
||||
bbr0 late
|
||||
bbr1 late
|
||||
bbr2 late
|
||||
bbr3 late
|
||||
bbr4 late
|
||||
bbr5 late
|
||||
bbr6 late
|
||||
bbr7 late
|
||||
bbr0 $42, late
|
||||
bbr1 $42, late
|
||||
bbr2 $42, late
|
||||
bbr3 $42, late
|
||||
bbr4 $42, late
|
||||
bbr5 $42, late
|
||||
bbr6 $42, late
|
||||
bbr7 $42, late
|
||||
bra late
|
||||
bbs0 late
|
||||
bbs1 late
|
||||
bbs2 late
|
||||
bbs3 late
|
||||
bbs4 late
|
||||
bbs5 late
|
||||
bbs6 late
|
||||
bbs7 late
|
||||
bbr0 early
|
||||
bbr1 early
|
||||
bbr2 early
|
||||
bbr3 early
|
||||
bbr4 early
|
||||
bbr5 early
|
||||
bbr6 early
|
||||
bbr7 early
|
||||
bbs0 $42, late
|
||||
bbs1 $42, late
|
||||
bbs2 $42, late
|
||||
bbs3 $42, late
|
||||
bbs4 $42, late
|
||||
bbs5 $42, late
|
||||
bbs6 $42, late
|
||||
bbs7 $42, late
|
||||
bbr0 $42, early
|
||||
bbr1 $42, early
|
||||
bbr2 $42, early
|
||||
bbr3 $42, early
|
||||
bbr4 $42, early
|
||||
bbr5 $42, early
|
||||
bbr6 $42, early
|
||||
bbr7 $42, early
|
||||
bra early
|
||||
bbs0 early
|
||||
bbs1 early
|
||||
bbs2 early
|
||||
bbs3 early
|
||||
bbs4 early
|
||||
bbs5 early
|
||||
bbs6 early
|
||||
bbs7 early
|
||||
|
||||
bbs0 $42, early
|
||||
bbs1 $42, early
|
||||
bbs2 $42, early
|
||||
bbs3 $42, early
|
||||
bbs4 $42, early
|
||||
bbs5 $42, early
|
||||
bbs6 $42, early
|
||||
bbs7 $42, early
|
||||
|
@ -1,106 +1,107 @@
|
||||
.text
|
||||
.org $0800
|
||||
early:
|
||||
bbs0 +
|
||||
bbs0 $42, +
|
||||
jmp late
|
||||
* bbs1 +
|
||||
* bbs1 $42, +
|
||||
jmp late
|
||||
* bbs2 +
|
||||
* bbs2 $42, +
|
||||
jmp late
|
||||
* bbs3 +
|
||||
* bbs3 $42, +
|
||||
jmp late
|
||||
* bbs4 +
|
||||
* bbs4 $42, +
|
||||
jmp late
|
||||
* bbs5 +
|
||||
* bbs5 $42, +
|
||||
jmp late
|
||||
* bbs6 +
|
||||
* bbs6 $42, +
|
||||
jmp late
|
||||
* bbs7 +
|
||||
* bbs7 $42, +
|
||||
jmp late
|
||||
* jmp late
|
||||
* bbr0 +
|
||||
* bbr0 $42, +
|
||||
jmp late
|
||||
* bbr1 +
|
||||
* bbr1 $42, +
|
||||
jmp late
|
||||
* bbr2 +
|
||||
* bbr2 $42, +
|
||||
jmp late
|
||||
* bbr3 +
|
||||
* bbr3 $42, +
|
||||
jmp late
|
||||
* bbr4 +
|
||||
* bbr4 $42, +
|
||||
jmp late
|
||||
* bbr5 +
|
||||
* bbr5 $42, +
|
||||
jmp late
|
||||
* bbr6 +
|
||||
* bbr6 $42, +
|
||||
jmp late
|
||||
* bbr7 +
|
||||
* bbr7 $42, +
|
||||
jmp late
|
||||
* bbr0 early
|
||||
bbr1 early
|
||||
bbr2 early
|
||||
bbr3 early
|
||||
bbr4 early
|
||||
bbr5 early
|
||||
bbr6 early
|
||||
bbr7 early
|
||||
* bbr0 $42, early
|
||||
bbr1 $42, early
|
||||
bbr2 $42, early
|
||||
bbr3 $42, early
|
||||
bbr4 $42, early
|
||||
bbr5 $42, early
|
||||
bbr6 $42, early
|
||||
bbr7 $42, early
|
||||
bra early
|
||||
bbs0 early
|
||||
bbs1 early
|
||||
bbs2 early
|
||||
bbs3 early
|
||||
bbs4 early
|
||||
bbs5 early
|
||||
bbs6 early
|
||||
bbs7 early
|
||||
early2:
|
||||
bbs0 $42, early2
|
||||
bbs1 $42, early2
|
||||
bbs2 $42, early2
|
||||
bbs3 $42, early2
|
||||
bbs4 $42, early2
|
||||
bbs5 $42, early2
|
||||
bbs6 $42, early2
|
||||
bbs7 $42, early2
|
||||
.advance ^+256
|
||||
late:
|
||||
bbr0 late
|
||||
bbr1 late
|
||||
bbr2 late
|
||||
bbr3 late
|
||||
bbr4 late
|
||||
bbr5 late
|
||||
bbr6 late
|
||||
bbr7 late
|
||||
bbr0 $42, late
|
||||
bbr1 $42, late
|
||||
bbr2 $42, late
|
||||
bbr3 $42, late
|
||||
bbr4 $42, late
|
||||
bbr5 $42, late
|
||||
bbr6 $42, late
|
||||
bbr7 $42, late
|
||||
bra late
|
||||
bbs0 late
|
||||
bbs1 late
|
||||
bbs2 late
|
||||
bbs3 late
|
||||
bbs4 late
|
||||
bbs5 late
|
||||
bbs6 late
|
||||
bbs7 late
|
||||
bbs0 +
|
||||
bbs0 $42, late
|
||||
bbs1 $42, late
|
||||
bbs2 $42, late
|
||||
bbs3 $42, late
|
||||
bbs4 $42, late
|
||||
bbs5 $42, late
|
||||
bbs6 $42, late
|
||||
bbs7 $42, late
|
||||
bbs0 $42, +
|
||||
jmp early
|
||||
* bbs1 +
|
||||
* bbs1 $42, +
|
||||
jmp early
|
||||
* bbs2 +
|
||||
* bbs2 $42, +
|
||||
jmp early
|
||||
* bbs3 +
|
||||
* bbs3 $42, +
|
||||
jmp early
|
||||
* bbs4 +
|
||||
* bbs4 $42, +
|
||||
jmp early
|
||||
* bbs5 +
|
||||
* bbs5 $42, +
|
||||
jmp early
|
||||
* bbs6 +
|
||||
* bbs6 $42, +
|
||||
jmp early
|
||||
* bbs7 +
|
||||
* bbs7 $42, +
|
||||
jmp early
|
||||
* jmp early
|
||||
bbr0 +
|
||||
bbr0 $42, +
|
||||
jmp early
|
||||
* bbr1 +
|
||||
* bbr1 $42, +
|
||||
jmp early
|
||||
* bbr2 +
|
||||
* bbr2 $42, +
|
||||
jmp early
|
||||
* bbr3 +
|
||||
* bbr3 $42, +
|
||||
jmp early
|
||||
* bbr4 +
|
||||
* bbr4 $42, +
|
||||
jmp early
|
||||
* bbr5 +
|
||||
* bbr5 $42, +
|
||||
jmp early
|
||||
* bbr6 +
|
||||
* bbr6 $42, +
|
||||
jmp early
|
||||
* bbr7 +
|
||||
* bbr7 $42, +
|
||||
jmp early
|
||||
*
|
||||
|
Binary file not shown.
@ -12,63 +12,63 @@
|
||||
TSB $04 ; 04: TSB - Zero Page
|
||||
RMB0 $07 ; 07: RMB0 - Zero Page
|
||||
TSB $0C0C ; 0C: TSB - Absolute
|
||||
BBR0 ^+$11 ; 0F: BBR0 - Relative
|
||||
BBR0 $0F, ^+$12 ; 0F: BBR0 - Zero Page, Relative
|
||||
ORA ($12) ; 12: ORA - (Zero Page)
|
||||
TRB $14 ; 14: TRB - Zero Page
|
||||
RMB1 $17 ; 17: RMB1 - Zero Page
|
||||
INA ; 1A: INA - Implied
|
||||
INC ; INC - Implied
|
||||
TRB $1C1C ; 1C: TRB - Absolute
|
||||
BBR1 ^+$21 ; 1F: BBR1 - Relative
|
||||
BBR1 $1F, ^+$22 ; 1F: BBR1 - Zero Page, Relative
|
||||
RMB2 $27 ; 27: RMB2 - Zero Page
|
||||
BBR2 ^+$31 ; 2F: BBR2 - Relative
|
||||
BBR2 $2F, ^+$32 ; 2F: BBR2 - Zero Page, Relative
|
||||
AND ($32) ; 32: AND - (Zero Page)
|
||||
BIT $34, X ; 34: BIT - Zero Page, X
|
||||
RMB3 $37 ; 37: RMB3 - Zero Page
|
||||
DEA ; 3A: DEA - Implied
|
||||
DEC ; 3A: DEC - Implied
|
||||
BIT $3C3C,X ; 3C: BIT - Absolute, X
|
||||
BBR3 ^+$41 ; 3F: BBR3 - Relative
|
||||
BBR3 $3F, ^+$42 ; 3F: BBR3 - Zero Page, Relative
|
||||
RMB4 $47 ; 47: RMB4 - Zero Page
|
||||
BBR4 ^+$51 ; 4F: BBR4 - Relative
|
||||
BBR4 $4F, ^+$52 ; 4F: BBR4 - Zero Page, Relative
|
||||
EOR ($52) ; 52: EOR - (Zero Page)
|
||||
RMB5 $57 ; 57: RMB5 - Zero Page
|
||||
PHY ; 5A: PHY - Implied
|
||||
BBR5 ^+$61 ; 5F: BBR5 - Relative
|
||||
BBR5 $5F, ^+$62 ; 5F: BBR5 - Zero Page, Relative
|
||||
STZ $64 ; 64: STZ - Zero Page
|
||||
RMB6 $67 ; 67: RMB6 - Zero Page
|
||||
BBR6 ^+$71 ; 6F: BBR6 - Relative
|
||||
BBR6 $6F, ^+$72 ; 6F: BBR6 - Zero Page, Relative
|
||||
ADC ($72) ; 72: ADC - (Zero Page)
|
||||
STZ $74, X ; 74: STZ - Zero Page, X
|
||||
RMB7 $77 ; 77: RMB7 - Zero Page
|
||||
PLY ; 7A: PLY - Implied
|
||||
JMP ($7C7C, X) ; 7C: JMP - (Absolute, X)
|
||||
BBR7 ^+$81 ; 7F: BBR7 - Relative
|
||||
BBR7 $7F, ^+$82 ; 7F: BBR7 - Zero Page, Relative
|
||||
BRA ^-$7E ; 80: BRA - Relative
|
||||
SMB0 $87 ; 87: SMB0 - Zero Page
|
||||
BIT #$89 ; 89: BIT - Immediate
|
||||
BBS0 ^-$6F ; 8F: BBS0 - Relative
|
||||
BBS0 $8F, ^-$6E ; 8F: BBS0 - Zero Page, Relative
|
||||
STA ($92) ; 92: STA - (Zero Page)
|
||||
SMB1 $97 ; 97: SMB1 - Zero Page
|
||||
STZ $9C9C ; 9C: STZ - Absolute
|
||||
STZ $9E9E, X ; 9E: STZ - Absolute, X
|
||||
BBS1 ^-$5F ; 9F: BBS1 - Relative
|
||||
BBS1 $9F, ^-$5E ; 9F: BBS1 - Zero Page, Relative
|
||||
SMB2 $A7 ; A7: SMB2 - Zero Page
|
||||
BBS2 ^-$4F ; AF: BBS2 - Relative
|
||||
BBS2 $AF, ^-$4E ; AF: BBS2 - Zero Page, Relative
|
||||
LDA ($B2) ; B2: LDA - (Zero Page)
|
||||
SMB3 $B7 ; B7: SMB3 - Zero Page
|
||||
BBS3 ^-$3F ; BF: BBS3 - Relative
|
||||
BBS3 $BF, ^-$3E ; BF: BBS3 - Zero Page, Relative
|
||||
SMB4 $C7 ; C7: SMB4 - Zero Page
|
||||
WAI ; CB: WAI - Implied
|
||||
BBS4 ^-$2F ; CF: BBS4 - Relative
|
||||
BBS4 $CF, ^-$2E ; CF: BBS4 - Zero Page, Relative
|
||||
CMP ($D2) ; D2: CMP - (Zero Page)
|
||||
SMB5 $D7 ; D7: SMB5 - Zero Page
|
||||
PHX ; DA: PHX - Implied
|
||||
STP ; DB: STP - Implied
|
||||
BBS5 ^-$1F ; DF: BBS5 - Relative
|
||||
BBS5 $DF, ^-$1E ; DF: BBS5 - Zero Page, Relative
|
||||
SMB6 $E7 ; E7: SMB6 - Zero Page
|
||||
BBS6 ^-$0F ; EF: BBS6 - Relative
|
||||
BBS6 $EF, ^-$0E ; EF: BBS6 - Zero Page, Relative
|
||||
SBC ($F2) ; F2: SBC - (Zero Page)
|
||||
SMB7 $F7 ; F7: SMB7 - Zero Page
|
||||
PLX ; FA: PLX - Implied
|
||||
BBS7 ^+$01 ; FF: BBS7 - Relative
|
||||
BBS7 $FF, ^+$02 ; FF: BBS7 - Zero Page, Relative
|
||||
|
Loading…
Reference in New Issue
Block a user