[新連載開始]W65C02マイコンボードの製作
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
私としてはW65C02をさわるのは全く初めてです。何から何まで未経験です。さてどうなりますでしょうか。
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
[第48回]
●ASR,LSR,ROL,ROR(2)テストプログラム
ASR,LSR,ROL,RORのテストプログラムです。
下がアセンブラソースプログラムです。
;w65c02test21 26/8/10
;
;ASL,LSR,ROL,ROR
;
org $8000
;
;set data
ldx #$10
lda #$12
sta $1000;1000<12,,,a
lda #$34
sta $1000,x;1010<34,,,a,x
lda #$56
sta $10;10<56,,,zp
lda #$78
sta $10,x;20<78
;A<78
;
sta $30;A,,,<78
lda $1000
sta $31;a<12
lda $1000,x
sta $32;a,x<34
lda $10
sta $33;zp<56
lda $10,x
sta $34;zp,x<78
txa
sta $35;x<10
ldy #$9a
tya
sta $36;y<9a
;
;asl start
lda $30;A
asl;78 01111000>11110000 f0
sta $40;f0
asl $1000;12 00010010>00100100 24
lda $1000
sta $41;24
asl $1000,x;34 00110100>01101000 68
lda $1000,x
sta $42;68
asl $10;56 01010110>10101100 ac
lda $10
sta $43;ac
asl $10,x;78 01111000>11110000 f0
lda $10,x
sta $44;f0
;
;lsr start
lda $40;f0
lsr;f0 11110000>01111000>78
sta $50;78
lsr $1000;24 00100100>00010010 12
lda $1000
sta $51;12
lsr $1000,x;68 01101000>00110100 34
lda $1000,x
sta $52;34
lsr $10;ac 10101100>01010110 56
lda $10
sta $53;56
lsr $10,x;f0 11110000>01111000 78 c=0
lda $10,x
sta $54;78
;
;rol start
lda $50;78
rol;78 01111000>11110000 c=0 f0
sta $60;f0
rol $1000;12 00010010>00100100 c=0 24
lda $1000
sta $61;24
rol $1000,x;34 00110100>01101000 c=0 68
lda $1000,x
sta $62;68
rol $10;56 01010110>10101100 c=0 ac
lda $10
sta $63;ac
rol $10,x;78 01111000>11110000 c=0 f0
lda $10,x
sta $64;f0
;
;ror start
lda $60
ror;f0 11110000>01111000 c=0 78
sta $70;78
ror $1000;24 00100100>00010010 c=0 12
lda $1000
sta $71;12
ror $1000,x;68 01101000>3\00110100 c=0 34
lda $1000,x
sta $72;34
ror $10;ac 10101100>01010110 c=0 56
lda $10
sta $73;56
ror $10,x;f0 11110000>01111000 c=0 78
lda $10,x
sta $74;78
stp
;end
|

