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 > Save-feature on the Easy Flash
2018-02-20 16:30
TWW

Registered: Jul 2009
Posts: 541
Save-feature on the Easy Flash

According to what I have (superficially) have read, the EasyFlash allows you to save data on the fly to the cartridge. I don't know of any other HW which allows this.

I was wondering if this could have been used as a "save game" functionality or is this a bad idea?

Reason I ask is due to a crack project I'm working on (for ages) which is made for the "C64 Game System Cartridge" and I was wondering if I could get rid of the need for any disk IO by porting it to EasyFlash.
 
... 17 posts hidden. Click here to view all posts....
 
2018-02-22 09:12
oziphantom

Registered: Oct 2014
Posts: 478
You need 2 chip packets of 8K each per "Bank", one for the $8000 and one for $a000

Note that the device starts in UltimaxMode so ExROM/Game needs to be set up for Ulitmax.
2018-02-22 09:14
oziphantom

Registered: Oct 2014
Posts: 478
Quote: GMOD2 also has flash memory for game state saves. I am not sure if you can buy this as an end consumer though

EEPROM for saves, as the Flash can only be written by an E rev. So you save to the Serial EEPROM.
2018-02-22 09:20
TWW

Registered: Jul 2009
Posts: 541
Yeah I was reading in the docs here that it boots in Ultimax and that you need to use the $fffc vector to make shit happen. I was hoping to use only one 8k bank at a time but seems you're need to use 2 at start-up and then set it up as you wish after that (fair enough). Will fiddle with it some more.
2018-02-22 09:45
Knight Rider

Registered: Mar 2005
Posts: 114
It looks like you are trying to reinvent the wheel. See here http://codebase64.org/doku.php?id=base:code_sample&s[]=easyflash
2018-02-22 13:53
TWW

Registered: Jul 2009
Posts: 541
In order to understand the wheel you have to reinvent the wheel ;-)

I had seen that framework but it (as far as I can tell) does not build the .crt fram around the binary.
2018-02-22 15:02
Knight Rider

Registered: Mar 2005
Posts: 114
Maybe you are overthinking it ? At the end you need a $FF padded 1024mb file.

Take C64 FIBR as an example. 1st your "standard" code and:

;64TASS
;
; =============================================================================
; 01;0;0000 (LOROM, bank 1)
bankStart_01_0
.logical $8000

Bank01x
.logical $0801
Bank01i
        .binary "fibr.prg",$02
.here
Bank01L = * - Bank01x

.rept $c000-*
  .byte $FF
.next
		
.here

         .fill $f7fff,$ff

* = $fffff
         .byte $ff


Built:

"...\64tass-1.53.1515\64tass" --long-address --no-warn ef.tas -b -o fibr.bin 
"...\WinVICE-3.1-x86\cartconv" -i fibr.bin -t easy -o fibr_ef.crt
2018-02-23 01:56
TWW

Registered: Jul 2009
Posts: 541
Got it working once I setup the binary file correctly. here's the framework in case it could be of use to someone:


/*-----------------------------------------------------------------------------

    EasyFlash Cartridge Framework

-----------------------------------------------------------------------------*/


    // Cartridge Parameters
    // ====================

    // Cartridge Header Parameters
    // ---------------------------
    .const CartridgeHeaderSize     = $40                         // #$40 is default Double Word (Big endian)
    .const CartridgeVersion        = 1.000                       // High/Low Order Fixed Point Word
    .const CartridgeType           = 32                          // 32 = EasyFlash (Big Endian)
    .const CartridgeEXROM          = 0                           // 0 = Inactive & 1 = Active.
    .const CartridgeGAME           = 1                           // 0 = Inactive & 1 = Active.
    .const CartridgeName           = "EasyFlash Cartridge"       // Maximum 32 bytes.

    // Chip Header Parameters
    // ----------------------
    .const CartridgeChipHeaderSize = $10                         // Size of Bank Header Integer (#$10 is default)
    .const CartridgeChipSize       = $2000                       // Size of Cartridge Banks Integer
    .const CartridgeChipType       = 2                           // 0 = ROM, 1 = RAM, 2 = Flash. Word (Big Endian)
    .var CartridgeChipNumber       = 0                           // ID Number for the Chips
    .const CartridgeLocationLo     = $8000                       // Cartridge ROM address on the C64 Word (Big Endian)
    .const CartridgeLocationHi     = $a000                       // Cartridge ROM address on the C64 Word (Big Endian)
    .var CartridgeLocation = CartridgeLocationLo

    // Cartridge Header File
    // =====================

    .pc = $0000 "Cartridge Header"

    .text "C64 CARTRIDGE   "
    .dword _SwitchEndian32(CartridgeHeaderSize)
    .byte CartridgeVersion, round([CartridgeVersion-floor(CartridgeVersion)]*1000)
    .word _SwitchEndian16(CartridgeType)
    .byte CartridgeGAME, CartridgeEXROM
    .fill 6,0
    .encoding "petscii_upper"
    .text CartridgeName
    .encoding "screencode_mixed"
    .fill 32-CartridgeName.size(),0


    // Macros
    // ======

    // Macro to set chip header for each bank (to be called at each bank)
    .macro ChipHeader() {
        .text "CHIP"
        .dword _SwitchEndian32(CartridgeChipHeaderSize + CartridgeChipSize)
        .word _SwitchEndian16(CartridgeChipType)
        .word _SwitchEndian16(CartridgeChipNumber)
        .word _SwitchEndian16(CartridgeLocation)
        .if (CartridgeLocation==CartridgeLocationLo) {
            .eval CartridgeLocation = CartridgeLocationHi
        } else {
            .eval CartridgeLocation = CartridgeLocationLo
            .eval CartridgeChipNumber++
        }
        .word _SwitchEndian16(CartridgeChipSize)
    }


    // Functions
    // =========

    // Switches endian on a 16 bit argument
    .function _SwitchEndian16(argument) {
        .return floor(argument / $100) + floor([argument/$100-floor(argument / $100)]*256)*256
    }

    // Switches endian on a 32 bit argument
    .function _SwitchEndian32(argument) {
        .return floor(argument / $1000000) + [floor(argument / $10000) - floor(argument / $1000000)*256]*256 + [floor(argument / $100) - floor(argument / $10000)*256]*$10000 + [argument - floor(argument / $100)*256]*$1000000
    }



    // LoBank #00 - Asset Manager
    // ==========================

    :ChipHeader()                       // Write the chip header for Bank #00
    .import source "Asset Manager.asm"  // Import Bank #00 which contains all the code to handle the startup and memory management etc.

    // HiBank #00 - EasyFlash Startup Bank
    //====================================

    :ChipHeader()
!Bank_Begin:

    .fill $1800,0
    // EAPI
    .import source "EasyAPI.asm"
    .encoding "petscii_upper"
    .text "EF-Name:KOL@@@@@@@@@@@@@"
    .encoding "screencode_mixed"
    .fill CartridgeChipSize - [* - !Bank_Begin-] - 2, $00
    .word $8000

    // Fill remaining banks with headers and 'null' data
    //==================================================

    .for (var i = 0 ; i < 190 - CartridgeChipNumber ; i++) {
        :ChipHeader()
    !Begin:
        .byte $00
    !End:
        .fill CartridgeChipSize - [!End- - !Begin-], $00
    }

    


Thanks for your input gents.
2018-02-26 11:55
Maxlide

Registered: Apr 2003
Posts: 29
Quoting TWW
(...)

.fill $1800,0
// EAPI
.import source "EasyAPI.asm"
.encoding "petscii_upper"
.text "EF-Name:KOL@@@@@@@@@@@@@"
.encoding "screencode_mixed"
.fill CartridgeChipSize - [* - !Bank_Begin-] - 2, $00
.word $8000

// Fill remaining banks with headers and 'null' data
//==================================================

.for (var i = 0 ; i < 190 - CartridgeChipNumber ; i++) {
:ChipHeader()
!Begin:
.byte $00
!End:
.fill CartridgeChipSize - [!End- - !Begin-], $00
}


[/code]

Thanks for your input gents.

Unused areas should be filled with $FF, not $00.
2018-02-26 13:22
TWW

Registered: Jul 2009
Posts: 541
Indeed ;-) Thanks.
2018-03-02 05:43
Majikeyric

Registered: Sep 2002
Posts: 83
Is 64KB (8 banks) the smallest amount of flash rom to erase (with EAPIEraseSector) in order to save a high score table or I misunderstood something in the docs ?
Previous - 1 | 2 | 3 - 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
csabanw
Sentinel/Excess/TREX
kbs/Pht/Lxt
HCL/Booze Design
Neotec/Padua
Krill/Plush
Mason/Unicess
K-reator/CMS/F4CG
Morpheus/IPC+C64.COM
zscs
jmin
Guests online: 157
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Diskmag Editors
1 Jazzcat  (9.4)
2 Magic  (9.4)
3 hedning  (9.2)
4 Newscopy  (9.1)
5 Elwix  (9.1)

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