Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 120x 120x 120x 120x 21x 21x 120x 12x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 120x 21x 21x 21x 21x 21x 21x 21x 21x 21x 120x 20x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 15x 15x 15x 15x 20x 11x 11x 11x 11x 11x 11x 11x 11x 11x 3x 3x 3x 2x 2x 3x 3x 3x 3x 3x 8x 11x 1x 1x 1x 1x 1x 1x 1x 11x 1x 1x 1x 1x 1x 1x 6x 11x 5x 5x 5x 5x 5x 5x 5x 2x 2x 2x 2x 2x 2x 5x 5x 4x 4x 4x 4x 4x 4x 4x 4x 4x 11x 11x 11x 11x 4x 4x 4x 4x 3x 3x 3x 3x 3x 4x 20x 2x 2x 1x 1x 1x | /*
The MIT License (MIT)
Copyright (c) 2014 Martin Maly, maly@maly.cz
6800 part - with a help of Jiri Sutera, jiri.sutera@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
export const M6800 = {
endian:true,
cpu:"m6800",
ext:"a68",
"set": {
// 0 1 2 3 4 5 6
// INH DIR IMM3 EXT IDX IMM REL
"ABA": [ 0x1B, -1, -1, -1, -1, -1, -1], // Sice je to správně ACC, ale nemá to operandy, takže INH
"ADCA": [ -1, 0x99, -1, 0xB9, 0xA9, 0x89, -1],
"ADCB": [ -1, 0xD9, -1, 0xF9, 0xE9, 0xC9, -1],
"ADDA": [ -1, 0x9B, -1, 0xBB, 0xAB, 0x8B, -1],
"ADDB": [ -1, 0xDB, -1, 0xFB, 0xEB, 0xCB, -1],
"ANDA": [ -1, 0x94, -1, 0xB4, 0xA4, 0x84, -1],
"ANDB": [ -1, 0xD4, -1, 0xF4, 0xE4, 0xC4, -1],
"ASL": [ -1, -1, -1, 0x78, 0x68, -1, -1],
"ASLA": [ 0x48, -1, -1, -1, -1, -1, -1],
"ASLB": [ 0x58, -1, -1, -1, -1, -1, -1],
"ASR": [ -1, -1, -1, 0x77, 0x67, -1, -1],
"ASRA": [ 0x47, -1, -1, -1, -1, -1, -1],
"ASRB": [ 0x57, -1, -1, -1, -1, -1, -1],
"BCC": [ -1, -1, -1, -1, -1, -1, 0x24],
"BCS": [ -1, -1, -1, -1, -1, -1, 0x25],
"BEQ": [ -1, -1, -1, -1, -1, -1, 0x27],
"BGE": [ -1, -1, -1, -1, -1, -1, 0x2C],
"BGT": [ -1, -1, -1, -1, -1, -1, 0x2E],
"BHI": [ -1, -1, -1, -1, -1, -1, 0x22],
"BITA": [ -1, 0x95, -1, 0xB5, 0xA5, 0x85, -1],
"BITB": [ -1, 0xD5, -1, 0xF5, 0xE5, 0xC5, -1],
"BLE": [ -1, -1, -1, -1, -1, -1, 0x2F],
"BLS": [ -1, -1, -1, -1, -1, -1, 0x23],
"BLT": [ -1, -1, -1, -1, -1, -1, 0x2D],
"BMI": [ -1, -1, -1, -1, -1, -1, 0x2B],
"BNE": [ -1, -1, -1, -1, -1, -1, 0x26],
"BPL": [ -1, -1, -1, -1, -1, -1, 0x2A],
"BRA": [ -1, -1, -1, -1, -1, -1, 0x20],
"BSR": [ -1, -1, -1, -1, -1, -1, 0x8D],
"BVC": [ -1, -1, -1, -1, -1, -1, 0x28],
"BVS": [ -1, -1, -1, -1, -1, -1, 0x29],
"CBA": [ 0x11, -1, -1, -1, -1, -1, -1],
"CLC": [ 0x0C, -1, -1, -1, -1, -1, -1],
"CLI": [ 0x0E, -1, -1, -1, -1, -1, -1],
"CLR": [ -1, -1, -1, 0x7F, 0x6F, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"CLRA": [ 0x4F, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"CLRB": [ 0x5F, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"CLV": [ 0x0A, -1, -1, -1, -1, -1, -1],
"CMPA": [ -1, 0x91, -1, 0xB1, 0xA1, 0x81, -1],
"CMPB": [ -1, 0xD1, -1, 0xF1, 0xE1, 0xC1, -1],
"COM": [ -1, -1, -1, 0x73, 0x63, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"COMA": [ 0x43, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"COMB": [ 0x53, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"CPX": [ -1, 0x9C, 0x8C, 0xBC, 0xAC, -1, -1],
"DAA": [ 0x19, -1, -1, -1, -1, -1, -1],
"DEC": [ -1, -1, -1, 0x7A, 0x6A, -1, -1],
"DECA": [ 0x4A, -1, -1, -1, -1, -1, -1],
"DECB": [ 0x5A, -1, -1, -1, -1, -1, -1],
"DES": [ 0x34, -1, -1, -1, -1, -1, -1],
"DEX": [ 0x09, -1, -1, -1, -1, -1, -1],
"EORA": [ -1, 0x98, -1, 0xB8, 0xA8, 0x88, -1],
"EORB": [ -1, 0xD8, -1, 0xF8, 0xE8, 0xC8, -1],
"INC": [ -1, -1, -1, 0x7C, 0x6C, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"INCA": [ 0x4C, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"INCB": [ 0x5C, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"INS": [ 0x31, -1, -1, -1, -1, -1, -1],
"INX": [ 0x08, -1, -1, -1, -1, -1, -1],
"JMP": [ -1, -1, -1, 0x7E, 0x6E, -1, -1],
"JSR": [ -1, -1, -1, 0xBD, 0xAD, -1, -1],
"LDAA": [ -1, 0x96, -1, 0xB6, 0xA6, 0x86, -1],
"LDAB": [ -1, 0xD6, -1, 0xF6, 0xE6, 0xC6, -1],
"LDS": [ -1, 0x9E, 0x8E, 0xBE, 0xAE, -1, -1],
"LDX": [ -1, 0xDE, 0xCE, 0xFE, 0xEE, -1, -1],
"LSR": [ -1, -1, -1, 0x74, 0x64, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"LSRA": [ 0x44, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"LSRB": [ 0x54, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"NEG": [ -1, -1, -1, 0x70, 0x60, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"NEGA": [ 0x40, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"NEGB": [ 0x50, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"NOP": [ 0x01, -1, -1, -1, -1, -1, -1],
"ORAA": [ -1, 0x9A, -1, 0xBA, 0xAA, 0x8A, -1],
"ORAB": [ -1, 0xDA, -1, 0xFA, 0xEA, 0xCA, -1],
"PSHA": [ 0x36, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x01 !
"PSHB": [ 0x37, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x01 !
"PULA": [ 0x32, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x01 !
"PULB": [ 0x33, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x01 !
"ROL": [ -1, -1, -1, 0x79, 0x69, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"ROLA": [ 0x49, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"ROLB": [ 0x59, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"ROR": [ -1, -1, -1, 0x76, 0x66, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"RORA": [ 0x46, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"RORB": [ 0x56, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"RTI": [ 0x3B, -1, -1, -1, -1, -1, -1],
"RTS": [ 0x39, -1, -1, -1, -1, -1, -1],
"SBA": [ 0x10, -1, -1, -1, -1, -1, -1],
"SBCA": [ -1, 0x92, -1, 0xB2, 0xA2, 0x82, -1],
"SBCB": [ -1, 0xD2, -1, 0xF2, 0xE2, 0xC2, -1],
"SEC": [ 0x0D, -1, -1, -1, -1, -1, -1],
"SEI": [ 0x0F, -1, -1, -1, -1, -1, -1],
"SEV": [ 0x0B, -1, -1, -1, -1, -1, -1],
"STAA": [ -1, 0x97, -1, 0xB7, 0xA7, -1, -1],
"STAB": [ -1, 0xD7, -1, 0xF7, 0xE7, -1, -1],
"STS": [ -1, 0x9F, -1, 0xBF, 0xAF, -1, -1],
"STX": [ -1, 0xDF, -1, 0xFF, 0xEF, -1, -1],
"SUBA": [ -1, 0x90, -1, 0xB0, 0xA0, 0x80, -1],
"SUBB": [ -1, 0xD0, -1, 0xF0, 0xE0, 0xC0, -1],
"SWI": [ 0x3F, -1, -1, -1, -1, -1, -1],
"TAB": [ 0x16, -1, -1, -1, -1, -1, -1],
"TAP": [ 0x06, -1, -1, -1, -1, -1, -1],
"TBA": [ 0x17, -1, -1, -1, -1, -1, -1],
"TPA": [ 0x07, -1, -1, -1, -1, -1, -1],
"TST": [ -1, -1, -1, 0x7D, 0x6D, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"TSTA": [ 0x4D, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"TSTB": [ 0x5D, -1, -1, -1, -1, -1, -1], //nutno osetrit ACC dle registru A/B - pokud B, tak pricist 0x10
"TSX": [ 0x30, -1, -1, -1, -1, -1, -1],
"TXS": [ 0x35, -1, -1, -1, -1, -1, -1],
"WAI": [ 0x3E, -1, -1, -1, -1, -1, -1]
},
"parseOpcode": function(s,vars, Parser) {
let p1;
let auxopcode = s.opcode;
//fix param
if (!s.opcode) return null;
//console.log(s,s.params, s.opcode)
if (s.params && auxopcode.length==3) {
if (s.params[0]=="A" ||s.params[0]=="B" ) {
if ((s.params[0].indexOf(" ")==1) || (s.params[0].length==1)) {
let p0 = s.params[0]+'';
s.reg6800 = p0.substr(0,1).toUpperCase();
s.params[0]= p0.substr(2).trim();
s.paramstring = s.paramstring.substr(2).trim();
auxopcode+=s.reg6800;
}
}
};
let ax = M6800.set[auxopcode];
s.opcode = auxopcode;
s.lens=[];
s.wia = 1; //Where is address (for relocation)
if (ax) {
if (ax[0]>=0) { //0 params.
/*
//probably unreachable...
if (ax[0]>0xff) {
s.lens = [ax[0]>>8,ax[0]&0xff];
s.bytes = 2;
return s;
}
*/
s.lens = [ax[0]];
s.bytes = 1;
return s;
}
// vice parametru...
//
p1 = s.params[0]+'';
if (s.params[0] && s.params[0].length>0 && !s.params[1]) {
//1 parametr
//DIR(1), EXT(3) nebo IMM(5), IMMdlouhe(2), mozna i REL(6)
let o1 = ax[1];
let o2 = ax[2];
let o3 = ax[3];
let o5 = ax[5];
let o6 = ax[6];
if (o6>-1) {
//REL
s.lens[0] = o6;
s.lens[1] = function(vars){
let n= Parser.evaluate(p1,vars) - vars._PC-2;
if (n<0) {n=256+n;}
return n;};
s.bytes = 2;
return s;
}
if (p1[0]=='#' && o2>-1) {
//IMM3
s.lens[0] = o2;
s.lens[1] = function(vars){return Parser.evaluate(p1.substr(1),vars);};
s.lens[2] = null;
s.bytes = 3;
return s;
}
if (p1[0]=='#' && o5>-1) {
//IMM
s.lens[0] = o5;
s.lens[1] = function(vars){return Parser.evaluate(p1.substr(1),vars);};
s.bytes = 2;
return s;
}
if (o1>-1 && vars) {
//otestujeme, jestli se kvalifikuje na DIR
let zptest = null;
try {
zptest = Parser.evaluate(p1,vars);
} catch(e) {;}
if (zptest<256 && zptest>=0) {
//je to DIR
s.lens[0] = o1;
s.lens[1] = function(vars){return Parser.evaluate(p1,vars);};
s.bytes = 2;
return s;
}
}
if (o3>-1) {
//IMM
s.lens[0] = o3;
s.lens[1] = function(vars){return Parser.evaluate(p1,vars);};
s.lens[2] = null;
s.bytes = 3;
return s;
}
}
//2 parms
if (ax[4]>-1) {
if (s.params[1].toUpperCase()=='X') {
s.lens[0] = ax[4];
s.lens[1] = function(vars){return Parser.evaluate(p1,vars);};
s.bytes = 2;
return s;
}
}
}
// not found
return null;
},
};
|