Jump to content

Photo

Which Harmony-compatible bankswitching gives most ROM/RAM?


6 replies to this topic

#1 Sdw OFFLINE  

Sdw

    Star Raider

  • 71 posts
  • Location:Sweden

Posted Fri Nov 18, 2011 6:56 AM

If I understand things correctly, the Harmony has 32kb of space for the cartridge ROM and 8kb of RAM.
However, there is no bankswitching method that uses all of these.
Which of the exisiting ones gives the best combination of ROM and RAM?
Looking at some charts of 2600 bankswitching methods, I'm guessing the E7/M-Network Bankswitch which seems to give access to 14kb of ROM and 2kb of RAM.

I've also read in the manual that custom bankswitching methods could be implemented in the Harmony. Is it theoretically possible to create some kind of super-bankswitch-method that gives access to the full 32kb ROM+8kb RAM?

Edited by Sdw, Fri Nov 18, 2011 6:56 AM.


#2 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 8,272 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Fri Nov 18, 2011 10:04 AM

You won't get the full amount as the custom bankswitching driver itself takes up some room. The best so far is probably DPC+, which gives you 24K ROM + 4K RAM.

The driver that makes the DPC+ bankswitching work is 3K. The way it's configured you get 24K (six 4K banks) directly accessible to the 6507 and 4K of RAM (known as Display Data) that's accessed via the DPC+ registers. 4K of ROM holds the initial state of the Display Data, and another 1K holds the frequency data for the 3-voice music.

32K = 24K 6507 + 4K Display Data initial state + 1K frequency data + 3K bankswitch driver

The 3K driver is copied into RAM(as is the frequency data) as it runs faster from RAM and timing is very critical.
8K RAM = 4K Display Data + 3K driver + 1K frequency data

DPC+ also lets you use ARM code in your programs, an example of which is Frantic.

Edited by SpiceWare, Fri Nov 18, 2011 10:06 AM.


#3 Sdw OFFLINE  

Sdw

    Star Raider

  • Topic Starter
  • 71 posts
  • Location:Sweden

Posted Fri Nov 18, 2011 12:41 PM

Thanks, that's good info!

But what if I want to have "normally" accessible RAM, that is RAM that I can actually put code in, access and modify with normal instructions (I like selfmodifying code :D), the E7 is still my best bet?

#4 SpiceWare OFFLINE  

SpiceWare

    Quadrunner

  • 8,272 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Fri Nov 18, 2011 1:13 PM

3E might be an option. The format can handle up to 512K ROM and 32K of RAM (supported by the Krokodile Cartridge) Harmony supports up to 4K of RAM with 3E, I don't know how much ROM it supports.

For most RAM there's the Supercharger format, it has 6K. It doesn't have ROM per say, the Supercharger used audio cassettes to store the program and would load it into the RAM. It can load in additional code on demand, though it's not instantaneous. The Harmony emulates this by storing the code within the BIN file. I think up to 32K, but I think there's also some overhead to mark the code. I'm not familiar with how to code for the Supercharger, so you'd have to do some research if 6K of RAM sounds interesting.

#5 Sdw OFFLINE  

Sdw

    Star Raider

  • Topic Starter
  • 71 posts
  • Location:Sweden

Posted Mon Nov 21, 2011 10:17 AM

3E seems like a good choice. Frmo what I've found while searching threads here on the forum, Harmony should be able to handle 32kb ROM and 4kb RAM with 3E, which would be great!
However, I'm having a hard time getting it to work.
I've assembled a test-program, at the moment haven't even started on getting the RAM ($3e-writes) to work, just the normal $3f ROM-bankswitching.
In Stella, it fails if I just run it as a .bin (since it autodetects the wrong bankswitching) but if I manually set it to 3E using the "Game properties", it works as expected.

On my real 2600 with Harmony cart however, it doesn't work. With BIN extension, it fails to run at all, (diagonal lines) and with the extension as .3E it starts, but seems to set garbage in the registers (I get strange background color and a tone) and it locks up.

Here's my example:

.import source "vcs_base40.inc"

.var FRAME=$80
.var BANK=$81

.pc = $0000 "Bank1"
.fill    2048,$00

.pc = * "Bank2"
.fill    2048,$02

.pc = * "Bank3"
.fill    2048,$04

