1.include "kernal.i" 2 3.import __mnemos1_RUN__ 4.import __mnemos2_RUN__ 5.import __asmchars1_RUN__ 6.import __asmchars2_RUN__ 7 8.import zp1_plus_a_2 9.import print_hex_16 10.import LAD4B 11.import basin_if_more 12.import check_end 13.import fill_kbd_buffer_a 14.import get_hex_byte 15.import get_hex_byte2 16.import get_hex_byte3 17.import get_hex_word 18.import get_hex_word3 19.import input_loop 20.import input_loop2 21.import load_byte 22.import num_asm_bytes 23.import prefix_suffix_bitfield 24.import print_cr_dot 25.import print_hex_byte2 26.import print_space 27.import print_up 28.import reg_s 29.import store_byte 30.import swap_zp1_and_zp2 31.import tmp10 32.import tmp16 33.import tmp17 34.import tmp3 35.import tmp4 36.import tmp6 37.import tmp8 38.import tmp9 39.import tmp_opcode 40.importzp zp1 41 42.export cmd_a 43.export LAE7C 44.export disassemble_line 45 46.segment "monitor" 47 48; ---------------------------------------------------------------- 49; "A" - assemble 50; ---------------------------------------------------------------- 51cmd_a: 52 jsr get_hex_word 53 jsr LB030 54 jsr LB05C 55 ldx #0 56 stx tmp6 57LAE61: ldx reg_s 58 txs 59 jsr LB08D 60 jsr LB0AB 61 jsr swap_zp1_and_zp2 62 jsr LB0EF 63 lda #'A' 64 jsr LAE7C 65 jsr fill_kbd_buffer_a 66 jmp input_loop2 67 68LAE7C: pha 69 jsr print_up 70 pla 71 tax 72 jsr LAD4B 73 jmp print_cr_dot 74 75; ---------------------------------------------------------------- 76; assembler/disassembler 77; ---------------------------------------------------------------- 78; prints the hex bytes consumed by an asm instruction 79print_asm_bytes: 80 pha 81 ldy #0 82LAF43: cpy num_asm_bytes 83 beq LAF52 84 bcc LAF52 85 jsr print_space 86 jsr print_space 87 bcc LAF58 88LAF52: jsr load_byte 89 jsr print_hex_byte2 90LAF58: jsr print_space 91 iny 92 cpy #3 93 bne LAF43 94 pla 95 rts 96 97; returns mnemo index in A 98decode_mnemo: 99 ldy #0 100 jsr load_byte; opcode 101decode_mnemo_2: 102.if .defined(CPU_65C02) 103 sta tmp_opcode 104.endif 105.if .defined(CPU_6502) 106 tay 107 lsr a 108 bcc @1 ; skip if opodes $x0, $x2, $x4, $x6, $x8, $xA, $xC, $xE 109 ; continue for opcodes $x1, $x3, $x5, $x7, $x9, $xB, $xD, $xF 110 lsr a 111 bcs @3 ; branch for opcodes $x3, $x7, $xC, $xF 112 ; continue for opcodes $x1, $x5, $x9, $xB 113 cmp #$22 114 beq @3 ; opcodes $89 of $8D? 115 and #$07 ; opcode bits 4,3,2 116 ora #$80 ; use special bytes past first 64 117@1: lsr a ; opcode bit 2 into carry 118 tax 119 lda addmode_table,x 120 bcs @2 ; opcode bit 2 set, then use low nybble 121 lsr a 122 lsr a 123 lsr a 124 lsr a ; otherwise get hi nybble 125@2: and #$0F 126 bne @4 ; if nybble is 0, Y = $80 127@3: ldy #$80 128 lda #0 129@4: tax 130 lda addmode_detail_table,x ; X = 0..13 131 sta prefix_suffix_bitfield 132 and #3 133 sta num_asm_bytes 134; mnemo: convert opcode in A to mnemo index (0-64) 135 tya ; opcode 136 and #%10001111 137 tax 138 tya ; opcode 139 ldy #3 140 cpx #%10001010 ; $8A/$9A/.../$FA? 141 beq @7 142@5: lsr a 143 bcc @7 144 lsr a 145@6: lsr a 146 ora #%00100000 147 dey 148 bne @6 149 iny 150@7: dey 151 bne @5 152 rts 153.elseif .defined(CPU_6502ILL) || .defined(CPU_65C02) 154 tay 155 lsr 156 tax 157 lda addmode_table,x 158 bcs @1 159 lsr 160 lsr 161 lsr 162 lsr 163@1: and #$0f 164 tax 165 lda addmode_detail_table,x ; X = 0..13 166 sta prefix_suffix_bitfield 167 and #3 168 sta num_asm_bytes 169 lda mnemotab,y 170 rts 171.if .defined(CPU_6502ILL) 172mnemotab: 173 .byte 15, 44, 36, 62, 43, 44, 6, 62, 46, 44, 6, 3, 43, 44, 6, 62, 14, 44, 36, 62, 43, 44, 6, 62, 18, 44, 43, 62, 43, 44, 6, 62, 35, 4, 36, 49, 11, 4, 50, 49, 48, 4, 50, 3, 11, 4, 50, 49, 12, 4, 36, 49, 43, 4, 50, 49, 57, 4, 43, 49, 43, 4, 50, 49, 53, 29, 36, 63, 43, 29, 42, 63, 45, 29, 42, 2, 34, 29, 42, 63, 16, 29, 36, 63, 43, 29, 42, 63, 20, 29, 43, 63, 43, 29, 42, 63, 54, 0, 36, 52, 43, 0, 51, 52, 47, 0, 51, 5, 34, 0, 51, 52, 17, 0, 36, 52, 43, 0, 51, 52, 59, 0, 43, 52, 43, 0, 51, 52, 43, 64, 43, 55, 66, 64, 65, 55, 28, 43, 71, 74, 66, 64, 65, 55, 8, 64, 36, 1, 66, 64, 65, 55, 73, 64, 72, 67, 61, 64, 60, 1, 41, 39, 40, 38, 41, 39, 40, 38, 69, 39, 68, 38, 41, 39, 40, 38, 9, 39, 36, 38, 41, 39, 40, 38, 21, 39, 70, 37, 41, 39, 40, 38, 24, 22, 43, 25, 24, 22, 26, 25, 32, 22, 27, 7, 24, 22, 26, 25, 13, 22, 36, 25, 43, 22, 26, 25, 19, 22, 43, 25, 43, 22, 26, 25, 23, 56, 43, 33, 23, 56, 30, 33, 31, 56, 43, 56, 23, 56, 30, 33, 10, 56, 36, 33, 43, 56, 30, 33, 58, 56, 43, 33, 43, 56, 30, 33 174.elseif .defined(CPU_65C02) 175mnemotab: 176 .byte 13, 37, 36, 36, 64, 37, 2, 46, 39, 37, 2, 36, 64, 37, 2, 3, 11, 37, 37, 36, 63, 37, 2, 46, 16, 37, 27, 36, 63, 37, 2, 3, 31, 1, 36, 36, 8, 1, 47, 46, 43, 1, 47, 36, 8, 1, 47, 3, 9, 1, 1, 36, 8, 1, 47, 46, 52, 1, 23, 36, 8, 1, 47, 3, 49, 26, 36, 36, 36, 26, 35, 46, 38, 26, 35, 36, 30, 26, 35, 3, 14, 26, 26, 36, 36, 26, 35, 46, 18, 26, 41, 36, 36, 26, 35, 3, 50, 0, 36, 36, 60, 0, 48, 46, 42, 0, 48, 36, 30, 0, 48, 3, 15, 0, 0, 36, 60, 0, 48, 46, 54, 0, 45, 36, 30, 0, 48, 3, 12, 56, 36, 36, 59, 56, 58, 55, 25, 8, 66, 36, 59, 56, 58, 4, 5, 56, 56, 36, 59, 56, 58, 55, 68, 56, 67, 36, 60, 56, 60, 4, 34, 32, 33, 36, 34, 32, 33, 55, 62, 32, 61, 36, 34, 32, 33, 4, 6, 32, 32, 36, 34, 32, 33, 55, 19, 32, 65, 36, 34, 32, 33, 4, 22, 20, 36, 36, 22, 20, 23, 55, 29, 20, 24, 69, 22, 20, 23, 4, 10, 20, 20, 36, 36, 20, 23, 55, 17, 20, 40, 57, 36, 20, 23, 4, 21, 51, 36, 36, 21, 51, 27, 55, 28, 51, 36, 36, 21, 51, 27, 4, 7, 51, 51, 36, 36, 51, 27, 55, 53, 51, 44, 36, 36, 51, 27, 4 177.endif 178.else 179.error "No CPU type specified!" 180.endif 181 182; prints name of mnemo in A 183print_mnemo: 184 tay 185 lda __mnemos1_RUN__,y 186 sta tmp10 187 lda __mnemos2_RUN__,y 188 sta tmp8 189 ldx #3 190LAFBE: lda #0 191 ldy #5 192LAFC2: asl tmp8 193 rol tmp10 194 rol a 195 dey 196 bne LAFC2 197 adc #$3F 198 jsr bsout 199 dex 200 bne LAFBE 201.ifdef CPU_65C02 202 ; add numeric suffix to BBR/BBS 203 lda tmp_opcode 204 and #$0f 205 cmp #$0f 206 bne :+ 207 lda tmp_opcode 208 lsr 209 lsr 210 lsr 211 lsr 212 and #$07 213 ora #'0' 214 jsr bsout 215: 216.endif 217 jmp print_space 218 219; Go through the list of prefixes (3) and suffixes (3), 220; and if the corresponding one of six bits is set in 221; prefix_suffix_bitfield, print it. 222; Between the prefixes and the suffixes, print the one 223; or two byte operand 224print_operand: 225 ldx #6 ; start with last prefix 226LAFD9: cpx #3 227 bne LAFF4 ; between prefixes and suffixes?, print operand 228 ldy num_asm_bytes 229 beq LAFF4 ; no operands 230: lda prefix_suffix_bitfield 231.ifdef CPU_65C02 232 cmp #<(S_ZPREL | 2) << 3 ; zp, relative addressing mode 233 beq print_zprel 234.endif 235 cmp #<(S_RELATIVE | 1) << 3 ; relative addressing mode 236 php 237 jsr load_byte 238 plp 239 bcs print_branch_target 240 jsr print_hex_byte2 241 dey 242 bne :- 243LAFF4: asl prefix_suffix_bitfield 244 bcc :+ ; nothing to print 245 lda __asmchars1_RUN__ - 1,x 246 jsr bsout 247 lda __asmchars2_RUN__ - 1,x 248 beq :+ ; no second character 249 jsr bsout 250: dex 251 bne LAFD9 252 rts 253 254print_branch_target: 255 jsr zp1_plus_a_2 256 tax 257 inx 258 bne :+ 259 iny 260: tya 261 jsr print_hex_byte2 262 txa 263 jmp print_hex_byte2 264 265.ifdef CPU_65C02 266print_zprel: 267 dey 268 jsr load_byte 269 jsr print_hex_byte2 270 lda #',' 271 jsr bsout 272 lda #'$' 273 jsr bsout 274 iny 275 jsr load_byte 276 tax 277 lda zp1 278 pha 279 lda zp1+1 280 pha 281 inc zp1 282 bne :+ 283 inc zp1+1 284: txa 285 sec 286 jsr print_branch_target 287 pla 288 sta zp1+1 289 pla 290 sta zp1 291 rts 292.endif 293 294LB030: ldx #0 295 stx tmp17 296LB035: jsr basin_if_more 297 cmp #' ' 298 beq LB030 299 sta BUF,x 300 inx 301 cpx #3 302 bne LB035 303LB044: dex 304 bmi LB05B 305 lda BUF,x 306 sec 307 sbc #$3F 308 ldy #5 309LB04F: lsr a 310 ror tmp17 311 ror tmp16 312 dey 313 bne LB04F 314 beq LB044 315LB05B: rts 316 317LB05C: ldx #2 318LB05E: jsr basin 319 cmp #CR 320 beq LB089 321 cmp #':' 322 beq LB089 323 cmp #' ' 324 beq LB05E 325 jsr is_hex_character 326 bcs LB081 327 jsr get_hex_byte3 328 ldy zp1 329 sty zp1 + 1 330 sta zp1 331 lda #'0' 332 sta tmp16,x 333 inx 334LB081: sta tmp16,x 335 inx 336 cpx #$17 337 bcc LB05E 338LB089: stx tmp10 339 rts 340 341LB08D: ldx #0 342 stx tmp4 343 lda tmp6 ; opcode 344 jsr decode_mnemo_2 345 ldx prefix_suffix_bitfield 346 stx tmp8 347 tax 348 lda __mnemos2_RUN__,x 349 jsr LB130 350 lda __mnemos1_RUN__,x 351 jmp LB130 352 353LB0AB: ldx #6 354LB0AD: cpx #3 355 bne LB0C5 356 ldy num_asm_bytes 357 beq LB0C5 358LB0B6: lda prefix_suffix_bitfield 359 cmp #<(S_RELATIVE | 1) << 3 ; relative addressing mode 360 lda #$30 361 bcs decode_rel 362 jsr LB12D 363 dey 364 bne LB0B6 365LB0C5: asl prefix_suffix_bitfield 366 bcc LB0D8 367 lda __asmchars1_RUN__ - 1,x 368 jsr LB130 369 lda __asmchars2_RUN__ - 1,x 370 beq LB0D8 371 jsr LB130 372LB0D8: dex 373 bne LB0AD 374 beq LB0E3 375 376decode_rel: 377 jsr LB12D 378 jsr LB12D 379LB0E3: lda tmp10 380 cmp tmp4 381 beq LB0EE 382 jmp LB13B 383LB0EE: rts 384 385LB0EF: ldy num_asm_bytes 386 beq LB123 387 lda tmp8 388 cmp #$9D 389 bne LB11A 390 jsr check_end 391 bcc LB10A 392 tya 393 bne LB12A 394 ldx tmp9 395 bmi LB12A 396 bpl LB112 397LB10A: iny 398 bne LB12A 399 ldx tmp9 400 bpl LB12A 401LB112: dex 402 dex 403 txa 404 ldy num_asm_bytes 405 bne LB11D 406LB11A: lda zp1 + 1,y 407LB11D: jsr store_byte 408 dey 409 bne LB11A 410LB123: lda tmp6 411 jsr store_byte 412 rts 413 414LB12A: jmp input_loop 415 416LB12D: jsr LB130 417LB130: stx tmp3 418 ldx tmp4 419 cmp tmp16,x 420 beq LB146 421LB13B: inc tmp6 422 beq LB143 423 jmp LAE61 424 425LB143: jmp input_loop 426 427LB146: inx 428 stx tmp4 429 ldx tmp3 430 rts 431 432; ---------------------------------------------------------------- 433; assembler tables 434; ---------------------------------------------------------------- 435addmode_table: 436.if .defined(CPU_6502) 437 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 438 .byte ADDMODE_IMP << 4 | ADDMODE_ZPG 439 .byte ADDMODE_IM2 << 4 | ADDMODE_IM3 440 .byte ADDMODE_IMP << 4 | ADDMODE_ABS 441 .byte ADDMODE_REL << 4 | ADDMODE_IMP 442 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 443 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 444 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 445 446 .byte ADDMODE_ABS << 4 | ADDMODE_IMP 447 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 448 .byte ADDMODE_IM2 << 4 | ADDMODE_IM3 449 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 450 .byte ADDMODE_REL << 4 | ADDMODE_IMP 451 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 452 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 453 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 454 455 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 456 .byte ADDMODE_IMP << 4 | ADDMODE_ZPG 457 .byte ADDMODE_IM2 << 4 | ADDMODE_IM3 458 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 459 .byte ADDMODE_REL << 4 | ADDMODE_IMP 460 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 461 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 462 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 463 464 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 465 .byte ADDMODE_IMP << 4 | ADDMODE_ZPG 466 .byte ADDMODE_IM2 << 4 | ADDMODE_IM3 467 .byte ADDMODE_IND << 4 | ADDMODE_ABS 468 .byte ADDMODE_REL << 4 | ADDMODE_IMP 469 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 470 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 471 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 472 473 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 474 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 475 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 476 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 477 .byte ADDMODE_REL << 4 | ADDMODE_IMP 478 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPY 479 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 480 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 481 482 .byte ADDMODE_IMM << 4 | ADDMODE_IMM 483 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 484 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 485 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 486 .byte ADDMODE_REL << 4 | ADDMODE_IMP 487 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPY 488 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 489 .byte ADDMODE_ABX << 4 | ADDMODE_ABY 490 491 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 492 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 493 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 494 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 495 .byte ADDMODE_REL << 4 | ADDMODE_IMP 496 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 497 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 498 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 499 500 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 501 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 502 .byte ADDMODE_IM2 << 4 | ADDMODE_IM2 503 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 504 .byte ADDMODE_REL << 4 | ADDMODE_IMP 505 .byte ADDMODE_IMP << 4 | ADDMODE_ZPX 506 .byte ADDMODE_IM2 << 4 | ADDMODE_IMP 507 .byte ADDMODE_IMP << 4 | ADDMODE_ABX 508 509 .byte ADDMODE_IZX << 4 | ADDMODE_ZPG 510 .byte ADDMODE_IMM << 4 | ADDMODE_ABS 511 .byte ADDMODE_IZY << 4 | ADDMODE_ZPX 512 .byte ADDMODE_ABY << 4 | ADDMODE_ABX 513.elseif .defined(CPU_6502ILL) 514 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 515 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 516 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 517 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 518 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 519 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 520 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 521 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 522 .byte ADDMODE_REL << 4 | ADDMODE_IZY 523 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 524 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 525 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 526 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 527 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 528 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 529 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 530 .byte ADDMODE_ABS << 4 | ADDMODE_IZX 531 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 532 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 533 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 534 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 535 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 536 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 537 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 538 .byte ADDMODE_REL << 4 | ADDMODE_IZY 539 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 540 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 541 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 542 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 543 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 544 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 545 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 546 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 547 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 548 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 549 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 550 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 551 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 552 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 553 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 554 .byte ADDMODE_REL << 4 | ADDMODE_IZY 555 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 556 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 557 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 558 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 559 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 560 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 561 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 562 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 563 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 564 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 565 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 566 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 567 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 568 .byte ADDMODE_IND << 4 | ADDMODE_ABS 569 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 570 .byte ADDMODE_REL << 4 | ADDMODE_IZY 571 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 572 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 573 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 574 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 575 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 576 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 577 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 578 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 579 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 580 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 581 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 582 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 583 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 584 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 585 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 586 .byte ADDMODE_REL << 4 | ADDMODE_IZY 587 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 588 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 589 .byte ADDMODE_ZPY << 4 | ADDMODE_ZPY 590 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 591 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 592 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 593 .byte ADDMODE_ABY << 4 | ADDMODE_ABY 594 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 595 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 596 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 597 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 598 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 599 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 600 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 601 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 602 .byte ADDMODE_REL << 4 | ADDMODE_IZY 603 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 604 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 605 .byte ADDMODE_ZPY << 4 | ADDMODE_ZPY 606 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 607 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 608 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 609 .byte ADDMODE_ABY << 4 | ADDMODE_ABY 610 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 611 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 612 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 613 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 614 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 615 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 616 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 617 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 618 .byte ADDMODE_REL << 4 | ADDMODE_IZY 619 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 620 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 621 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 622 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 623 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 624 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 625 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 626 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 627 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 628 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 629 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 630 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 631 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 632 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 633 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 634 .byte ADDMODE_REL << 4 | ADDMODE_IZY 635 .byte ADDMODE_IMP << 4 | ADDMODE_IZY 636 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 637 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 638 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 639 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 640 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 641 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 642.elseif .defined(CPU_65C02) 643 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 644 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 645 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 646 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 647 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 648 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 649 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 650 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 651 .byte ADDMODE_REL << 4 | ADDMODE_IZY 652 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 653 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPX 654 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 655 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 656 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 657 .byte ADDMODE_ABS << 4 | ADDMODE_ABX 658 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 659 .byte ADDMODE_ABS << 4 | ADDMODE_IZX 660 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 661 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 662 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 663 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 664 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 665 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 666 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 667 .byte ADDMODE_REL << 4 | ADDMODE_IZY 668 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 669 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 670 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 671 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 672 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 673 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 674 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 675 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 676 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 677 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 678 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 679 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 680 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 681 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 682 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 683 .byte ADDMODE_REL << 4 | ADDMODE_IZY 684 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 685 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 686 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 687 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 688 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 689 .byte ADDMODE_ABS << 4 | ADDMODE_ABX 690 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 691 .byte ADDMODE_IMP << 4 | ADDMODE_IZX 692 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 693 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 694 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 695 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 696 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 697 .byte ADDMODE_IND << 4 | ADDMODE_ABS 698 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 699 .byte ADDMODE_REL << 4 | ADDMODE_IZY 700 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 701 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 702 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 703 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 704 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 705 .byte ADDMODE_IAX << 4 | ADDMODE_ABX 706 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 707 .byte ADDMODE_REL << 4 | ADDMODE_IZX 708 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 709 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 710 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 711 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 712 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 713 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 714 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 715 .byte ADDMODE_REL << 4 | ADDMODE_IZY 716 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 717 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 718 .byte ADDMODE_ZPY << 4 | ADDMODE_ZPG 719 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 720 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 721 .byte ADDMODE_ABS << 4 | ADDMODE_ABX 722 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 723 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 724 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 725 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 726 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 727 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 728 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 729 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 730 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 731 .byte ADDMODE_REL << 4 | ADDMODE_IZY 732 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 733 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 734 .byte ADDMODE_ZPY << 4 | ADDMODE_ZPG 735 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 736 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 737 .byte ADDMODE_ABX << 4 | ADDMODE_ABX 738 .byte ADDMODE_ABY << 4 | ADDMODE_ZPR 739 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 740 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 741 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 742 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 743 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 744 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 745 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 746 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 747 .byte ADDMODE_REL << 4 | ADDMODE_IZY 748 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 749 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 750 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 751 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 752 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 753 .byte ADDMODE_ABS << 4 | ADDMODE_ABX 754 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 755 .byte ADDMODE_IMM << 4 | ADDMODE_IZX 756 .byte ADDMODE_IMM << 4 | ADDMODE_IMP 757 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 758 .byte ADDMODE_ZPG << 4 | ADDMODE_ZPG 759 .byte ADDMODE_IMP << 4 | ADDMODE_IMM 760 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 761 .byte ADDMODE_ABS << 4 | ADDMODE_ABS 762 .byte ADDMODE_ABS << 4 | ADDMODE_ZPR 763 .byte ADDMODE_REL << 4 | ADDMODE_IZY 764 .byte ADDMODE_IZP << 4 | ADDMODE_IMP 765 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPX 766 .byte ADDMODE_ZPX << 4 | ADDMODE_ZPG 767 .byte ADDMODE_IMP << 4 | ADDMODE_ABY 768 .byte ADDMODE_IMP << 4 | ADDMODE_IMP 769 .byte ADDMODE_ABS << 4 | ADDMODE_ABX 770 .byte ADDMODE_ABX << 4 | ADDMODE_ZPR 771.else 772.error "No CPU type specified!" 773.endif 774 775P_NONE = 0 776P_DOLLAR = 1 << 7 777P_PAREN = 1 << 6 778P_HASH = 1 << 5 779S_X = 1 << 4 780S_PAREN = 1 << 3 781S_Y = 1 << 2 782; use otherwise illegal combinations for the special cases 783S_RELATIVE = S_X | S_PAREN | S_Y 784.ifdef CPU_65C02 785S_ZPREL = S_X | S_Y 786.endif 787 788.macro addmode_detail symbol, bytes, flags 789 symbol = * - addmode_detail_table 790 .byte flags | bytes 791.endmacro 792 793addmode_detail_table: 794 addmode_detail ADDMODE_IMP, 0, P_NONE ; implied 795 addmode_detail ADDMODE_IMM, 1, P_HASH ; immediate 796 addmode_detail ADDMODE_ZPG, 1, P_DOLLAR ; zero page 797 addmode_detail ADDMODE_ABS, 2, P_DOLLAR ; absolute 798.ifdef CPU_6502 799 addmode_detail ADDMODE_IM2, 0, P_NONE ; implied 800 addmode_detail ADDMODE_IM3, 0, P_NONE ; implied 801.endif 802 addmode_detail ADDMODE_IZX, 1, P_PAREN | S_X | S_PAREN ; X indexed indirect 803 addmode_detail ADDMODE_IZY, 1, P_PAREN | S_PAREN | S_Y ; indirect Y indexed 804 addmode_detail ADDMODE_ZPX, 1, P_DOLLAR | S_X ; zero page X indexed 805 addmode_detail ADDMODE_ABX, 2, P_DOLLAR | S_X ; absolute X indexed 806 addmode_detail ADDMODE_ABY, 2, P_DOLLAR | S_Y ; absolute Y indexed 807 addmode_detail ADDMODE_IND, 2, P_PAREN | S_PAREN ; absolute indirect 808 addmode_detail ADDMODE_ZPY, 1, P_DOLLAR | S_Y ; zero page Y indexed 809 addmode_detail ADDMODE_REL,1, P_DOLLAR | S_RELATIVE ; relative 810.ifdef CPU_65C02 811 addmode_detail ADDMODE_IAX, 2, P_PAREN | S_X | S_PAREN ; X indexed indirect 812 addmode_detail ADDMODE_IZP, 1, P_PAREN | S_PAREN ; zp indirect 813 addmode_detail ADDMODE_ZPR, 2, P_DOLLAR | S_ZPREL ; zp, relative 814.endif 815 816.macro asmchars c1, c2 817.segment "asmchars1" 818 .byte c1 819.segment "asmchars2" 820 .byte c2 821.endmacro 822 823 ; suffixes 824 asmchars ',', 'Y' ; 1 825 asmchars ')', 0 ; 2 826 asmchars ',', 'X' ; 3 827 ; prefixes 828 asmchars '#', '$' ; 4 829 asmchars '(', '$' ; 5 830 asmchars '$', 0 ; 6 831 832; encoded mnemos: 833; every combination of a byte of mnemos1 and mnemos2 834; encodes 3 ascii characters 835 836.macro mnemo c1, c2, c3 837.segment "mnemos1" 838 .byte (c1 - $3F) << 3 | (c2 - $3F) >> 2 839.segment "mnemos2" 840 .byte <((c2 - $3F) << 6 | (c3 - $3F) << 1) 841.endmacro 842 843.if .defined(CPU_6502) 844; 64 entries 845 mnemo 'B','R','K' 846 mnemo 'P','H','P' 847 mnemo 'B','P','L' 848 mnemo 'C','L','C' 849 mnemo 'J','S','R' 850 mnemo 'P','L','P' 851 mnemo 'B','M','I' 852 mnemo 'S','E','C' 853 mnemo 'R','T','I' 854 mnemo 'P','H','A' 855 mnemo 'B','V','C' 856 mnemo 'C','L','I' 857 mnemo 'R','T','S' 858 mnemo 'P','L','A' 859 mnemo 'B','V','S' 860 mnemo 'S','E','I' 861 mnemo '?','?','?' 862 mnemo 'D','E','Y' 863 mnemo 'B','C','C' 864 mnemo 'T','Y','A' 865 mnemo 'L','D','Y' 866 mnemo 'T','A','Y' 867 mnemo 'B','C','S' 868 mnemo 'C','L','V' 869 mnemo 'C','P','Y' 870 mnemo 'I','N','Y' 871 mnemo 'B','N','E' 872 mnemo 'C','L','D' 873 mnemo 'C','P','X' 874 mnemo 'I','N','X' 875 mnemo 'B','E','Q' 876 mnemo 'S','E','D' 877 mnemo '?','?','?' 878 mnemo 'B','I','T' 879 mnemo 'J','M','P' 880 mnemo 'J','M','P' 881 mnemo 'S','T','Y' 882 mnemo 'L','D','Y' 883 mnemo 'C','P','Y' 884 mnemo 'C','P','X' 885 mnemo 'T','X','A' 886 mnemo 'T','X','S' 887 mnemo 'T','A','X' 888 mnemo 'T','S','X' 889 mnemo 'D','E','X' 890 mnemo '?','?','?' 891 mnemo 'N','O','P' 892 mnemo '?','?','?' 893 mnemo 'A','S','L' 894 mnemo 'R','O','L' 895 mnemo 'L','S','R' 896 mnemo 'R','O','R' 897 mnemo 'S','T','X' 898 mnemo 'L','D','X' 899 mnemo 'D','E','C' 900 mnemo 'I','N','C' 901 mnemo 'O','R','A' 902 mnemo 'A','N','D' 903 mnemo 'E','O','R' 904 mnemo 'A','D','C' 905 mnemo 'S','T','A' 906 mnemo 'L','D','A' 907 mnemo 'C','M','P' 908 mnemo 'S','B','C' 909.elseif .defined(CPU_6502ILL) 910 mnemo 'A','D','C' 911 mnemo 'A','H','X' 912 mnemo 'A','L','R' 913 mnemo 'A','N','C' 914 mnemo 'A','N','D' 915 mnemo 'A','R','R' 916 mnemo 'A','S','L' 917 mnemo 'A','X','S' 918 mnemo 'B','C','C' 919 mnemo 'B','C','S' 920 mnemo 'B','E','Q' 921 mnemo 'B','I','T' 922 mnemo 'B','M','I' 923 mnemo 'B','N','E' 924 mnemo 'B','P','L' 925 mnemo 'B','R','K' 926 mnemo 'B','V','C' 927 mnemo 'B','V','S' 928 mnemo 'C','L','C' 929 mnemo 'C','L','D' 930 mnemo 'C','L','I' 931 mnemo 'C','L','V' 932 mnemo 'C','M','P' 933 mnemo 'C','P','X' 934 mnemo 'C','P','Y' 935 mnemo 'D','C','P' 936 mnemo 'D','E','C' 937 mnemo 'D','E','X' 938 mnemo 'D','E','Y' 939 mnemo 'E','O','R' 940 mnemo 'I','N','C' 941 mnemo 'I','N','X' 942 mnemo 'I','N','Y' 943 mnemo 'I','S','C' 944 mnemo 'J','M','P' 945 mnemo 'J','S','R' 946 mnemo 'K','I','L' 947 mnemo 'L','A','S' 948 mnemo 'L','A','X' 949 mnemo 'L','D','A' 950 mnemo 'L','D','X' 951 mnemo 'L','D','Y' 952 mnemo 'L','S','R' 953 mnemo 'N','O','P' 954 mnemo 'O','R','A' 955 mnemo 'P','H','A' 956 mnemo 'P','H','P' 957 mnemo 'P','L','A' 958 mnemo 'P','L','P' 959 mnemo 'R','L','A' 960 mnemo 'R','O','L' 961 mnemo 'R','O','R' 962 mnemo 'R','R','A' 963 mnemo 'R','T','I' 964 mnemo 'R','T','S' 965 mnemo 'S','A','X' 966 mnemo 'S','B','C' 967 mnemo 'S','E','C' 968 mnemo 'S','E','D' 969 mnemo 'S','E','I' 970 mnemo 'S','H','X' 971 mnemo 'S','H','Y' 972 mnemo 'S','L','O' 973 mnemo 'S','R','E' 974 mnemo 'S','T','A' 975 mnemo 'S','T','X' 976 mnemo 'S','T','Y' 977 mnemo 'T','A','S' 978 mnemo 'T','A','X' 979 mnemo 'T','A','Y' 980 mnemo 'T','S','X' 981 mnemo 'T','X','A' 982 mnemo 'T','X','S' 983 mnemo 'T','Y','A' 984 mnemo 'X','A','A' 985.elseif .defined(CPU_65C02) 986 mnemo 'A','D','C' 987 mnemo 'A','N','D' 988 mnemo 'A','S','L' 989 mnemo 'B','B','R' 990 mnemo 'B','B','S' 991 mnemo 'B','C','C' 992 mnemo 'B','C','S' 993 mnemo 'B','E','Q' 994 mnemo 'B','I','T' 995 mnemo 'B','M','I' 996 mnemo 'B','N','E' 997 mnemo 'B','P','L' 998 mnemo 'B','R','A' 999 mnemo 'B','R','K' 1000 mnemo 'B','V','C' 1001 mnemo 'B','V','S' 1002 mnemo 'C','L','C' 1003 mnemo 'C','L','D' 1004 mnemo 'C','L','I' 1005 mnemo 'C','L','V' 1006 mnemo 'C','M','P' 1007 mnemo 'C','P','X' 1008 mnemo 'C','P','Y' 1009 mnemo 'D','E','C' 1010 mnemo 'D','E','X' 1011 mnemo 'D','E','Y' 1012 mnemo 'E','O','R' 1013 mnemo 'I','N','C' 1014 mnemo 'I','N','X' 1015 mnemo 'I','N','Y' 1016 mnemo 'J','M','P' 1017 mnemo 'J','S','R' 1018 mnemo 'L','D','A' 1019 mnemo 'L','D','X' 1020 mnemo 'L','D','Y' 1021 mnemo 'L','S','R' 1022 mnemo 'N','O','P' 1023 mnemo 'O','R','A' 1024 mnemo 'P','H','A' 1025 mnemo 'P','H','P' 1026 mnemo 'P','H','X' 1027 mnemo 'P','H','Y' 1028 mnemo 'P','L','A' 1029 mnemo 'P','L','P' 1030 mnemo 'P','L','X' 1031 mnemo 'P','L','Y' 1032 mnemo 'R','M','B' 1033 mnemo 'R','O','L' 1034 mnemo 'R','O','R' 1035 mnemo 'R','T','I' 1036 mnemo 'R','T','S' 1037 mnemo 'S','B','C' 1038 mnemo 'S','E','C' 1039 mnemo 'S','E','D' 1040 mnemo 'S','E','I' 1041 mnemo 'S','M','B' 1042 mnemo 'S','T','A' 1043 mnemo 'S','T','P' 1044 mnemo 'S','T','X' 1045 mnemo 'S','T','Y' 1046 mnemo 'S','T','Z' 1047 mnemo 'T','A','X' 1048 mnemo 'T','A','Y' 1049 mnemo 'T','R','B' 1050 mnemo 'T','S','B' 1051 mnemo 'T','S','X' 1052 mnemo 'T','X','A' 1053 mnemo 'T','X','S' 1054 mnemo 'T','Y','A' 1055 mnemo 'W','A','I' 1056.else 1057.error "No CPU type specified!" 1058.endif 1059 1060; XXX this detects :;<=>?@ as hex characters, see also get_hex_digit 1061is_hex_character: 1062 cmp #'0' 1063 bcc :+ 1064 cmp #'F' + 1 1065 rts 1066: sec 1067 rts 1068 1069disassemble_line: 1070 jsr print_hex_16 1071 jsr print_space 1072 jsr decode_mnemo 1073 jsr print_asm_bytes 1074 jsr print_mnemo 1075 jmp print_operand 1076