mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-28 09:30:41 +00:00
pt3: autogenerate tone table
This commit is contained in:
parent
ccf75e4be2
commit
6589803355
@ -30,7 +30,8 @@ Code Optimization
|
|||||||
MoveNoteToZP 2650 ?? 1A.23 26s 171s 15.2%
|
MoveNoteToZP 2650 ?? 1A.23 26s 171s 15.2%
|
||||||
MinorFixes 2418 + 143 1A.1F 26s 171s 15.2%
|
MinorFixes 2418 + 143 1A.1F 26s 171s 15.2%
|
||||||
FixVibrato 2423 + 143 1A.1F 26s 171s 15.2%
|
FixVibrato 2423 + 143 1A.1F 26s 171s 15.2%
|
||||||
GetNoteSMC 1A.16 26 171s 15.2%
|
GetNoteSMC 2448 + 143 1A.16 26s 171s 15.2%
|
||||||
|
2407 + 143 1A.16
|
||||||
|
|
||||||
Times: Validated
|
Times: Validated
|
||||||
BH.PT3: 10.0B 16 1:33 93 17.2%
|
BH.PT3: 10.0B 16 1:33 93 17.2%
|
||||||
|
@ -454,28 +454,121 @@ zero_song_structs_loop:
|
|||||||
cmp #1 ; 2
|
cmp #1 ; 2
|
||||||
bne use_freq_table_2 ; 2/3
|
bne use_freq_table_2 ; 2/3
|
||||||
|
|
||||||
use_freq_table_1:
|
;==================================
|
||||||
lda #>PT3NoteTable_ST_high ; 4+
|
; Assume PTVERSION > 3
|
||||||
sta get_note_smc1+2
|
; HEADER_FREQ==1 implies = PT3NoteTable_ST
|
||||||
lda #<PT3NoteTable_ST_high ; 4+
|
|
||||||
sta get_note_smc1+1
|
use_freq_table_1:
|
||||||
|
; create PT3NoteTable_ST[]
|
||||||
|
|
||||||
|
ldy #11
|
||||||
|
freq_table_1_copy_loop:
|
||||||
|
lda NoteBase2_high,Y
|
||||||
|
sta NoteTable_high,Y
|
||||||
|
lda NoteBase2_low,Y
|
||||||
|
sta NoteTable_low,Y
|
||||||
|
dey
|
||||||
|
bpl freq_table_1_copy_loop
|
||||||
|
|
||||||
|
; for(x=0;x<84;x++) Tone[x+12]=Tone[x]>>1;
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
freq_table_1_adjust_loop:
|
||||||
|
clc
|
||||||
|
lda NoteTable_high,Y
|
||||||
|
ror
|
||||||
|
sta NoteTable_high+12,Y
|
||||||
|
|
||||||
|
lda NoteTable_low,Y
|
||||||
|
ror
|
||||||
|
sta NoteTable_low+12,Y
|
||||||
|
|
||||||
|
iny
|
||||||
|
cpy #84
|
||||||
|
bne freq_table_1_adjust_loop
|
||||||
|
|
||||||
|
; last adjustments
|
||||||
|
lda #$FD ; Tone[23]=$3FD
|
||||||
|
sta NoteTable_low+23
|
||||||
|
dec NoteTable_low+46 ; Tone[46]-=1;
|
||||||
|
|
||||||
|
|
||||||
lda #>PT3NoteTable_ST_low ; 4+
|
|
||||||
sta get_note_smc2+2
|
|
||||||
lda #<PT3NoteTable_ST_low ; 4+
|
|
||||||
jmp done_set_freq_table
|
jmp done_set_freq_table
|
||||||
|
|
||||||
use_freq_table_2:
|
;==================================
|
||||||
lda #>PT3NoteTable_ASM_34_35_high ; 4+
|
; Assume PTVERSION > 3
|
||||||
sta get_note_smc1+2
|
; HEADER_FREQ!=1 implies = PT3NoteTable_ASM_34_35
|
||||||
lda #<PT3NoteTable_ASM_34_35_high ; 4+
|
|
||||||
sta get_note_smc1+1
|
use_freq_table_2:
|
||||||
|
; create PT3NoteTable_ASM_34_35
|
||||||
|
ldy #11
|
||||||
|
freq_table_2_copy_loop:
|
||||||
|
lda NoteBase1_high,Y
|
||||||
|
sta NoteTable_high,Y
|
||||||
|
lda NoteBase1_low,Y
|
||||||
|
sta NoteTable_low,Y
|
||||||
|
dey
|
||||||
|
bpl freq_table_2_copy_loop
|
||||||
|
|
||||||
|
ldy #0
|
||||||
|
freq_table_2_adjust_loop:
|
||||||
|
clc
|
||||||
|
lda NoteTable_high,Y
|
||||||
|
ror
|
||||||
|
sta NoteTable_high+12,Y
|
||||||
|
|
||||||
|
lda NoteTable_low,Y
|
||||||
|
ror
|
||||||
|
sta NoteTable_low+12,Y
|
||||||
|
|
||||||
|
iny
|
||||||
|
cpy #84
|
||||||
|
bne freq_table_2_adjust_loop
|
||||||
|
|
||||||
|
; adjust
|
||||||
|
|
||||||
|
|
||||||
|
ldx #0
|
||||||
|
adjust_freq2_outer:
|
||||||
|
|
||||||
|
lda Table1_Adjust,X
|
||||||
|
sta TEMP
|
||||||
|
|
||||||
|
; reset smc
|
||||||
|
lda #<NoteTable_low
|
||||||
|
sta ntl_smc+1
|
||||||
|
lda #>NoteTable_low
|
||||||
|
sta ntl_smc+2
|
||||||
|
|
||||||
|
|
||||||
|
ldy #7
|
||||||
|
adjust_freq2_inner:
|
||||||
|
ror TEMP
|
||||||
|
bcc skip_adjust
|
||||||
|
|
||||||
|
ntl_smc:
|
||||||
|
inc NoteTable_low,X
|
||||||
|
|
||||||
|
skip_adjust:
|
||||||
|
clc
|
||||||
|
lda #12
|
||||||
|
adc ntl_smc+1
|
||||||
|
sta ntl_smc+1
|
||||||
|
lda #0
|
||||||
|
adc ntl_smc+2 ; unnecessary if aligned
|
||||||
|
sta ntl_smc+2
|
||||||
|
|
||||||
|
skip_adjust_done:
|
||||||
|
dey
|
||||||
|
bpl adjust_freq2_inner
|
||||||
|
|
||||||
|
inx
|
||||||
|
cpx #12
|
||||||
|
bne adjust_freq2_outer
|
||||||
|
|
||||||
|
|
||||||
lda #>PT3NoteTable_ASM_34_35_low ; 4+
|
|
||||||
sta get_note_smc2+2
|
|
||||||
lda #<PT3NoteTable_ASM_34_35_low ; 4+
|
|
||||||
done_set_freq_table:
|
done_set_freq_table:
|
||||||
sta get_note_smc2+1
|
|
||||||
|
|
||||||
;======================
|
;======================
|
||||||
; calculate version
|
; calculate version
|
||||||
@ -2223,99 +2316,81 @@ done_do_frame:
|
|||||||
; Which note is in A
|
; Which note is in A
|
||||||
; return in freq_l/freq_h
|
; return in freq_l/freq_h
|
||||||
|
|
||||||
; FIXME: self modify code
|
|
||||||
GetNoteFreq:
|
GetNoteFreq:
|
||||||
|
|
||||||
sty PT3_TEMP ; 3
|
sty PT3_TEMP ; 3
|
||||||
tay ; 2
|
tay ; 2
|
||||||
|
|
||||||
; lda PT3_LOC+PT3_HEADER_FREQUENCY ; 4
|
lda NoteTable_high,Y ; 4+
|
||||||
; cmp #1 ; 2
|
|
||||||
; bne freq_table_2 ; 2/3
|
|
||||||
|
|
||||||
get_note_smc1:
|
|
||||||
lda PT3NoteTable_ST_high,Y ; 4+
|
|
||||||
sta freq_h_smc+1 ; 4
|
sta freq_h_smc+1 ; 4
|
||||||
get_note_smc2:
|
lda NoteTable_low,Y ; 4+
|
||||||
lda PT3NoteTable_ST_low,Y ; 4+
|
|
||||||
sta freq_l_smc+1 ; 4
|
sta freq_l_smc+1 ; 4
|
||||||
|
|
||||||
ldy PT3_TEMP ; 3
|
ldy PT3_TEMP ; 3
|
||||||
rts ; 6
|
rts ; 6
|
||||||
;===========
|
;===========
|
||||||
; 40
|
; 30
|
||||||
|
|
||||||
|
|
||||||
;freq_table_2:
|
|
||||||
; lda PT3NoteTable_ASM_34_35_high,Y ; 4+
|
|
||||||
; sta freq_h_smc+1 ; 4
|
|
||||||
; lda PT3NoteTable_ASM_34_35_low,Y ; 4+
|
|
||||||
; sta freq_l_smc+1 ; 4
|
|
||||||
|
|
||||||
; ldy PT3_TEMP ; 3
|
|
||||||
; rts ; 6
|
|
||||||
;===========
|
|
||||||
; 41
|
|
||||||
|
|
||||||
|
|
||||||
; Table #1 of Pro Tracker 3.3x - 3.5x
|
; Table #1 of Pro Tracker 3.3x - 3.5x
|
||||||
PT3NoteTable_ST_high:
|
;PT3NoteTable_ST_high:
|
||||||
.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09
|
;.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09
|
||||||
.byte $09,$08,$08,$07,$07,$07,$06,$06
|
;.byte $09,$08,$08,$07,$07,$07,$06,$06
|
||||||
.byte $05,$05,$05,$04,$04,$04,$04,$03
|
;.byte $05,$05,$05,$04,$04,$04,$04,$03
|
||||||
.byte $03,$03,$03,$03,$02,$02,$02,$02
|
;.byte $03,$03,$03,$03,$02,$02,$02,$02
|
||||||
.byte $02,$02,$02,$01,$01,$01,$01,$01
|
;.byte $02,$02,$02,$01,$01,$01,$01,$01
|
||||||
.byte $01,$01,$01,$01,$01,$01,$01,$00
|
;.byte $01,$01,$01,$01,$01,$01,$01,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
|
|
||||||
PT3NoteTable_ST_low:
|
;PT3NoteTable_ST_low:
|
||||||
.byte $F8,$10,$60,$80,$D8,$28,$88,$F0
|
;.byte $F8,$10,$60,$80,$D8,$28,$88,$F0
|
||||||
.byte $60,$E0,$58,$E0,$7C,$08,$B0,$40
|
;.byte $60,$E0,$58,$E0,$7C,$08,$B0,$40
|
||||||
.byte $EC,$94,$44,$F8,$B0,$70,$2C,$FD
|
;.byte $EC,$94,$44,$F8,$B0,$70,$2C,$FD
|
||||||
.byte $BE,$84,$58,$20,$F6,$CA,$A2,$7C
|
;.byte $BE,$84,$58,$20,$F6,$CA,$A2,$7C
|
||||||
.byte $58,$38,$16,$F8,$DF,$C2,$AC,$90
|
;.byte $58,$38,$16,$F8,$DF,$C2,$AC,$90
|
||||||
.byte $7B,$65,$51,$3E,$2C,$1C,$0A,$FC
|
;.byte $7B,$65,$51,$3E,$2C,$1C,$0A,$FC
|
||||||
.byte $EF,$E1,$D6,$C8,$BD,$B2,$A8,$9F
|
;.byte $EF,$E1,$D6,$C8,$BD,$B2,$A8,$9F
|
||||||
.byte $96,$8E,$85,$7E,$77,$70,$6B,$64
|
;.byte $96,$8E,$85,$7E,$77,$70,$6B,$64
|
||||||
.byte $5E,$59,$54,$4F,$4B,$47,$42,$3F
|
;.byte $5E,$59,$54,$4F,$4B,$47,$42,$3F
|
||||||
.byte $3B,$38,$35,$32,$2F,$2C,$2A,$27
|
;.byte $3B,$38,$35,$32,$2F,$2C,$2A,$27
|
||||||
.byte $25,$23,$21,$1F,$1D,$1C,$1A,$19
|
;.byte $25,$23,$21,$1F,$1D,$1C,$1A,$19
|
||||||
.byte $17,$16,$15,$13,$12,$11,$10,$0F
|
;.byte $17,$16,$15,$13,$12,$11,$10,$0F
|
||||||
|
|
||||||
|
|
||||||
; Table #2 of Pro Tracker 3.4x - 3.5x
|
; Table #2 of Pro Tracker 3.4x - 3.5x
|
||||||
PT3NoteTable_ASM_34_35_high:
|
;PT3NoteTable_ASM_34_35_high:
|
||||||
.byte $0D,$0C,$0B,$0A,$0A,$09,$09,$08
|
;.byte $0D,$0C,$0B,$0A,$0A,$09,$09,$08
|
||||||
.byte $08,$07,$07,$06,$06,$06,$05,$05
|
;.byte $08,$07,$07,$06,$06,$06,$05,$05
|
||||||
.byte $05,$04,$04,$04,$04,$03,$03,$03
|
;.byte $05,$04,$04,$04,$04,$03,$03,$03
|
||||||
.byte $03,$03,$02,$02,$02,$02,$02,$02
|
;.byte $03,$03,$02,$02,$02,$02,$02,$02
|
||||||
.byte $02,$01,$01,$01,$01,$01,$01,$01
|
;.byte $02,$01,$01,$01,$01,$01,$01,$01
|
||||||
.byte $01,$01,$01,$01,$01,$00,$00,$00
|
;.byte $01,$01,$01,$01,$01,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
.byte $00,$00,$00,$00,$00,$00,$00,$00
|
;.byte $00,$00,$00,$00,$00,$00,$00,$00
|
||||||
|
|
||||||
PT3NoteTable_ASM_34_35_low:
|
;PT3NoteTable_ASM_34_35_low:
|
||||||
.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8
|
;.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8
|
||||||
.byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E
|
;.byte $3B,$C5,$55,$EC,$88,$2A,$D2,$7E
|
||||||
.byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76
|
;.byte $2F,$E5,$9E,$5C,$1D,$E2,$AB,$76
|
||||||
.byte $44,$15,$E9,$BF,$98,$72,$4F,$2E
|
;.byte $44,$15,$E9,$BF,$98,$72,$4F,$2E
|
||||||
.byte $0F,$F1,$D5,$BB,$A2,$8B,$74,$60
|
;.byte $0F,$F1,$D5,$BB,$A2,$8B,$74,$60
|
||||||
.byte $4C,$39,$28,$17,$07,$F9,$EB,$DD
|
;.byte $4C,$39,$28,$17,$07,$F9,$EB,$DD
|
||||||
.byte $D1,$C5,$BA,$B0,$A6,$9D,$94,$8C
|
;.byte $D1,$C5,$BA,$B0,$A6,$9D,$94,$8C
|
||||||
.byte $84,$7C,$75,$6F,$69,$63,$5D,$58
|
;.byte $84,$7C,$75,$6F,$69,$63,$5D,$58
|
||||||
.byte $53,$4E,$4A,$46,$42,$3E,$3B,$37
|
;.byte $53,$4E,$4A,$46,$42,$3E,$3B,$37
|
||||||
.byte $34,$31,$2F,$2C,$29,$27,$25,$23
|
;.byte $34,$31,$2F,$2C,$29,$27,$25,$23
|
||||||
.byte $21,$1F,$1D,$1C,$1A,$19,$17,$16
|
;.byte $21,$1F,$1D,$1C,$1A,$19,$17,$16
|
||||||
.byte $15,$14,$12,$11,$10,$0F,$0E,$0D
|
;.byte $15,$14,$12,$11,$10,$0F,$0E,$0D
|
||||||
|
|
||||||
|
|
||||||
;PT3VolumeTable_33_34:
|
;PT3VolumeTable_33_34:
|
||||||
@ -2354,9 +2429,25 @@ PT3NoteTable_ASM_34_35_low:
|
|||||||
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$7,$8,$9,$A,$B,$C,$D,$E
|
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$7,$8,$9,$A,$B,$C,$D,$E
|
||||||
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F
|
;.byte $0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F
|
||||||
|
|
||||||
|
; FIXME: merge both highs?
|
||||||
|
|
||||||
|
NoteBase1_high:
|
||||||
|
.byte $0D,$0C,$0B,$0A,$0A,$09,$09,$08,$08,$07,$07,$06
|
||||||
|
NoteBase1_low:
|
||||||
|
.byte $10,$55,$A4,$FC,$5F,$CA,$3D,$B8,$3B,$C5,$55,$EC
|
||||||
|
|
||||||
|
NoteBase2_high:
|
||||||
|
.byte $0E,$0E,$0D,$0C,$0B,$0B,$0A,$09,$09,$08,$08,$07
|
||||||
|
NoteBase2_low:
|
||||||
|
.byte $F8,$10,$60,$80,$D8,$28,$88,$F0,$60,$E0,$58,$E0
|
||||||
|
|
||||||
|
Table1_Adjust:
|
||||||
|
.byte $20,$a8,$40,$f8,$bc,$90,$78,$70,$74,$08,$2a,$50
|
||||||
|
|
||||||
|
NoteTable_high:
|
||||||
|
.res 96,0
|
||||||
|
NoteTable_low:
|
||||||
|
.res 96,0
|
||||||
|
|
||||||
VolumeTable:
|
VolumeTable:
|
||||||
.res 256,0
|
.res 256,0
|
||||||
|
197
pt3_player/table_gen/6502_tone.c
Normal file
197
pt3_player/table_gen/6502_tone.c
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
// 8*12
|
||||||
|
static unsigned short PT3NoteTable_ST[]={
|
||||||
|
0xEF8,0xE10,0xD60,0xC80,0xBD8,0xB28,0xA88,0x9F0,0x960,0x8E0,0x858,0x7E0,
|
||||||
|
0x77C,0x708,0x6B0,0x640,0x5EC,0x594,0x544,0x4F8,0x4B0,0x470,0x42C,0x3FD,
|
||||||
|
0x3BE,0x384,0x358,0x320,0x2F6,0x2CA,0x2A2,0x27C,0x258,0x238,0x216,0x1F8,
|
||||||
|
0x1DF,0x1C2,0x1AC,0x190,0x17B,0x165,0x151,0x13E,0x12C,0x11C,0x10A,0x0FC,
|
||||||
|
0x0EF,0x0E1,0x0D6,0x0C8,0x0BD,0x0B2,0x0A8,0x09F,0x096,0x08E,0x085,0x07E,
|
||||||
|
0x077,0x070,0x06B,0x064,0x05E,0x059,0x054,0x04F,0x04B,0x047,0x042,0x03F,
|
||||||
|
0x03B,0x038,0x035,0x032,0x02F,0x02C,0x02A,0x027,0x025,0x023,0x021,0x01F,
|
||||||
|
0x01D,0x01C,0x01A,0x019,0x017,0x016,0x015,0x013,0x012,0x011,0x010,0x00F,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Table #2 of Pro Tracker 3.4x - 3.5x */
|
||||||
|
static unsigned short PT3NoteTable_ASM_34_35[] = {
|
||||||
|
0xD10,0xC55,0xBA4,0xAFC,0xA5F,0x9CA,0x93D,0x8B8,0x83B,0x7C5,0x755,0x6EC,
|
||||||
|
0x688,0x62A,0x5D2,0x57E,0x52F,0x4E5,0x49E,0x45C,0x41D,0x3E2,0x3AB,0x376,
|
||||||
|
0x344,0x315,0x2E9,0x2BF,0x298,0x272,0x24F,0x22E,0x20F,0x1F1,0x1D5,0x1BB,
|
||||||
|
0x1A2,0x18B,0x174,0x160,0x14C,0x139,0x128,0x117,0x107,0x0F9,0x0EB,0x0DD,
|
||||||
|
0x0D1,0x0C5,0x0BA,0x0B0,0x0A6,0x09D,0x094,0x08C,0x084,0x07C,0x075,0x06F,
|
||||||
|
0x069,0x063,0x05D,0x058,0x053,0x04E,0x04A,0x046,0x042,0x03E,0x03B,0x037,
|
||||||
|
0x034,0x031,0x02F,0x02C,0x029,0x027,0x025,0x023,0x021,0x01F,0x01D,0x01C,
|
||||||
|
0x01A,0x019,0x017,0x016,0x015,0x014,0x012,0x011,0x010,0x00F,0x00E,0x00D,
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned short Tone[256];
|
||||||
|
//static unsigned char ToneHigh[256];
|
||||||
|
//static unsigned char ToneLow[256];
|
||||||
|
|
||||||
|
|
||||||
|
// NoteTableCreator (c) Ivan Roshin
|
||||||
|
// A - NoteTableNumber*2+VersionForNoteTable
|
||||||
|
// (xx1b - 3.xx..3.4r, xx0b - 3.4x..3.6x..VTII1.0)
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
unsigned short base[]={
|
||||||
|
0x0D10*2,(0x0C55*2)+1,0x0BA4*2,0x0AFC*2,0x0A5F*2,0x09CA*2,
|
||||||
|
0x093D*2,0x08B8*2,0x083B*2,0x07C5*2,0x0755*2,0x06EC*2,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
unsigned short base[]={
|
||||||
|
0x0D10,0x0C55,0x0BA4,0x0AFC,0x0A5F,0x09CA,
|
||||||
|
0x093D,0x08B8,0x083B,0x07C5,0x0755,0x06EC,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
unsigned short base2[]={
|
||||||
|
0x0EF8,0x0E10,0x0D60,0x0C80,0x0BD8,0x0B28,0x0A88,0x09F0, // 50
|
||||||
|
0x0960,0x08E0,0x0858,0x07E0,
|
||||||
|
};
|
||||||
|
|
||||||
|
void NoteTableCreate0(void) {
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
|
||||||
|
for(y=0;y<12;y++) {
|
||||||
|
Tone[y]=base2[y];
|
||||||
|
//ToneHigh[y]=base2[y]>>8;
|
||||||
|
//ToneLow[y]=base2[y]&0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(x=0;x<84;x++) {
|
||||||
|
Tone[x+12]=Tone[x]>>1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Tone[23]+=13;
|
||||||
|
Tone[46]-=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 1 0
|
||||||
|
0 0 0 0 1 0 0 0 1 0 0 0
|
||||||
|
0 1 0 1 1 0 1 0 0 1 1 0
|
||||||
|
|
||||||
|
0 0 0 1 1 1 1 1 1 0 0 1
|
||||||
|
1 1 0 1 1 0 1 1 1 0 1 0
|
||||||
|
0 0 1 1 0 0 1 1 1 0 0 1
|
||||||
|
0 1 0 1 1 1 0 0 0 0 0 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
static unsigned char table1_adjust[]={
|
||||||
|
0x20, 0xa8, 0x40, 0xf8, 0xbc, 0x90, 0x78, 0x70, 0x74, 0x08, 0x2a, 0x50
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void NoteTableCreate1(void) {
|
||||||
|
|
||||||
|
int x,y;
|
||||||
|
int extra;
|
||||||
|
|
||||||
|
for(y=0;y<12;y++) Tone[y]=base[y];
|
||||||
|
|
||||||
|
for(x=0;x<84;x++) {
|
||||||
|
Tone[x+12]=Tone[x]>>1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int blah;
|
||||||
|
int offset=0;
|
||||||
|
for(y=0;y<12;y++) {
|
||||||
|
offset=y;
|
||||||
|
blah=table1_adjust[y];
|
||||||
|
for(x=0;x<8;x++) {
|
||||||
|
extra=blah&1;
|
||||||
|
blah>>=1;
|
||||||
|
|
||||||
|
// printf("%d ",extra);
|
||||||
|
// if (x%12==11) printf("\n");
|
||||||
|
|
||||||
|
Tone[offset]+=extra;
|
||||||
|
offset+=12;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tone[95]--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
/* Test table 0 */
|
||||||
|
NoteTableCreate0();
|
||||||
|
|
||||||
|
for(i=0;i<8*12;i++) {
|
||||||
|
if (i%12==0) printf("\n");
|
||||||
|
printf(" %03X",Tone[i]);
|
||||||
|
if (Tone[i]-PT3NoteTable_ST[i]) {
|
||||||
|
printf("+%d",Tone[i]-PT3NoteTable_ST[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
if (!memcmp(Tone,PT3NoteTable_ST,8*12*sizeof(short))) {
|
||||||
|
printf("MATCH 35\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NO MATCH 35\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!memcmp(Tone,PT3NoteTable_ASM_34_35,8*12*sizeof(short))) {
|
||||||
|
printf("MATCH 34\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NO MATCH 34\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Test table 1 */
|
||||||
|
|
||||||
|
NoteTableCreate1();
|
||||||
|
|
||||||
|
int nomatch=0;
|
||||||
|
|
||||||
|
for(i=0;i<8*12;i++) {
|
||||||
|
if (i%12==0) printf("\n");
|
||||||
|
printf("%03X",Tone[i]);
|
||||||
|
if (Tone[i]-PT3NoteTable_ASM_34_35[i]) {
|
||||||
|
printf("+%d/",Tone[i]-PT3NoteTable_ASM_34_35[i]);
|
||||||
|
nomatch++;
|
||||||
|
//printf("%03X",PT3NoteTable_ASM_34_35[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
if (!memcmp(Tone,PT3NoteTable_ST,8*12*sizeof(short))) {
|
||||||
|
printf("MATCH 35\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NO MATCH 35\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!memcmp(Tone,PT3NoteTable_ASM_34_35,8*12*sizeof(short))) {
|
||||||
|
printf("MATCH 34\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("NO MATCH 34\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Nomatch count=%d\n",nomatch);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2,7 +2,7 @@ CC = gcc
|
|||||||
CFLAGS = -O2 -Wall
|
CFLAGS = -O2 -Wall
|
||||||
LFLASG =
|
LFLASG =
|
||||||
|
|
||||||
all: 6502_table table_gen z80_volume c_tone
|
all: 6502_table table_gen z80_volume c_tone 6502_tone
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
@ -14,6 +14,14 @@ all: 6502_table table_gen z80_volume c_tone
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
6502_tone: 6502_tone.o
|
||||||
|
$(CC) $(LFLASG) -o 6502_tone 6502_tone.o
|
||||||
|
|
||||||
|
6502_tone.o: 6502_tone.c
|
||||||
|
$(CC) $(CFLAGS) -c 6502_tone.c
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
table_gen: table_gen.o
|
table_gen: table_gen.o
|
||||||
$(CC) $(LFLAGS) -o table_gen table_gen.o
|
$(CC) $(LFLAGS) -o table_gen table_gen.o
|
||||||
|
|
||||||
@ -48,4 +56,4 @@ c_tone.o: c_tone.c
|
|||||||
###
|
###
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *~ *.o z80_volume z80_tone table_gen 6502_table c_tone
|
rm -f *~ *.o z80_volume z80_tone table_gen 6502_table c_tone 6502_tone
|
||||||
|
@ -63,83 +63,40 @@ void NoteTableCreate0(void) {
|
|||||||
Tone[46]-=1;
|
Tone[46]-=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 1 0
|
||||||
|
0 0 0 0 1 0 0 0 1 0 0 0
|
||||||
|
0 1 0 1 0 0 1 0 0 1 1 0
|
||||||
|
|
||||||
|
0 0 0 0 0 1 0 1 1 0 0 1
|
||||||
|
1 1 0 0 0 0 0 0 0 0 1 0
|
||||||
|
0 0 1 0 0 0 0 0 0 0 0 1
|
||||||
|
0 1 0 0 1 1 0 0 0 0 0 0
|
||||||
|
*/
|
||||||
|
|
||||||
|
static unsigned char table1_adjust[]={
|
||||||
|
0x20, 0xa8, 0x40, 0x08, 0x84, 0x90, 0x08, 0x10, 0x14, 0x08, 0x2a, 0x50
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void NoteTableCreate1(void) {
|
void NoteTableCreate1(void) {
|
||||||
|
|
||||||
int round;
|
|
||||||
int x,y;
|
int x,y;
|
||||||
|
int extra;
|
||||||
|
|
||||||
for(y=0;y<12;y++) Tone[y]=base[y];
|
for(y=0;y<12;y++) Tone[y]=base[y];
|
||||||
|
|
||||||
for(x=0;x<84;x++) {
|
for(x=0;x<84;x++) {
|
||||||
round=0;
|
extra=(table1_adjust[x%12]>>((x+12)/12))&1;
|
||||||
// round=Tone[x]&1;
|
|
||||||
Tone[x+12]=Tone[x]>>1;
|
|
||||||
Tone[x+12]+=round;
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
Tone[22]+=1;
|
|
||||||
Tone[28]+=1;
|
|
||||||
|
|
||||||
Tone[32]+=1;
|
printf("%d ",extra);
|
||||||
//
|
if (x%12==11) printf("\n");
|
||||||
//
|
|
||||||
//
|
Tone[x+12]=Tone[x]>>1;
|
||||||
//
|
Tone[x+12]+=extra;
|
||||||
Tone[37]+=1;
|
}
|
||||||
//
|
Tone[95]--;
|
||||||
Tone[39]+=1;
|
|
||||||
Tone[40]+=1;
|
|
||||||
//
|
|
||||||
Tone[42]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[45]+=1;
|
|
||||||
Tone[46]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[51]+=1;
|
|
||||||
Tone[52]+=1;
|
|
||||||
Tone[53]+=1;
|
|
||||||
Tone[54]+=1;
|
|
||||||
Tone[55]+=1;
|
|
||||||
Tone[56]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[59]+=1;
|
|
||||||
Tone[60]+=1;
|
|
||||||
Tone[61]+=1;
|
|
||||||
//
|
|
||||||
Tone[63]+=1;
|
|
||||||
Tone[64]+=1;
|
|
||||||
//
|
|
||||||
Tone[66]+=1;
|
|
||||||
Tone[67]+=1;
|
|
||||||
Tone[68]+=1;
|
|
||||||
//
|
|
||||||
Tone[70]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[74]+=1;
|
|
||||||
Tone[75]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[78]+=1;
|
|
||||||
Tone[79]+=1;
|
|
||||||
Tone[80]+=1;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
Tone[83]+=1;
|
|
||||||
//
|
|
||||||
Tone[85]+=1;
|
|
||||||
//
|
|
||||||
Tone[87]+=1;
|
|
||||||
Tone[88]+=1;
|
|
||||||
Tone[89]+=1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user