chiptune_player: reads in the KRW file

This commit is contained in:
Vince Weaver 2018-02-21 20:32:40 -05:00
parent 4fdf1f8864
commit 7423b1d3ee
4 changed files with 50 additions and 28 deletions

View File

@ -3,11 +3,9 @@
; FIXME: make these a parameter
; filename
;disk_buff EQU $6000
;read_size EQU $2A00 ; (3*256*14)
disk_buff EQU $4000
read_size EQU $1000 ; 4kB
disk_buff EQU $2000
read_size EQU $4000 ; 16kB
;; For the disk-read code
;RWTSL EQU $F0
@ -40,7 +38,8 @@ FILEMANAGER EQU $3D6
;================================
; read from disk
;================================
;
; FILENAME pointed to by INH:INL
; OUTH:OUTL trashed
;
read_file:
jsr LOCATE_FILEM_PARAM ; $3DC entry point
@ -54,6 +53,30 @@ read_file:
; lda #0 ; 0 = text
; sta (FILEML),y
; copy filename into place
ldy #0
lda #<filename ; combine with below? (filename-8?)
sta OUTL
lda #>filename
sta OUTH
filename_copy_loop:
lda (INL),y ; load byte
beq filename_pad_spaces ; if zero, done
ora #$80 ; convert to apple ascii
sta (OUTL),y ; store out
iny
bne filename_copy_loop
filename_pad_spaces:
lda #$A0 ; filename needs ' ' padded
sta (OUTL),y
iny
cpy #31 ; fill 30 bytes
bne filename_pad_spaces
ldy #8 ; filename ptr offset = 8
lda #<filename
sta (FILEML),y
@ -243,8 +266,8 @@ dos33_read:
filename:
; OUT.0
.byte 'O'+$80,'U'+$80,'T'+$80,'.'+$80,'L'+$80
.byte 'Z'+$80,'4'+$80,$A0,$A0,$A0
.byte 'I'+$80,'N'+$80,'T'+$80,'R'+$80,'O'+$80
.byte '2'+$80,'.'+$80,'K'+$80,'R'+$80,'W'+$80
.byte $A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0
.byte $A0,$A0,$A0,$A0,$A0

BIN
chiptune_player/INTRO2.KRW Normal file

Binary file not shown.

View File

@ -7,8 +7,8 @@ all: chiptune_player.dsk
chiptune_player.dsk: CHIPTUNE_PLAYER OUT.0
$(DOS33) -y chiptune_player.dsk BSAVE -a 0x1000 CHIPTUNE_PLAYER
$(DOS33) -y chiptune_player.dsk SAVE B OUT.0
$(DOS33) -y chiptune_player.dsk SAVE B OUT.LZ4
$(DOS33) -y chiptune_player.dsk SAVE B INTRO2.KRW
# $(DOS33) -y chiptune_player.dsk SAVE B OUT.LZ4
# $(DOS33) -y chiptune_player.dsk BSAVE -a 0x6000 OUT.0

View File

@ -2,8 +2,8 @@
.include "zp.inc"
LZ4_BUFFER EQU $4000
CHUNK_BUFFER EQU $6000
LZ4_BUFFER EQU $2000 ; 16k for now, FIXME: expand
CHUNK_BUFFER EQU $6000 ; 10.5k, $2A00
CHUNKSIZE EQU $3
;=============================
@ -322,7 +322,7 @@ new_song:
jsr clear_bottoms ; clear bottom of page 0/1
lda #0
lda #0 ; print LOADING message
sta CH
lda #21
sta CV
@ -338,6 +338,10 @@ new_song:
; init pointer to the music
;===========================
lda #<krw_file
sta INL
lda #>krw_file
sta INH
jsr read_file
@ -358,11 +362,11 @@ new_song:
jsr clear_bottoms ; clear bottom of page 0/1
lda #<file_info
sta OUTL
lda #>file_info
sta OUTH
ldy #0
; lda #<file_info
; sta OUTL
; lda #>file_info
; sta OUTH
; ldy #0
; FIXME: optimize
@ -424,6 +428,12 @@ bloop3:
rts
;==========
; filenames
;==========
krw_file:
.asciiz "INTRO2.KRW"
;=========
;routines
;=========
@ -440,17 +450,6 @@ bloop3:
.include "rasterbars.s"
.include "volume_bars.s"
;===========
; File info
;===========
file_info:
.byte 1
.asciiz "INTRO2: JUNGAR OF BIT WORLD FROM KIEV"
.byte 5
.asciiz "BY: SURGEON (ALEKSEY LUTSENKO)"
.byte 15
.asciiz "0:00 / 0:00"
;=========
; strings
;=========