0000 ;w65c02test21 26/8/10 0000 ; 0000 ;ASL,LSR,ROL,ROR 0000 ; 8000 org $8000 8000 ; 8000 ;set data 8000 A210 ldx #$10 8002 A912 lda #$12 8004 8D0010 sta $1000;1000<12,,,a 8007 A934 lda #$34 8009 9D0010 sta $1000,x;1010<34,,,a,x 800C A956 lda #$56 800E 8510 sta $10;10<56,,,zp 8010 A978 lda #$78 8012 9510 sta $10,x;20<78 8014 ;A<78 8014 ; 8014 8530 sta $30;A,,,<78 8016 AD0010 lda $1000 8019 8531 sta $31;a<12 801B BD0010 lda $1000,x 801E 8532 sta $32;a,x<34 8020 A510 lda $10 8022 8533 sta $33;zp<56 8024 B510 lda $10,x 8026 8534 sta $34;zp,x<78 8028 8A txa 8029 8535 sta $35;x<10 802B A09A ldy #$9a 802D 98 tya 802E 8536 sta $36;y<9a 8030 ; 8030 ;asl start 8030 A530 lda $30;A 8032 0A asl;78 01111000>11110000 f0 8033 8540 sta $40;f0 8035 0E0010 asl $1000;12 00010010>00100100 24 8038 AD0010 lda $1000 803B 8541 sta $41;24 803D 1E0010 asl $1000,x;34 00110100>01101000 68 8040 BD0010 lda $1000,x 8043 8542 sta $42;68 8045 0610 asl $10;56 01010110>10101100 ac 8047 A510 lda $10 8049 8543 sta $43;ac 804B 1610 asl $10,x;78 01111000>11110000 f0 804D B510 lda $10,x 804F 8544 sta $44;f0 8051 ; 8051 ;lsr start 8051 A540 lda $40;f0 8053 4A lsr;f0 11110000>01111000>78 8054 8550 sta $50;78 8056 4E0010 lsr $1000;24 00100100>00010010 12 8059 AD0010 lda $1000 805C 8551 sta $51;12 805E 5E0010 lsr $1000,x;68 01101000>00110100 34 8061 BD0010 lda $1000,x 8064 8552 sta $52;34 8066 4610 lsr $10;ac 10101100>01010110 56 8068 A510 lda $10 806A 8553 sta $53;56 806C 5610 lsr $10,x;f0 11110000>01111000 78 c=0 806E B510 lda $10,x 8070 8554 sta $54;78 8072 ; 8072 ;rol start 8072 A550 lda $50;78 8074 2A rol;78 01111000>11110000 c=0 f0 8075 8560 sta $60;f0 8077 2E0010 rol $1000;12 00010010>00100100 c=0 24 807A AD0010 lda $1000 807D 8561 sta $61;24 807F 3E0010 rol $1000,x;34 00110100>01101000 c=0 68 8082 BD0010 lda $1000,x 8085 8562 sta $62;68 8087 2610 rol $10;56 01010110>10101100 c=0 ac 8089 A510 lda $10 808B 8563 sta $63;ac 808D 3610 rol $10,x;78 01111000>11110000 c=0 f0 808F B510 lda $10,x 8091 8564 sta $64;f0 8093 ; 8093 ;ror start 8093 A560 lda $60 8095 6A ror;f0 11110000>01111000 c=0 78 8096 8570 sta $70;78 8098 6E0010 ror $1000;24 00100100>00010010 c=0 12 809B AD0010 lda $1000 809E 8571 sta $71;12 80A0 7E0010 ror $1000,x;68 01101000>3\00110100 c=0 34 80A3 BD0010 lda $1000,x 80A6 8572 sta $72;34 80A8 6610 ror $10;ac 10101100>01010110 c=0 56 80AA A510 lda $10 80AC 8573 sta $73;56 80AE 7610 ror $10,x;f0 11110000>01111000 c=0 78 80B0 B510 lda $10,x 80B2 8574 sta $74;78 80B4 DB stp 80B5 ;end |

;w65c02test21b 26/8/19
;
;ASL,LSR,ROL,ROR
;
org $8000
;
;set data
ldx #$10
lda #$12
sta $1000;1000<12,,,a
lda #$34
sta $1000,x;1010<34,,,a,x
lda #$56
sta $10;10<56,,,zp
lda #$78
sta $10,x;20<78
;A<78
;
sta $30;A,,,<78
lda $1000
sta $31;a<12
lda $1000,x
sta $32;a,x<34
lda $10
sta $33;zp<56
lda $10,x
sta $34;zp,x<78
txa
sta $35;x<10
ldy #$9a
tya
sta $36;y<9a
;
;asl start
lda $30;A
asl;78 01111000>11110000 f0
sta $40;f0
asl $1000;12 00010010>00100100 24
lda $1000
sta $41;24
asl $1000,x;34 00110100>01101000 68
lda $1000,x
sta $42;68
asl $10;56 01010110>10101100 ac
lda $10
sta $43;ac
asl $10,x;78 01111000>11110000 f0
lda $10,x
sta $44;f0
;
;lsr start
lda $40;f0
lsr;f0 11110000>01111000>78
sta $50;78
lsr $1000;24 00100100>00010010 12
lda $1000
sta $51;12
lsr $1000,x;68 01101000>00110100 34
lda $1000,x
sta $52;34
lsr $10;ac 10101100>01010110 56
lda $10
sta $53;56
lsr $10,x;f0 11110000>01111000 78 c=0
lda $10,x
sta $54;78
sec
;
;rol start
lda $50;78
rol;78 01111000>11110001 c=0 f1
sta $60;f0
rol $1000;12 00010010>00100100 c=0 24
lda $1000
sta $61;24
rol $1000,x;34 00110100>01101000 c=0 68
lda $1000,x
sta $62;68
rol $10;56 01010110>10101100 c=0 ac
lda $10
sta $63;ac
rol $10,x;78 01111000>11110000 c=0 f0
lda $10,x
sta $64;f0
;
;ror start
lda $60
ror;f0 11110001>01111000 c=1 78
sta $70;78
ror $1000;24 00100100>10010010 c=0 92
lda $1000
sta $71;12
ror $1000,x;68 01101000>3\00110100 c=0 34
lda $1000,x
sta $72;34
ror $10;ac 10101100>01010110 c=0 56
lda $10
sta $73;56
ror $10,x;f0 11110000>01111000 c=0 78
lda $10,x
sta $74;78
stp
;end
|