.pc = * "Bank4"
.fill    2048,$06

.pc = * "Bank5"
.fill    2048,$08

.pc = * "Bank6"
.fill    2048,$0a

.pc = * "Bank7"
.fill    2048,$0c

.pc = * "Bank8"
.fill    2048,$0e

.pc = * "Bank9"
.fill    2048,$0c

.pc = * "Bank10"
.fill    2048,$0a

.pc = * "Bank11"
.fill    2048,$08

.pc = * "Bank12"
.fill    2048,$06

.pc = * "Bank13"
.fill    2048,$04

.pc = * "Bank14"
.fill    2048,$02

.pc = * "Bank15"
.fill    2048,$64

.pc = * "Bank16"
.pseudopc $f800
{
    lda #$00
    sta $3f    
start:
    ldx #$00
    txa
clear:
   dex
   txs
   pha
   bne clear
frameloop:
    // Start of vertical blank processing
    lda #0
    sta VBLANK
    lda #2
    sta VSYNC
    lda #$00
    sta COLUBK

     // 3 scanlines of VSYNCH signal...
   sta WSYNC
    sta WSYNC
    sta WSYNC

   lda #0
    sta VSYNC		  

    // 37 scanlines of vertical blank...
    lda #127+44
    sta TIM64T
    
    // Do stuff
            
!wait:    
    lda INTIM
    and #$80
    bne !wait-
    sta WSYNC
            
   // 242 scanlines of picture...
   ldy #242
!loop:    
    sta WSYNC
    lda $f000,y
    sta COLUBK
    dey		         
    bne !loop-             

    // end of screen - enter blanking
   lda #%01000010
    sta VBLANK	      	     

    // 30 scanlines of overscan...
    lda #127+36
    sta TIM64T    
    
    inc FRAME    
    lda FRAME
    and #$0f
    bne !skip+
    inc BANK
    lda BANK
    cmp #$0f
    bne doit
    lda #$00
    sta BANK
doit:    
    sta $3f
!skip:    
        
    
!wait:    
    lda INTIM
    and #$80
    bne !wait-
    sta WSYNC

   jmp frameloop    
    rts   
    
}

.pc =$7ffa "Vectors"
    .word start // NMI
    .word start // RESET
    .word start // IRQ


And here's the layout of the assembled binary
Memory Map
----------
$0000-$07ff Bank1
$0800-$0fff Bank2
$1000-$17ff Bank3
$1800-$1fff Bank4
$2000-$27ff Bank5
$2800-$2fff Bank6
$3000-$37ff Bank7
$3800-$3fff Bank8
$4000-$47ff Bank9
$4800-$4fff Bank10
$5000-$57ff Bank11
$5800-$5fff Bank12
$6000-$67ff Bank13
$6800-$6fff Bank14
$7000-$77ff Bank15
$7800-$7867 Bank16
$7ffa-$7fff Vectors

The program *should* flash the screen in all the grey colors (with color data fetched from the different banks) and then finally in red before restarting. (this is all PAL btw)

Here's the compiled binary:
http://ag1976.com/tmp/3e.bin

What have I done wrong?

#6 cd-w OFFLINE  

cd-w

    Stargunner

  • 1,249 posts
  • Juno First!
  • Location:Glasgow, UK

Posted Mon Nov 21, 2011 11:11 AM

I don't think Harmony can support 3E with 32KB - you may be able to get it to work by reducing the ROM usage.

Harmony has 32KB of Flash, but some of that is required for the bootloader and menu system. For normal 32KB ROMS (F4, F4SC), some of the RAM is used to compensate, but I'm not sure if that support was ever extended to 3E.

Chris

#7 Sdw OFFLINE  

Sdw

    Star Raider

  • Topic Starter
  • 71 posts
  • Location:Sweden

Posted Mon Nov 21, 2011 4:30 PM

Since my testprogram didn't use the extra RAM yet, I actually tried and renamed it to .3F instead, and then it worked on my Harmony.
So a 32k ROM with 3F bankswitching seems to work fine.

However, when running in 3E mode, it doesn't work. I tried dropping the size by removing two banks, giving me a 28k ROM, but it still didn't work.

I guess now we need someone with real insight to tell us how the 3E support in Harmony works!




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users