From 236736decd5b4f9a74cff525340d9e88b64821f5 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 28 Oct 2018 00:18:00 -0400 Subject: [PATCH] megamusic: more language card support --- megamusic/Makefile | 2 +- megamusic/falling_apple.s | 15 +++---- megamusic/megaload.s | 95 +++++++++++++++++++++++++++++++++++---- megamusic/music_1000.s | 10 ++++- 4 files changed, 102 insertions(+), 20 deletions(-) diff --git a/megamusic/Makefile b/megamusic/Makefile index 6cf5dd8a..ef554455 100644 --- a/megamusic/Makefile +++ b/megamusic/Makefile @@ -10,7 +10,7 @@ all: megamusic.dsk megamusic.dsk: MEGAMUSIC MEGALOAD HALFMUSIC MUSIC.D000X2 MUSIC.D000 MUSIC.1000 $(DOS33) -y megamusic.dsk BSAVE -a 0x1000 MUSIC.1000 $(DOS33) -y megamusic.dsk BSAVE -a 0x4000 MUSIC.D000 - $(DOS33) -y megamusic.dsk BSAVE -a 0xD000 MUSIC.D000X2 + $(DOS33) -y megamusic.dsk BSAVE -a 0x4000 MUSIC.D000X2 $(DOS33) -y megamusic.dsk BSAVE -a 0x4000 MEGAMUSIC $(DOS33) -y megamusic.dsk BSAVE -a 0x4000 HALFMUSIC $(DOS33) -y megamusic.dsk BSAVE -a 0x800 MEGALOAD diff --git a/megamusic/falling_apple.s b/megamusic/falling_apple.s index bb904603..98b818d5 100644 --- a/megamusic/falling_apple.s +++ b/megamusic/falling_apple.s @@ -150,21 +150,20 @@ page1_loop: ; delay 115+(7 loop)+4 (bit)+4(extra) ; -1 (+1-2) from above ; -25 inc framecount ; -7 see if timeout - ;-1023 play_music + ;-1031 play_music ; -10 keypress ;================ - ; 3484 + ; 3476 - jsr play_music ; 6+1017 + jsr play_music ; 6+1025 + ; Try X=29 Y=23 cycles=3474 R2 - ; Try X=231 Y=3 cycles=3484 + nop - - - ldy #3 ; 2 -faloop1:ldx #231 ; 2 + ldy #23 ; 2 +faloop1:ldx #29 ; 2 faloop2:dex ; 2 bne faloop2 ; 2nt/3 dey ; 2 diff --git a/megamusic/megaload.s b/megamusic/megaload.s index 49dca304..ed0e2bdf 100644 --- a/megamusic/megaload.s +++ b/megamusic/megaload.s @@ -19,7 +19,8 @@ tmptrk = $fe ; temporary copy of current track phase = $ff ; current phase for /seek - dirbuf = $1e00 ; note, don't put this immediately below + dirbuf = $2200 + ; $1e00 ; note, don't put this immediately below ; the value being read as destaddr-4 ; is temporarily overwritten during read ; process @@ -31,6 +32,66 @@ start: jsr init ; unhook DOS, init nibble table + ; Language card! READ ROM, WRITE RAM, $D000 bank 1 + lda $c089 + lda $c089 + + ; open and read a file + lda #md000_filename + sta namhi + jsr opendir ; open and read entire file into memory + + ; copy 12k from $4000 to $d000 + + ldy #0 +yloop: + ldx #0 +xloop: +xloop_smc1: + lda $4000,X +xloop_smc2: + sta $D000,X + inx + bne xloop + iny + inc xloop_smc1+2 + inc xloop_smc2+2 + cpy #48 + bne yloop + + + ; open and read a file + lda #md000x2_filename + sta namhi + jsr opendir ; open and read entire file into memory + + ; Language card! READ ROM, WRITE RAM, $D000 bank 2 + lda $c081 + lda $c081 + + ; copy 4k from $4000 to $d000 + + ldy #0 +yloop2: + ldx #0 +xloop2: +xloop2_smc1: + lda $4000,X +xloop2_smc2: + sta $D000,X + inx + bne xloop2 + iny + inc xloop2_smc1+2 + inc xloop2_smc2+2 + cpy #16 + bne yloop2 + + ; open and read a file lda #half_filename -; sta namhi -; jsr opendir ; open and read entire file into memory + lda #m1000_filename + sta namhi + jsr opendir ; open and read entire file into memory + + + + jmp $4000 ; jump to entry point @@ -55,9 +120,21 @@ megademo_filename: ;.byte "MEGAMUSIC " .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .byte $A0,$A0,$A0,$A0,$A0,$A0 -half_filename: ;.byte "HALFMUSIC " - .byte 'H'|$80,'A'|$80,'L'|$80,'F'|$80,'M'|$80,'U'|$80,'S'|$80,'I'|$80 - .byte 'C'|$80,$A0,$A0,$A0,$A0,$A0,$A0,$A0 +m1000_filename: ;.byte "MUSIC.1000 " + .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'1'|$80,'0'|$80 + .byte '0'|$80,'0'|$80,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0 + +md000_filename: ;.byte "MUSIC.D000 " + .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'D'|$80,'0'|$80 + .byte '0'|$80,'0'|$80,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0 + +md000x2_filename: ;.byte "MUSIC.D000X2 " + .byte 'M'|$80,'U'|$80,'S'|$80,'I'|$80,'C'|$80,'.'|$80,'D'|$80,'0'|$80 + .byte '0'|$80,'0'|$80,'X'|$80,'2'|$80,$A0,$A0,$A0,$A0 .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .byte $A0,$A0,$A0,$A0,$A0,$A0 diff --git a/megamusic/music_1000.s b/megamusic/music_1000.s index 86d88d16..bdea32f1 100644 --- a/megamusic/music_1000.s +++ b/megamusic/music_1000.s @@ -75,13 +75,16 @@ MB_FRAME = $94 MB_PATTERN = $95 ; takes + ; 4 + ; 3 + 79 + ; 80 + 82 + 88 + ; 80 + 82 + 88 + ; 80 + 82 + 88 + ; 80 + 80 + - ; 21 = 1017 + ; 25 = 1025 play_music: + ; turn on language card + lda $C088 ; 4 ; self-modify the code lda MB_PATTERN ; 3 @@ -241,10 +244,13 @@ mb_no_change: nop ; 2 mb_done_change: + ; restore language card + lda $C08A ; 4 rts ; 6 ;======= - ; 21 + ; 25 +.align $100 .include "mockingboard.s" .align $100