[zxspectrum] Re: [Bulk] Re: ULA & dintorni

  • From: ooky <stridermolko@xxxxxxxxxx>
  • To: zxspectrum@xxxxxxxxxxxxx
  • Date: Fri, 16 Nov 2012 19:53:18 +0100

Il 16/11/12 19.37, Gennaro Montedoro ha scritto:
Fai presto altrimenti vengo a casa tua ;)


allora: il nostro "acerrimo nemico biscottone" ha questo software/cartuccia che trasforma il c64 in un sintetizzatore polifonico. video http://www.youtube.com/watch?v=BhjqItcSfLA

premendo i vari tasti si ottengono le note ( come se fosse un pianoforte ) e ci sono alcune "patch" pre impostate per ottenere suoni diversi. Scartabellando nel forum di wos ho visto questo codice molto rudimentale che permette di fare qualcosa di simile con l'AY. Questa à una soluzione. L'altra che avrei in mente à un interfaccia per collegare strumenti midi per suonare l'AY, sempre utilizzando un software. Ci sono riusciti tempo fa utilizzando la SIF interface, ma à tutto molto sperimentale.. Avrei bisogno come l'aria di un software cosÃ. Se qualcuno lo facesse, sarei felicissimo e se fossi in grado lo farei io. Ci vorrebbe il controllo delle note tramite tastiera, un tasto per aumentare e diminuire l' ottava, un tasto per scegliere la forma d'onda standard dell' AY sui 3 canali, qualcosa per "stirare" le note tipo pitch bend magari di un semitono. Scusate per la mole di roba che ho scritto..
Che ne pensate? Saludos!!!!

Copio il codice di alcuni progetti.

primo file,

aylib.c
###########################################
#ifndef _AYL_H
#define _AYL_H

////////////////////////////////
//                            //
//  AY-lib   0.1 Header File  //
//                            //
//      Timmy 15 August 2012  //
//                            //
////////////////////////////////

void __FASTCALL__ ay_command(unsigned char *p)
{
    // IN:  h=register, l=value
    // OUT: out 65533,h : out 49149,l
    #asm
        ld c, 253

        ld b, 255
        out (c), h
        ld b, 191
        out (c), l
    #endasm
}

void __FASTCALL__ ay_tone1(unsigned int p)
{
    // IN:  p = tone number, 12 bits
    #asm
        ld d,h
        ld h,0
        call _ay_command
        ld l,d
        ld h,1
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_tone2(unsigned int p)
{
    // IN:  p = tone number, 12 bits
    #asm
        ld d,h
        ld h,2
        call _ay_command
        ld l,d
        ld h,3
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_tone3(unsigned int p)
{
    // IN:  p = tone number, 12 bits
    #asm
        ld d,h
        ld h,4
        call _ay_command
        ld l,d
        ld h,5
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_noise_period(unsigned int p)
{
    // IN:  l = volume, max 31
    #asm
        ld h,6
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_enable(unsigned int p)
{
    // IN:  l = enable data, 7 bits
    #asm
        ld h,7
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_volume1(unsigned int p)
{
    // IN:  l = volume, max 15
    #asm
        ld h,8
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_volume2(unsigned int p)
{
    // IN:  l = volume, max 15
    #asm
        ld h,9
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_volume3(unsigned int p)
{
    // IN:  l = volume, max 15
    #asm
        ld h,10
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_envelope_period(unsigned int p)
{
    // IN:  p = envelope_period, 12 bits
    #asm
        ld d,h
        ld h,11
        call _ay_command
        ld l,d
        ld h,12
        call _ay_command
    #endasm
}

void __FASTCALL__ ay_envelope_shape(unsigned int p)
{
    // IN:  p = envelope_period, 4 bits
    #asm
        ld d,h
        ld h,13
        call _ay_command
    #endasm
}

#######################

secondo file,
demo.c

#########################

////////////////////////////////
//                            //
//  AY-lib   Demo             //
//                            //
//      Timmy 15 August 2012  //
//                            //
////////////////////////////////

// Demo doesn't show anything on screen. My stdio lib is still broken.
// Keys available in this demo:
//
//        S D   G H J
//       Z X C V B N M

#include <spectrum.h>
#include <input.h>
#include "aylib.c"

uint periods[12] = { 424, 400, 377, 356, 336, 317, 300, 283, 267, 252, 238, 224}; uint keycodes[12]={766, 765, 1278, 1277, 2302, 4350, 4349, 4223, 4287, 2175, 2239, 1151};

main()
{
    uint i,j,q;

    ay_volume1(15);
    ay_tone1(251);
    ay_enable(0x3e);

    for (i=0; i<8; i++)
    {
        ay_tone1(periods[i]);
        in_Wait(500);
    }

    ay_enable(0x3f);
    ay_volume1(0);

    ay_enable(0x3e);

    while (1)
    {
        q = 0;

        for (i=0; i<12; i++)
        {
            if (in_KeyPressed(keycodes[i]))
            {
                ay_tone1(periods[i]);
                q = 1;
            }
        }

        if (q) ay_volume1(15);
            else ay_volume1(0);

    }

    return 0;
}

##################################

Other related posts: