dya: working 6-channels, at least I think so

This commit is contained in:
Vince Weaver 2018-11-20 13:22:17 -05:00
parent b3ab064899
commit 7a83fa05af
6 changed files with 131 additions and 22 deletions

View File

@ -13,7 +13,7 @@ chiptune_dya.dsk: CHIPTUNE_PLAYER HELLO
$(DOS33) -y chiptune_dya.dsk SAVE A HELLO
$(DOS33) -y chiptune_dya.dsk BSAVE -a 0x0800 CHIPTUNE_PLAYER
$(DOS33) -y chiptune_dya.dsk BSAVE -a 0x1c00 DOTD1.KRW
$(DOS33) -y chiptune_dya.dsk BSAVE -a 0x1c00 DOTD2.KRW
$(DOS33) -y chiptune_dya.dsk BSAVE -a 0xd100 DOTD2.KRW
HELLO: hello.bas
../asoft_basic-utils/tokenize_asoft < hello.bas > HELLO

25
dya/README Normal file
View File

@ -0,0 +1,25 @@
Horrible hack of the VMW chiptune player code to try to play a 6-channel file.
There's really not enough RAM to do things this way.
Proper solution is to write a real pt3 tracker.
Hacks:
Needs 10k+10k RAM for each KRW file (converted PT3)
Needs 14k+14k for buffers
Needs 4k for player
==================
52k RAM, more than we have on stock Apple II
We cheat and use language card which gives up 64k in theory.
The problem is we use interrupts, and the interrupt routine is
hard-coded to jump into the $F000 range. IIe/IIc might
be smart enough to handle this, but older machines are not.
Hack: copy the FXXX range into the language card so it doesn't
matter?

View File

@ -4,6 +4,7 @@
; program is ~4k, so from 0xc00 to 0x1C00
LZ4_BUFFER EQU $1C00 ; $1C00 - $4400, 10k = $2800
DISK_BUFFER EQU $4400 ; for disk loading
LZ4_BUFFER2 EQU $D100 ; $D100 - $F900
UNPACK_BUFFER1 EQU $5000 ; $5000 - $8800, 14k, $3800
UNPACK_BUFFER2 EQU $8800 ; $8800 - $C000, 14k, $3800
; by using qkumba's RTS code
@ -13,7 +14,7 @@ UNPACK_BUFFER2 EQU $8800 ; $8800 - $C000, 14k, $3800
; $6000 - $C000 = 24k
NUM_FILES EQU 2
NUM_FILES EQU 1
jmp chiptune_setup
@ -33,6 +34,25 @@ chiptune_setup:
jsr rts_init
ldx #0
copy_from_ff00:
lda $ff00,X
sta $6000,X
inx
bne copy_from_ff00
; Setup language card
lda $C08B ; 4
lda $C08B ; 4 ; RR C08B = read RAM/write RAM
ldx #0
copy_to_ff00:
lda $6000,X
sta $ff00,X
inx
bne copy_to_ff00
; init variables
lda #0
@ -264,6 +284,42 @@ new_song:
sta OUTH
jsr print_both_pages
;===========================
; Load 2nd file first
;===========================
; needs to be space-padded $A0 30-byte filename
; this is hard-coded for now
lda #<readfile_filename
sta namlo
lda #>readfile_filename
sta namhi
ldy #0
ldx #30 ; 30 chars
name_loop2:
lda filename2,Y
beq space_loop2
ora #$80
sta (namlo),Y
iny
dex
bne name_loop2
beq done_name_loop2
space_loop2:
lda #$a0 ; pad with ' '
sta (namlo),Y
iny
dex
bne space_loop2
done_name_loop2:
; open and read a file
; loads to whatever it was BSAVED at (default is $D100)
jsr read_file ; read KRW file from disk
;===========================
; Load in KRW file
@ -359,7 +415,24 @@ done_name_loop:
sta $777
sta $B77
; Point LZ4 src at proper place
; Point Second LZ4 src at proper place
ldy #0
lda #>(LZ4_BUFFER2+3)
sta LZ4_SRC2+1
lda #<(LZ4_BUFFER2+3)
sta LZ4_SRC2
lda (LZ4_SRC2),Y ; get header skip
clc
adc LZ4_SRC2
sta LZ4_SRC2
lda LZ4_SRC2+1
adc #0
sta LZ4_SRC2+1
; Point First LZ4 src at proper place
ldy #0
lda #>(LZ4_BUFFER+3)
@ -398,11 +471,9 @@ done_name_loop:
lda LZ4_SRC
sta LZ4_SRC1
sta LZ4_SRC2
lda LZ4_SRC+1
sta LZ4_SRC1+1
sta LZ4_SRC2+1
jsr setup_next_subsong
@ -673,7 +744,7 @@ krw_file:
.include "../asm_routines/gr_fast_clear.s"
.include "../asm_routines/pageflip.s"
;.include "../asm_routines/gr_unrle.s"
.include "../asm_routines/gr_setpage.s"
.include "gr_setpage.s"
.include "qkumba_rts.s"
.include "../asm_routines/gr_hlin.s"
.include "lz4_decode.s"

12
dya/gr_setpage.s Normal file
View File

@ -0,0 +1,12 @@
;==========================================================
; set_gr_page0
;==========================================================
;
set_gr_page0:
bit PAGE0 ; set page 0
bit LORES ; Lo-res graphics
bit TEXTGR ; mixed gr/text mode
bit SET_GR ; set graphics
rts

View File

@ -1,3 +1,4 @@
.asciiz "DOTD1.KRW"
filename2:
.asciiz "DOTD2.KRW"

View File

@ -223,25 +223,25 @@ PTRIG EQU $C070
;; BASIC ROUTINES
NORMAL EQU $F273
;NORMAL EQU $F273
;; MONITOR ROUTINES
HLINE EQU $F819 ;; HLINE Y,$2C at A
VLINE EQU $F828 ;; VLINE A,$2D at Y
CLRSCR EQU $F832 ;; Clear low-res screen
CLRTOP EQU $F836 ;; clear only top of low-res screen
SETCOL EQU $F864 ;; COLOR=A
TEXT EQU $FB36
TABV EQU $FB5B ;; VTAB to A
BASCALC EQU $FBC1 ;;
VTAB EQU $FC22 ;; VTAB to CV
HOME EQU $FC58 ;; Clear the text screen
WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
SETINV EQU $FE80 ;; INVERSE
SETNORM EQU $FE84 ;; NORMAL
COUT EQU $FDED ;; output A to screen
COUT1 EQU $FDF0 ;; output A to screen
;HLINE EQU $F819 ;; HLINE Y,$2C at A
;VLINE EQU $F828 ;; VLINE A,$2D at Y
;CLRSCR EQU $F832 ;; Clear low-res screen
;CLRTOP EQU $F836 ;; clear only top of low-res screen
;SETCOL EQU $F864 ;; COLOR=A
;TEXT EQU $FB36
;TABV EQU $FB5B ;; VTAB to A
;BASCALC EQU $FBC1 ;;
;VTAB EQU $FC22 ;; VTAB to CV
;HOME EQU $FC58 ;; Clear the text screen
;WAIT EQU $FCA8 ;; delay 1/2(26+27A+5A^2) us
;SETINV EQU $FE80 ;; INVERSE
;SETNORM EQU $FE84 ;; NORMAL
;COUT EQU $FDED ;; output A to screen
;COUT1 EQU $FDF0 ;; output A to screen