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?