Stone Oakvalley's Authentic SID Collection (SOASC=)
The automated Commodore 64 SID Music recorded to MP3/FLAC. Project based on High Voltage SID Collection & Compute's Gazette SID (CGSC)


                      
More music:  
   



T H E   R E A L   D E A L   I N    - A U T H E N T I C -    C O M M O D O R E   6 4   M U S I C  !



Code of Automation!
in All about SOASC= | Sunday, September 06, 2015 | 17:52


Presented here are the 3 techniques that helped me with autoboot and loading with a neat combination of MMC64 and SD2IEC hardware, including assembly code, autorun poke trick and just simple BASIC code - all harmonically working together :-)


Step 1: MMC64 BOOT.BIN Assembly project

This code is not mine, I was lucky to find a technique to allow MMC64 to autoboot a program once the Commodore 64 was switched on. I'm not a assembly expert, and I did notice if the imported code was too big trashed bytes started to appear in the listing. So, whatever that means it doesn't matter, as I ended up only needing 1 single line of code anyway (see step 2 below).

The assembly code was found (and then modified by me and Waxhead prior to compiling). It was compiled using "DASM 2.20.11 20140304".

The final BOOT.BIN you can include in your own project in case you have severe problems getting such techniques to function yourselves. Just remember to replace the bytes in the BOOT.BIN ("STICKLOAD.PRG") to your desired loading filename from a ,8 device (Floppy Disk or other means of ,8 device emulation for Commodore 64).

; 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 # bne mikeCopy
lda srcptr+1
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 "STICKLOAD.PRG"
top:



Step 2: MMC64 Mini Basic Loader

A simple program called MMC64_Loader.PRG with the following code:

10 CLOSE 15
11 OPEN#15,8,15:PRINT#15,"CD//"
13 LOAD "STICKLOAD.PRG",8,1

was saved as .PRG file, then included into the assembly project included into the SYSTEM64/BOOT.BIN explained above. When executed from the MMC64 Cartridge automatically, it will simply load my "STICKLOAD.PRG" of the ,8 device of SD2IEC's SD Card. The reference to #15,8,15 is to open up control channel on the SD2IEC device and default back to root on the SDCARD (since we are changing directories on the SDCARD depending on HVSC release and PAL/NTSC variations so that we can load the PRG file needed.



Step 2: SD2IEC StickLoad BASIC

A even similar simple BASIC program was created, saved as .PRG, then EXOMIZED (to ensure it does not locate itself in the BASIC area, as other SID BASIC based tunes would be trashed or junked if I didn't). The exomized PRG file was placed onto the SD2IEC SD Card into ROOT, together with the needed PSID64 SID to PRG converted files, all formatted as a 8 numeric filename, like "00010001.PRG".

Further by using the control command channel #15 on SD2IEC device, we can also jump into the appropriate SDCARD directory when dealing with multiple HVSC releases with PAL/NTSC variations.

First it detects 2 characters (for HVSC release ID number), then 0 or 1 for PAL or NTSC, and finally a 8digit filename .PRG reference.


StickLoad code:

2 PRINT"dir:"
3 A=PEEK(56321):B=PEEK(56320)
4 IFA=254THENA$="0":GOSUB15
5 IFA=253THENA$="1":GOSUB15
6 IFA=251THENA$="2":GOSUB15
7 IFA=247THENA$="3":GOSUB15
8 IFA=239THENA$="4":GOSUB15
9 IFB=126THENA$="5":GOSUB15
10 IFB=125THENA$="6":GOSUB15
11 IFB=123THENA$="7":GOSUB15
12 IFB=119THENA$="8":GOSUB15
13 IFB=111THENA$="9":GOSUB15
14 GOTO3
15 FORT=0TO300:NEXT
16 PRINTA$;
17 B$=B$+A$
18 IFLEN(B$)=2THENGOTO20
19 RETURN
20 B$=B$+"/":PRINT
21 PRINT"change to cd/sid"CHR$(95)"conv"CHR$(95)B$
22 OPEN15,8,15
23 PRINT#15,"cd/sid"CHR$(95)"conv"CHR$(95)B$
24 PRINT"":FORT=0TO10:NEXT
26 PRINT"chip:"
27 C=PEEK(56321)
28 IFC=254THENC$="pal/":PRINT"0":GOSUB34
29 IFC=253THENC$="ntsc/":PRINT"1":GOSUB34
30 GOTO27
31 FORT=0TO300:NEXT
34 PRINT:PRINT"change to cd/"C$"prg/"
35 PRINT#15,"cd/"C$:PRINT#15,"cd/prg/"
36 CLOSE 15
37 PRINT"":FORT=0TO150:NEXT
39 PRINT"song:"
40 E=PEEK(56321):F=PEEK(56320)
41 IFE=254THENE$="0":GOSUB52
42 IFE=253THENE$="1":GOSUB52
43 IFE=251THENE$="2":GOSUB52
44 IFE=247THENE$="3":GOSUB52
45 IFE=239THENE$="4":GOSUB52
46 IFF=126THENE$="5":GOSUB52
47 IFF=125THENE$="6":GOSUB52
48 IFF=123THENE$="7":GOSUB52
49 IFF=119THENE$="8":GOSUB52
50 IFF=111THENE$="9":GOSUB52
51 GOTO40
52 FORT=0TO270:NEXT
53 PRINTE$;
54 F$=F$+E$
55 IFLEN(F$)=8THENGOTO58
56 RETURN
58 F$=F$+".prg"
59 FORL=54272TO54296:POKEL,0:NEXT
60 PRINT:PRINT"loading "F$
61 POKE631,82:POKE 632,85
62 POKE633,78:POKE 634,13
63 POKE198,4
64 LOADF$,8,1


Replace these chars for MMC64 BOOT.BIN file to autoboot your own program if needed :-)



Example of STICKLOAD.PRG

Simply output and stores a number sequence of 8 numeric chars which are read from joystick port movements, .PRG is added to the final string which automatically starts loading when it reached a max number of 8 digits. The number will refer to an PSID64 SID to PRG unique file which contains the music to be recorded.




Please review these related article links:
Click to open binThe actual working BOOT.BIN for MMC64 (place into SYSTEM64 directory).
Click to open sSource Code for MMC64 BOOT.BIN (use dasm to compile)
Click to open urlMMC64 boot.bin (retrohackers.org) forum post


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Posted by: Old-schooler, Stone Oakvalley | Publisher: Crazy Multi Talent, Stone Oakvalley
Last revised: November 15, 2016 - 01:02 | Page views: 1074


Website Design by post@stone-oakvalley-studios.com - Copyright © 2017 www.stone-oakvalley-studios.com