; Creates a boot.bin for MMC64, works with BIOS v1.10 and FAT16 ; The basic program is autostarted by placing pokes into keyboard cache and setting the keyboard buffer length which ends with a RETURN $13 to ; execute the included program automatically. MMC64 is disabled. ;Source heavily based on source found at http://retrohackers.com/viewtopic.php?f=6&t=401 ;Source modifed by Waxhead with final fix of compiling flags such as dasm.exe boot_bin_loader_mmc64.s -f3 -oBOOT.BIN ;This source and technique was key to automation during ROTS (Return of the SOASC=) project 2015. 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 ; 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 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 ;Pokes in run+cr+ into keyboard cache (631,632,633,634) and sets 4 chars in buffer into POKE 198 = RUNs automatically the loaded program as coded in the test.prg basic program lda #82 ; R sta 631 lda #85 ; U sta 632 lda #78 ; N sta 633 lda #13 ; RETURN sta 634 lda #4 sta 198 rts org $207f ;set this low, when dasm complains use that value instead rorg $207f ;set this low, when dasm complains use that value instead bottom: incbin "MMC64_Loader.prg" top: