Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Kernal save (again)
2018-10-08 13:00
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..
 
... 10 posts hidden. Click here to view all posts....
 
2018-10-08 14:55
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.
2018-10-08 16:43
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...
2018-10-08 17:11
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
2018-10-08 17:29
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... ;)
2018-10-08 17:29
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Don't expect an official patch anytime soon... ;)

Hehe no. I just avoid it.
2018-10-08 17:30
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.
2018-10-08 17:39
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.
2018-10-08 18:15
JackAsser

Registered: Jun 2002
Posts: 2014
Quote: Yes. Lda, and, ora, sta seems fine.

Which makes it my bug.. :)
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
The Human Co../Maste..
Flashback
E$G/HF ⭐ 7
Shake/Role
Hoild/Ultimate Newco..
Chesser/Blazon
El Gato
Steffan/BOOM!
v3nt0r/ibex-crew
aNdy/AL/Cosine
t0m3000/hf^boom!^ibx
MCM/ONSLAUGHT
Fred/Channel 4
Hobbit/Laser Inc.
Guests online: 131
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.043 sec.