]> git.sur5r.net Git - cc65/commitdiff
added support for LAX#imm, all done
authormrdudz <mrdudz@users.noreply.github.com>
Wed, 19 Nov 2014 23:18:12 +0000 (00:18 +0100)
committermrdudz <mrdudz@users.noreply.github.com>
Wed, 19 Nov 2014 23:18:12 +0000 (00:18 +0100)
src/ca65/instr.c
testcode/assembler/.gitignore
testcode/assembler/Makefile
testcode/assembler/all.s
testcode/assembler/illegal.ref [new file with mode: 0644]
testcode/assembler/illegal.s
testcode/assembler/legal.ref
testcode/assembler/legal.s

index 945d5ee797eebbc362e3dae75d20869b21a264ee..09b86b393a6b51cc340049b9edc09d8762f8b7fc 100644 (file)
@@ -257,7 +257,7 @@ static const struct {
         { "JMP",  0x0000808, 0x4c, 6, PutJMP },
         { "JSR",  0x0000008, 0x20, 7, PutAll },
         { "LAS",  0x0000200, 0xBB, 0, PutAll },         /* X */
-        { "LAX",  0x000A30C, 0xA3, 1, PutAll },         /* X */
+        { "LAX",  0x080A30C, 0xA3, 11, PutAll },        /* X */
         { "LDA",  0x080A26C, 0xa0, 0, PutAll },
         { "LDX",  0x080030C, 0xa2, 1, PutAll },
         { "LDY",  0x080006C, 0xa0, 1, PutAll },
@@ -790,7 +790,7 @@ const InsTable* InsTab = (const InsTable*) &InsTab6502;
 /* Table to build the effective 65xx opcode from a base opcode and an
 ** addressing mode. (The value in the table is ORed with the base opcode)
 */
-static unsigned char EATab[11][AM65I_COUNT] = {
+static unsigned char EATab[12][AM65I_COUNT] = {
     {   /* Table 0 */
         0x00, 0x00, 0x05, 0x0D, 0x0F, 0x15, 0x1D, 0x1F,
         0x00, 0x19, 0x12, 0x00, 0x07, 0x11, 0x17, 0x01,
@@ -857,6 +857,12 @@ static unsigned char EATab[11][AM65I_COUNT] = {
         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
         0x00, 0x00, 0x00
     },
+    {   /* Table 11 (LAX) */
+        0x08, 0x08, 0x04, 0x0C, 0x00, 0x14, 0x1C, 0x00,
+        0x14, 0x1C, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+        0x00, 0x00, 0x80
+    },
 };
 
 /* Table to build the effective SWEET16 opcode from a base opcode and an
index 3694d870237fb749a613c0bc803b1830add4f30b..93dedf2e225235a5f0df43daf819422a23f1f253 100644 (file)
@@ -1,4 +1,6 @@
 chkillegal.bin
 chklegal.bin
+chkall.bin
 legal.o
 illegal.o
+all.o
\ No newline at end of file
index ae08864f8dc707c36de148075dfccd5c9e7ce523..a9257ce7519690925204815ce4d750927b8f522e 100644 (file)
@@ -1,19 +1,25 @@
 
-all: chklegal.bin chkillegal.bin
+all: chklegal.bin chkillegal.bin chkall.bin
        @#
 
-.PHONY: chklegal.bin chkillegal.bin
+.PHONY: chklegal.bin chkillegal.bin chkall.bin
 
 chklegal.bin: legal.s
        ../../bin/cl65 --target none --cpu 6502X -o chklegal.bin legal.s
-       diff legal.ref chklegal.bin
+       diff -q legal.ref chklegal.bin || hex chklegal.bin
 
 chkillegal.bin: illegal.s
        ../../bin/cl65 --target none --cpu 6502X -o chkillegal.bin illegal.s
+       diff -q illegal.ref chkillegal.bin || hex chkillegal.bin
 
-ref: legal.s
+chkall.bin: all.s
+       ../../bin/cl65 --target none --cpu 6502X -o chkall.bin all.s
+
+ref: legal.s illegal.s
        ../../bin/cl65 --target none --cpu 6502X -o legal.ref legal.s
+       ../../bin/cl65 --target none --cpu 6502X -o illegal.ref illegal.s
 
 clean:
        rm -f legal.o chklegal.bin
        rm -f illegal.o chkillegal.bin
+       rm -f all.o chkall.bin
index 286f52670daecdc39e62ec19af3835191beabd84..b1795f99b381e7513bcb9bb3c0fa3034c3e24db3 100644 (file)
@@ -1,10 +1,13 @@
         .setcpu         "6502X"
 
+; all legal and illegal opcodes as they would be disassembled by da65
+; note that this would not assemble into the exact same binary
+
             brk                 ; 00
             ora ($12,x)         ; 01 12
             jam                 ; 02
             slo ($12,x)         ; 03 12
-            noop $12            ; 04 12
+            nop $12             ; 04 12
             ora $12             ; 05 12
             asl $12             ; 06 12
             slo $12             ; 07 12
             ora #$12            ; 09 12
             asl a               ; 0a
             anc #$12            ; 0b 12
-            noop $1234          ; 0c 34 12
+            nop $1234           ; 0c 34 12
             ora $1234           ; 0d 34 12
             asl $1234           ; 0e 34 12
             slo $1234           ; 0f 34 12
-            bpl $101c           ; 10 12
+            bpl *+$14           ; 10 12
             ora ($12),y         ; 11 12
             jam                 ; 12
             slo ($12),y         ; 13 12
-            noop $12,x          ; 14 12
+            nop $12,x           ; 14 12
             ora $12,x           ; 15 12
             asl $12,x           ; 16 12
             slo $12,x           ; 17 12
             clc                 ; 18
             ora $1234,y         ; 19 34 12
-            noop                ; 1a
+            no                ; 1a
             slo $1234,y         ; 1b 34 12
-            noop $1234,x        ; 1c 34 12
+            nop $1234,x         ; 1c 34 12
             ora $1234,x         ; 1d 34 12
             asl $1234,x         ; 1e 34 12
             slo $1234,x         ; 1f 34 12
             and $1234           ; 2d 34 12
             rol $1234           ; 2e 34 12
             rla $1234           ; 2f 34 12
-            bmi $107c           ; 30 12
+            bmi *+$14           ; 30 12
             and ($12),y         ; 31 12
             jam                 ; 32
             rla ($12),y         ; 33 12
-            noop $12,x          ; 34 12
+            nop $12,x           ; 34 12
             and $12,x           ; 35 12
             rol $12,x           ; 36 12
             rla $12,x           ; 37 12
             sec                 ; 38
             and $1234,y         ; 39 34 12
-            noop                ; 3a
+            no                ; 3a
             rla $1234,y         ; 3b 34 12
-            noop $1234,x        ; 3c 34 12
+            nop $1234,x         ; 3c 34 12
             and $1234,x         ; 3d 34 12
             rol $1234,x         ; 3e 34 12
             rla $1234,x         ; 3f 34 12
             eor ($12,x)         ; 41 12
             jam                 ; 42
             sre ($12,x)         ; 43 12
-            noop $12            ; 44 12
+            nop $12             ; 44 12
             eor $12             ; 45 12
             lsr $12             ; 46 12
             sre $12             ; 47 12
             pha                 ; 48
             eor #$12            ; 49 12
             lsr a               ; 4a
-            asr #$12            ; 4b 12
+            alr #$12            ; 4b 12
             jmp $1234           ; 4c 34 12
             eor $1234           ; 4d 34 12
             lsr $1234           ; 4e 34 12
             sre $1234           ; 4f 34 12
-            bvc $10dc           ; 50 12
+            bvc *+$14           ; 50 12
             eor ($12),y         ; 51 12
             jam                 ; 52
             sre ($12),y         ; 53 12
-            noop $12,x          ; 54 12
+            nop $12,x           ; 54 12
             eor $12,x           ; 55 12
             lsr $12,x           ; 56 12
             sre $12,x           ; 57 12
             cli                 ; 58
             eor $1234,y         ; 59 34 12
-            noop                ; 5a
+            no                ; 5a
             sre $1234,y         ; 5b 34 12
-            noop $1234,x        ; 5c 34 12
+            nop $1234,x         ; 5c 34 12
             eor $1234,x         ; 5d 34 12
             lsr $1234,x         ; 5e 34 12
             sre $1234,x         ; 5f 34 12
             adc ($12,x)         ; 61 12
             jam                 ; 62
             rra ($12,x)         ; 63 12
-            noop $12            ; 64 12
+            nop $12             ; 64 12
             adc $12             ; 65 12
             ror $12             ; 66 12
             rra $12             ; 67 12
             adc $1234           ; 6d 34 12
             ror $1234           ; 6e 34 12
             rra $1234           ; 6f 34 12
-            bvs $113c           ; 70 12
+            bvs *+$14           ; 70 12
             adc ($12),y         ; 71 12
             jam                 ; 72
             rra ($12),y         ; 73 12
-            noop $12,x          ; 74 12
+            nop $12,x           ; 74 12
             adc $12,x           ; 75 12
             ror $12,x           ; 76 12
             rra $12,x           ; 77 12
             sei                 ; 78
             adc $1234,y         ; 79 34 12
-            noop                ; 7a
+            no                ; 7a
             rra $1234,y         ; 7b 34 12
-            noop $1234,x        ; 7c 34 12
+            nop $1234,x         ; 7c 34 12
             adc $1234,x         ; 7d 34 12
             ror $1234,x         ; 7e 34 12
             rra $1234,x         ; 7f 34 12
-            noop #$12           ; 80 12
+            nop #$12            ; 80 12
             sta ($12,x)         ; 81 12
-            noop #$12           ; 82 12
+            nop #$12            ; 82 12
             sax ($12,x)         ; 83 12
             sty $12             ; 84 12
             sta $12             ; 85 12
             stx $12             ; 86 12
             sax $12             ; 87 12
             dey                 ; 88
-            noop #$12           ; 89 12
+            nop #$12            ; 89 12
             txa                 ; 8a
             ane #$12            ; 8b 12
             sty $1234           ; 8c 34 12
             sta $1234           ; 8d 34 12
             stx $1234           ; 8e 34 12
             sax $1234           ; 8f 34 12
-            bcc $119c           ; 90 12
+            bcc *+$14           ; 90 12
             sta ($12),y         ; 91 12
             jam                 ; 92
             sha ($12),y         ; 93 12
             tay                 ; a8
             lda #$12            ; a9 12
             tax                 ; aa
-            lxa #$12            ; ab 12
+            lax #$12            ; ab 12
             ldy $1234           ; ac 34 12
             lda $1234           ; ad 34 12
             ldx $1234           ; ae 34 12
             lax $1234           ; af 34 12
-            bcs $11fc           ; b0 12
+            bcs *+$14           ; b0 12
             lda ($12),y         ; b1 12
             jam                 ; b2
             lax ($12),y         ; b3 12
             lax $1234,y         ; bf 34 12
             cpy #$12            ; c0 12
             cmp ($12,x)         ; c1 12
-            noop #$12           ; c2 12
+            nop #$12            ; c2 12
             dcp ($12,x)         ; c3 12
             cpy $12             ; c4 12
             cmp $12             ; c5 12
             iny                 ; c8
             cmp #$12            ; c9 12
             dex                 ; ca
-            sbx #$12            ; cb 12
+            axs #$12            ; cb 12
             cpy $1234           ; cc 34 12
             cmp $1234           ; cd 34 12
             dec $1234           ; ce 34 12
             dcp $1234           ; cf 34 12
-            bne $125c           ; d0 12
+            bne *+$14           ; d0 12
             cmp ($12),y         ; d1 12
             jam                 ; d2
             dcp ($12),y         ; d3 12
-            noop $12,x          ; d4 12
+            nop $12,x           ; d4 12
             cmp $12,x           ; d5 12
             dec $12,x           ; d6 12
             dcp $12,x           ; d7 12
             cld                 ; d8
             cmp $1234,y         ; d9 34 12
-            noop                ; da
+            no                ; da
             dcp $1234,y         ; db 34 12
-            noop $1234,x        ; dc 34 12
+            nop $1234,x         ; dc 34 12
             cmp $1234,x         ; dd 34 12
             dec $1234,x         ; de 34 12
             dcp $1234,x         ; df 34 12
             cpx #$12            ; e0 12
             sbc ($12,x)         ; e1 12
-            noop #$12           ; e2 12
-            isb ($12,x)         ; e3 12
+            nop #$12            ; e2 12
+            isc ($12,x)         ; e3 12
             cpx $12             ; e4 12
             sbc $12             ; e5 12
             inc $12             ; e6 12
-            isb $12             ; e7 12
+            isc $12             ; e7 12
             inx                 ; e8
             sbc #$12            ; e9 12
             nop                 ; ea
-            usbc #$12           ; eb 12
+            sbc #$12            ; eb 12
             cpx $1234           ; ec 34 12
             sbc $1234           ; ed 34 12
             inc $1234           ; ee 34 12
-            isb $1234           ; ef 34 12
-            beq $12bc           ; f0 12
+            isc $1234           ; ef 34 12
+            beq *+$14           ; f0 12
             sbc ($12),y         ; f1 12
             jam                 ; f2
-            isb ($12),y         ; f3 12
-            noop $12,x          ; f4 12
+            isc ($12),y         ; f3 12
+            nop $12,x           ; f4 12
             sbc $12,x           ; f5 12
             inc $12,x           ; f6 12
-            isb $12,x           ; f7 12
+            isc $12,x           ; f7 12
             sed                 ; f8
             sbc $1234,y         ; f9 34 12
-            isb $1234,y         ; fb 34 12
-            noop $1234,x        ; fc 34 12
+            isc $1234,y         ; fb 34 12
+            nop $1234,x         ; fc 34 12
             sbc $1234,x         ; fd 34 12
             inc $1234,x         ; fe 34 12
-            isb $1234,x         ; ff 34 12
+            isc $1234,x         ; ff 34 12
diff --git a/testcode/assembler/illegal.ref b/testcode/assembler/illegal.ref
new file mode 100644 (file)
index 0000000..c8dc208
--- /dev/null
@@ -0,0 +1 @@
+\a\12\ f4\12\1f4\12\e4\12\ 3\12\17\12\13\12'\12/4\12?4\12;4\12#\127\123\12O4\12_4\12[4\12G\12C\12W\12S\12o4\12\7f4\12{4\12g\12c\12w\12s\12Ï4\12ß4\12Û4\12Ç\12Ã\12×\12Ó\12ï4\12ÿ4\12û4\12ç\12ã\12÷\12ó\12\8f4\12\87\12\83\12\97\12¯4\12¿4\12§\12£\12³\12·\12\v\12k\12K\12Ë\12\f4\12\1c4\12\ 4\12\14\12\80\12\ 2\93\12\9f4\12\9e4\12\9c4\12\9b4\12»4\12«\12\8b\12
\ No newline at end of file
index 1a1841fb3abc6daab3b810aad3a340325349b130..c73e2eba394c431a50a93113159331937a7b6875 100644 (file)
@@ -1,6 +1,9 @@
 
         .setcpu         "6502X"
 
+; all so called "illegal" opcodes. duplicated (functionally identical) ones
+; are commented out
+
 ; first all totally stable undocs:
 
         slo $12             ; 07 12
 
 ; the two so-called "highly unstable" ones:
 
-;        lax #$12            ; ab 12
+        lax #$12            ; ab 12
 
         ane #$12            ; 8b 12
index 4e9f5c45d9566f2d5e77236c7a2c5319959b5cce..c38f2901465090f656f005ccd12e091ee55c3911 100644 (file)
Binary files a/testcode/assembler/legal.ref and b/testcode/assembler/legal.ref differ
index 10377b4b8dacdf46fd1788305d195ebd0f152fcb..1de43b98b293d1e29e0e96e3e99a703071bda3ea 100644 (file)
             asl $12,x           ; 16 12
             asl a               ; 0a
 
-            bcc *+$12           ; 90 12
-            bcs *+$12           ; b0 12
-            beq *+$12           ; f0 12
+            bcc *+$14           ; 90 12
+            bcs *+$14           ; b0 12
+            beq *+$14           ; f0 12
+            bmi *+$14           ; 30 12
+            bne *+$14           ; d0 12
+            bpl *+$14           ; 10 12
+            bvc *+$14           ; 50 12
+            bvs *+$14           ; 70 12
 
             bit $12             ; 24 12
             bit $1234           ; 2c 34 12
 
-            bmi *+$12           ; 30 12
-            bne *+$12           ; d0 12
-            bpl *+$12           ; 10 12
-
             brk                 ; 00
 
-            bvc *+$12           ; 50 12
-            bvs *+$12           ; 70 12
-
             clc                 ; 18
             cld                 ; d8
             cli                 ; 58