I couldn't get the cart to freeze when running boot.bin, but maybe I was doing something wrong. It appears that the main problem I was having is that the MMC64 boot.bin loader uses some memory around $1000 and so loading a BASIC program directly into memory causes bad things to happen. I haven't totally verified that this is why things weren't working, but regardless, the code below works fine. And it could probably be modified to run an actual BASIC program pretty easily (as I said before this is a machine code program with a BASIC wrapper, so I'm bypassing the BASIC part).
Code:
; Loads a supersnapshot image at startup
; on an MMC64 as boot.bin
; Assembled using DASM
processor 6502
MEMCPY equ $C000
srcptr equ 34
destptr equ 36
; It appears that the MMC64 bootup copier places itself in
; memory below this, so if you load into the normal BASIC
; area then bad things happen.
org $1FFE
word $2000
; copy setup code into high memory
ldx #0
copyloop:
lda startup,x
sta MEMCPY,x
dex
bne copyloop
jmp MEMCPY
startup:
rorg MEMCPY
; disable MMC64
lda #$55
sta $df13
asl
sta $df13
lda #$FF
sta $DF11
sei
lda #2
sta 53280
sta 53281
; init system to the state it would
; be in after a normal boot
;*********************************************
ldx #$FF
sei
txs
cld
stx $d016
jsr $FF84 ; initialize I/O devices
jsr $FF87 ; initalise memory pointers
jsr $FF8A ; restore I/O vectors
jsr $FF81 ; initalise screen and keyboard
cli
lda #15
sta 53280
sta 53281
jsr $E453 ; initialize BASIC vector
jsr $E3BF ; init BASIC
; jsr $E422 ; print BASIC startup message
;*********************************************
; setup pointers to copy program into BASIC memory space
lda #<(bottom+2)
sta srcptr
lda #>(bottom+2)
sta srcptr+1
lda #$01 ; BASIC
sta destptr
lda #$08 ; BASIC
sta destptr+1
; copy program into BASIC memory
ldy #0
mikeCopy:
lda (srcptr),y
sta (destptr),y
inc srcptr
bne noCarry1
inc srcptr+1
noCarry1
inc destptr
bne noCarry2
inc destptr+1
noCarry2
lda srcptr
cmp #<top
bne mikeCopy
lda srcptr+1
cmp #>top
bne mikeCopy
lda #0
sta 53280
jmp 2061 ; go to start of freeze loader
org $2080
rorg $2080
bottom:
incbin final9.prg
top: