1540 memory write

Basic and Machine Language

Moderator: Moderators

User avatar
bjonte
Vic 20 Hobbyist
Posts: 110
Joined: Sun Jan 22, 2017 5:47 am
Location: Gothenburg

Re: 1540 memory write

Post 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.
User avatar
bjonte
Vic 20 Hobbyist
Posts: 110
Joined: Sun Jan 22, 2017 5:47 am
Location: Gothenburg

Re: 1540 memory write

Post 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
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: 1540 memory write

Post 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?
User avatar
bjonte
Vic 20 Hobbyist
Posts: 110
Joined: Sun Jan 22, 2017 5:47 am
Location: Gothenburg

Re: 1540 memory write

Post 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.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: 1540 memory write

Post 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.
User avatar
ops
Vic 20 Dabbler
Posts: 88
Joined: Mon Feb 19, 2018 11:25 am
Location: Finland

Re: 1540 memory write

Post 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
User avatar
ops
Vic 20 Dabbler
Posts: 88
Joined: Mon Feb 19, 2018 11:25 am
Location: Finland

Re: 1540 memory write

Post 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!
crusti
Vic 20 Drifter
Posts: 27
Joined: Sat Nov 28, 2020 5:22 am
Location: Southampton UK

Re: 1540 memory write

Post 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.
Post Reply