Login
Forum Help



Post Your Message
="hidden" name="cat" value="Programming">
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

mono
on 2024-09-30
11:22:26
 Re: spy vs spy music

@Luca: I took this routine from my other project and used it partially.

Posted By

Luca
on 2024-09-30
02:02:51
 Re: spy vs spy music

Talking about the keys usage: why the undocumented Commodore Key, Control and Space have been involved too?

Posted By

mono
on 2024-09-29
15:50:02
 Re: spy vs spy music

@Verona I wasn't aware of existence of this guy happy Thanks. (Maybe it'd be better to say "I'm an Atarian"?)

Posted By

Verona
on 2024-09-29
13:05:38
 Re: spy vs spy music

@mono But for me, you are NOT The Atarian. happy
He is the man:

https://www.youtube.com/watch?v=yY28EYGvZ1c&list=PLRiYYfr6zccw_dfV3wLpGwvcknZBVPkbP&index=2

Posted By

Ati
on 2024-09-28
12:55:07
 Re: spy vs spy music

Oh, thank you guy. Good to see (hear) it, because i like pokey music.

Posted By

Verona
on 2024-09-28
12:22:46
 Re: spy vs spy music

Good.

But the first song is falling apart very soon.

Posted By

mono
on 2024-09-27
13:56:19
 Re: spy vs spy music

Thank you.

Posted By

Csabo
on 2024-09-27
13:50:06
 Re: spy vs spy music

No worries, updated the PRG and the screenshot (the old one will be cached for a while but it will update).

Posted By

mono
on 2024-09-27
13:16:06
 Re: spy vs spy music

I've updated archive, because in a result of being hurry there is a doubled line "Songs of Spies". I'm sorry.
Edit: Thanks @Csabo it looks that it's fail start :)

Posted By

Csabo
on 2024-09-27
10:37:11
 Re: spy vs spy music

Cool stuff, also congrats on your very first Commodore Plus/4 Release! One Of Us!... One Of Us!... grin

Posted By

mono
on 2024-09-27
10:12:47
 Re: spy vs spy music

An entitled version available to download.

Posted By

Luca
on 2024-09-27
10:02:56
 Re: spy vs spy music

This is very interesting: first POKEY -> TED conversion ever!

Posted By

Csabo
on 2024-09-27
09:53:28
 Re: spy vs spy music

Sure, that's a good one happy

Posted By

mono
on 2024-09-27
09:52:16
 Re: spy vs spy music

I knew I forgot about something happy
What title do you offer? I'll place it on the top of items list.

Maybe "Songs of the spies?"... ;-]

Posted By

Csabo
on 2024-09-27
08:21:21
 Re: spy vs spy music

Neat! What is the name of your demo? I couldn't figure out from the screen - doesn't appear to have a title. (I hope it's not Spy Vs Spy since that name is already taken happy)

Posted By

mono
on 2024-09-27
08:18:13
 spy vs spy music

I've deassembled all "Spy vs Spy" parts' music code and moved them to Plus4. Original code still generates data as it does for POKEY but values are stored in RAM. Then I transform it on the fly to TED sound registers' configuration.

The program has two modes of operation:
1. CONSTANT - sound volume is always set to 8 and square/noise waves are turned on/off at the moments.
2. DYNAMIC - sound volume is a max function taken from volume configuration of two POKEY channels and transposed to TED settings.
You can download PRG file and the source of this code and compile it using MADS assembler (I'm the Atarian and I have atarian duties ;-D) using

mads -o:spyvsspy.prg spyvsspy.asx
or by
make


Following snippet shows how POKEY to TED tranposition is doing:

;ted
;f = (14318181/16/8)/(1024-(K+1))
;pokey
;f = 1789772.5/(2*28*(N+1))

;(14318181/16/8)/(1024-(K+1)) = 1789772.5/(2*28*(N+1))

;14318181*(2*28*(N+1))/(16*8*1789772.5) = 1024-(K+1)
;14318181*2*28*(N+1)/(16*14318181) = 1024-(K+1)
;2*28*(N+1)/16 = 1024-K-1
;K+2*28*(N+1)/16 = 1024-1
;K+28*(N+1)/8 = 1023
;K = 1023-28*(N+1)/8

;noiseKmin = 595
;moiseKmax = 938

;K = 1023-28*(N+1)/8
;28*(N+1)/8 = 1023-K
;N = (1023-K)*8/28-1

PERIODMIN = ($3FF-595)*8/28-1 ;23
PERIODMAX = ($3FF-938)*8/28-1 ;121


FRE1LO = $FF0E
FRE2LO = $FF0F
FRE2HI = $FF10
NOISE = 1 << 6
V2SEL = 1 << 5
V1SEL = 1 << 4
VCTL = $FF11
CR1 = $FF12


play
lda AUDC3s
and #%00001111
tay
lda volumetable,y
sta vol3

lda AUDC4s
and #%00001111
tay
lda volumetable,y
sta vol4

cmp vol3
scs
lda vol3

ldy playmode
bne ?volume
ora #0
seq
lda #8
?volume sta volumecontrol

lda AUDC4s
and #%10100000
eor #%10100000
php

lda AUDC3s
and #%10100000
eor #%10100000
bne noiseunknown

pureunknown:
lda volumecontrol
ldy vol3
seq
ora #V1SEL

plp
php
beq ?pure

?noise ldy vol4
beq ?voices
ora #NOISE
bne ?voices

?pure ldy vol4
beq ?voices
ora #V2SEL

?voices sta VCTL

ldy AUDF3s
jsr setfreq1

ldy AUDF4s
plp
seq
jsr fixrange
jmp setfreq2

noiseunknown:
plp
bne noisenoise

noisepure:
lda volumecontrol

ldy vol4
seq
ora #V1SEL

ldy vol3
seq
ora #NOISE

sta VCTL

ldy AUDF4s
jsr setfreq1

ldy AUDF3s
jsr fixrange
jmp setfreq2

noisenoise:
ldy AUDF4s
lda vol3
beq ?one

ldy AUDF3s
lda vol4
beq ?one

?both ldy AUDF4s
cmp vol3
scs
ldy AUDF3s

?one lda volumecontrol
seq
ora #NOISE
sta VCTL

jsr fixrange
; jmp setfreq2

setfreq2:
lda frequencytable.?lo,y
sta FRE2LO
lda frequencytable.?hi,y
sta FRE2HI
rts

setfreq1:
lda frequencytable.?lo,y
sta FRE1LO
lda frequencytable.?hi,y
ora videocontrol
sta CR1
rts

fixrange:
cpy #PERIODMIN
scs
ldy #PERIODMIN
cpy #PERIODMAX
scc
ldy #PERIODMAX
rts


volumetable:
:16 .byte 8*#/15

frequencytable:
?lo
:$100 .byte <[$3FF-[28*[#+1]/8
?hi
:$100 .byte >[$3FF-[28*[#+1]/8

AUDC3 and AUDC4 are voice control registers that controls distortion (hi nibble - %1x1x is pure tone, other ones are different types of noises) + volume (low niibble),
AUDF3 and AUDF4 are voice period control registers.

All calculations were done for NTSC base clock.

It sounds a bit different than on Atari of course, but I was surprised that there are only music from the first part of this game on the Commodore 264 machines.


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon