1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-01 05:41:31 +00:00

pce: optimizations, 32KB carts

This commit is contained in:
Steven Hugg 2023-10-31 19:55:42 -05:00
parent 5bc85161eb
commit 69600744df
4 changed files with 3741 additions and 3428 deletions

View File

@ -0,0 +1,283 @@
import { hex } from "../util";
export var OPS_HuC6280 = [
{mn:"BRK",am:"",nb:1,il:0,c1:7,c2:0,nw:3,br:1,mod:"SI"}, // 0
{mn:"ORA",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"AZN"}, // 1
{mn:"SXY",am:"",nb:1,il:0,c1:3,c2:0,nw:0,br:0,mod:"XY"}, // 2
{mn:"ST0",am:"#aa",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:""}, // 3
{mn:"TSB",am:"aa",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"NZV"}, // 4
{mn:"ORA",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"AZN"}, // 5
{mn:"ASL",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"CZN"}, // 6
{mn:"RMB0",am:"aa",nb:2,il:0,c1:7,c2:0,nw:1,br:0,mod:""}, // 7
{mn:"PHP",am:"",nb:1,il:0,c1:3,c2:0,nw:1,br:0,mod:"S"}, // 8
{mn:"ORA",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 9
{mn:"ASL",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // a
{mn:"ANC",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // b
{mn:"TSB",am:"AAAA",nb:3,il:0,c1:7,c2:0,nw:0,br:0,mod:"NZV"}, // c
{mn:"ORA",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // d
{mn:"ASL",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // e
{mn:"BBR0",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:0,br:0,mod:""}, // f
// TODO: finish these
{mn:"BPL",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 10
{mn:"ORA",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"AZN"}, // 11
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 12
{mn:"SLO",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZN"}, // 13
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 14
{mn:"ORA",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // 15
{mn:"ASL",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 16
{mn:"SLO",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZN"}, // 17
{mn:"CLC",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"C"}, // 18
{mn:"ORA",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 19
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 1a
{mn:"SLO",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 1b
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 1c
{mn:"ORA",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 1d
{mn:"ASL",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // 1e
{mn:"SLO",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 1f
{mn:"JSR",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:1,mod:"S"}, // 20
{mn:"AND",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"AZN"}, // 21
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 22
{mn:"RLA",am:"(aa,x)",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZN"}, // 23
{mn:"BIT",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"ZVN"}, // 24
{mn:"AND",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"AZN"}, // 25
{mn:"ROL",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"CZN"}, // 26
{mn:"RLA",am:"aa",nb:2,il:1,c1:5,c2:0,nw:2,br:0,mod:"ACZN"}, // 27
{mn:"PLP",am:"",nb:1,il:0,c1:4,c2:0,nw:0,br:0,mod:"SCZIDVN"}, // 28
{mn:"AND",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 29
{mn:"ROL",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // 2a
{mn:"ANC",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // 2b
{mn:"BIT",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"ZVN"}, // 2c
{mn:"AND",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // 2d
{mn:"ROL",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 2e
{mn:"RLA",am:"AAAA",nb:3,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZN"}, // 2f
{mn:"BMI",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 30
{mn:"AND",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"AZN"}, // 31
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 32
{mn:"RLA",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZN"}, // 33
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 34
{mn:"AND",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // 35
{mn:"ROL",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 36
{mn:"RLA",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZN"}, // 37
{mn:"SEC",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"C"}, // 38
{mn:"AND",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 39
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 3a
{mn:"RLA",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 3b
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 3c
{mn:"AND",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 3d
{mn:"ROL",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // 3e
{mn:"RLA",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 3f
{mn:"RTI",am:"",nb:1,il:0,c1:6,c2:0,nw:0,br:1,mod:"SCZIDVN"}, // 40
{mn:"EOR",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"AZN"}, // 41
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 42
{mn:"SRE",am:"(aa,x)",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZN"}, // 43
{mn:"NOP",am:"aa",nb:2,il:1,c1:3,c2:0,nw:0,br:0,mod:""}, // 44
{mn:"EOR",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"AZN"}, // 45
{mn:"LSR",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"CZN"}, // 46
{mn:"SRE",am:"aa",nb:2,il:1,c1:5,c2:0,nw:2,br:0,mod:"ACZN"}, // 47
{mn:"PHA",am:"",nb:1,il:0,c1:3,c2:0,nw:1,br:0,mod:"S"}, // 48
{mn:"EOR",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 49
{mn:"LSR",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // 4a
{mn:"ASR",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // 4b
{mn:"JMP",am:"AAAA",nb:3,il:0,c1:3,c2:0,nw:0,br:1,mod:""}, // 4c
{mn:"EOR",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // 4d
{mn:"LSR",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 4e
{mn:"SRE",am:"AAAA",nb:3,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZN"}, // 4f
{mn:"BVC",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 50
{mn:"EOR",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"AZN"}, // 51
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 52
{mn:"SRE",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZN"}, // 53
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 54
{mn:"EOR",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // 55
{mn:"LSR",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 56
{mn:"SRE",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZN"}, // 57
{mn:"CLI",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"I"}, // 58
{mn:"EOR",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 59
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 5a
{mn:"SRE",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 5b
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 5c
{mn:"EOR",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // 5d
{mn:"LSR",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // 5e
{mn:"SRE",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZN"}, // 5f
{mn:"RTS",am:"",nb:1,il:0,c1:6,c2:0,nw:0,br:1,mod:"S"}, // 60
{mn:"ADC",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"ACZVN"}, // 61
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 62
{mn:"RRA",am:"(aa,x)",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZVN"}, // 63
{mn:"NOP",am:"aa",nb:2,il:1,c1:3,c2:0,nw:0,br:0,mod:""}, // 64
{mn:"ADC",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"ACZVN"}, // 65
{mn:"ROR",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"CZN"}, // 66
{mn:"RRA",am:"aa",nb:2,il:1,c1:5,c2:0,nw:2,br:0,mod:"ACZVN"}, // 67
{mn:"PLA",am:"",nb:1,il:0,c1:4,c2:0,nw:0,br:0,mod:"SAZN"}, // 68
{mn:"ADC",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZVN"}, // 69
{mn:"ROR",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZN"}, // 6a
{mn:"ARR",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"ACZVN"}, // 6b
{mn:"JMP",am:"(AAAA)",nb:3,il:0,c1:5,c2:0,nw:0,br:1,mod:""}, // 6c
{mn:"ADC",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"ACZVN"}, // 6d
{mn:"ROR",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 6e
{mn:"RRA",am:"AAAA",nb:3,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZVN"}, // 6f
{mn:"BVS",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 70
{mn:"ADC",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"ACZVN"}, // 71
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 72
{mn:"RRA",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZVN"}, // 73
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 74
{mn:"ADC",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"ACZVN"}, // 75
{mn:"ROR",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // 76
{mn:"RRA",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZVN"}, // 77
{mn:"SEI",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"I"}, // 78
{mn:"ADC",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"ACZVN"}, // 79
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 7a
{mn:"RRA",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZVN"}, // 7b
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // 7c
{mn:"ADC",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"ACZVN"}, // 7d
{mn:"ROR",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // 7e
{mn:"RRA",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZVN"}, // 7f
{mn:"BRA",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 80
{mn:"STA",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:1,br:0,mod:""}, // 81
{mn:"NOP",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 82
{mn:"SAX",am:"(aa,x)",nb:2,il:1,c1:6,c2:0,nw:1,br:0,mod:""}, // 83
{mn:"STY",am:"aa",nb:2,il:0,c1:3,c2:0,nw:1,br:0,mod:""}, // 84
{mn:"STA",am:"aa",nb:2,il:0,c1:3,c2:0,nw:1,br:0,mod:""}, // 85
{mn:"STX",am:"aa",nb:2,il:0,c1:3,c2:0,nw:1,br:0,mod:""}, // 86
{mn:"SAX",am:"aa",nb:2,il:1,c1:3,c2:0,nw:1,br:0,mod:""}, // 87
{mn:"DEY",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"YZN"}, // 88
{mn:"NOP",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // 89
{mn:"TXA",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 8a
{mn:"ANE",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 8b
{mn:"STY",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 8c
{mn:"STA",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 8d
{mn:"STX",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 8e
{mn:"SAX",am:"AAAA",nb:3,il:1,c1:4,c2:0,nw:1,br:0,mod:""}, // 8f
{mn:"BCC",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // 90
{mn:"STA",am:"(aa),y",nb:2,il:0,c1:6,c2:0,nw:1,br:0,mod:""}, // 91
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // 92
{mn:"SHA",am:"(aa),y",nb:2,il:1,c1:6,c2:0,nw:1,br:0,mod:""}, // 93
{mn:"STY",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 94
{mn:"STA",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 95
{mn:"STX",am:"aa,y",nb:2,il:0,c1:4,c2:0,nw:1,br:0,mod:""}, // 96
{mn:"SAX",am:"aa,y",nb:3,il:1,c1:4,c2:0,nw:1,br:1,mod:""}, // 97
{mn:"TYA",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // 98
{mn:"STA",am:"AAAA,y",nb:3,il:0,c1:5,c2:0,nw:1,br:0,mod:""}, // 99
{mn:"TXS",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"S"}, // 9a
{mn:"SHS",am:"AAAA,y",nb:3,il:1,c1:5,c2:0,nw:1,br:0,mod:"S"}, // 9b
{mn:"SHY",am:"AAAA,x",nb:3,il:1,c1:5,c2:0,nw:1,br:0,mod:""}, // 9c
{mn:"STA",am:"AAAA,x",nb:3,il:0,c1:5,c2:0,nw:1,br:0,mod:""}, // 9d
{mn:"SHX",am:"AAAA,y",nb:3,il:1,c1:5,c2:0,nw:1,br:0,mod:""}, // 9e
{mn:"SHA",am:"AAAA,y",nb:3,il:1,c1:5,c2:0,nw:1,br:0,mod:""}, // 9f
{mn:"LDY",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"YZN"}, // a0
{mn:"LDA",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"AZN"}, // a1
{mn:"LDX",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"XZN"}, // a2
{mn:"LAX",am:"(aa,x)",nb:2,il:1,c1:6,c2:0,nw:0,br:0,mod:"AXZN"}, // a3
{mn:"LDY",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"YZN"}, // a4
{mn:"LDA",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"AZN"}, // a5
{mn:"LDX",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"XZN"}, // a6
{mn:"LAX",am:"aa",nb:2,il:1,c1:3,c2:0,nw:0,br:0,mod:"AXZN"}, // a7
{mn:"TAY",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"YZN"}, // a8
{mn:"LDA",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"AZN"}, // a9
{mn:"TAX",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"XZN"}, // aa
{mn:"LXA",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"AXZN"}, // ab
{mn:"LDY",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"YZN"}, // ac
{mn:"LDA",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // ad
{mn:"LDX",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"XZN"}, // ae
{mn:"LAX",am:"AAAA",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:"AXZN"}, // af
{mn:"BCS",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // b0
{mn:"LDA",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"AZN"}, // b1
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // b2
{mn:"LAX",am:"(aa),y",nb:2,il:1,c1:5,c2:1,nw:0,br:0,mod:"AXZN"}, // b3
{mn:"LDY",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"YZN"}, // b4
{mn:"LDA",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"AZN"}, // b5
{mn:"LDX",am:"aa,y",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"XZN"}, // b6
{mn:"LAX",am:"aa,y",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:"AXZN"}, // b7
{mn:"CLV",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"V"}, // b8
{mn:"LDA",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // b9
{mn:"TSX",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"XZN"}, // ba
{mn:"LAS",am:"AAAA,y",nb:3,il:1,c1:4,c2:1,nw:0,br:0,mod:"SAXZN"}, // bb
{mn:"LDY",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"YZN"}, // bc
{mn:"LDA",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"AZN"}, // bd
{mn:"LDX",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"XZN"}, // be
{mn:"LAX",am:"AAAA,y",nb:3,il:1,c1:4,c2:1,nw:0,br:0,mod:"AXZN"}, // bf
{mn:"CPY",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"CZN"}, // c0
{mn:"CMP",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"CZN"}, // c1
{mn:"NOP",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // c2
{mn:"DCP",am:"(aa,x)",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"CZN"}, // c3
{mn:"CPY",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"CZN"}, // c4
{mn:"CMP",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"CZN"}, // c5
{mn:"DEC",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"ZN"}, // c6
{mn:"DCP",am:"aa",nb:2,il:1,c1:5,c2:0,nw:2,br:0,mod:"CZN"}, // c7
{mn:"INY",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"YZN"}, // c8
{mn:"CMP",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"CZN"}, // c9
{mn:"DEX",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"XZN"}, // ca
{mn:"SBX",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"XCZN"}, // cb
{mn:"CPY",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"CZN"}, // cc
{mn:"CMP",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"CZN"}, // cd
{mn:"DEC",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"ZN"}, // ce
{mn:"DCP",am:"AAAA",nb:3,il:1,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // cf
{mn:"BNE",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // d0
{mn:"CMP",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"CZN"}, // d1
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // d2
{mn:"DCP",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"CZN"}, // d3
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // d4
{mn:"CMP",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"CZN"}, // d5
{mn:"DEC",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"ZN"}, // d6
{mn:"DCP",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"CZN"}, // d7
{mn:"CLD",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"D"}, // d8
{mn:"CMP",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"CZN"}, // d9
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // da
{mn:"DCP",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // db
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // dc
{mn:"CMP",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"CZN"}, // dd
{mn:"DEC",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"ZN"}, // de
{mn:"DCP",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"CZN"}, // df
{mn:"CPX",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"CZN"}, // e0
{mn:"SBC",am:"(aa,x)",nb:2,il:0,c1:6,c2:0,nw:0,br:0,mod:"ACZVN"}, // e1
{mn:"NOP",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // e2
{mn:"ISB",am:"(aa,x)",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZVN"}, // e3
{mn:"CPX",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"CZN"}, // e4
{mn:"SBC",am:"aa",nb:2,il:0,c1:3,c2:0,nw:0,br:0,mod:"ACZVN"}, // e5
{mn:"INC",am:"aa",nb:2,il:0,c1:5,c2:0,nw:2,br:0,mod:"ZN"}, // e6
{mn:"ISB",am:"aa",nb:2,il:1,c1:5,c2:0,nw:2,br:0,mod:"ACZVN"}, // e7
{mn:"INX",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"XZN"}, // e8
{mn:"SBC",am:"#aa",nb:2,il:0,c1:2,c2:0,nw:0,br:0,mod:"ACZVN"}, // e9
{mn:"NOP",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:""}, // ea
{mn:"SBC",am:"#aa",nb:2,il:1,c1:2,c2:0,nw:0,br:0,mod:"ACZVN"}, // eb
{mn:"CPX",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"CZN"}, // ec
{mn:"SBC",am:"AAAA",nb:3,il:0,c1:4,c2:0,nw:0,br:0,mod:"ACZVN"}, // ed
{mn:"INC",am:"AAAA",nb:3,il:0,c1:6,c2:0,nw:2,br:0,mod:"ZN"}, // ee
{mn:"ISB",am:"AAAA",nb:3,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZVN"}, // ef
{mn:"BEQ",am:"branch",nb:2,il:0,c1:2,c2:2,nw:0,br:1,mod:""}, // f0
{mn:"SBC",am:"(aa),y",nb:2,il:0,c1:5,c2:1,nw:0,br:0,mod:"ACZVN"}, // f1
{mn:"KIL",am:"",nb:1,il:2,c1:3,c2:0,nw:0,br:1,mod:""}, // f2
{mn:"ISB",am:"(aa),y",nb:2,il:1,c1:8,c2:0,nw:2,br:0,mod:"ACZVN"}, // f3
{mn:"NOP",am:"aa,x",nb:2,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // f4
{mn:"SBC",am:"aa,x",nb:2,il:0,c1:4,c2:0,nw:0,br:0,mod:"ACZVN"}, // f5
{mn:"INC",am:"aa,x",nb:2,il:0,c1:6,c2:0,nw:2,br:0,mod:"ZN"}, // f6
{mn:"ISB",am:"aa,x",nb:2,il:1,c1:6,c2:0,nw:2,br:0,mod:"ACZVN"}, // f7
{mn:"SED",am:"",nb:1,il:0,c1:2,c2:0,nw:0,br:0,mod:"D"}, // f8
{mn:"SBC",am:"AAAA,y",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"ACZVN"}, // f9
{mn:"NOP",am:"",nb:1,il:1,c1:2,c2:0,nw:0,br:0,mod:""}, // fa
{mn:"ISB",am:"AAAA,y",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZVN"}, // fb
{mn:"NOP",am:"AAAA,x",nb:3,il:1,c1:4,c2:0,nw:0,br:0,mod:""}, // fc
{mn:"SBC",am:"AAAA,x",nb:3,il:0,c1:4,c2:1,nw:0,br:0,mod:"ACZVN"}, // fd
{mn:"INC",am:"AAAA,x",nb:3,il:0,c1:7,c2:0,nw:2,br:0,mod:"ZN"}, // fe
{mn:"ISB",am:"AAAA,x",nb:3,il:1,c1:7,c2:0,nw:2,br:0,mod:"ACZVN"}, // ff
];
export function disassembleHuC6280(pc:number, b0:number, b1:number, b2:number) : {line:string, nbytes:number, isaddr:boolean} {
var op = OPS_HuC6280[b0];
if (op == null) return {line:"???", nbytes:1, isaddr:false};
var s = op.mn;
var am = op.am;
var isaddr = false;
if (am == 'branch') {
var offset = (b1 < 0x80) ? (pc+2+b1) : (pc+2-(256-b1));
offset &= 0xffff;
am = '$'+hex(offset, 4);
isaddr = true;
} else {
am = am.replace('aa','$'+hex(b1, 2));
am = am.replace('AAAA','$'+hex(b1+(b2<<8), 4));
if (am.indexOf('#') < 0 && am.indexOf('$') >= 0)
isaddr = true;
}
return {line:op.mn + " " + am, nbytes:op.nb, isaddr:isaddr};
};

View File

@ -1,4 +1,4 @@
import { Platform, Preset, getToolForFilename_6502 } from "../common/baseplatform";
import { DisasmLine, Platform, Preset, getToolForFilename_6502 } from "../common/baseplatform";
import { Keys, PLATFORMS, RasterVideo } from "../common/emu";
const PCE_PRESETS = [
@ -36,7 +36,7 @@ class PCEnginePlatform implements Platform {
getPresets(): Preset[] {
return PCE_PRESETS;
}
loadROM(title: string, rom: any) {
loadROM(title: string, rom: Uint8Array) {
this.pce.Pause();
this.pce.Init();
this.pce.SetROM(rom);
@ -50,6 +50,21 @@ class PCEnginePlatform implements Platform {
getDefaultExtension(): string {
return ".pce";
}
readAddress(addr: number): number {
return this.pce.Get(addr);
}
writeAddress(addr: number, value: number): void {
this.pce.Set(addr, value);
}
readVRAMAddress(addr: number): number {
return this.pce.VDC[0].VRAM[addr];
}
// TODO
/*
disassemble(pc: number, read: (addr: number) => number): DisasmLine {
return disassembleHuC6280(pc, read(pc), read(pc + 1), read(pc + 2));
}
*/
}
PLATFORMS['pce'] = PCEnginePlatform;
@ -103,7 +118,7 @@ class PCE {
PC: number;
S: number;
P: number;
NZCacheTable: any[];
NZCacheTable: Uint8Array;
NFlag: number;
VFlag: number;
TFlag: number;
@ -129,9 +144,9 @@ class PCE {
LastInt: number;
MPRSelect: any;
MPR: any;
RAM: any[];
RAM: Uint8Array;
RAMMask: number;
BRAM: any[];
BRAM: Uint8Array;
BRAMUse: boolean;
INTIRQ2: number;
IntDisableRegister: number;
@ -156,7 +171,7 @@ class PCE {
Mapper0: typeof this.MapperBase;
Mapper1: typeof this.MapperBase;
Mapper2: typeof this.MapperBase;
VDC: any;
VDC: any[];
INTTIQ: number;
Palette: any[];
PaletteData: any[];
@ -165,19 +180,19 @@ class PCE {
VCEControl: number;
VCEAddress: number;
VCEData: number;
VPCRegister: any[];
VPCRegister: Uint8Array;
VPCWindow1: number;
VPCWindow2: number;
VPCPriority: any[];
VPCPriority: Uint8Array;
VDCPutLineProgressClock: number;
VDCPutLine: number;
VDCLineClock: number;
ScreenSize: any[];
PutScreenSize: any[];
VScreenWidthArray: any[];
ReverseBit: any[];
ReverseBit16: any[];
ReverseBit256: any[];
ReverseBit: Uint8Array;
ReverseBit16: Uint16Array;
ReverseBit256: Uint32Array;
SPAddressMask: any[];
WaveDataArray: any[];
WaveClockCounter: number;
@ -385,7 +400,7 @@ class PCE {
this.S = 0;
this.P = 0;
this.NZCacheTable = new Array(0x100).fill(0x00);
this.NZCacheTable = new Uint8Array(0x100);
this.NZCacheTable = this.NZCacheTable.map((d, i) => { return i & 0x80; });
this.NZCacheTable[0x00] = 0x02;
@ -1901,9 +1916,9 @@ class PCE {
StorageConstruct() {
this.MPR = new Array(8);
this.MPRSelect = 0;
this.RAM = new Array(0x8000);
this.RAM = new Uint8Array(0x8000);
this.RAMMask = 0x1FFF;
this.BRAM = new Array(0x2000).fill(0x00);
this.BRAM = new Uint8Array(0x2000).fill(0x00);
this.BRAMUse = false;
this.INTIRQ2 = 0x00;
@ -1961,11 +1976,11 @@ class PCE {
ROM: any;
constructor(rom, core) {
super(rom, core);
this.ROM = rom.concat(new Array(0x80000).fill(0x00));
this.ROM = rom;
}
Read(address) {
return this.ROM[address];
return this.ROM[address] || 0;
}
Write(address, data) {
@ -2367,11 +2382,11 @@ class PCE {
/* **** VPC **** */
/* ************* */
VPCConstruct() {
this.VPCRegister = new Array(8);
this.VPCRegister = new Uint8Array(8);
this.VDCSelect = 0;
this.VPCWindow1 = 0;
this.VPCWindow2 = 0;
this.VPCPriority = new Array(4);
this.VPCPriority = new Uint8Array(4);
}
@ -2455,17 +2470,20 @@ class PCE {
this.VScreenWidthArray[0x20] = 128;
this.VScreenWidthArray[0x30] = 128;
this.ReverseBit = new Array(0x100).fill(0x00);
this.ReverseBit = this.ReverseBit.map((d, i) => { return ((i & 0x80) >> 7) | ((i & 0x40) >> 5) |
this.ReverseBit = new Uint8Array(0x100);
this.ReverseBit = this.ReverseBit.map((d, i) => {
return ((i & 0x80) >> 7) | ((i & 0x40) >> 5) |
((i & 0x20) >> 3) | ((i & 0x10) >> 1) |
((i & 0x08) << 1) | ((i & 0x04) << 3) |
((i & 0x02) << 5) | ((i & 0x01) << 7); });
((i & 0x02) << 5) | ((i & 0x01) << 7);
});
this.ReverseBit16 = new Array(0x10000).fill(0x00);
this.ReverseBit16 = new Uint16Array(0x10000).fill(0x00);
this.ReverseBit16 = this.ReverseBit16.map((d, i) => { return (this.ReverseBit[i & 0x00FF] << 8) | this.ReverseBit[(i & 0xFF00) >> 8]; });
this.ReverseBit256 = new Array(0x100).fill(0x00);
this.ReverseBit256 = this.ReverseBit256.map((d, i) => { let b = this.ReverseBit[i];
this.ReverseBit256 = new Uint32Array(0x100).fill(0x00);
this.ReverseBit256 = this.ReverseBit256.map((d, i) => {
let b = this.ReverseBit[i];
return ((b & 0x80) << (28 - 7)) |
((b & 0x40) << (24 - 6)) |
((b & 0x20) << (20 - 5)) |
@ -2473,7 +2491,8 @@ class PCE {
((b & 0x08) << (12 - 3)) |
((b & 0x04) << (8 - 2)) |
((b & 0x02) << (4 - 1)) |
((b & 0x01) << ( 0 - 0)); });
((b & 0x01) << (0 - 0));
});
this.SPAddressMask = [];
this.SPAddressMask[16] = [];
@ -2881,9 +2900,9 @@ class PCE {
for (let vdcno = 0; vdcno < 2; vdcno++) {
this.VDC[vdcno] = {
VDCRegister: new Array(20).fill(0x0000),
VRAM: new Array(0x10000).fill(0x0000),
SATB: new Array(256).fill(0x0000),
VDCRegister: new Uint16Array(20).fill(0x0000),
VRAM: new Uint16Array(0x10000).fill(0x0000),
SATB: new Uint16Array(256).fill(0x0000),
VDCBurst: false,
SpriteLimit: false,
@ -2918,7 +2937,8 @@ class PCE {
VDS: 0,
VSW: 0,
VDW: 0,
VCR: 0};
VCR: 0
};
for (let i = 0; i < this.VDC[vdcno].SPLine.length; i++)
this.VDC[vdcno].SPLine[i] = { data: 0x00, no: 255, priority: 0x00 };
@ -3166,7 +3186,8 @@ class PCE {
this.SoundInit();
for (let i = 0; i < this.PSGChannel.length; i++)
this.PSGChannel[i] = { R: new Array(10).fill(0),
this.PSGChannel[i] = {
R: new Array(10).fill(0),
keyon: false,
dda: false,
freq: 0,
@ -3179,7 +3200,8 @@ class PCE {
noise: 0x8000,
noisestate: 0,
index: 0,
wave: new Array(32).fill(0)};
wave: new Uint8Array(32)
};
}

View File

@ -186,6 +186,14 @@ export function linkLD65(step: BuildStep): BuildStepResult {
var aout = FS.readFile("main", { encoding: 'binary' });
var mapout = FS.readFile("main.map", { encoding: 'utf8' });
var viceout = FS.readFile("main.vice", { encoding: 'utf8' });
// correct binary for PCEngine
if (step.platform == 'pce' && aout.length > 0x2000) {
// move 8 KB from end to front
let newrom = new Uint8Array(aout.length);
newrom.set(aout.slice(aout.length - 0x2000), 0);
newrom.set(aout.slice(0, aout.length - 0x2000), 0x2000);
aout = newrom;
}
//var dbgout = FS.readFile("main.dbg", {encoding:'utf8'});
putWorkFile("main", aout);
putWorkFile("main.map", mapout);

View File

@ -398,7 +398,7 @@ var PLATFORM_PARAMS = {
arch: 'huc6280',
define: ['__PCE__'],
cfgfile: 'pce.cfg',
libargs: ['pce.lib'],
libargs: ['pce.lib', '-D', '__CARTSIZE__=0x8000'],
},
};