Page 2 of 2

Re: 1540 memory write

Posted: Tue Dec 14, 2021 4:18 pm
by bjonte
srowe wrote: Tue Dec 14, 2021 1:03 pm Are you signalling EOI correctly? The timing before the first bit of the last byte is special, see

https://www.pagetable.com/?p=1135
I'm only using kernal calls so I don't know how I can mess it up. The kernal is buffering one byte to signal end of message when the unlisten call happens so I'm guessing there's a glitch there somewhere so the last byte is trashed. It appears to often become $02, but I have seen $22, $04 and $06 as well.

Re: 1540 memory write

Posted: Tue Dec 14, 2021 4:33 pm
by bjonte
tlr wrote: Tue Dec 14, 2021 12:41 pm Sounds weird... could you post some example code?
The relevant part from Robotic Liberation (with the same problem) is:

Code: Select all

-- open file
.C:1149  A2 08       LDX #$08
.C:114b  A0 0F       LDY #$0F
.C:114d  98          TYA
.C:114e  20 BA FF    JSR $FFBA
.C:1151  A9 00       LDA #$00
.C:1153  20 BD FF    JSR $FFBD
.C:1156  20 C0 FF    JSR $FFC0
.C:1159  B0 AD       BCS $1108
.C:115b  A2 0F       LDX #$0F
.C:115d  20 C9 FF    JSR $FFC9
.C:1160  B0 A6       BCS $1108
-- send backwards M-W
.C:1162  A0 06       LDY #$06
.C:1164  B9 AE 11    LDA $11AE,Y
.C:1167  20 D2 FF    JSR $FFD2
.C:116a  88          DEY
.C:116b  D0 F7       BNE $1164
-- send chunk
.C:116d  B1 FB       LDA ($FB),Y
.C:116f  20 D2 FF    JSR $FFD2
.C:1172  C8          INY
.C:1173  C0 14       CPY #$14
.C:1175  D0 F6       BNE $116D
.C:1177  20 CC FF    JSR $FFCC
-- move pointers
.C:117a  18          CLC
.C:117b  A5 FB       LDA $FB
.C:117d  69 14       ADC #$14
.C:117f  85 FB       STA $FB
.C:1181  90 03       BCC $1186
.C:1183  18          CLC
.C:1184  E6 FC       INC $FC
.C:1186  AD B1 11    LDA $11B1
.C:1189  69 14       ADC #$14
.C:118b  8D B1 11    STA $11B1
.C:118e  AA          TAX
.C:118f  A9 00       LDA #$00
.C:1191  6D B0 11    ADC $11B0
.C:1194  8D B0 11    STA $11B0
.C:1197  E0 1A       CPX #$1A
.C:1199  E9 06       SBC #$06
.C:119b  90 BE       BCC $115B
-- execute code
.C:119d  A2 0F       LDX #$0F
.C:119f  20 C9 FF    JSR $FFC9
.C:11a2  A9 55       LDA #$55
.C:11a4  20 D2 FF    JSR $FFD2
.C:11a7  A9 33       LDA #$33
.C:11a9  20 D2 FF    JSR $FFD2
.C:11ac  4C CC FF    JMP $FFCC

Re: 1540 memory write

Posted: Fri Dec 17, 2021 5:27 am
by tlr
Looks pretty weird. It could be a race condition with the 1540 timing, but you'd think that would have been noticed. Still it wasn't produced that long so I suppose something could have slipped through the net and then have been fixed in the 1541.

What happens if you switch a 1541 to 1540 timing with OPEN 15,8,15, "UI-" : CLOSE 15?

Re: 1540 memory write

Posted: Fri Dec 17, 2021 1:30 pm
by bjonte
tlr wrote: Fri Dec 17, 2021 5:27 am Looks pretty weird. It could be a race condition with the 1540 timing, but you'd think that would have been noticed. Still it wasn't produced that long so I suppose something could have slipped through the net and then have been fixed in the 1541.

What happens if you switch a 1541 to 1540 timing with OPEN 15,8,15, "UI-" : CLOSE 15?
It appears to be working fine.

Re: 1540 memory write

Posted: Fri Dec 17, 2021 1:58 pm
by tlr
If it works on a 1541 in 1540 mode, then it isn't the normal timing issue, rather some other discrepancy. Probably have to check the diffs between the roms to find out.

Re: 1540 memory write

Posted: Sat Dec 18, 2021 2:32 am
by ops
bjonte wrote: Tue Dec 14, 2021 4:33 pm The relevant part from Robotic Liberation (with the same problem) is:
I don't know if I'm testing correctly but this works OK

Code: Select all

xvic -default -drive8type 1540 -drive8truedrive liberation.d64

Re: 1540 memory write

Posted: Sat Dec 18, 2021 2:52 am
by ops
ops wrote: Sat Dec 18, 2021 2:32 am I don't know if I'm testing correctly but this works OK
Whoops, not so fast. It really fails sometimes!

Re: 1540 memory write

Posted: Sat Dec 18, 2021 4:25 am
by crusti
8bit guy has a episode on the CBM disk range.
Skipping the first section, he explains some of the little differences between the 1540 and the 1541
https://youtu.be/6QBXY8dx8ZA?t=139

I'm hoping it may help as it kinda explains the firmware difference.