| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Kernal save (again)
After calling JSR $FFD8 to save a file the motor keeps spinning and the file isn't really "finalised". Works fine with Jiffy DOS, but not using the regular Kernal.
When SAVE returns I immediately throw out the kernal again and take over the system. Is there a call I need to make to "shut it down" properly or wait for it to complete the operation? Feels like some kind of race condition to me.. |
|
... 8 posts hidden. Click here to view all posts.... |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Narrowing down. :) Totally reproducible from basic.
10 REM STUPID DRIVE
SAVE "TEST",8:POKE 56576,63
This will keep the drive motor on indefinitely. |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
So, follow up question. When is it safe to touch $dd00?! |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Oh well, I didn't need to touch $dd00 after the SAVE anyway so I removed it and now it works. But still... weird. A good polling solution would be much appreciated. |
| | TWW
Registered: Jul 2009 Posts: 545 |
Hello
This from a piece of code from somewhere which might be of help:
Init:
// ========================
// Serial Bus Clock Pulse Output
lda $dd00
ora #$13
sta $dd00
InitializeDrive:
ldx #6
!: lda SetParameters,x
sta $b7,x // Set SETLFS & SETNAM
dex
bpl !-
jsr $ffc0
lda #$0f
jsr $ffc3
rts
SetParameters:
.byte $01 // Length of Filename
.byte $0f // Logical File Number
.byte $6f // Channel
.byte $08 // Device
.word FormatName
FormatName:
.text "I"
//---------------------------------------------------------------------
// Save memory to a file
//
// A = File Number/Pointer
SaveFile:
asl // A = File Pointer x 2
tax // X = File Pointer x 2
lda $01
pha // Preserve Memory Configuration
lda #$36
sta $01 // BANK KERNAL+IO+RAM
lda $d015
pha
lda #$00
sta $d015
lda FileLocationRAM_End,x
sta !SMC1++1 // File Save Memory Stop LoByte
lda FileLocationRAM_End+1,x
sta !SMC2++1 // File Save Memory Stop HiByte
lda FileLocationRAM_Start,x
sta ZP_Vector1Lo // File Save Memory Start LoByte
lda FileLocationRAM_Start+1,x
sta ZP_Vector1Hi // File Save Memory Start HiByte
ldy FileNameList+1,x // Pointer to Filename LoByte
lda FileNameList,x // Pointer to Filename HiByte
tax
lda #$03 // All filenames are 3 characters long
jsr $ffbd // SETNAM
lda #$00
tay
ldx #$08 // Device Number
jsr $ffba // SETLFS
!SMC1:
ldx #$00
!SMC2:
ldy #$00
lda #ZP_Vector1 // Start Address (ZP_Vector1)
jsr $ffd8 // SAVE
pla
sta $d015
pla
sta $01
rts
FileLocationRAM_Start:
.word $c000, $c000, $c000, $c000, $c000, $c000, $c000, $c000
.word $c000, $c000, $c000, $c000, $c000, $c000, $c000, $c000
.word $c000, $c000, $c000, $c000, $c000, $c000, $c000, $c000
.word $c000, $c000, $c000, $c000, $c000, $c000, $c000, $c000
.word $c000, $c000, $c000, $c000, $c000, $c000, $c000
FileLocationRAM_End:
.word $c080, $c080, $c080, $c080, $c080, $c080, $c080, $c080
.word $c080, $c080, $c080, $c080, $c080, $c080, $c080, $c080
.word $c080, $c080, $c080, $c080, $c080, $c080, $c080, $c080
.word $c080, $c080, $c080, $c080, $c080, $c080, $c080, $c080
.word $c080, $d000, $c7b0, $c7b0, $c7b0, $c7b0, $c7b0
FileNameList:
.word FileName00, FileName01, FileName02, FileName03, FileName04, FileName05, FileName06, FileName07
.word FileName08, FileName09, FileName0a, FileName0b, FileName0c, FileName0d, FileName0e, FileName0f
.word FileName10, FileName11, FileName12, FileName13, FileName14, FileName15, FileName16, FileName17
.word FileName18, FileName19, FileName1a, FileName1b, FileName1c, FileName1d, FileName1e, FileName1f
.word FileName20, FileName21, FileName22, FileName23, FileName24, FileName25, FileName26
FileName00: .text "T00"
FileName01: .text "W00"
FileName02: .text "W01"
FileName03: .text "W02"
FileName04: .text "W03"
FileName05: .text "W04"
FileName06: .text "W05"
FileName07: .text "W06"
FileName08: .text "W07"
FileName09: .text "W08"
FileName0a: .text "W09"
FileName0b: .text "W0A"
FileName0c: .text "W0B"
FileName0d: .text "W0C"
FileName0e: .text "W0D"
FileName0f: .text "W0E"
FileName10: .text "W0F"
FileName11: .text "W80"
FileName12: .text "W81"
FileName13: .text "W82"
FileName14: .text "W83"
FileName15: .text "W84"
FileName16: .text "W85"
FileName17: .text "W86"
FileName18: .text "W87"
FileName19: .text "W88"
FileName1a: .text "W89"
FileName1b: .text "W8A"
FileName1c: .text "W8B"
FileName1d: .text "W8C"
FileName1e: .text "W8D"
FileName1f: .text "W8E"
FileName20: .text "W8F"
FileName21: .text "WFF"
FileName22: .text "R00"
FileName23: .text "R01"
FileName24: .text "R02"
FileName25: .text "R03"
FileName26: .text "R04"
Then again maybee not... |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
TWW: try set dd00 after the jsr to save. No, this is not helpful at all. ;) saving per se is not the problem.
The ”problem” is touching dd00 immediatly after save is not safe and imho a Kernal bug |
| | tlr
Registered: Sep 2003 Posts: 1790 |
Quote: TWW: try set dd00 after the jsr to save. No, this is not helpful at all. ;) saving per se is not the problem.
The ”problem” is touching dd00 immediatly after save is not safe and imho a Kernal bug
Don't expect an official patch anytime soon... ;) |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Don't expect an official patch anytime soon... ;)
Hehe no. I just avoid it. |
| | cadaver
Registered: Feb 2002 Posts: 1160 |
Can you modify just the videobank bits, which should be safe? (ie. lda, and/or, sta). That way the ATN line is left alone, and the drive can't interpret the change as a new incoming command. |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Can you modify just the videobank bits, which should be safe? (ie. lda, and/or, sta). That way the ATN line is left alone, and the drive can't interpret the change as a new incoming command.
Yes. Lda, and, ora, sta seems fine. |
| | JackAsser
Registered: Jun 2002 Posts: 2014 |
Quote: Yes. Lda, and, ora, sta seems fine.
Which makes it my bug.. :) |
Previous - 1 | 2 - Next | |