6809 / 6702 puzzle

From: Rhialto <rhialto_at_falu.nl>
Date: Sat, 4 Feb 2012 00:46:26 +0100
Message-ID: <20120203234625.GC414@falu.nl>
Hi all,

in the last weeks I've been putting more SuperPET features into VICE.
I'm currently testing to see how far I get running the Waterloo software
(all available from zimmers.net).

I'm getting to the point where I can load in the disk-based software,
and one of the first things it seems to do is to check the dongle.
I've made a trace from that point on, until it goes into never-never
land. Obviously my implementation of the 6702 dongle as a simple
register isn't good enough!

I've edited the monitor output for readability (sorry, I can't make it
fit in 80 columns) and I added a few bits that I forgot the first time
round.

I've set a breakpoint on any access to eff0-eff4. The first register
dump is seemingly *after* the listed instruction has been executed, but
the subsequent ones are *before* the instruction has been run.

This is what happened after I typed "disk/0.edit" (to load the file
"edit" from drive 0 instead of the default drive 1).

Can anybody see what this code is trying to do, and where it's going
wrong? I can supply more disassembly if wanted.

(I hope I didn't make too many mistakes in the disassembly code...)

*** DONGLE efe0 -> 42 ***
#1 (Stop on  load efe0)  010 052
.C:9860  A6 F8 06    LDA [$06,S]         - A:42 B:00 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
(C:$9863) disable 1
Set checkpoint #1 to state: disabled
.C:9863  8A 11       ORA #$11
>C:09dd  05 bb 92 bb  97 b8 ef e0  00 fe 00 04  9d e8 bc 0d   ................
>C:09ed  00 0d 00 00  90 4d 00 01  a9 e6 00 00  aa 0d 00 00   .....M..........
>C:09fd  a9 9c ff 02  01 02 05 3a  00 00 00 00  00 00 00 00   .......:........

(C:$9863) step
.C:9867  A7 65       STA 5,S             - A:53 B:00 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:9869  C6 40       LDB #$40            - A:53 B:00 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:986b  58          ASLB                - A:53 B:40 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:986c  E7 61       STB 1,S             - A:53 B:80 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N.V.
.C:986e  E7 F8 06    STB [$06,S]         - A:53 B:80 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N...
*** DONGLE efe0 := 80 ***
.C:9871  EC 64       LDD 4,S             - A:53 B:80 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N...
.C:9873  3D          MUL                 - A:53 B:53 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF......
.C:9874  E7 65       STB 5,S             - A:1A B:E9 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:9876  AA 65       ORA 5,S             - A:1A B:E9 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
.C:9878  A7 64       STA 4,S             - A:FB B:E9 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
.C:987a  C8 D7       EORB #$D7           - A:FB B:E9 X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
.C:987c  68 F8 06    ASL [$06,S]         - A:FB B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
*** DONGLE efe0 -> 80 ***
*** DONGLE efe0 := 00 ***
.C:987f  E8 F8 06    EORB [$06,S]        - A:FB B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF...ZVC
*** DONGLE efe0 -> 00 ***
.C:9882  A6 65       LDA 5,S             - A:FB B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:9884  A7 F8 06    STA [$06,S]         - A:E9 B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
*** DONGLE efe0 := E9 ***
.C:9887  68 F8 06    ASL [$06,S]         - A:E9 B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
*** DONGLE efe0 -> E9 ***
*** DONGLE efe0 := D2 ***
.C:988a  A6 F8 06    LDA [$06,S]         - A:E9 B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
*** DONGLE efe0 -> D2 ***
.C:988d  A7 E4       STA ,S              - A:D2 B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
.C:988f  E7 82       STB ,-X             - A:D2 B:3E X:09EB Y:9057 SP:09DD U:02FC DP:00 EF..N..C
.C:9891  AF 62       STX 2,S             - A:D2 B:3E X:09EA Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:9893  E6 61       LDB 1,S             - A:D2 B:3E X:09EA Y:9057 SP:09DD U:02FC DP:00 EF.....C
.C:9895  8D 08       BSR $989F           - A:D2 B:80 X:09EA Y:9057 SP:09DD U:02FC DP:00 EF..N..C
>C:9897  10 80 22 00  40 00 04 a8  10 ae e1 aa  e4 a4 a4 34   ..".@..........4
.C:989f  10 AE E1    LDY ,S++            - A:D2 B:80 X:09EA Y:9057 SP:09DB U:02FC DP:00 EF..N..C
.C:98a2  AA E4       ORA ,S              - A:D2 B:80 X:09EA Y:9897 SP:09DD U:02FC DP:00 EF..N..C
.C:98a4  A4 A4       ANDA ,Y             - A:D2 B:80 X:09EA Y:9897 SP:09DD U:02FC DP:00 EF..N..C
.C:98a6  34 02       PSHS A              - A:10 B:80 X:09EA Y:9897 SP:09DD U:02FC DP:00 EF.....C
.C:98a8  A6 80       LDA ,X+             - A:10 B:80 X:09EA Y:9897 SP:09DC U:02FC DP:00 EF.....C
.C:98aa  A4 A0       ANDA ,Y+            - A:3E B:80 X:09EB Y:9897 SP:09DC U:02FC DP:00 EF.....C
.C:98ac  A0 E0       SUBA ,S+            - A:10 B:80 X:09EB Y:9898 SP:09DC U:02FC DP:00 EF.....C
.C:98ae  26 0A       BNE $98BA           - A:00 B:80 X:09EB Y:9898 SP:09DD U:02FC DP:00 EF...Z..
.C:98b0  68 61       ASL 1,S             - A:00 B:80 X:09EB Y:9898 SP:09DD U:02FC DP:00 EF...Z..
.C:98b2  26 EE       BNE $98A2           - A:00 B:80 X:09EB Y:9898 SP:09DD U:02FC DP:00 EF...ZVC
.C:98b4  AE 62       LDX 2,S             - A:00 B:80 X:09EB Y:9898 SP:09DD U:02FC DP:00 EF...ZVC
.C:98b6  54          LSRB                - A:00 B:80 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF.....C
.C:98b7  54          LSRB                - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:98b8  26 B1       BNE $986B           - A:00 B:20 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:986b  58          ASLB                - A:00 B:20 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:986c  E7 61       STB 1,S             - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:986e  E7 F8 06    STB [$06,S]         - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
*** DONGLE efe0 := 40 ***
.C:9871  EC 64       LDD 4,S             - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:9873  3D          MUL                 - A:FB B:E9 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:9874  E7 65       STB 5,S             - A:E4 B:73 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:9876  AA 65       ORA 5,S             - A:E4 B:73 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:9878  A7 64       STA 4,S             - A:F7 B:73 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:987a  C8 D7       EORB #$D7           - A:F7 B:73 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:987c  68 F8 06    ASL [$06,S]         - A:F7 B:A4 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
*** DONGLE efe0 -> 40 ***
*** DONGLE efe0 := 80 ***
.C:987f  E8 F8 06    EORB [$06,S]        - A:F7 B:A4 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N.V.
*** DONGLE efe0 -> 80 ***
.C:9882  A6 65       LDA 5,S             - A:F7 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
.C:9884  A7 F8 06    STA [$06,S]         - A:73 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
*** DONGLE efe0 := 73 ***
.C:9887  68 F8 06    ASL [$06,S]         - A:73 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF......
*** DONGLE efe0 -> 73 ***
*** DONGLE efe0 := E6 ***
.C:988a  A6 F8 06    LDA [$06,S]         - A:73 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N.V.
*** DONGLE efe0 -> E6 ***
.C:988d  A7 E4       STA ,S              - A:E6 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:988f  E7 82       STB ,-X             - A:E6 B:24 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:9891  AF 62       STX 2,S             - A:E6 B:24 X:09E9 Y:9898 SP:09DD U:02FC DP:00 EF......
.C:9893  E6 61       LDB 1,S             - A:E6 B:24 X:09E9 Y:9898 SP:09DD U:02FC DP:00 EF......
.C:9895  8D 08       BSR $989F           - A:E6 B:40 X:09E9 Y:9898 SP:09DD U:02FC DP:00 EF......
.C:989f  10 AE E1    LDY ,S++            - A:E6 B:40 X:09E9 Y:9898 SP:09DB U:02FC DP:00 EF......
.C:98a2  AA E4       ORA ,S              - A:E6 B:40 X:09E9 Y:9897 SP:09DD U:02FC DP:00 EF..N...
.C:98a4  A4 A4       ANDA ,Y             - A:E6 B:40 X:09E9 Y:9897 SP:09DD U:02FC DP:00 EF..N...
.C:98a6  34 02       PSHS A              - A:00 B:40 X:09E9 Y:9897 SP:09DD U:02FC DP:00 EF...Z..
.C:98a8  A6 80       LDA ,X+             - A:00 B:40 X:09E9 Y:9897 SP:09DC U:02FC DP:00 EF...Z..
.C:98aa  A4 A0       ANDA ,Y+            - A:24 B:40 X:09EA Y:9897 SP:09DC U:02FC DP:00 EF......
.C:98ac  A0 E0       SUBA ,S+            - A:00 B:40 X:09EA Y:9898 SP:09DC U:02FC DP:00 EF...Z..
.C:98ae  26 0A       BNE $98BA           - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF...Z..
.C:98b0  68 61       ASL 1,S             - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF...Z..
.C:98b2  26 EE       BNE $98A2           - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N.V.
.C:98a2  AA E4       ORA ,S              - A:00 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N.V.
.C:98a4  A4 A4       ANDA ,Y             - A:E6 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:98a6  34 02       PSHS A              - A:80 B:40 X:09EA Y:9898 SP:09DD U:02FC DP:00 EF..N...
.C:98a8  A6 80       LDA ,X+             - A:80 B:40 X:09EA Y:9898 SP:09DC U:02FC DP:00 EF..N...
.C:98aa  A4 A0       ANDA ,Y+            - A:3E B:40 X:09EB Y:9898 SP:09DC U:02FC DP:00 EF......
.C:98ac  A0 E0       SUBA ,S+            - A:00 B:40 X:09EB Y:9899 SP:09DC U:02FC DP:00 EF...Z..
.C:98ae  26 0A       BNE $98BA           - A:80 B:40 X:09EB Y:9899 SP:09DD U:02FC DP:00 EF..N.VC
.C:98ba  32 6E       LEAS 14,S           - A:80 B:40 X:09EB Y:9899 SP:09DD U:02FC DP:00 EF..N.VC
.C:98bc  39          RTS                 - A:80 B:40 X:09EB Y:9899 SP:09EB U:02FC DP:00 EF..N.VC
.C:bc0d  34 06       PSHS D              - A:80 B:40 X:09EB Y:9899 SP:09ED U:02FC DP:00 EF..N.VC
.C:bc0f  37 24       PULU Y,B            - A:80 B:40 X:09EB Y:9899 SP:09EB U:02FC DP:00 EF..N.VC
.C:bc11  F7 02 20    STB $0220           - A:80 B:00 X:09EB Y:9057 SP:09EB U:02FF DP:00 EF..N.VC
.C:bc14  F7 EF FC    STB $EFFC           - A:80 B:00 X:09EB Y:9057 SP:09EB U:02FF DP:00 EF...Z.C
spet_bank := 0
spet_ctrlwp := 1
.C:bc17  EC E1       LDD ,S++            - A:80 B:00 X:09EB Y:9057 SP:09EB U:02FF DP:00 EF...Z.C
.C:bc19  6E A4       JMP ,Y              - A:80 B:40 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF..N..C
.C:9057  ED E4       STD ,S              - A:80 B:40 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF..N..C
.C:9059  E6 63       LDB 3,S             - A:80 B:40 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF..N..C
.C:905b  26 28       BNE $9085           - A:80 B:00 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF...Z.C
.C:905d  DC 20       LDD <$20            - A:80 B:00 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF...Z.C
.C:905f  DD 26       STD <$26            - A:0A B:00 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9061  DD 24       STD <$24            - A:0A B:00 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9063  C6 02       LDB #$02            - A:0A B:00 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9065  9E 24       LDX <$24            - A:0A B:02 X:09EB Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9067  E7 84       STB ,X              - A:0A B:02 X:0A00 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9069  30 01       LEAX 1,X            - A:0A B:02 X:0A00 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:906b  9F 24       STX <$24            - A:0A B:02 X:0A01 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:906d  C6 01       LDB #$01            - A:0A B:02 X:0A01 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:906f  E7 84       STB ,X              - A:0A B:01 X:0A01 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9071  30 01       LEAX 1,X            - A:0A B:01 X:0A01 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9073  9F 24       STX <$24            - A:0A B:01 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9075  DC 24       LDD <$24            - A:0A B:01 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9077  DD 28       STD <$28            - A:0A B:02 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9079  C6 02       LDB #$02            - A:0A B:02 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:907b  E7 84       STB ,X              - A:0A B:02 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:907d  30 01       LEAX 1,X            - A:0A B:02 X:0A02 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:907f  9F 24       STX <$24            - A:0A B:02 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9081  C6 01       LDB #$01            - A:0A B:02 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9083  E7 84       STB ,X              - A:0A B:01 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9085  EC E4       LDD ,S              - A:0A B:01 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF.....C
.C:9087  27 03       BEQ $908C           - A:80 B:40 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF..N..C
.C:9089  BD B0 03    JSR $B003           - A:80 B:40 X:0A03 Y:9057 SP:09ED U:02FF DP:00 EF..N..C
.C:b003  7E BC AB    JMP $BCAB           - A:80 B:40 X:0A03 Y:9057 SP:09EB U:02FF DP:00 EF..N..C
.C:bcab  34 04       PSHS B              - A:80 B:40 X:0A03 Y:9057 SP:09EB U:02FF DP:00 EF..N..C
.C:bcad  34 02       PSHS A              - A:80 B:40 X:0A03 Y:9057 SP:09EA U:02FF DP:00 EF..N..C
.C:bcaf  32 7B       LEAS -5,S           - A:80 B:40 X:0A03 Y:9057 SP:09E9 U:02FF DP:00 EF..N..C
.C:bcb1  10 DE 2C    LDS <$2C            - A:80 B:40 X:0A03 Y:9057 SP:09E4 U:02FF DP:00 EF..N..C
.C:bcb4  EC E4       LDD ,S              - A:80 B:40 X:0A03 Y:9057 SP:0000 U:02FF DP:00 EF...Z.C
.C:bcb6  DD 2C       STD <$2C            - A:00 B:00 X:0A03 Y:9057 SP:0000 U:02FF DP:00 EF...Z.C
.C:bcb8  DE 33       LDU <$33            - A:00 B:00 X:0A03 Y:9057 SP:0000 U:02FF DP:00 EF...Z.C
.C:bcba  EC 62       LDD 2,S             - A:00 B:00 X:0A03 Y:9057 SP:0000 U:053A DP:00 EF.....C
.C:bcbc  DD 33       STD <$33            - A:05 B:3A X:0A03 Y:9057 SP:0000 U:053A DP:00 EF.....C
.C:bcbe  4F          CLRA                - A:05 B:3A X:0A03 Y:9057 SP:0000 U:053A DP:00 EF.....C
.C:bcbf  E6 64       LDB 4,S             - A:00 B:3A X:0A03 Y:9057 SP:0000 U:053A DP:00 EF...Z..
.C:bcc1  F7 02 20    STB $0220           - A:00 B:0C X:0A03 Y:9057 SP:0000 U:053A DP:00 EF......
.C:bcc4  4F          CLRA                - A:00 B:0C X:0A03 Y:9057 SP:0000 U:053A DP:00 EF......
.C:bcc5  E6 64       LDB 4,S             - A:00 B:0C X:0A03 Y:9057 SP:0000 U:053A DP:00 EF...Z..
.C:bcc7  F7 EF FC    STB $EFFC           - A:00 B:0C X:0A03 Y:9057 SP:0000 U:053A DP:00 EF......
spet_bank := 12
spet_ctrlwp := 1
.C:bcca  CC 00 01    LDD #$0001          - A:00 B:0C X:0A03 Y:9057 SP:0000 U:053A DP:00 EF......
.C:bccd  32 67       LEAS 7,S            - A:00 B:01 X:0A03 Y:9057 SP:0000 U:053A DP:00 EF......
.C:bccf  39          RTS                 - A:00 B:01 X:0A03 Y:9057 SP:0007 U:053A DP:00 EF......
.C:1400  00 00       NEG <$00            - A:00 B:01 X:0A03 Y:9057 SP:0009 U:053A DP:00 EF......
.C:1402  00 00       NEG <$00            - A:00 B:01 X:0A03 Y:9057 SP:0009 U:053A DP:00 EF...Z..
.C:1404  00 00       NEG <$00            - A:00 B:01 X:0A03 Y:9057 SP:0009 U:053A DP:00 EF...Z..
.C:1406  00 00       NEG <$00            - A:00 B:01 X:0A03 Y:9057 SP:0009 U:053A DP:00 EF...Z..


       Message was sent through the cbm-hackers mailing list
Received on 2012-02-04 00:00:33

Archive generated by hypermail 2.2.0.