mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-03-03 12:31:32 +00:00
pt3_lib: bump to version 0.4
made it so you can configure out the frequency scale code *hopefully* this is mostly transparent and doesn't break anyone's code
This commit is contained in:
parent
26e272ff42
commit
ba3adb6447
7
music/pt3_lib/CHANGES
Normal file
7
music/pt3_lib/CHANGES
Normal file
@ -0,0 +1,7 @@
|
||||
V0.4 (15 May 2023)
|
||||
+ Changed so that you can disable the 1.77MHz frequency adjustment at compile
|
||||
time. This saves a few hundred cycles and also some binary size.
|
||||
|
||||
Default is left to have it enabled and switchable so hopefully
|
||||
this won't break anything for anyone.
|
||||
|
@ -1,10 +1,10 @@
|
||||
The PT3_player Library version 0.3
|
||||
The PT3_player Library version 0.4
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
by Vince "Deater" Weaver <vince@deater.net>
|
||||
http://www.deater.net/weave/vmwprod/pt3_lib/
|
||||
|
||||
Last Update: 30 May 2021
|
||||
Last Update: 15 May 2023
|
||||
|
||||
Plays Vortex Tracker II .pt3 files on the Apple II
|
||||
|
||||
@ -53,7 +53,7 @@ To get a pt3 file playing:
|
||||
the right code.
|
||||
+ Be sure to either include the pt3 file as a binary, or load
|
||||
it from disk to a buffer pointed to by PT3_LOC.
|
||||
Not the beginning of the song needs to be aligned on
|
||||
Note the beginning of the song needs to be aligned on
|
||||
a page boundary (this makes the decode code a bit
|
||||
more simple)
|
||||
+ If you want to make the code more compact but use a lot of
|
||||
@ -125,6 +125,12 @@ and then use a deterministic playback function to play back this music.
|
||||
Each frame of music decodes to 11bytes of register info, which means
|
||||
at 60Hz you can get roughly 4s of music per 3kB of RAM.
|
||||
|
||||
For those using an Apple IIe or newer with VBLANK detection support,
|
||||
the player playing simple songs will usually (but sadly not always)
|
||||
finish in under 4550 cycles and thus can play music in the VBLANK handler
|
||||
without having to cycle-count everything. Turning off the 1.77MHz
|
||||
frequency conversion helps here.
|
||||
|
||||
|
||||
Overhead:
|
||||
~~~~~~~~~
|
||||
|
@ -1,2 +1,2 @@
|
||||
10 PRINT "PT3 LIB TEST V0.3"
|
||||
10 PRINT "PT3 LIB TEST V0.4"
|
||||
100 PRINT CHR$ (4)"BRUN PT3_TEST"
|
||||
|
@ -232,6 +232,29 @@ note_c:
|
||||
end_vars:
|
||||
.endif
|
||||
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
|
||||
; Set to 1MHz mode (no convert freq)
|
||||
; this saves a few 100 cycles?
|
||||
pt3_toggle_freq_conversion:
|
||||
lda convert_177_smc1
|
||||
eor #$20
|
||||
bne pt3_freq_common
|
||||
pt3_enable_freq_conversion:
|
||||
lda #$38 ; SEC
|
||||
bne pt3_freq_common ; bra
|
||||
pt3_disable_freq_conversion:
|
||||
lda #$18 ; CLC
|
||||
pt3_freq_common:
|
||||
sta convert_177_smc1
|
||||
sta convert_177_smc2
|
||||
sta convert_177_smc3
|
||||
sta convert_177_smc4
|
||||
sta convert_177_smc5
|
||||
rts
|
||||
.endif
|
||||
|
||||
load_ornament0_sample1:
|
||||
lda #0 ; 2
|
||||
jsr load_ornament ; 6
|
||||
@ -1692,9 +1715,6 @@ do_frame:
|
||||
ldx #(NOTE_STRUCT_SIZE*2) ; Note C ; 2
|
||||
jsr calculate_note ; 6+?
|
||||
|
||||
convert_177_smc1:
|
||||
sec ; 2
|
||||
|
||||
; Load up the Frequency Registers
|
||||
|
||||
lda note_a+NOTE_TONE_L ; Note A Period L ; 4
|
||||
@ -1703,7 +1723,15 @@ convert_177_smc1:
|
||||
lda note_a+NOTE_TONE_H ; Note A Period H ; 4
|
||||
sta AY_REGISTERS+1 ; into R1 ; 3
|
||||
lda note_a+NOTE_TONE_L ; Note A Period L ; 4
|
||||
|
||||
.ifndef PT3_DISABLE_FREQ_CONVERSION
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
convert_177_smc1:
|
||||
|
||||
sec ; 2
|
||||
bcc no_scale_a ; 2/3
|
||||
.endif
|
||||
|
||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||
|
||||
@ -1735,20 +1763,25 @@ convert_177_smc1:
|
||||
ror AY_REGISTERS+0 ; 5
|
||||
and #$0f ; 2
|
||||
sta AY_REGISTERS+1 ; 3
|
||||
.endif
|
||||
|
||||
no_scale_a:
|
||||
|
||||
convert_177_smc2:
|
||||
sec ; 2
|
||||
|
||||
lda note_b+NOTE_TONE_L ; Note B Period L ; 4
|
||||
sta AY_REGISTERS+2 ; into R2 ; 3
|
||||
|
||||
lda note_b+NOTE_TONE_H ; Note B Period H ; 4
|
||||
sta AY_REGISTERS+3 ; into R3 ; 3
|
||||
lda note_b+NOTE_TONE_L ; Note B Period L ; 4
|
||||
bcc no_scale_b ; 2/3
|
||||
|
||||
.ifndef PT3_DISABLE_FREQ_CONVERSION
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
|
||||
convert_177_smc2:
|
||||
sec ; 2
|
||||
bcc no_scale_b ; 2/3
|
||||
.endif
|
||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||
|
||||
; first multiply by 8
|
||||
@ -1777,18 +1810,23 @@ convert_177_smc2:
|
||||
ror AY_REGISTERS+2 ; 5
|
||||
and #$0f ; 2
|
||||
sta AY_REGISTERS+3 ; 3
|
||||
.endif
|
||||
|
||||
no_scale_b:
|
||||
|
||||
convert_177_smc3:
|
||||
sec ; 2
|
||||
|
||||
lda note_c+NOTE_TONE_L ; Note C Period L ; 4
|
||||
sta AY_REGISTERS+4 ; into R4 ; 3
|
||||
lda note_c+NOTE_TONE_H ; Note C Period H ; 4
|
||||
sta AY_REGISTERS+5 ; into R5 ; 3
|
||||
lda note_c+NOTE_TONE_L ; Note C Period L ; 4
|
||||
|
||||
.ifndef PT3_DISABLE_FREQ_CONVERSION
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
convert_177_smc3:
|
||||
sec ; 2
|
||||
bcc no_scale_c ; 2/3
|
||||
.endif
|
||||
|
||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||
|
||||
@ -1818,6 +1856,7 @@ convert_177_smc3:
|
||||
ror AY_REGISTERS+4 ; 5
|
||||
and #$0f ; 2
|
||||
sta AY_REGISTERS+5 ; 3
|
||||
.endif
|
||||
|
||||
no_scale_c:
|
||||
|
||||
@ -1830,11 +1869,17 @@ pt3_noise_period_smc:
|
||||
pt3_noise_add_smc:
|
||||
adc #$d1 ; 2
|
||||
and #$1f ; 2
|
||||
|
||||
.ifndef PT3_DISABLE_ENABLE_FREQ_CONVERSION
|
||||
|
||||
sta AY_REGISTERS+6 ; 3
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
|
||||
convert_177_smc4:
|
||||
sec ; 2
|
||||
bcc no_scale_n ; 2/3
|
||||
.endif
|
||||
|
||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||
|
||||
@ -1852,8 +1897,10 @@ convert_177_smc4:
|
||||
ror ; 2
|
||||
ror ; 2
|
||||
and #$1f ; 2
|
||||
.endif
|
||||
|
||||
no_scale_n:
|
||||
|
||||
sta AY_REGISTERS+6 ; 3
|
||||
|
||||
;=======================
|
||||
@ -1895,10 +1942,15 @@ pt3_envelope_slide_h_smc:
|
||||
adc #$d1 ; 2
|
||||
sta AY_REGISTERS+12 ; 3
|
||||
|
||||
|
||||
.ifndef PT3_DISABLE_FREQ_CONVERSION
|
||||
|
||||
.ifndef PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION
|
||||
|
||||
convert_177_smc5:
|
||||
sec
|
||||
bcc no_scale_e ; 2/3
|
||||
|
||||
.endif
|
||||
; Convert from 1.77MHz to 1MHz by multiplying by 9/16
|
||||
|
||||
tay ; 2
|
||||
@ -1929,6 +1981,7 @@ convert_177_smc5:
|
||||
ror AY_REGISTERS+11 ; 5
|
||||
and #$0f ; 2
|
||||
sta AY_REGISTERS+12 ; 3
|
||||
.endif
|
||||
|
||||
no_scale_e:
|
||||
|
||||
|
@ -25,6 +25,24 @@ PT3_LOC = song
|
||||
|
||||
PT3_ENABLE_APPLE_IIC = 1
|
||||
|
||||
; The Vortex Tracker by default generates Atari-ST style pt3 files
|
||||
; which assume there is a 1.77MHz clock frequency driving
|
||||
; the AY-3-8910. Apple II Mockingboards run at 1MHz, so unless
|
||||
; you convert the frequency the music will sound pitched lower.
|
||||
; The 1.77MHz frequency conversion code can be in three states:
|
||||
; Enabled (always convert)
|
||||
; PT3_DISABLE_FREQ_CONVERSION commented out
|
||||
; PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION = 1
|
||||
; Disabled (don't convert)
|
||||
; PT3_DISABLE_FREQ_CONVERSION = 1
|
||||
; PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION = 1
|
||||
; Switchable (can disable/enable on the fly)
|
||||
; this is the default for historical reasons
|
||||
; PT3_DISABLE_FREQ_CONVERSION commented out
|
||||
; PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION commented out
|
||||
|
||||
; PT3_DISABLE_FREQ_CONVERSION = 1
|
||||
; PT3_DISABLE_SWITCHABLE_FREQ_CONVERSION = 1
|
||||
|
||||
;=============================
|
||||
; Setup
|
||||
|
Loading…
x
Reference in New Issue
Block a user