0000 ;w65c02test21b 26/8/19 0000 ; 0000 ;ASL,LSR,ROL,ROR 0000 ; 8000 org $8000 8000 ; 8000 ;set data 8000 A210 ldx #$10 8002 A912 lda #$12 8004 8D0010 sta $1000;1000<12,,,a 8007 A934 lda #$34 8009 9D0010 sta $1000,x;1010<34,,,a,x 800C A956 lda #$56 800E 8510 sta $10;10<56,,,zp 8010 A978 lda #$78 8012 9510 sta $10,x;20<78 8014 ;A<78 8014 ; 8014 8530 sta $30;A,,,<78 8016 AD0010 lda $1000 8019 8531 sta $31;a<12 801B BD0010 lda $1000,x 801E 8532 sta $32;a,x<34 8020 A510 lda $10 8022 8533 sta $33;zp<56 8024 B510 lda $10,x 8026 8534 sta $34;zp,x<78 8028 8A txa 8029 8535 sta $35;x<10 802B A09A ldy #$9a 802D 98 tya 802E 8536 sta $36;y<9a 8030 ; 8030 ;asl start 8030 A530 lda $30;A 8032 0A asl;78 01111000>11110000 f0 8033 8540 sta $40;f0 8035 0E0010 asl $1000;12 00010010>00100100 24 8038 AD0010 lda $1000 803B 8541 sta $41;24 803D 1E0010 asl $1000,x;34 00110100>01101000 68 8040 BD0010 lda $1000,x 8043 8542 sta $42;68 8045 0610 asl $10;56 01010110>10101100 ac 8047 A510 lda $10 8049 8543 sta $43;ac 804B 1610 asl $10,x;78 01111000>11110000 f0 804D B510 lda $10,x 804F 8544 sta $44;f0 8051 ; 8051 ;lsr start 8051 A540 lda $40;f0 8053 4A lsr;f0 11110000>01111000>78 8054 8550 sta $50;78 8056 4E0010 lsr $1000;24 00100100>00010010 12 8059 AD0010 lda $1000 805C 8551 sta $51;12 805E 5E0010 lsr $1000,x;68 01101000>00110100 34 8061 BD0010 lda $1000,x 8064 8552 sta $52;34 8066 4610 lsr $10;ac 10101100>01010110 56 8068 A510 lda $10 806A 8553 sta $53;56 806C 5610 lsr $10,x;f0 11110000>01111000 78 c=0 806E B510 lda $10,x 8070 8554 sta $54;78 8072 38 sec 8073 ; 8073 ;rol start 8073 A550 lda $50;78 8075 2A rol;78 01111000>11110001 c=0 f1 8076 8560 sta $60;f0 8078 2E0010 rol $1000;12 00010010>00100100 c=0 24 807B AD0010 lda $1000 807E 8561 sta $61;24 8080 3E0010 rol $1000,x;34 00110100>01101000 c=0 68 8083 BD0010 lda $1000,x 8086 8562 sta $62;68 8088 2610 rol $10;56 01010110>10101100 c=0 ac 808A A510 lda $10 808C 8563 sta $63;ac 808E 3610 rol $10,x;78 01111000>11110000 c=0 f0 8090 B510 lda $10,x 8092 8564 sta $64;f0 8094 ; 8094 ;ror start 8094 A560 lda $60 8096 6A ror;f0 11110001>01111000 c=1 78 8097 8570 sta $70;78 8099 6E0010 ror $1000;24 00100100>10010010 c=0 92 809C AD0010 lda $1000 809F 8571 sta $71;12 80A1 7E0010 ror $1000,x;68 01101000>3\00110100 c=0 34 80A4 BD0010 lda $1000,x 80A7 8572 sta $72;34 80A9 6610 ror $10;ac 10101100>01010110 c=0 56 80AB A510 lda $10 80AD 8573 sta $73;56 80AF 7610 ror $10,x;f0 11110000>01111000 c=0 78 80B1 B510 lda $10,x 80B3 8574 sta $74;78 80B5 DB stp 80B6 ;end |
