;=========================================================== ; Cycle-invariant Library to decode Vortex Tracker PT3 files ; in 6502 assembly for Apple ][ Mockingboard ; ; by Vince Weaver ; Roughly based on the Formats.pas Pascal code from Ay_Emul ; Header offsets PT3_VERSION = $0D PT3_HEADER_FREQUENCY = $63 PT3_SPEED = $64 PT3_LOOP = $66 PT3_PATTERN_LOC_L = $67 PT3_PATTERN_LOC_H = $68 PT3_SAMPLE_LOC_L = $69 PT3_SAMPLE_LOC_H = $6A PT3_ORNAMENT_LOC_L = $A9 PT3_ORNAMENT_LOC_H = $AA PT3_PATTERN_TABLE = $C9 ; Use memset to set things to 0? NOTE_VOLUME =0 NOTE_TONE_SLIDING_L =1 NOTE_TONE_SLIDING_H =2 NOTE_ENABLED =3 NOTE_ENVELOPE_ENABLED =4 NOTE_SAMPLE_POINTER_L =5 NOTE_SAMPLE_POINTER_H =6 NOTE_SAMPLE_LOOP =7 NOTE_SAMPLE_LENGTH =8 NOTE_TONE_L =9 NOTE_TONE_H =10 NOTE_AMPLITUDE =11 NOTE_NOTE =12 NOTE_LEN =13 NOTE_LEN_COUNT =14 NOTE_ADDR_L =15 NOTE_ADDR_H =16 NOTE_ORNAMENT_POINTER_L =17 NOTE_ORNAMENT_POINTER_H =18 NOTE_ORNAMENT_LOOP =19 NOTE_ORNAMENT_LENGTH =20 NOTE_ONOFF =21 NOTE_TONE_ACCUMULATOR_L =22 NOTE_TONE_ACCUMULATOR_H =23 NOTE_TONE_SLIDE_COUNT =24 NOTE_ORNAMENT_POSITION =25 NOTE_SAMPLE_POSITION =26 NOTE_ENVELOPE_SLIDING =27 NOTE_NOISE_SLIDING =28 NOTE_AMPLITUDE_SLIDING =29 NOTE_ONOFF_DELAY =30 ;ordering of DELAYs is hard-coded now NOTE_OFFON_DELAY =31 ;ordering of DELAYs is hard-coded now NOTE_TONE_SLIDE_STEP_L =32 NOTE_TONE_SLIDE_STEP_H =33 NOTE_TONE_SLIDE_DELAY =34 NOTE_SIMPLE_GLISS =35 NOTE_SLIDE_TO_NOTE =36 NOTE_TONE_DELTA_L =37 NOTE_TONE_DELTA_H =38 NOTE_TONE_SLIDE_TO_STEP =39 NOTE_STRUCT_SIZE=40 ; always use zero page note_a = $80 note_b = $80+(NOTE_STRUCT_SIZE*1) note_c = $80+(NOTE_STRUCT_SIZE*2) begin_vars=$80 end_vars=$80+(NOTE_STRUCT_SIZE*3) ;======================================================================== ;======================================================================== ;======================================================================== ;======================================================================== ;======================================================================== ; EVERYTHING IS CYCLE COUNTED ;======================================================================== ;======================================================================== ;======================================================================== ;======================================================================== ;======================================================================== .align $100 .include "pt3_lib_sample_ornament.s" .include "pt3_lib_calculate_note.s" .include "pt3_lib_decode_note.s" .include "pt3_lib_set_pattern.s" .include "pt3_lib_make_frame.s" .include "pt3_lib_do_frame.s" ;======================= ; tables ;======================= ; aligned to avoid page crossing .align $100 NoteTable_high: .res 96,0 NoteTable_low: .res 96,0 .align $100 VolumeTable: .res 256,0 pt3_lib_end: